public class RegistryStrategyOSGI extends RegistryStrategy
RegistryFactory.setDefaultRegistryProvider(IRegistryProvider)| Modifier and Type | Field and Description |
|---|---|
protected boolean |
DEBUG
Debug extension registry
|
protected boolean |
DEBUG_REGISTRY_EVENTS
Debug extension registry events
|
| Constructor and Description |
|---|
RegistryStrategyOSGI(java.io.File[] theStorageDir,
boolean[] cacheReadOnly,
java.lang.Object key) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
cacheLazyLoading()
Specifies if lazy cache loading is used.
|
boolean |
cacheUse()
Specifies if the extension registry should use cache to store registry data between
invocations.
|
boolean |
checkContributionsTimestamp() |
java.lang.Object |
createExecutableExtension(RegistryContributor contributor,
java.lang.String className,
java.lang.String overridenContributorName)
Creates an executable extension.
|
long |
getContributionsTimestamp()
This method is called as a part of the registry cache validation.
|
long |
getExtendedTimestamp(Bundle bundle,
java.net.URL pluginManifest) |
java.lang.String |
getLocale()
Returns the current locale for the extension registry with enabled
multi-language support.
|
javax.xml.parsers.SAXParserFactory |
getXMLParser()
Returns the parser used by the registry to parse descriptions of extension points and extensions.
|
void |
onStart(IExtensionRegistry registry,
boolean loadedFromCache)
Override this method to provide additional processing performed
when the registry is created and started.
|
void |
onStop(IExtensionRegistry registry)
Override this method to provide additional processing to be performed
just before the registry is stopped.
|
java.lang.String[] |
translate(java.lang.String[] nonTranslated,
IContributor contributor,
java.lang.String locale)
Translates array of keys supplied by the contributor to the requested locale.
|
java.lang.String |
translate(java.lang.String key,
java.util.ResourceBundle resources)
Translates key using the supplied resource bundle.
|
debug, debugRegistryEvents, getContainerTimestamp, getLocationsLength, getStorage, isCacheReadOnly, log, onStart, processChangeEvent, scheduleChangeEventprotected boolean DEBUG
protected boolean DEBUG_REGISTRY_EVENTS
public RegistryStrategyOSGI(java.io.File[] theStorageDir,
boolean[] cacheReadOnly,
java.lang.Object key)
theStorageDir - - array of file system directories to store cache files; might be nullcacheReadOnly - - array of read only attributes. True: cache at this location is read
only; false: cache is read/writekey - - control key for the registry (should be the same key as used in
the RegistryManager#createExtensionRegistry() of this registrypublic final java.lang.String translate(java.lang.String key,
java.util.ResourceBundle resources)
RegistryStrategynull.
The default translation routine assumes that keys are prefixed with '%'. If no resource bundle is present, the key itself (without leading '%') is returned. There is no decoding for the leading '%%'.
translate in class RegistryStrategykey - message key to be translatedresources - resource bundle, or nullnullpublic java.lang.String[] translate(java.lang.String[] nonTranslated,
IContributor contributor,
java.lang.String locale)
RegistryStrategyThis method is intended to be overridden by specialized registry strategies that know translation conventions for the contributors, for instance, the agreed upon locations of the translated keys for bundle contributors. The base implementation simply returns the array of non-translated keys.
This method is only used if multi-language support is enabled.
translate in class RegistryStrategynonTranslated - message keys to be translatedcontributor - the contributor of the keys to be translatedlocale - the requested locale for the keysIExtensionRegistry.isMultiLanguage()public java.lang.Object createExecutableExtension(RegistryContributor contributor, java.lang.String className, java.lang.String overridenContributorName) throws CoreException
RegistryStrategy
This method receives the contributor of the executable extension and, possibly,
an optional contributor name if specified by the executable extension. The overridden
contributor name might be null.
In this implementation registry attempts to instantiate the class specified via
the class name (must not be null) using standard Java reflection mechanism.
This method assumes that such class has a default constructor with no arguments.
createExecutableExtension in class RegistryStrategycontributor - the contributor of this executable extensionclassName - the name of the class to be instantiatedoverridenContributorName - the contributor to be used, or null if not specifiednullCoreException - if there was a problem creating the executable extensionIConfigurationElement.createExecutableExtension(String),
IExecutableExtensionpublic void onStart(IExtensionRegistry registry, boolean loadedFromCache)
RegistryStrategysuper.onStart() at the beginning of the processing.onStart in class RegistryStrategyregistry - the extension registry being startedloadedFromCache - true is registry contents was loaded from
cache when the registry was createdpublic void onStop(IExtensionRegistry registry)
RegistryStrategysuper.onStop() at the end of the processing.onStop in class RegistryStrategyregistry - the extension registry being stoppedpublic boolean cacheUse()
RegistryStrategy
The default implementation enables caching returning true.
cacheUse in class RegistryStrategytrue if the cache should be used and false otherwisepublic boolean cacheLazyLoading()
RegistryStrategy
The default implementation specifies that lazy cache loading is going to be used
and therefore returns true.
cacheLazyLoading in class RegistryStrategytrue if lazy cache loading is used and false otherwisepublic long getContributionsTimestamp()
RegistryStrategy
The value returned by the method is compared with the timestamp tracked by the registry.
If contributions changed since they have been added to the registry (i.e., plugin.xml
file was modified since the last run), the value of the RegistryStrategy.getContributionsTimestamp()
will change and no longer will be the same as the value tracked by the registry. In this case
the cache is considered to be invalid and the registry is going to be re-populated form scratch.
(The word "timestamp" is used very loosely here. In this context, "timestamp" is more likely to be a hash value aggregating a number of actual timestamps from the contributions.)
This method may return 0 to indicate that no time stamp verification is required.
getContributionsTimestamp in class RegistryStrategypublic boolean checkContributionsTimestamp()
public long getExtendedTimestamp(Bundle bundle,
java.net.URL pluginManifest)
public javax.xml.parsers.SAXParserFactory getXMLParser()
RegistryStrategynull.getXMLParser in class RegistryStrategyIExtensionRegistry.addContribution(java.io.InputStream, IContributor, boolean, String, ResourceBundle, Object)public java.lang.String getLocale()
RegistryStrategy
The default implementation assumes that there is a single system wide
locale, equivalent to Locale.getDefault().
The result of this method should not be retained or passed to other threads. The current locale can change any time and may be different for each thread.
This method can be overridden by subclasses that wish to provide a way to change the default locale.
This method is only used if multi-language support is enabled.
getLocale in class RegistryStrategyIExtensionRegistry.isMultiLanguage()