|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.deepamehta.core.impl.PluginImpl
public class PluginImpl
Field Summary | |
---|---|
private BundleContext |
bundleContext
|
private Map<Class<? extends PluginService>,InjectableService> |
consumedPluginServices
|
private StaticResources |
directoryResource
|
private EmbeddedService |
dms
|
private EventAdmin |
eventService
|
private Logger |
logger
|
private static String |
PLUGIN_ACTIVATED
|
private static String |
PLUGIN_CONFIG_FILE
|
private static String |
PLUGIN_DEFAULT_PACKAGE
|
private Bundle |
pluginBundle
|
private PluginContext |
pluginContext
|
private List<String> |
pluginDependencies
|
private PluginInfo |
pluginInfo
|
private String |
pluginPackage
|
private Properties |
pluginProperties
|
private Topic |
pluginTopic
|
private String |
pluginUri
|
private ServiceRegistration |
registration
|
private RestResources |
restResources
|
private List<ServiceTracker> |
serviceTrackers
|
private StaticResources |
staticResources
|
private WebPublishingService |
webPublishingService
|
Constructor Summary | |
---|---|
PluginImpl(PluginContext pluginContext)
|
Method Summary | |
---|---|
(package private) void |
activate()
Activates this plugin and then posts the PLUGIN_ACTIVATED OSGi event. |
private void |
addService(Object service,
Class serviceInterface)
|
private void |
checkRequirementsForActivation()
Checks if this plugin's requirements are met, and if so, activates this plugin. |
private void |
closeServiceTrackers()
|
private void |
createCoreServiceTrackers()
|
private List<InjectableService> |
createInjectableServices()
|
private void |
createPluginServiceTrackers()
|
private Topic |
createPluginTopic()
Creates a Plugin topic in the DB. |
private boolean |
createPluginTopicIfNotExists()
|
private ServiceTracker |
createServiceTracker(Class serviceInterface)
|
(package private) void |
deactivate()
|
private void |
deliverEvent(DeepaMehtaEvent event,
Object... params)
Checks weather this plugin is a listener for the given event, and if so, delivers the event to this plugin. |
private boolean |
dependenciesAvailable()
|
private String |
entryPathToClassName(String entryPath)
|
private Topic |
fetchPluginTopic()
|
private URL |
getBundleEntry(String path)
|
(package private) String |
getConfigProperty(String key)
Returns a plugin configuration property (as read from file "plugin.properties") or null if no such property exists. |
(package private) String |
getConfigProperty(String key,
String defaultValue)
|
(package private) PluginContext |
getContext()
|
private List<DeepaMehtaEvent> |
getEvents()
Returns the events this plugin is listening to. |
(package private) PluginInfo |
getInfo()
|
(package private) String |
getMigrationClassName(int migrationNr)
Returns the migration class name for the given migration number. |
private Enumeration<String> |
getPluginPaths(String relativePath)
|
(package private) Topic |
getPluginTopic()
|
private List<Class<?>> |
getProviderClasses()
|
private List<Object> |
getRootResources()
|
InputStream |
getStaticResource(String name)
Accesses a static resource of the plugin. |
private String |
getStaticResourcesNamespace()
|
String |
getUri()
|
void |
handleEvent(Event event)
|
private boolean |
hasDependency(String pluginUri)
|
boolean |
hasStaticResource(String name)
Checks if this plugin bundle contains a static resource with the given name. |
private void |
initializePlugin()
|
private void |
installPluginInDB()
Installs the plugin in the database. |
private void |
introduceAssociationTypesToPlugin()
|
private void |
introduceTopicTypesToPlugin()
|
private boolean |
isListenerInterface(Class interfaze)
Returns true if the specified interface is an event listener interface. |
private boolean |
isPluginActivated(String pluginUri)
|
(package private) Class |
loadClass(String className)
Uses the plugin bundle's class loader to load a class by name. |
private void |
openServiceTrackers()
|
private List<String> |
pluginDependencies()
|
private String |
pluginName()
|
private boolean |
pluginServicesAvailable()
|
private void |
postPluginActivatedEvent()
|
private String |
providedServiceInterface()
|
void |
publishDirectory(String directoryPath,
String uriNamespace,
SecurityHandler securityHandler)
|
private void |
publishRestResources()
Publishes this plugin's REST resources (via Web Publishing service). |
private void |
publishStaticResources()
Publishes this plugin's static resources (via Web Publishing service). |
private Properties |
readConfigFile()
|
private void |
registerListeners()
|
private void |
registerPluginActivatedEventListener()
|
private void |
registerPluginService()
Registers this plugin's OSGi service at the OSGi framework. |
private void |
removeService(Object service,
Class serviceInterface)
|
private List<String> |
scanPackage(String relativePath)
|
private void |
setCoreService(EmbeddedService dms)
|
(package private) void |
setMigrationNr(int migrationNr)
|
void |
start()
|
void |
stop()
|
String |
toString()
|
private void |
unpublishDirectoryResource()
|
private void |
unpublishRestResources()
|
private void |
unpublishStaticResources()
|
private void |
unregisterListeners()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final String PLUGIN_DEFAULT_PACKAGE
private static final String PLUGIN_CONFIG_FILE
private static final String PLUGIN_ACTIVATED
private PluginContext pluginContext
private BundleContext bundleContext
private Bundle pluginBundle
private String pluginUri
private Properties pluginProperties
private String pluginPackage
private PluginInfo pluginInfo
private List<String> pluginDependencies
private Topic pluginTopic
private EmbeddedService dms
private WebPublishingService webPublishingService
private EventAdmin eventService
private Map<Class<? extends PluginService>,InjectableService> consumedPluginServices
private List<ServiceTracker> serviceTrackers
private ServiceRegistration registration
private StaticResources staticResources
private StaticResources directoryResource
private RestResources restResources
private Logger logger
Constructor Detail |
---|
public PluginImpl(PluginContext pluginContext)
Method Detail |
---|
public void start()
public void stop()
public void publishDirectory(String directoryPath, String uriNamespace, SecurityHandler securityHandler)
public String getUri()
public InputStream getStaticResource(String name)
Plugin
getStaticResource
in interface Plugin
name
- The resource name: a "/"-separated path name, relative to the plugin bundle's root directory.
It may or may not begin with "/" (it makes no difference).
public boolean hasStaticResource(String name)
Plugin
hasStaticResource
in interface Plugin
name
- The resource name: a "/"-separated path name, relative to the plugin bundle's root directory.
It may or may not begin with "/" (it makes no difference).public String toString()
toString
in class Object
PluginInfo getInfo()
PluginContext getContext()
Topic getPluginTopic()
String getConfigProperty(String key)
null
if no such property exists.
String getConfigProperty(String key, String defaultValue)
String getMigrationClassName(int migrationNr)
null
if the migration package is unknown.
This is the case if the plugin bundle contains no Plugin subclass and the "pluginPackage" config
property is not set.void setMigrationNr(int migrationNr)
Class loadClass(String className)
null
if the class is not found.private Properties readConfigFile()
private void createCoreServiceTrackers()
private void createPluginServiceTrackers()
private List<InjectableService> createInjectableServices()
private boolean pluginServicesAvailable()
private ServiceTracker createServiceTracker(Class serviceInterface)
private void openServiceTrackers()
private void closeServiceTrackers()
private void addService(Object service, Class serviceInterface)
private void removeService(Object service, Class serviceInterface)
private void setCoreService(EmbeddedService dms)
private void checkRequirementsForActivation()
void activate()
void deactivate()
private void installPluginInDB()
CoreEvent.INTRODUCE_TOPIC_TYPE
and
CoreEvent.INTRODUCE_ASSOCIATION_TYPE
events)
private boolean createPluginTopicIfNotExists()
private Topic createPluginTopic()
A Plugin topic represents an installed plugin and is used to track its version.
private Topic fetchPluginTopic()
private void introduceTopicTypesToPlugin()
private void introduceAssociationTypesToPlugin()
private void initializePlugin()
private void registerListeners()
private void unregisterListeners()
private List<DeepaMehtaEvent> getEvents()
private void deliverEvent(DeepaMehtaEvent event, Object... params)
Called internally to deliver the INTRODUCE_TOPIC_TYPE and INTRODUCE_ASSOCIATION_TYPE events.
private boolean isListenerInterface(Class interfaze)
EventListener
.
private void registerPluginService()
private String providedServiceInterface()
private void publishStaticResources()
private void unpublishStaticResources()
private String getStaticResourcesNamespace()
private URL getBundleEntry(String path)
private void unpublishDirectoryResource()
private void publishRestResources()
private void unpublishRestResources()
private List<Object> getRootResources()
private List<Class<?>> getProviderClasses() throws IOException
IOException
private List<String> pluginDependencies()
private boolean hasDependency(String pluginUri)
private boolean dependenciesAvailable()
private boolean isPluginActivated(String pluginUri)
private void registerPluginActivatedEventListener()
private void postPluginActivatedEvent()
public void handleEvent(Event event)
handleEvent
in interface EventHandler
private String pluginName()
private List<String> scanPackage(String relativePath)
private Enumeration<String> getPluginPaths(String relativePath)
private String entryPathToClassName(String entryPath)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |