[Jboss-cvs] JBossAS SVN: r56474 - in trunk/ejb3: . src/main/org/jboss/ejb3 src/main/org/jboss/ejb3/embedded src/main/org/jboss/ejb3/naming src/main/org/jboss/ejb3/naming/client src/main/org/jboss/ejb3/naming/client/java src/resources/test/iiop

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 31 05:26:26 EDT 2006


Author: wolfc
Date: 2006-08-31 05:26:10 -0400 (Thu, 31 Aug 2006)
New Revision: 56474

Added:
   trunk/ejb3/src/main/org/jboss/ejb3/naming/
   trunk/ejb3/src/main/org/jboss/ejb3/naming/BrainlessContext.java
   trunk/ejb3/src/main/org/jboss/ejb3/naming/client/
   trunk/ejb3/src/main/org/jboss/ejb3/naming/client/java/
   trunk/ejb3/src/main/org/jboss/ejb3/naming/client/java/javaURLContextFactory.java
Removed:
   trunk/ejb3/src/main/org/jboss/ejb3/embedded/BrainlessContext.java
Modified:
   trunk/ejb3/build.xml
   trunk/ejb3/src/main/org/jboss/ejb3/embedded/JaasSecurityManagerService.java
   trunk/ejb3/src/resources/test/iiop/jndi.properties
Log:
EJBTHREE-667: added ejb3 javaURLContextFactory

Modified: trunk/ejb3/build.xml
===================================================================
--- trunk/ejb3/build.xml	2006-08-31 08:52:05 UTC (rev 56473)
+++ trunk/ejb3/build.xml	2006-08-31 09:26:10 UTC (rev 56474)
@@ -396,6 +396,10 @@
 
             <!-- EJBTHREE-485: include java assist proxy stuff -->
             <include name="org/jboss/ejb3/stateless/Javassist*.class"/>
+            
+            <!-- EJBTHREE-667: include object factory -->
+            <include name="org/jboss/ejb3/naming/client/**/*.class"/>
+            <include name="org/jboss/ejb3/naming/BrainlessContext.class"/>
          </fileset>
       </jar>
 

Deleted: trunk/ejb3/src/main/org/jboss/ejb3/embedded/BrainlessContext.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/embedded/BrainlessContext.java	2006-08-31 08:52:05 UTC (rev 56473)
+++ trunk/ejb3/src/main/org/jboss/ejb3/embedded/BrainlessContext.java	2006-08-31 09:26:10 UTC (rev 56474)
@@ -1,183 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, 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.embedded;
-
-import javax.naming.*;
-import java.util.Hashtable;
-
-/**
- * A naming context which can't do anything.
- *
- * @author carlo
- */
-public class BrainlessContext implements Context
-{
-   public BrainlessContext()
-   {
-      super();
-   }
-
-   public Object lookup(Name name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public Object lookup(String name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void bind(Name name, Object obj) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void bind(String name, Object obj) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void rebind(Name name, Object obj) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void rebind(String name, Object obj) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void unbind(Name name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void unbind(String name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void rename(Name oldName, Name newName) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void rename(String oldName, String newName) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public NamingEnumeration<NameClassPair> list(Name name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public NamingEnumeration<NameClassPair> list(String name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public NamingEnumeration<Binding> listBindings(Name name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public NamingEnumeration<Binding> listBindings(String name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void destroySubcontext(Name name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void destroySubcontext(String name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public Context createSubcontext(Name name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public Context createSubcontext(String name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public Object lookupLink(Name name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public Object lookupLink(String name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public NameParser getNameParser(Name name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public NameParser getNameParser(String name) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public Name composeName(Name name, Name prefix) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public String composeName(String name, String prefix) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public Object addToEnvironment(String propName, Object propVal) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public Object removeFromEnvironment(String propName) throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public Hashtable<?, ?> getEnvironment() throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public void close() throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-
-   public String getNameInNamespace() throws NamingException
-   {
-      throw new OperationNotSupportedException();
-   }
-}

Modified: trunk/ejb3/src/main/org/jboss/ejb3/embedded/JaasSecurityManagerService.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/embedded/JaasSecurityManagerService.java	2006-08-31 08:52:05 UTC (rev 56473)
+++ trunk/ejb3/src/main/org/jboss/ejb3/embedded/JaasSecurityManagerService.java	2006-08-31 09:26:10 UTC (rev 56474)
@@ -22,6 +22,7 @@
 package org.jboss.ejb3.embedded;
 
 
+import org.jboss.ejb3.naming.BrainlessContext;
 import org.jboss.logging.Logger;
 import org.jboss.security.auth.callback.SecurityAssociationHandler;
 import org.jboss.security.auth.login.XMLLoginConfigImpl;

Copied: trunk/ejb3/src/main/org/jboss/ejb3/naming/BrainlessContext.java (from rev 56468, trunk/ejb3/src/main/org/jboss/ejb3/embedded/BrainlessContext.java)
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/embedded/BrainlessContext.java	2006-08-31 05:44:51 UTC (rev 56468)
+++ trunk/ejb3/src/main/org/jboss/ejb3/naming/BrainlessContext.java	2006-08-31 09:26:10 UTC (rev 56474)
@@ -0,0 +1,183 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, 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.naming;
+
+import javax.naming.*;
+import java.util.Hashtable;
+
+/**
+ * A naming context which can't do anything.
+ *
+ * @author carlo
+ */
+public class BrainlessContext implements Context
+{
+   public BrainlessContext()
+   {
+      super();
+   }
+
+   public Object lookup(Name name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public Object lookup(String name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void bind(Name name, Object obj) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void bind(String name, Object obj) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void rebind(Name name, Object obj) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void rebind(String name, Object obj) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void unbind(Name name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void unbind(String name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void rename(Name oldName, Name newName) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void rename(String oldName, String newName) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public NamingEnumeration<NameClassPair> list(Name name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public NamingEnumeration<NameClassPair> list(String name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public NamingEnumeration<Binding> listBindings(Name name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public NamingEnumeration<Binding> listBindings(String name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void destroySubcontext(Name name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void destroySubcontext(String name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public Context createSubcontext(Name name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public Context createSubcontext(String name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public Object lookupLink(Name name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public Object lookupLink(String name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public NameParser getNameParser(Name name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public NameParser getNameParser(String name) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public Name composeName(Name name, Name prefix) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public String composeName(String name, String prefix) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public Object addToEnvironment(String propName, Object propVal) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public Object removeFromEnvironment(String propName) throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public Hashtable<?, ?> getEnvironment() throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public void close() throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+
+   public String getNameInNamespace() throws NamingException
+   {
+      throw new OperationNotSupportedException();
+   }
+}

Added: trunk/ejb3/src/main/org/jboss/ejb3/naming/client/java/javaURLContextFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/naming/client/java/javaURLContextFactory.java	2006-08-31 08:52:05 UTC (rev 56473)
+++ trunk/ejb3/src/main/org/jboss/ejb3/naming/client/java/javaURLContextFactory.java	2006-08-31 09:26:10 UTC (rev 56474)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.naming.client.java;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.Name;
+import javax.naming.NameNotFoundException;
+import javax.naming.NameParser;
+import javax.naming.NamingException;
+import javax.naming.spi.ObjectFactory;
+
+import org.jboss.corba.ORBFactory;
+import org.jboss.ejb3.naming.BrainlessContext;
+import org.jboss.naming.client.java.HandleDelegateFactory;
+
+/**
+ * Creates objects for in the java:comp namespace.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class javaURLContextFactory implements ObjectFactory
+{
+
+   /* (non-Javadoc)
+    * @see javax.naming.spi.ObjectFactory#getObjectInstance(java.lang.Object, javax.naming.Name, javax.naming.Context, java.util.Hashtable)
+    */
+   public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment)
+         throws Exception
+   {
+      if(nameCtx == null)
+         nameCtx = new InitialContext(environment); 
+      final Context lookupCtx = nameCtx;
+      return new BrainlessContext() 
+      {
+         @Override
+         public Object lookup(Name name) throws NamingException
+         {
+            if (name.size() > 0 && "java:comp".equals(name.get(0)))
+            {
+               if (name.size() == 2 && "ORB".equals(name.get(1)))
+                  return ORBFactory.getORB();
+               else if (name.size() == 2 && "HandleDelegate".equals(name.get(1)))
+                  return HandleDelegateFactory.getHandleDelegateSingleton();
+            }
+            throw new NameNotFoundException(name.toString());
+         }
+         
+         @Override
+         public Object lookup(String name) throws NamingException
+         {
+            NameParser parser = lookupCtx.getNameParser("");
+            return lookup(parser.parse(name));
+         }
+      };
+   }
+
+}

Modified: trunk/ejb3/src/resources/test/iiop/jndi.properties
===================================================================
--- trunk/ejb3/src/resources/test/iiop/jndi.properties	2006-08-31 08:52:05 UTC (rev 56473)
+++ trunk/ejb3/src/resources/test/iiop/jndi.properties	2006-08-31 09:26:10 UTC (rev 56474)
@@ -3,6 +3,6 @@
 #java.naming.provider.url=corbaloc::localhost:3528/JBoss/Naming/root
 java.naming.factory.object=org.jboss.tm.iiop.client.IIOPClientUserTransactionObjectFactory
 # use java: client namespace
-java.naming.factory.url.pkgs=org.jboss.naming.client:org.jnp.interfaces
+java.naming.factory.url.pkgs=org.jboss.ejb3.naming.client:org.jnp.interfaces
 # hack to get java: client namespace up
 j2ee.clientName=iiop-unit-test




More information about the jboss-cvs-commits mailing list