[infinispan-commits] Infinispan SVN: r1349 - in trunk: core/src/main/java/org/infinispan/lifecycle and 4 other directories.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Thu Jan 7 06:49:03 EST 2010


Author: manik.surtani at jboss.com
Date: 2010-01-07 06:49:03 -0500 (Thu, 07 Jan 2010)
New Revision: 1349

Added:
   trunk/core/src/main/java/org/infinispan/lifecycle/AbstractModuleLifecycle.java
   trunk/core/src/main/java/org/infinispan/lifecycle/ModuleLifecycle.java
   trunk/query/src/main/resources/infinispan-module.properties
Removed:
   trunk/core/src/main/java/org/infinispan/factories/ModuleLifecycle.java
   trunk/query/src/main/resources/META-INF/infinispan-module.properties
Modified:
   trunk/core/src/main/java/org/infinispan/factories/AbstractComponentRegistry.java
   trunk/core/src/main/java/org/infinispan/factories/ComponentRegistry.java
   trunk/core/src/main/java/org/infinispan/factories/GlobalComponentRegistry.java
   trunk/core/src/main/java/org/infinispan/util/ModuleProperties.java
   trunk/query/src/main/java/org/infinispan/query/impl/LifecycleManager.java
Log:
[ISPN-245] Finalised

Modified: trunk/core/src/main/java/org/infinispan/factories/AbstractComponentRegistry.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/factories/AbstractComponentRegistry.java	2010-01-06 18:21:38 UTC (rev 1348)
+++ trunk/core/src/main/java/org/infinispan/factories/AbstractComponentRegistry.java	2010-01-07 11:49:03 UTC (rev 1349)
@@ -35,6 +35,7 @@
 import org.infinispan.factories.scopes.Scopes;
 import org.infinispan.lifecycle.ComponentStatus;
 import org.infinispan.lifecycle.Lifecycle;
+import org.infinispan.lifecycle.ModuleLifecycle;
 import org.infinispan.util.BeanUtils;
 import org.infinispan.util.ModuleProperties;
 import org.infinispan.util.ReflectionUtil;

Modified: trunk/core/src/main/java/org/infinispan/factories/ComponentRegistry.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/factories/ComponentRegistry.java	2010-01-06 18:21:38 UTC (rev 1348)
+++ trunk/core/src/main/java/org/infinispan/factories/ComponentRegistry.java	2010-01-07 11:49:03 UTC (rev 1349)
@@ -8,6 +8,7 @@
 import org.infinispan.factories.scopes.ScopeDetector;
 import org.infinispan.factories.scopes.Scopes;
 import org.infinispan.lifecycle.ComponentStatus;
+import org.infinispan.lifecycle.ModuleLifecycle;
 import org.infinispan.notifications.cachemanagerlistener.CacheManagerNotifier;
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;

Modified: trunk/core/src/main/java/org/infinispan/factories/GlobalComponentRegistry.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/factories/GlobalComponentRegistry.java	2010-01-06 18:21:38 UTC (rev 1348)
+++ trunk/core/src/main/java/org/infinispan/factories/GlobalComponentRegistry.java	2010-01-07 11:49:03 UTC (rev 1349)
@@ -9,6 +9,7 @@
 import org.infinispan.factories.scopes.Scopes;
 import org.infinispan.jmx.CacheManagerJmxRegistration;
 import org.infinispan.lifecycle.ComponentStatus;
+import org.infinispan.lifecycle.ModuleLifecycle;
 import org.infinispan.manager.CacheManager;
 import org.infinispan.util.logging.Log;
 import org.infinispan.util.logging.LogFactory;

Deleted: trunk/core/src/main/java/org/infinispan/factories/ModuleLifecycle.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/factories/ModuleLifecycle.java	2010-01-06 18:21:38 UTC (rev 1348)
+++ trunk/core/src/main/java/org/infinispan/factories/ModuleLifecycle.java	2010-01-07 11:49:03 UTC (rev 1349)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.infinispan.factories;
-
-/**
- * ModuleLifecycle is an internal API hook for delegating lifecycle events to modules.
- * <p>
- * 
- * For example, the 'tree' module needs to register specific types with the Marshaller. The 'query'
- * module needs to register an interceptor with the Cache if the Cache has enabled querying etc etc.
- * 
- * 
- * @author Manik Surtani
- * @since 4.0
- */
-public interface ModuleLifecycle {
-    void cacheManagerStarting(GlobalComponentRegistry gcr);
-
-    void cacheManagerStarted(GlobalComponentRegistry gcr);
-
-    void cacheManagerStopping(GlobalComponentRegistry gcr);
-
-    void cacheManagerStopped(GlobalComponentRegistry gcr);
-
-    void cacheStarting(ComponentRegistry cr, String cacheName);
-
-    void cacheStarted(ComponentRegistry cr, String cacheName);
-
-    void cacheStopping(ComponentRegistry cr, String cacheName);
-
-    void cacheStopped(ComponentRegistry cr, String cacheName);
-}

Added: trunk/core/src/main/java/org/infinispan/lifecycle/AbstractModuleLifecycle.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/lifecycle/AbstractModuleLifecycle.java	                        (rev 0)
+++ trunk/core/src/main/java/org/infinispan/lifecycle/AbstractModuleLifecycle.java	2010-01-07 11:49:03 UTC (rev 1349)
@@ -0,0 +1,54 @@
+package org.infinispan.lifecycle;
+
+import org.infinispan.factories.ComponentRegistry;
+import org.infinispan.factories.GlobalComponentRegistry;
+
+
+/**
+ * A default, no-op implementation of the {@link org.infinispan.lifecycle.ModuleLifecycle} interface, designed for easy
+ * extension.
+ *
+ * @author Manik Surtani
+ * @version 4.0
+ */
+public class AbstractModuleLifecycle implements ModuleLifecycle {
+   @Override
+   public void cacheManagerStarting(GlobalComponentRegistry gcr) {
+      // a no-op
+   }
+
+   @Override
+   public void cacheManagerStarted(GlobalComponentRegistry gcr) {
+      // a no-op
+   }
+
+   @Override
+   public void cacheManagerStopping(GlobalComponentRegistry gcr) {
+      // a no-op
+   }
+
+   @Override
+   public void cacheManagerStopped(GlobalComponentRegistry gcr) {
+      // a no-op
+   }
+
+   @Override
+   public void cacheStarting(ComponentRegistry cr, String cacheName) {
+      // a no-op
+   }
+
+   @Override
+   public void cacheStarted(ComponentRegistry cr, String cacheName) {
+      // a no-op
+   }
+
+   @Override
+   public void cacheStopping(ComponentRegistry cr, String cacheName) {
+      // a no-op
+   }
+
+   @Override
+   public void cacheStopped(ComponentRegistry cr, String cacheName) {
+      // a no-op
+   }
+}


Property changes on: trunk/core/src/main/java/org/infinispan/lifecycle/AbstractModuleLifecycle.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Copied: trunk/core/src/main/java/org/infinispan/lifecycle/ModuleLifecycle.java (from rev 1348, trunk/core/src/main/java/org/infinispan/factories/ModuleLifecycle.java)
===================================================================
--- trunk/core/src/main/java/org/infinispan/lifecycle/ModuleLifecycle.java	                        (rev 0)
+++ trunk/core/src/main/java/org/infinispan/lifecycle/ModuleLifecycle.java	2010-01-07 11:49:03 UTC (rev 1349)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.infinispan.lifecycle;
+
+import org.infinispan.factories.ComponentRegistry;
+import org.infinispan.factories.GlobalComponentRegistry;
+
+/**
+ * ModuleLifecycle is an internal API hook for delegating lifecycle events to Infinispan sub-modules.
+ * <p>
+ * For example, the 'tree' module needs to register specific types with the Marshaller. The 'query'
+ * module needs to register an interceptor with the Cache if the Cache has enabled querying etc etc.
+ * <p />
+ * To use this hook, you would need to implement this interface (or extend {@link AbstractModuleLifecycle})
+ * and then create a file called <tt>infinispan-module.properties</tt> in the root of your module's JAR.
+ * When using Maven, for example, <tt>infinispan-module.properties</tt> would typically be in the module's
+ * <tt>src/main/resources</tt> directory so it gets packaged appropriately.
+ * <p />
+ * <u>infinispan-modules.properties</u>
+ * <p />
+ * Currently, the following properties are supported:
+ * <ul>
+ * <li><tt>infinispan.module.name</tt> - the name of the module</li>
+ * <li><tt>infinispan.module.lifecycle</tt> - the name of the class implementing {@link ModuleLifecycle}.  This implementation would typically reside in the module's codebase.</li>
+ * </ul>
+ *
+ * @author Manik Surtani
+ * @since 4.0
+ */
+public interface ModuleLifecycle {
+    void cacheManagerStarting(GlobalComponentRegistry gcr);
+
+    void cacheManagerStarted(GlobalComponentRegistry gcr);
+
+    void cacheManagerStopping(GlobalComponentRegistry gcr);
+
+    void cacheManagerStopped(GlobalComponentRegistry gcr);
+
+    void cacheStarting(ComponentRegistry cr, String cacheName);
+
+    void cacheStarted(ComponentRegistry cr, String cacheName);
+
+    void cacheStopping(ComponentRegistry cr, String cacheName);
+
+    void cacheStopped(ComponentRegistry cr, String cacheName);
+}

Modified: trunk/core/src/main/java/org/infinispan/util/ModuleProperties.java
===================================================================
--- trunk/core/src/main/java/org/infinispan/util/ModuleProperties.java	2010-01-06 18:21:38 UTC (rev 1348)
+++ trunk/core/src/main/java/org/infinispan/util/ModuleProperties.java	2010-01-07 11:49:03 UTC (rev 1349)
@@ -21,6 +21,11 @@
  */
 package org.infinispan.util;
 
+import org.infinispan.config.ConfigurationException;
+import org.infinispan.lifecycle.ModuleLifecycle;
+import org.infinispan.util.logging.Log;
+import org.infinispan.util.logging.LogFactory;
+
 import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -29,13 +34,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Map.Entry;
 
-import org.infinispan.config.ConfigurationException;
-import org.infinispan.factories.ModuleLifecycle;
-import org.infinispan.util.logging.Log;
-import org.infinispan.util.logging.LogFactory;
-
 /**
  * The <code>ModuleProperties</code> class represents Infinispan's module configuration key value
  * pairs. Each Infinispan module is required to provide accompanying infinispan-module.properties in
@@ -111,7 +110,7 @@
    public static List<ModuleLifecycle> resolveModuleLifecycles() throws Exception {
       List<ModuleLifecycle> lifecycles = new ArrayList<ModuleLifecycle>();
       Map<String, ModuleProperties> p = ModuleProperties.loadModuleProperties();
-      for (Entry<String, ModuleProperties> m : p.entrySet()) {
+      for (Map.Entry<String, ModuleProperties> m : p.entrySet()) {
          try {
             String lifecycleClassName = m.getValue().getLifecycleClassName();
             Class<?> loadClass = Util.loadClass(lifecycleClassName);

Modified: trunk/query/src/main/java/org/infinispan/query/impl/LifecycleManager.java
===================================================================
--- trunk/query/src/main/java/org/infinispan/query/impl/LifecycleManager.java	2010-01-06 18:21:38 UTC (rev 1348)
+++ trunk/query/src/main/java/org/infinispan/query/impl/LifecycleManager.java	2010-01-07 11:49:03 UTC (rev 1349)
@@ -22,48 +22,18 @@
 package org.infinispan.query.impl;
 
 import org.infinispan.factories.ComponentRegistry;
-import org.infinispan.factories.GlobalComponentRegistry;
-import org.infinispan.factories.ModuleLifecycle;
+import org.infinispan.lifecycle.AbstractModuleLifecycle;
 
-public class LifecycleManager implements ModuleLifecycle {
+public class LifecycleManager extends AbstractModuleLifecycle {
 
     @Override
-    public void cacheManagerStarted(GlobalComponentRegistry gcr) {
-        System.out.println("cacheManagerStarted");
-    }
-
-    @Override
-    public void cacheManagerStarting(GlobalComponentRegistry gcr) {
-        System.out.println("cacheManagerStarting");
-    }
-
-    @Override
-    public void cacheManagerStopped(GlobalComponentRegistry gcr) {
-        System.out.println("cacheManagerStopped");
-    }
-
-    @Override
-    public void cacheManagerStopping(GlobalComponentRegistry gcr) {
-        System.out.println("cacheManagerStopping");
-    }
-
-    @Override
     public void cacheStarted(ComponentRegistry cr, String cacheName) {
-        System.out.println("cacheStarted");
+       // TODO: at this point, initialise the query interceptor and inject into the cache's interceptor chain?  Essentially the work done in QueryHelper
+       // this can only be completed once we have HSEARCH-397 in place so that the indexable types can be gathered on the fly, rather than a-priori
     }
 
     @Override
-    public void cacheStarting(ComponentRegistry cr, String cacheName) {
-        System.out.println("cacheStarting");
-    }
-
-    @Override
     public void cacheStopped(ComponentRegistry cr, String cacheName) {
-        System.out.println("cacheStopped " + cacheName);
+       // TODO: do we need to "shut down" anything in Hibernate Search?
     }
-
-    @Override
-    public void cacheStopping(ComponentRegistry cr, String cacheName) {
-        System.out.println("cacheStopping " + cacheName);
-    }
 }

Deleted: trunk/query/src/main/resources/META-INF/infinispan-module.properties
===================================================================
--- trunk/query/src/main/resources/META-INF/infinispan-module.properties	2010-01-06 18:21:38 UTC (rev 1348)
+++ trunk/query/src/main/resources/META-INF/infinispan-module.properties	2010-01-07 11:49:03 UTC (rev 1349)
@@ -1,3 +0,0 @@
-infinispan.module.name=query
-infinispan.module.configurationClassName=org.infinispan.query.config.QueryConfigurationBean
-infinispan.module.lifecycle=org.infinispan.query.impl.LifecycleManager
\ No newline at end of file

Copied: trunk/query/src/main/resources/infinispan-module.properties (from rev 1348, trunk/query/src/main/resources/META-INF/infinispan-module.properties)
===================================================================
--- trunk/query/src/main/resources/infinispan-module.properties	                        (rev 0)
+++ trunk/query/src/main/resources/infinispan-module.properties	2010-01-07 11:49:03 UTC (rev 1349)
@@ -0,0 +1,2 @@
+infinispan.module.name=query
+infinispan.module.lifecycle=org.infinispan.query.impl.LifecycleManager
\ No newline at end of file



More information about the infinispan-commits mailing list