You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemind.apache.org by ah...@apache.org on 2006/10/05 09:26:22 UTC
svn commit: r453126 - in
/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind:
definition/RegistryDefinition.java
events/RegistryInitializationListener.java impl/RegistryBuilder.java
Author: ahuegen
Date: Thu Oct 5 00:26:21 2006
New Revision: 453126
URL: http://svn.apache.org/viewvc?view=rev&rev=453126
Log:
Implemented registry initialization listener
Added:
hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/events/RegistryInitializationListener.java
Modified:
hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java
hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java?view=diff&rev=453126&r1=453125&r2=453126
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/definition/RegistryDefinition.java Thu Oct 5 00:26:21 2006
@@ -12,6 +12,7 @@
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.ErrorHandler;
import org.apache.hivemind.Occurances;
+import org.apache.hivemind.events.RegistryInitializationListener;
import org.apache.hivemind.impl.DefaultErrorHandler;
import org.apache.hivemind.impl.RegistryPostProcessor;
import org.apache.hivemind.internal.Visibility;
@@ -36,6 +37,8 @@
private Map _natures = new HashMap();
private List _postProcessors = new ArrayList();
+
+ private List _initializationListeners = new ArrayList();
public RegistryDefinition()
{
@@ -75,6 +78,19 @@
public List getPostProcessors()
{
return _postProcessors;
+ }
+
+ /**
+ * @see RegistryInitializationListener
+ */
+ public void addRegistryInitializationListener(RegistryInitializationListener listener)
+ {
+ _initializationListeners.add(listener);
+ }
+
+ public List getRegistryInitializationListeners()
+ {
+ return _initializationListeners;
}
public Collection getModules()
Added: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/events/RegistryInitializationListener.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/events/RegistryInitializationListener.java?view=auto&rev=453126
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/events/RegistryInitializationListener.java (added)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/events/RegistryInitializationListener.java Thu Oct 5 00:26:21 2006
@@ -0,0 +1,37 @@
+// Copyright 2004, 2005 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.hivemind.events;
+
+import java.util.EventListener;
+
+import org.apache.hivemind.internal.RegistryInfrastructure;
+
+/**
+ * Lifecycle interface that may be implemented by objects
+ * that need to know when the {@link org.apache.hivemind.Registry}
+ * has been fully initialized and that need a reference to the {@link RegistryInfrastructure} interface.
+ * Typically, this is implemented by core service implementations.
+ *
+ * @author Achim Huegen
+ */
+public interface RegistryInitializationListener extends EventListener
+{
+ /**
+ * Invoked when the registry has been initialized.
+ * All runtime data (Modules, ServicePoints) etc. is assembled.
+ * The hivemind.Startup service point has not been launched before.
+ */
+ public void registryInitialized(RegistryInfrastructure registry);
+}
Modified: hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java
URL: http://svn.apache.org/viewvc/hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java?view=diff&rev=453126&r1=453125&r2=453126
==============================================================================
--- hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java (original)
+++ hivemind/branches/branch-2-0-annot/framework/src/java/org/apache/hivemind/impl/RegistryBuilder.java Thu Oct 5 00:26:21 2006
@@ -23,6 +23,7 @@
import org.apache.hivemind.ErrorHandler;
import org.apache.hivemind.Registry;
import org.apache.hivemind.definition.RegistryDefinition;
+import org.apache.hivemind.events.RegistryInitializationListener;
import org.apache.hivemind.internal.RegistryInfrastructure;
/**
@@ -111,7 +112,7 @@
definition.checkDependencies();
definition.checkContributionCounts();
- // Post process phase
+ // Notify post processors
for (Iterator i = definition.getPostProcessors().iterator(); i.hasNext();)
{
RegistryPostProcessor processor = (RegistryPostProcessor) i.next();
@@ -123,6 +124,14 @@
RegistryInfrastructure infrastructure = constructor
.constructRegistryInfrastructure(definition);
+ // Notify initialization listeners
+ for (Iterator i = definition.getRegistryInitializationListeners().iterator(); i.hasNext();)
+ {
+ RegistryInitializationListener listener = (RegistryInitializationListener) i.next();
+
+ listener.registryInitialized(infrastructure);
+ }
+
infrastructure.startup();
return new RegistryImpl(infrastructure);