Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jul 28, 2012
@jri Core: new event INITIALIZE_PLUGIN.
Plugin developers use this event to initialize the in-memory plugin instance.
The event is fired each time the plugin is activated, after it is installed in the DB, before it is registered at core.
435f428
@jri Merge branch 'master' into file-upload a9e3b19
View
14 modules/dm4-core/src/main/java/de/deepamehta/core/impl/service/PluginImpl.java
@@ -446,7 +446,7 @@ private void checkServiceAvailability() {
}
}
- // ---
+ // === Activation ===
/**
* Activates this plugin. This comprises:
@@ -470,6 +470,7 @@ private synchronized boolean activate() {
//
logger.info("----- Activating " + this + " -----");
installPluginInDB(); // relies on DeepaMehtaService
+ initializePlugin(); // ### merge notice: must perform *before* registerListeners()
registerPlugin(); // relies on DeepaMehtaService (and committed migrations)
logger.info("----- Activation of " + this + " complete -----");
return true;
@@ -546,6 +547,12 @@ private void introduceTypesToPlugin() {
}
}
+ // === Initialization ===
+
+ private void initializePlugin() {
+ deliverEvent(CoreEvent.INITIALIZE_PLUGIN);
+ }
+
// === Core Registration ===
/**
@@ -626,9 +633,10 @@ private void unregisterListeners() {
* By this method this plugin delivers an "internal" event to itself. An internal event is bound
* to a particular plugin, in contrast to being fired and delivered to all registered plugins.
* <p>
- * There are 4 internal events:
+ * There are 5 internal events:
* - POST_INSTALL_PLUGIN
- * - INTRODUCE_TOPIC_TYPE
+ * - INTRODUCE_TOPIC_TYPE (has a double nature)
+ * - INITIALIZE_PLUGIN
* - PLUGIN_SERVICE_ARRIVED
* - PLUGIN_SERVICE_GONE
*/
View
28 modules/dm4-core/src/main/java/de/deepamehta/core/service/CoreEvent.java
@@ -17,9 +17,10 @@
*
* There are 2 types of events:
* - regular events: are fired (usually) by the core and then delivered to all registered listeners (plugins).
- * - internal plugin events: are fired by a plugin and then delivered only to itself. There are 4 internal events:
+ * - internal plugin events: are fired by a plugin and then delivered only to itself. There are 5 internal events:
* - POST_INSTALL_PLUGIN
* - INTRODUCE_TOPIC_TYPE (has a double nature)
+ * - INITIALIZE_PLUGIN
* - PLUGIN_SERVICE_ARRIVED
* - PLUGIN_SERVICE_GONE
*
@@ -42,33 +43,34 @@
POST_DELETE_ASSOCIATION(PostDeleteAssociationListener.class,
"postDeleteAssociation", Association.class, Directives.class),
- POST_RETYPE_ASSOCIATION(PostRetypeAssociationListener.class, // ### TODO: remove this event. Retype is special
- "postRetypeAssociation", Association.class, String.class, Directives.class), // case of update.
+ // ### TODO: remove this event. Retype is special case of update
+ POST_RETYPE_ASSOCIATION(PostRetypeAssociationListener.class,
+ "postRetypeAssociation", Association.class, String.class, Directives.class),
PRE_SEND_TOPIC(PreSendTopicListener.class,
"preSendTopic", Topic.class, ClientState.class),
PRE_SEND_TOPIC_TYPE(PreSendTopicTypeListener.class,
"preSendTopicType", TopicType.class, ClientState.class),
- POST_INSTALL_PLUGIN(PostInstallPluginListener.class, // ### TODO: remove this event. Use migration 1 instead.
- "postInstallPlugin"),
- // Note: this is an internal plugin event (see {@link Plugin#installPluginInDB}).
-
ALL_PLUGINS_ACTIVE(AllPluginsActiveListener.class,
"allPluginsActive"),
+ // === Internal plugin events ===
+
+ // ### TODO: remove this event. Use migration 1 instead.
+ POST_INSTALL_PLUGIN(PostInstallPluginListener.class,
+ "postInstallPlugin"),
+
INTRODUCE_TOPIC_TYPE(IntroduceTopicTypeListener.class,
"introduceTopicType", TopicType.class, ClientState.class),
- // Note: besides regular firing (see {@link EmbeddedService#createTopicType})
- // this is an internal plugin event (see {@link Plugin#introduceTypesToPlugin}).
+
+ INITIALIZE_PLUGIN(InitializePluginListener.class,
+ "initializePlugin"),
PLUGIN_SERVICE_ARRIVED(PluginServiceArrivedListener.class,
"pluginServiceArrived", PluginService.class),
- // Note: this is an internal plugin event (see {@link Plugin#createServiceTracker}).
PLUGIN_SERVICE_GONE(PluginServiceGoneListener.class,
- "pluginServiceGone", PluginService.class)
- // Note: this is an internal plugin event (see {@link Plugin#createServiceTracker}).
- ;
+ "pluginServiceGone", PluginService.class);
public final Class listenerInterface;
public final String handlerMethodName;
View
10 .../dm4-core/src/main/java/de/deepamehta/core/service/listener/InitializePluginListener.java
@@ -0,0 +1,10 @@
+package de.deepamehta.core.service.listener;
+
+import de.deepamehta.core.service.Listener;
+
+
+
+public interface InitializePluginListener extends Listener {
+
+ void initializePlugin();
+}

No commit comments for this range

Something went wrong with that request. Please try again.