[jboss-cvs] JBossAS SVN: r65618 - in projects/ejb3/trunk/locator/src: main/org/jboss/ejb3 and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Sep 26 05:12:18 EDT 2007
Author: ALRubinger
Date: 2007-09-26 05:12:18 -0400 (Wed, 26 Sep 2007)
New Revision: 65618
Added:
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/
projects/ejb3/trunk/locator/src/test/org/
projects/ejb3/trunk/locator/src/test/org/jboss/
projects/ejb3/trunk/locator/src/test/org/jboss/ejb3/
projects/ejb3/trunk/locator/src/test/org/jboss/ejb3/test/
projects/ejb3/trunk/locator/src/test/org/jboss/ejb3/test/locator/
projects/ejb3/trunk/locator/src/test/org/jboss/ejb3/test/locator/client/
projects/ejb3/trunk/locator/src/test/org/jboss/ejb3/test/locator/client/jndihostequality/
Removed:
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/servicelocator/
Modified:
projects/ejb3/trunk/locator/src/legacy/ServiceContextProximityBindManagerOld.java
projects/ejb3/trunk/locator/src/legacy/ServiceLocatorOldImpl.java
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/CachingServiceLocator.java
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/Ejb3NotFoundException.java
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/JndiCachingServiceLocator.java
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/JndiHost.java
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/JndiHostMetadataParser.java
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/ServiceLocator.java
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/ServiceLocatorException.java
projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/ServiceLocatorFactory.java
Log:
Minor revisions, JBoss-izing
Modified: projects/ejb3/trunk/locator/src/legacy/ServiceContextProximityBindManagerOld.java
===================================================================
--- projects/ejb3/trunk/locator/src/legacy/ServiceContextProximityBindManagerOld.java 2007-09-26 03:22:24 UTC (rev 65617)
+++ projects/ejb3/trunk/locator/src/legacy/ServiceContextProximityBindManagerOld.java 2007-09-26 09:12:18 UTC (rev 65618)
@@ -19,9 +19,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.validator.GenericValidator;
-import org.jboss.ejb3.servicelocator.Ejb3NotFoundException;
-import org.jboss.ejb3.servicelocator.JndiHost;
-import org.jboss.ejb3.servicelocator.ServiceLocatorException;
+import org.jboss.ejb3.locator.client.Ejb3NotFoundException;
+import org.jboss.ejb3.locator.client.JndiHost;
+import org.jboss.ejb3.locator.client.ServiceLocatorException;
import org.xml.sax.SAXException;
/**
Modified: projects/ejb3/trunk/locator/src/legacy/ServiceLocatorOldImpl.java
===================================================================
--- projects/ejb3/trunk/locator/src/legacy/ServiceLocatorOldImpl.java 2007-09-26 03:22:24 UTC (rev 65617)
+++ projects/ejb3/trunk/locator/src/legacy/ServiceLocatorOldImpl.java 2007-09-26 09:12:18 UTC (rev 65618)
@@ -9,8 +9,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.ejb3.servicelocator.Ejb3NotFoundException;
-import org.jboss.ejb3.servicelocator.ServiceLocatorException;
+import org.jboss.ejb3.locator.client.Ejb3NotFoundException;
+import org.jboss.ejb3.locator.client.ServiceLocatorException;
/**
* ServiceLocator
Copied: projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client (from rev 65616, projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/servicelocator)
Modified: projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/CachingServiceLocator.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/servicelocator/CachingServiceLocator.java 2007-09-25 22:26:20 UTC (rev 65616)
+++ projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/CachingServiceLocator.java 2007-09-26 09:12:18 UTC (rev 65618)
@@ -1,4 +1,25 @@
-package org.jboss.ejb3.servicelocator;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.locator.client;
import java.util.Collections;
import java.util.HashMap;
Modified: projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/Ejb3NotFoundException.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/servicelocator/Ejb3NotFoundException.java 2007-09-25 22:26:20 UTC (rev 65616)
+++ projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/Ejb3NotFoundException.java 2007-09-26 09:12:18 UTC (rev 65618)
@@ -1,19 +1,44 @@
-package org.jboss.ejb3.servicelocator;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.locator.client;
-public class Ejb3NotFoundException extends RuntimeException {
- // Class Members
- private static final long serialVersionUID = 6533428942404073608L;
+public class Ejb3NotFoundException extends RuntimeException
+{
+ // Class Members
+ private static final long serialVersionUID = 6533428942404073608L;
- // Constructors
- public Ejb3NotFoundException(String arg0) {
- super(arg0);
- }
+ // Constructors
+ public Ejb3NotFoundException(String arg0)
+ {
+ super(arg0);
+ }
- public Ejb3NotFoundException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
+ public Ejb3NotFoundException(String arg0, Throwable arg1)
+ {
+ super(arg0, arg1);
+ }
- public Ejb3NotFoundException(Throwable arg0) {
- super(arg0);
- }
+ public Ejb3NotFoundException(Throwable arg0)
+ {
+ super(arg0);
+ }
}
Modified: projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/JndiCachingServiceLocator.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/servicelocator/JndiCachingServiceLocator.java 2007-09-25 22:26:20 UTC (rev 65616)
+++ projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/JndiCachingServiceLocator.java 2007-09-26 09:12:18 UTC (rev 65618)
@@ -1,8 +1,32 @@
-package org.jboss.ejb3.servicelocator;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.locator.client;
+
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -10,9 +34,8 @@
/**
* JndiCachingServiceLocator
*
- * JNDI-based implementation of the Service Locator; will
- * attempt to obtain services from one of a set of configured
- * JNDI Directories (Hosts).
+ * JNDI-based implementation of the Service Locator; will attempt to obtain
+ * services from one of a set of configured JNDI Directories (Hosts).
*
* @version $Revision $
* @author <a href="mailto:alr at alrubinger.com">ALR</a>
@@ -32,6 +55,11 @@
*/
private List<JndiHost> jndiHosts = Collections.synchronizedList(new ArrayList<JndiHost>());
+ /**
+ * Mapping of Business Interface to the JNDI Host upon which it resides
+ */
+ private Map<Class<?>, JndiHost> serviceMappings = Collections.synchronizedMap(new HashMap<Class<?>, JndiHost>());
+
// Constructor
/**
@@ -46,19 +74,20 @@
// Contracts
/**
- * Obtains the object associated with the specified business interface
- * from one of the configured remote hosts.
+ * Obtains the object associated with the specified business interface from
+ * one of the configured remote hosts.
*
* @param <T>
- * @param clazz The business interface of the desired service
+ * @param clazz
+ * The business interface of the desired service
* @return
- * @throws Ejb3NotFoundException
- * If no services implementing the specified business interface
- * could be found on any of the configured local/remote hosts
+ * @throws Ejb3NotFoundException
+ * If no services implementing the specified business interface
+ * could be found on any of the configured local/remote hosts
* @throws IllegalArgumentException
- * If the specified class is a business interface implemented by more than
- * one service across the configured local/remote hosts, or if the
- * specified class is no an interface
+ * If the specified class is a business interface implemented by
+ * more than one service across the configured local/remote
+ * hosts, or if the specified class is no an interface
*/
public <T> T getObjectFromRemoteHost(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
{
Modified: projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/JndiHost.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/servicelocator/JndiHost.java 2007-09-25 22:26:20 UTC (rev 65616)
+++ projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/JndiHost.java 2007-09-26 09:12:18 UTC (rev 65618)
@@ -1,13 +1,33 @@
-package org.jboss.ejb3.servicelocator;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.locator.client;
-
import java.io.Serializable;
/**
* Represents a JNDI Host location on which remote and local services may be
* deployed.
*
- * @author ALR
+ * @author <a href="mailto:alr at alrubinger.com">ALR</a>
*/
public class JndiHost implements Serializable
{
@@ -33,7 +53,7 @@
this.setPort(port);
}
- // Accessors/Mutators
+ // Acccessors/Mutators
public String getAddress()
{
return address;
@@ -64,4 +84,42 @@
this.port = port;
}
+ // Overridden Implementations
+
+ /**
+ * Equals implementation to return true if and only if the
+ * address (non-case-specific) and ports are both equal
+ *
+ * @param obj
+ * @return Whether the specified object is equal to this one by value
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ // Ensure types are same
+ if (!(obj instanceof JndiHost))
+ {
+ return false;
+ }
+
+ // Compare addresses and ports
+ JndiHost comp = (JndiHost) obj;
+ if (!comp.getAddress().toLowerCase().equals(this.getAddress().toLowerCase()) || comp.getPort() != this.getPort())
+ {
+ return false;
+ }
+
+ // Equal
+ return true;
+ }
+
+ /**
+ * Overridden hashCode to fit contract that two "equal"
+ * objects must always have the same hash code
+ */
+ @Override
+ public int hashCode()
+ {
+ return this.getAddress().hashCode() + new Integer(this.getPort()).hashCode();
+ }
}
Modified: projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/JndiHostMetadataParser.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/servicelocator/JndiHostMetadataParser.java 2007-09-25 22:26:20 UTC (rev 65616)
+++ projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/JndiHostMetadataParser.java 2007-09-26 09:12:18 UTC (rev 65618)
@@ -1,4 +1,25 @@
-package org.jboss.ejb3.servicelocator;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.locator.client;
import java.io.IOException;
import java.io.InputStream;
Modified: projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/ServiceLocator.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/servicelocator/ServiceLocator.java 2007-09-25 22:26:20 UTC (rev 65616)
+++ projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/ServiceLocator.java 2007-09-26 09:12:18 UTC (rev 65618)
@@ -1,4 +1,25 @@
-package org.jboss.ejb3.servicelocator;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.locator.client;
/**
* ServiceLocator
Modified: projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/ServiceLocatorException.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/servicelocator/ServiceLocatorException.java 2007-09-25 22:26:20 UTC (rev 65616)
+++ projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/ServiceLocatorException.java 2007-09-26 09:12:18 UTC (rev 65618)
@@ -1,20 +1,45 @@
-package org.jboss.ejb3.servicelocator;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.locator.client;
-public class ServiceLocatorException extends RuntimeException {
+public class ServiceLocatorException extends RuntimeException
+{
- // Class Members
- private static final long serialVersionUID = -8470028232704428218L;
+ // Class Members
+ private static final long serialVersionUID = -8470028232704428218L;
- // Constructors
- public ServiceLocatorException(String arg0) {
- super(arg0);
- }
+ // Constructors
+ public ServiceLocatorException(String arg0)
+ {
+ super(arg0);
+ }
- public ServiceLocatorException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
+ public ServiceLocatorException(String arg0, Throwable arg1)
+ {
+ super(arg0, arg1);
+ }
- public ServiceLocatorException(Throwable arg0) {
- super(arg0);
- }
+ public ServiceLocatorException(Throwable arg0)
+ {
+ super(arg0);
+ }
}
Modified: projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/ServiceLocatorFactory.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/servicelocator/ServiceLocatorFactory.java 2007-09-25 22:26:20 UTC (rev 65616)
+++ projects/ejb3/trunk/locator/src/main/org/jboss/ejb3/locator/client/ServiceLocatorFactory.java 2007-09-26 09:12:18 UTC (rev 65618)
@@ -1,4 +1,25 @@
-package org.jboss.ejb3.servicelocator;
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.locator.client;
import java.io.File;
import java.io.FileInputStream;
@@ -11,13 +32,13 @@
private static ServiceLocator serviceLocator = null;
/*
- * Initialize Service Locator depending upon
- * external configuration of JNDI Hosts
+ * Initialize Service Locator depending upon external configuration of JNDI
+ * Hosts
*/
static
{
// Obatin Metadata and parse
- //TODO Needs to follow rules, order of finding config file
+ // TODO Needs to follow rules, order of finding config file
File jndiHostConfigFile = new File("IMPLEMENT.xml");
try
{
@@ -26,7 +47,7 @@
}
catch (FileNotFoundException e)
{
- //TODO Add more elegant error message
+ // TODO Add more elegant error message
throw new ServiceLocatorException(e);
}
@@ -34,6 +55,7 @@
/**
* Obtains the Service Locator configured for this application
+ *
* @return
*/
public ServiceLocator getServiceLocator()
More information about the jboss-cvs-commits
mailing list