[jboss-cvs] JBossAS SVN: r96380 - in projects/naming/branches/Branch_5_0: jnpserver and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 14 05:44:20 EST 2009


Author: scott.stark at jboss.org
Date: 2009-11-14 05:44:20 -0500 (Sat, 14 Nov 2009)
New Revision: 96380

Modified:
   projects/naming/branches/Branch_5_0/jnpserver/.classpath
   projects/naming/branches/Branch_5_0/jnpserver/pom.xml
   projects/naming/branches/Branch_5_0/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java
   projects/naming/branches/Branch_5_0/jnpserver/src/main/java/org/jnp/server/NamingServerWrapper.java
   projects/naming/branches/Branch_5_0/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java
   projects/naming/branches/Branch_5_0/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testMainBeanSFs.xml
   projects/naming/branches/Branch_5_0/pom.xml
Log:
JBNAME-39, JBPAPP-2941, simplify the handling of IPv6 addresses


Modified: projects/naming/branches/Branch_5_0/jnpserver/.classpath
===================================================================
--- projects/naming/branches/Branch_5_0/jnpserver/.classpath	2009-11-13 22:30:39 UTC (rev 96379)
+++ projects/naming/branches/Branch_5_0/jnpserver/.classpath	2009-11-14 10:44:20 UTC (rev 96380)
@@ -1,32 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-  <classpathentry kind="src" path="src/main/java"/>
-  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
-  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
-  <classpathentry kind="output" path="target/classes"/>
-  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-  <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1.1/activation-1.1.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
-  <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar" sourcepath="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.10.GA/jboss-common-core-2.2.10.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.10.GA/jboss-common-core-2.2.10.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.CR5/jboss-dependency-2.0.0.CR5.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.CR5/jboss-dependency-2.0.0.CR5-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.CR5/jboss-kernel-2.0.0.CR5.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.CR5/jboss-kernel-2.0.0.CR5-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.1.GA/jboss-mdr-2.0.1.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.1.GA/jboss-mdr-2.0.1.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.GA/jboss-reflect-2.0.0.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.GA/jboss-reflect-2.0.0.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.GA/jbossxb-2.0.0.GA.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.GA/jbossxb-2.0.0.GA-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar" sourcepath="M2_REPO/junit/junit/3.8.2/junit-3.8.2-sources.jar">
-    <attributes>
-      <attribute value="jar:file:/Users/svn/repository.jboss.org/maven2/junit/junit/3.8.2/junit-3.8.2-javadoc.jar!/" name="javadoc_location"/>
-    </attributes>
-  </classpathentry>
-  <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
-  <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
-</classpath>
\ No newline at end of file
+	<classpathentry kind="src" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1.1/activation-1.1.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant/1.7.0/ant-1.7.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-junit/1.7.0/ant-junit-1.7.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/apache/ant/ant-launcher/1.7.0/ant-launcher-1.7.0.jar"/>
+	<classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4.jar" sourcepath="M2_REPO/sun-jaxb/jaxb-api/2.1.4/jaxb-api-2.1.4-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.10.GA/jboss-common-core-2.2.10.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.10.GA/jboss-common-core-2.2.10.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.CR5/jboss-dependency-2.0.0.CR5.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-dependency/2.0.0.CR5/jboss-dependency-2.0.0.CR5-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.CR5/jboss-kernel-2.0.0.CR5.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-kernel/2.0.0.CR5/jboss-kernel-2.0.0.CR5-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-log4j/2.0.5.GA/jboss-logging-log4j-2.0.5.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA.jar" sourcepath="M2_REPO/org/jboss/logging/jboss-logging-spi/2.0.5.GA/jboss-logging-spi-2.0.5.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-mdr/2.0.1.GA/jboss-mdr-2.0.1.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-mdr/2.0.1.GA/jboss-mdr-2.0.1.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/jboss/profiler/jvmti/jboss-profiler-jvmti/1.0.0.CR5/jboss-profiler-jvmti-1.0.0.CR5.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jboss-reflect/2.0.0.GA/jboss-reflect-2.0.0.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-reflect/2.0.0.GA/jboss-reflect-2.0.0.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/jbossas/jboss-server-manager/0.1.1.GA/jboss-server-manager-0.1.1.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA.jar" sourcepath="M2_REPO/org/jboss/test/jboss-test/1.1.1.GA/jboss-test-1.1.1.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.GA/jbossxb-2.0.0.GA.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.GA/jbossxb-2.0.0.GA-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/junit/junit/4.5/junit-4.5.jar" sourcepath="/M2_REPO/junit/junit/4.5/junit-4.5-sources.jar">
+		<attributes>
+			<attribute name="javadoc_location" value="jar:file:/Users/svn/repository.jboss.org/maven2/junit/junit/3.8.2/junit-3.8.2-javadoc.jar!/"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+	<classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
+	<classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.9.1/xml-apis-2.9.1.jar"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Modified: projects/naming/branches/Branch_5_0/jnpserver/pom.xml
===================================================================
--- projects/naming/branches/Branch_5_0/jnpserver/pom.xml	2009-11-13 22:30:39 UTC (rev 96379)
+++ projects/naming/branches/Branch_5_0/jnpserver/pom.xml	2009-11-14 10:44:20 UTC (rev 96380)
@@ -25,7 +25,7 @@
     <!-- testing dependencies -->
     <version.org.jboss.microcontainer>2.0.0.CR5</version.org.jboss.microcontainer>
     <version.org.jboss.test>1.1.1.GA</version.org.jboss.test>
-    <version.junit>3.8.2</version.junit>
+    <version.junit>4.4</version.junit>
   </properties>
 
   <build>
@@ -96,4 +96,4 @@
     </dependency>
   </dependencies>
   
-</project>
\ No newline at end of file
+</project>

Modified: projects/naming/branches/Branch_5_0/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java
===================================================================
--- projects/naming/branches/Branch_5_0/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java	2009-11-13 22:30:39 UTC (rev 96379)
+++ projects/naming/branches/Branch_5_0/jnpserver/src/main/java/org/jnp/interfaces/NamingContext.java	2009-11-14 10:44:20 UTC (rev 96380)
@@ -1270,7 +1270,9 @@
    {
       if((naming instanceof NamingEvents) == false)
       {
-         throw new UnsupportedOperationException("Naming implementation does not support NamingExt");
+         Class<?> cls = naming.getClass();
+         String cs = cls.getName() + ", CS:"+ cls.getProtectionDomain().getCodeSource().toString();
+         throw new UnsupportedOperationException("Naming implementation does not support NamingExt, : "+cs);
       }
       NamingEvents next = (NamingEvents) naming;
       try
@@ -1813,34 +1815,93 @@
    static private int parseHostPort(String url, Object[] output, int defaultPort)
    {
       // First look for a @ separating the host and port
+
       int colon = url.indexOf('@');
+      String host = null;
+      int port = defaultPort;
+
       if(colon < 0)
       {
-         // If there are multiple ':' assume its an IPv6 address
+         // <IPv4>, <IPv4>:port, [<IPv6>] or [<IPv6>]:port
+         colon = url.indexOf(':');
+         int rightbracket = url.indexOf(']') ;
+         int lastcolon = url.lastIndexOf(':') ;
+
+         if (rightbracket < 0)
+         {
+            // If there are multiple ':' assume its an IPv6 address
+            int firstColon = url.indexOf(':');
+            if(lastcolon > firstColon)
+               colon = lastcolon;
+
+            // assume IPv4 host port combination
+            if (colon < 0)
+            {
+               host = url.trim();
+            }
+            else
+            {
+               host = url.substring(0, colon).trim();
+               try
+               {
+                  port = Integer.parseInt(url.substring(colon + 1).trim());
+               }
+               catch (Exception ex)
+               {
+                  // Use default;
+               }
+            }
+         }
+         else
+         {
+            // assume IPv6 host port combination
+            if (lastcolon < rightbracket)
+            {
+               host = url.substring(1,rightbracket).trim() ;
+            }
+            else
+            {
+               host = url.substring(1,rightbracket).trim() ;
+               try
+               {
+                  port = Integer.parseInt(url.substring(lastcolon + 1).trim());
+               }
+               catch (Exception ex)
+               {
+                  // Use default;
+               }
+            }
+         }
+      }
+      else
+      {
+         // <IPv6>@port, If there are multiple ':' assume its an IPv6 address
          colon = url.lastIndexOf(':');
          int firstColon = url.indexOf(':');
          if(colon > firstColon)
             colon = -1;
-      }
-
-      if(colon < 0)
-      {
-         output[HOST_INDEX] = url;
-         output[PORT_INDEX] = new Integer(defaultPort);
-      }
-      else
-      {
-         output[HOST_INDEX] = url.substring(0, colon);  
-         try
+         if(colon < 0)
          {
-            output[PORT_INDEX] = Integer.parseInt(url.substring(colon+1).trim());
+            host = url;
+            port = defaultPort;
          }
-         catch (Exception ex)
+         else
          {
-            // Use default port
-            output[PORT_INDEX] = new Integer(defaultPort);
-         }
+            host = url.substring(0, colon);  
+            try
+            {
+               port = Integer.parseInt(url.substring(colon+1).trim());
+            }
+            catch (Exception ex)
+            {
+               // Use default port
+               port = defaultPort;
+            }
+         }      
       }
+
+      output[HOST_INDEX] = host;
+      output[PORT_INDEX] = new Integer(port);
       return colon;
    }
 

Modified: projects/naming/branches/Branch_5_0/jnpserver/src/main/java/org/jnp/server/NamingServerWrapper.java
===================================================================
--- projects/naming/branches/Branch_5_0/jnpserver/src/main/java/org/jnp/server/NamingServerWrapper.java	2009-11-13 22:30:39 UTC (rev 96379)
+++ projects/naming/branches/Branch_5_0/jnpserver/src/main/java/org/jnp/server/NamingServerWrapper.java	2009-11-14 10:44:20 UTC (rev 96380)
@@ -27,8 +27,11 @@
 import javax.naming.Context;
 import javax.naming.Name;
 import javax.naming.NamingException;
+import javax.naming.event.EventContext;
+import javax.naming.event.NamingListener;
 
 import org.jnp.interfaces.Naming;
+import org.jnp.interfaces.NamingEvents;
 
 /**
  * A delegating wrapper that can be used to create a unique rmi server endpoint
@@ -38,12 +41,16 @@
  * @version $Revision:$
  */
 public class NamingServerWrapper
-   implements Naming
+   implements Naming, NamingEvents
 {
    Naming delegate;
+   NamingEvents edelegate;
+
    NamingServerWrapper(Naming delegate)
    {
       this.delegate = delegate;
+      if(delegate instanceof NamingEvents)
+         edelegate = (NamingEvents) delegate;
    }
 
    public void bind(Name name, Object obj, String className)
@@ -81,4 +88,19 @@
    {
       delegate.unbind(name);
    }
+
+   public void addNamingListener(EventContext context, Name target, int scope,
+         NamingListener l) throws NamingException, RemoteException
+   {
+      edelegate.addNamingListener(context, target, scope, l);
+   }
+   public void removeNamingListener(NamingListener l) throws NamingException,
+         RemoteException
+   {
+      edelegate.removeNamingListener(l);
+   }
+   public boolean targetMustExist() throws NamingException, RemoteException
+   {
+      return edelegate.targetMustExist();
+   }
 }

Modified: projects/naming/branches/Branch_5_0/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java
===================================================================
--- projects/naming/branches/Branch_5_0/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java	2009-11-13 22:30:39 UTC (rev 96379)
+++ projects/naming/branches/Branch_5_0/jnpserver/src/test/java/org/jnp/test/NamingMCUnitTest.java	2009-11-14 10:44:20 UTC (rev 96380)
@@ -152,7 +152,8 @@
       assertNull("main.getLookupListenerException", main.getLookupListenerException());
       Properties env = new Properties();
       env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
-      env.setProperty("java.naming.provider.url", "localhost:1099");
+      String providerURL = System.getProperty("java.naming.provider.url", "localhost:1099");
+      env.setProperty("java.naming.provider.url", providerURL);
       env.setProperty("java.naming.factory.url", "org.jboss.naming:org.jnp.interfaces");
       env.setProperty(TimedSocketFactory.JNP_TIMEOUT, "10000");
       env.setProperty(TimedSocketFactory.JNP_SO_TIMEOUT, "10000");
@@ -172,7 +173,8 @@
       getLog().debug("InetAddress.getLocalHost(): "+localAddr);
       Properties env = new Properties();
       env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
-      env.setProperty("java.naming.provider.url", "localhost:2099");
+      String providerURL = System.getProperty("java.naming.provider.url", "localhost:2099");
+      env.setProperty("java.naming.provider.url", providerURL);
       env.setProperty("java.naming.factory.url", "org.jboss.naming:org.jnp.interfaces");
       env.setProperty(TimedSocketFactory.JNP_TIMEOUT, "1000");
       env.setProperty(TimedSocketFactory.JNP_SO_TIMEOUT, "1000");

Modified: projects/naming/branches/Branch_5_0/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testMainBeanSFs.xml
===================================================================
--- projects/naming/branches/Branch_5_0/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testMainBeanSFs.xml	2009-11-13 22:30:39 UTC (rev 96379)
+++ projects/naming/branches/Branch_5_0/jnpserver/src/test/resources/org/jnp/test/NamingMCUnitTest#testMainBeanSFs.xml	2009-11-14 10:44:20 UTC (rev 96380)
@@ -69,7 +69,7 @@
     <bean name="testLocaNamingBeanImpl" class="org.jnp.server.NamingBeanImpl">
         <!-- Install this bean as the global JVM NamingServer -->
         <property name="installGlobalService">true</property>
-        
+        <property name="installJavaComp">false</property>
         <property name="useGlobalService">false</property>
     </bean>
     <bean name="jboss:service=Naming" class="org.jnp.server.Main">

Modified: projects/naming/branches/Branch_5_0/pom.xml
===================================================================
--- projects/naming/branches/Branch_5_0/pom.xml	2009-11-13 22:30:39 UTC (rev 96379)
+++ projects/naming/branches/Branch_5_0/pom.xml	2009-11-14 10:44:20 UTC (rev 96380)
@@ -42,6 +42,24 @@
           <autoVersionSubmodules>true</autoVersionSubmodules>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.4.3</version>
+        <configuration>
+          <excludes>
+            <!-- This is not a unit test -->
+            <exclude>**/TestSecurityManager.java</exclude>
+          </excludes>
+          <redirectTestOutputToFile>true</redirectTestOutputToFile>
+          <systemProperties>
+            <property>
+              <name>xb.builder.useUnorderedSequence</name>
+              <value>true</value>
+            </property>
+          </systemProperties>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   




More information about the jboss-cvs-commits mailing list