[jboss-cvs] JBossAS SVN: r69947 - projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 19 14:08:59 EST 2008


Author: bdecoste
Date: 2008-02-19 14:08:59 -0500 (Tue, 19 Feb 2008)
New Revision: 69947

Added:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/LoadBalancePolicyNotRegisteredException.java
Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactoryRegistry.java
Log:
fixed loadBalancePolicy as String not Class

Added: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/LoadBalancePolicyNotRegisteredException.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/LoadBalancePolicyNotRegisteredException.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/LoadBalancePolicyNotRegisteredException.java	2008-02-19 19:08:59 UTC (rev 69947)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.jboss.ejb3.remoting;
+
+/**
+ * LoadBalancePolicyNotRegisteredException
+ * 
+ * Thrown when attempting to retrieve a LBP with 
+ * unrecognized name from the registry
+ * 
+ * @author <a href="mailto:wdecoste at redhat.com">William DeCoste</a>
+ */
+public class LoadBalancePolicyNotRegisteredException extends Exception
+{
+   // Constructors
+
+   public LoadBalancePolicyNotRegisteredException()
+   {
+      super();
+   }
+
+   public LoadBalancePolicyNotRegisteredException(String message)
+   {
+      super(message);
+   }
+
+}

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactoryRegistry.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactoryRegistry.java	2008-02-19 19:08:09 UTC (rev 69946)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/remoting/RemoteProxyFactoryRegistry.java	2008-02-19 19:08:59 UTC (rev 69947)
@@ -21,6 +21,8 @@
  */
 package org.jboss.ejb3.remoting;
 
+import org.jboss.ha.client.loadbalance.LoadBalancePolicy;
+
 import java.util.Map;
 
 /**
@@ -33,7 +35,9 @@
 {
    // Instance Members
    private Map<String, Class<? extends RemoteProxyFactory>> factories;
-
+   
+   private Map<String, Class<LoadBalancePolicy>> loadBalancePolicies;
+  
    // Accessors / Mutators
 
    public Map<String, Class<? extends RemoteProxyFactory>> getFactories()
@@ -45,7 +49,17 @@
    {
       this.factories = factories;
    }
+   
+   public Map<String, Class<LoadBalancePolicy>> getLoadBalancePolicies()
+   {
+      return loadBalancePolicies;
+   }
 
+   public void setLoadBalancePolicies(Map<String, Class<LoadBalancePolicy>> loadBalancePolicies)
+   {
+      this.loadBalancePolicies = loadBalancePolicies;
+   }
+
    // Functional Methods
 
    /**
@@ -70,4 +84,21 @@
       return proxyFactory;
 
    }
+   
+   public Class<LoadBalancePolicy> getLoadBalancePolicy(String name) throws LoadBalancePolicyNotRegisteredException
+   {
+      // Obtain cache factory
+      Class<LoadBalancePolicy> loadBalancePolicy = this.loadBalancePolicies.get(name);
+
+      // Ensure registered
+      if (loadBalancePolicy == null)
+      {
+         throw new LoadBalancePolicyNotRegisteredException("LoadBalancePolicy with name " + name
+               + " is not registered.");
+      }
+      
+      // Return 
+      return loadBalancePolicy;
+
+   }
 }




More information about the jboss-cvs-commits mailing list