The module allows SCM systems to fully integrate into the IDE workflow.Question (arch-overall): Describe the overall architecture. Answer:
Versioning SPI module enables Source Code Management (SCM or Versioning) modules to fully integrate into the IDE workflow. Mostly it is a facade over existing friend APIs (masterfs). Registration: SCM module extends VersioningSystem and registers itself via default Lookup: it puts "org.netbeans.modules.versioning.spi.VersioningSystem" file in its META-INF/services folder. VersioningSPI - Enables Source Code Management (SCM or Versioning) modules to fully integrate into the IDE workflow.Question (arch-usecases): Describe the main use cases of the new API. Who will use it under what circumstances? What kind of code would typically need to be written to use the module? Answer:
Main and Popup Menu usecases come from the UI spec available here: Versioning UI spec
The module is done.Question (arch-quality): How will the quality of your code be tested and how are future regressions going to be prevented? Answer:
Module's APIs will be tested by unit tests, all areas should be covered.Question (arch-where): Where one can find sources for your module? Answer:
The sources for the module are in the Apache Git repositories or in the GitHub repositories.
These modules are required in project.xml:
The module does NOT depend on any external projects.Question (dep-platform): On which platforms does your module run? Does it run in the same way on each? Answer:
The module does NOT depend on OS-specific features, it is pure Java.Question (dep-jre): Which version of JRE do you need (1.2, 1.3, 1.4, etc.)? Answer:
1.5Question (dep-jrejdk): Do you require the JDK or is the JRE enough? Answer:
No, JRE is enough.
Just the module's JAR file.Question (deploy-nbm): Can you deploy an NBM via the Update Center? Answer:
Yes.Question (deploy-shared): Do you need to be installed in the shared location only, or in the user directory only, or can your module be installed anywhere? Answer:
Does not matter.Question (deploy-packages): Are packages of your module made inaccessible by not declaring them public? Answer:
Package org.netbeans.modules.versioning.spi is declared as public, all others are left private.Question (deploy-dependencies): What do other modules need to do to declare a dependency on this one, in addition to or instead of the normal module dependency declaration (e.g. tokens to require)? Answer:
No special requirements here.
Yes.Question (compat-standards): Does the module implement or define any standards? Is the implementation exact or does it deviate somehow? Answer:
The module does not implement or define any standards.Question (compat-version): Can your module coexist with earlier and future versions of itself? Can you correctly read all old settings? Will future versions be able to read your current settings? Can you read or politely ignore settings stored by a future version? Answer:
Yes, the module is designed to evolve over time. Currently the module persists one (boolean) property via standard NbPreferences API and can live happily with future releases, it ignores all other settings.Question (compat-deprecation): How the introduction of your project influences functionality provided by previous version of the product? Answer:
The module introduces new SPI, it does not deprecate any existing APIs.
Yes, the SPI is designed to work with java.io.File.Question (resources-layer): Does your module provide own layer? Does it create any files or folders in it? What it is trying to communicate by that and with which components? Answer:
Yes, for the following things: - registers Diff sidebar into editor - registers Diff sidebar's marks into errorstripe - registers Show Diff Sidebar menu item in the View main menu - registers ProjectMenuItem popup menu item into projects - registers Versioning top level main menu - registers Window/Versioning menuQuestion (resources-read): Does your module read any resources from layers? For what purpose? Answer:
No.Question (resources-mask): Does your module mask/hide/override any resources provided by other modules in their layers? Answer:
No.Question (resources-preferences): Does your module uses preferences via Preferences API? Does your module use NbPreferences or or regular JDK Preferences ? Does it read, write or both ? Does it share preferences with other modules ? If so, then why ? Answer:
Yes, using NbPreferences for its own settings. It does not share settings.
org.openide.util.Lookupor any similar technology to find any components to communicate with? Which ones? Answer:
The SPI module uses default Lookup to find registered SCM modules. Searching for all "org.netbeans.modules.versioning.spi.VersioningSystem" implementations, order does not matter with one exception: the first module that defines VersioningSystem.PROP_LOCALHISTORY_VCS property becomes the LocalHistory module for the current IDE session.Question (lookup-register): Do you register anything into lookup for other code to find? Answer:
Yes, the module registers its implementation of "org.netbeans.modules.masterfs.providers.AnnotationProvider".Question (lookup-remove): Do you remove entries of other modules from lookup? Answer:
System.getProperty) property? On a similar note, is there something interesting that you pass to
java.util.logging.Logger? Or do you observe what others log? Answer:
a) System.getProperty("java.io.tmpdir") to create temporary folders.
b) System.getEnv($VARIABLE) - A private contract used to determine a VCS Systems metadata folder name in case it is registered via
@VersioningSystem.Registration. Might be changed in the future. Initialy created
because of the Subversion module where the metadata folder name is given by the state of the environment variable
$SVN_ASP_DOT_NET_HACK. In general - a VCS System doesn't have to provide in the
@VersioningSystem.Registration#metadataFolderNames attribute the explicite folder name as defined in
javadoc, but instead the necessary information how to determine the relevant folder name based on a environment variable:
$FOLDER_NAME:getenv:$VARIABLE:null|notnull will be interpreted so that
$FOLDER_NAME will be used in case
System.getenv($VARIABLE) == null or
System.getenv($VARIABLE) != null respectively.
metadata folder name will be ".svn" if
System.getenv("SVN_ASP_DOT_NET_HACK") == null, or "_svn"
System.getenv("SVN_ASP_DOT_NET_HACK") != null.
true. Question (exec-component): Is execution of your code influenced by any (string) property of any of your components? Answer:
Yes. VersionigSystem defines set of public properties that are documented in javadoc and are used by VersioningManager class. Other than that, the module does not depend on any non-public/friend properties with one exception: Diff sidebar's Diff window reads UndoRedo.class property from the JComponent that DiffView provides to enable Undo functionality in Diff windows it opens. UndoRedo undoredo = (UndoRedo) diffView.getClientProperty(UndoRedo.class);Question (exec-ant-tasks): Do you define or register any ant tasks that other can use? Answer:
No.Question (exec-classloader): Does your code create its own class loader(s)? Answer:
No.Question (exec-reflection): Does your code use Java Reflection to execute other code? Answer:
No.Question (exec-privateaccess): Are you aware of any other parts of the system calling some of your methods by reflection? Answer:
No.Question (exec-process): Do you execute an external process from your module? How do you ensure that the result is the same on different platforms? Do you parse output? Do you depend on result code? Answer:
No.Question (exec-introspection): Does your module use any kind of runtime type information (
instanceof, work with
java.lang.Class, etc.)? Answer:
Yes, instanceof operator is used on several places. Class.* methods are not used.Question (exec-threading): What threading models, if any, does your module adhere to? How the project behaves with respect to threading? Answer:
The SPI defines entry points from the IDE to VersioningSystem implementors. There is no guarantee about threading, SPI methods can be called by any thread in any order, the SPI implementors must synchronize access to their structures as needed. All callbacks back to SPI are threadsafe.Question (security-policy): Does your functionality require modifications to the standard policy file? Answer:
No.Question (security-grant): Does your code grant additional rights to some other code? Answer:
The module does not communicate with ouside world via files/network protocols.Question (format-dnd): Which protocols (if any) does your code understand during Drag & Drop? Answer:
None.Question (format-clipboard): Which data flavors (if any) does your code read from or insert to the clipboard (by access to clipboard on means calling methods on
No clipboard interaction.
Versioning manager looks up all registered SCM systems.Question (perf-exit): Does your module run any code on exit? Answer:
Diff sidebar calls File.deleteOnExit() on temporary files.Question (perf-scale): Which external criteria influence the performance of your program (size of file in editor, number of files in menu, in source directory, etc.) and how well your code scales? Answer:
Diff sidebar's performance depends on size of open documents and scales as well as diff algorithm scales (HuntDiff in case of internal diff).Question (perf-limit): Are there any hard-coded or practical limits in the number or size of elements your code can handle? Answer:
No.Question (perf-mem): How much memory does your component consume? Estimate with a relation to the number of windows, etc. Answer:
Inline diff: caches the original document - amount of memory is proportional to the size of opened documents SPI: some temporary caches, all data is referenced weaklyQuestion (perf-wakeup): Does any piece of your code wake up periodically and do something even when the system is otherwise idle (no user interaction)? Answer:
No.Question (perf-progress): Does your module execute any long-running tasks? Answer:
Yes, diff sidebar need to get the original version of a file which may use the network. This is done using RequestProcessor.Question (perf-huge_dialogs): Does your module contain any dialogs or wizards with a large number of GUI controls such as combo boxes, lists, trees, or text areas? Answer:
No.Question (perf-menus): Does your module use dynamically updated context menus, or context-sensitive actions with complicated and slow enablement logic? Answer:
VersioningManager dynamically constructs main and popup menus based on the current selection. However, it does not provide any menu items itself, it asks SCM implementors for them.Question (perf-spi): How the performance of the plugged in code will be enforced? Answer:
SPI will log (on demand) performance of plugged-in VCSInterceptors.