[jbosscache-commits] JBoss Cache SVN: r7543 - in core/branches/flat/src/main/java/org/horizon: factories and 1 other directory.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Tue Jan 20 12:33:24 EST 2009


Author: manik.surtani at jboss.com
Date: 2009-01-20 12:33:24 -0500 (Tue, 20 Jan 2009)
New Revision: 7543

Added:
   core/branches/flat/src/main/java/org/horizon/factories/RPCManagerFactory.java
Removed:
   core/branches/flat/src/main/java/org/horizon/factories/RuntimeConfigAwareFactory.java
Modified:
   core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java
   core/branches/flat/src/main/java/org/horizon/factories/AbstractComponentRegistry.java
   core/branches/flat/src/main/java/org/horizon/factories/TransportFactory.java
Log:
Transport and rpc manager is null by default and needs to be explicitly constructed

Modified: core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java	2009-01-20 17:24:43 UTC (rev 7542)
+++ core/branches/flat/src/main/java/org/horizon/config/GlobalConfiguration.java	2009-01-20 17:33:24 UTC (rev 7543)
@@ -10,7 +10,6 @@
 import org.horizon.factories.annotations.NonVolatile;
 import org.horizon.factories.scopes.Scope;
 import org.horizon.factories.scopes.Scopes;
-import org.horizon.remoting.transport.jgroups.JGroupsTransport;
 import org.horizon.util.TypedProperties;
 
 import java.util.Properties;
@@ -42,7 +41,7 @@
    String marshallVersion;
    int objectInputStreamPoolSize;
    int objectOutputStreamPoolSize;
-   String transportClass = JGroupsTransport.class.getName();
+   String transportClass = null; // this defaults to a non-clustered cache.
    TypedProperties transportProperties;
    Configuration defaultConfiguration;
    String clusterName = "Horizon-Cluster";

Modified: core/branches/flat/src/main/java/org/horizon/factories/AbstractComponentRegistry.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/factories/AbstractComponentRegistry.java	2009-01-20 17:24:43 UTC (rev 7542)
+++ core/branches/flat/src/main/java/org/horizon/factories/AbstractComponentRegistry.java	2009-01-20 17:33:24 UTC (rev 7543)
@@ -80,7 +80,8 @@
 @Scope(Scopes.NAMED_CACHE)
 public abstract class AbstractComponentRegistry implements Lifecycle {
 
-   private static final boolean DEBUG_DEPENDENCIES = true;
+   // Be careful when changing this to 'true'.  It should *never* go into the code repo with this flag set to 'true'!
+   private static final boolean DEBUG_DEPENDENCIES = false;
    private Stack<String> debugStack = DEBUG_DEPENDENCIES ? new Stack<String>() : null;
 
    /**
@@ -143,7 +144,7 @@
       s.add(BootstrapFactory.class);
       s.add(EmptyConstructorFactory.class);
       s.add(InterceptorChainFactory.class);
-      s.add(RuntimeConfigAwareFactory.class);
+      s.add(RPCManagerFactory.class);
       s.add(TransactionManagerFactory.class);
       s.add(ReplicationQueueFactory.class);
       s.add(StateTransferManagerFactory.class);

Copied: core/branches/flat/src/main/java/org/horizon/factories/RPCManagerFactory.java (from rev 7537, core/branches/flat/src/main/java/org/horizon/factories/RuntimeConfigAwareFactory.java)
===================================================================
--- core/branches/flat/src/main/java/org/horizon/factories/RPCManagerFactory.java	                        (rev 0)
+++ core/branches/flat/src/main/java/org/horizon/factories/RPCManagerFactory.java	2009-01-20 17:33:24 UTC (rev 7543)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2000 - 2008, 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.horizon.factories;
+
+import org.horizon.config.RuntimeConfig;
+import org.horizon.factories.annotations.DefaultFactoryFor;
+import org.horizon.remoting.RPCManager;
+
+/**
+ * An extension of the EmptyConstructorFactory that places a component in the {@link RuntimeConfig} after creating it.
+ *
+ * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
+ * @since 1.0
+ */
+ at DefaultFactoryFor(classes = RPCManager.class)
+public class RPCManagerFactory extends EmptyConstructorFactory implements AutoInstantiableFactory {
+   @Override
+   public <T> T construct(Class<T> componentType) {
+      // only do this if we have a transport configured!
+      if (configuration.getGlobalConfiguration().getTransportClass() == null) return null;
+      return super.construct(componentType);
+   }
+}


Property changes on: core/branches/flat/src/main/java/org/horizon/factories/RPCManagerFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: core/branches/flat/src/main/java/org/horizon/factories/RuntimeConfigAwareFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/factories/RuntimeConfigAwareFactory.java	2009-01-20 17:24:43 UTC (rev 7542)
+++ core/branches/flat/src/main/java/org/horizon/factories/RuntimeConfigAwareFactory.java	2009-01-20 17:33:24 UTC (rev 7543)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2000 - 2008, 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.horizon.factories;
-
-import org.horizon.config.ConfigurationException;
-import org.horizon.config.RuntimeConfig;
-import org.horizon.factories.annotations.DefaultFactoryFor;
-import org.horizon.remoting.RPCManager;
-import org.horizon.util.BeanUtils;
-
-import java.lang.reflect.Method;
-
-/**
- * An extension of the EmptyConstructorFactory that places a component in the {@link RuntimeConfig} after creating it.
- *
- * @author Manik Surtani (<a href="mailto:manik at jboss.org">manik at jboss.org</a>)
- * @since 1.0
- */
- at DefaultFactoryFor(classes = RPCManager.class)
-public class RuntimeConfigAwareFactory extends EmptyConstructorFactory implements AutoInstantiableFactory {
-   @Override
-   public <T> T construct(Class<T> componentType) {
-      T component = super.construct(componentType);
-
-      Method setter = BeanUtils.setterMethod(RuntimeConfig.class, componentType);
-      if (setter != null) {
-         try {
-            setter.invoke(configuration.getRuntimeConfig(), component);
-         }
-         catch (Exception e) {
-            throw new ConfigurationException("Unable to put newly constructed component of type " + componentType + " in the RuntimeConfig", e);
-         }
-      }
-      return component;
-   }
-}

Modified: core/branches/flat/src/main/java/org/horizon/factories/TransportFactory.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/factories/TransportFactory.java	2009-01-20 17:24:43 UTC (rev 7542)
+++ core/branches/flat/src/main/java/org/horizon/factories/TransportFactory.java	2009-01-20 17:33:24 UTC (rev 7543)
@@ -21,6 +21,7 @@
    public <T> T construct(Class<T> componentType) {
       String transportClass = configuration.getGlobalConfiguration().getTransportClass();
       try {
+         if (transportClass == null) return null;
          return (T) Util.getInstance(transportClass);
       } catch (Exception e) {
          throw new CacheException("Unable to create transport of type " + transportClass, e);




More information about the jbosscache-commits mailing list