[jboss-cvs] JBossAS SVN: r88761 - in trunk: component-matrix and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 12 13:22:34 EDT 2009


Author: bstansberry at jboss.com
Date: 2009-05-12 13:22:34 -0400 (Tue, 12 May 2009)
New Revision: 88761

Added:
   trunk/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml
   trunk/server/src/main/org/jboss/naming/NamingProviderURLWriter.java
Modified:
   trunk/build/build.xml
   trunk/component-matrix/pom.xml
   trunk/server/src/etc/conf/all/jboss-service.xml
   trunk/server/src/etc/conf/all/xmdesc/NamingService-xmbean.xml
   trunk/server/src/etc/conf/minimal/jboss-service.xml
   trunk/server/src/main/org/jboss/naming/NamingService.java
Log:
[JBAS-6875] Have the naming service write its connection URL to data dir
[JBAS-6903] Upgrade Naming to 5.0.3.GA

Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml	2009-05-12 17:13:33 UTC (rev 88760)
+++ trunk/build/build.xml	2009-05-12 17:22:34 UTC (rev 88761)
@@ -711,6 +711,7 @@
         <include name="bootstrap/profile.xml"/>
         <include name="xmdesc/NamingBean-xmbean.xml"/>
         <include name="xmdesc/NamingService-xmbean.xml"/>
+        <include name="xmdesc/NamingProviderURLWriter-xmbean.xml"/>
         <include name="xmdesc/Log4jService-xmbean.xml"/>          
       </fileset>
     </copy>

Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml	2009-05-12 17:13:33 UTC (rev 88760)
+++ trunk/component-matrix/pom.xml	2009-05-12 17:22:34 UTC (rev 88761)
@@ -83,7 +83,7 @@
     <version.org.jboss.metadata>1.0.0.CR16</version.org.jboss.metadata>
     <version.org.jboss.microcontainer>2.0.4.GA</version.org.jboss.microcontainer>
     <version.org.jboss.mx>6.0.0.Beta1</version.org.jboss.mx>
-    <version.org.jboss.naming>5.0.2.GA</version.org.jboss.naming>
+    <version.org.jboss.naming>5.0.3.GA</version.org.jboss.naming>
     <version.org.jboss.reflect>2.0.2.GA</version.org.jboss.reflect>
     <version.org.jboss.remoting>2.5.0.SP2</version.org.jboss.remoting>
     <version.org.jboss.security>2.1.0.20090318</version.org.jboss.security>

Modified: trunk/server/src/etc/conf/all/jboss-service.xml
===================================================================
--- trunk/server/src/etc/conf/all/jboss-service.xml	2009-05-12 17:13:33 UTC (rev 88760)
+++ trunk/server/src/etc/conf/all/jboss-service.xml	2009-05-12 17:22:34 UTC (rev 88761)
@@ -240,6 +240,17 @@
       <depends optional-attribute-name="Naming"
          proxy-type="attribute">jboss:service=NamingBeanImpl</depends>
    </mbean>
+
+   <!-- Writes the bootstrap URL for the NamingService in a known location,
+        so tools (e.g. Jopr) can use it as a java.naming.provider.url.
+   -->
+   <mbean code="org.jboss.naming.NamingProviderURLWriter"
+      name="jboss:service=NamingProviderURLWriter"
+      xmbean-dd="resource:xmdesc/NamingProviderURLWriter-xmbean.xml">
+      
+      <attribute name="Server"><inject bean="JBossServer"/></attribute>
+      <attribute name="BootstrapURL"><inject bean="jboss:service=Naming" property="bootstrapURL"/></attribute>
+   </mbean>
    
    <mbean code="org.jboss.naming.JNDIView"
    	name="jboss:service=JNDIView"

Copied: trunk/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml (from rev 88758, branches/Branch_5_x/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml)
===================================================================
--- trunk/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml	                        (rev 0)
+++ trunk/server/src/etc/conf/all/xmdesc/NamingProviderURLWriter-xmbean.xml	2009-05-12 17:22:34 UTC (rev 88761)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mbean PUBLIC
+   "-//JBoss//DTD JBOSS XMBEAN 1.1//EN"
+   "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_1.dtd">
+
+<!-- The NamingProviderURLWriter XMBean
+   $Id: NamingBean-xmbean.xml 85945 2009-03-16 19:45:12Z dimitris at jboss.org $
+-->
+<mbean>
+   <description>Writes the bootstrap URL of the NamingService to a known location</description>
+
+   <class>org.jboss.naming.NamingProviderURLWriter</class>
+   
+   <constructor>
+       <description>The default constructor</description>
+       <name>NamingProviderURLWriter</name>
+   </constructor>
+   
+   <attribute access="read-write" getMethod="getOutputDirURI" setMethod="setOutputDirURI">
+       <description>URL of the base dir into which the file with the provider URL should be written</description>
+       <name>OutputDirURI</name>
+       <type>java.net.URI</type>
+   </attribute>
+   
+   <attribute access="read-write" getMethod="getOutputFileName" setMethod="setOutputFileName">
+       <description>Name, relative to the OutputDirURL, of the file into which the provider URL should be written</description>
+       <name>OutputFileName</name>
+       <type>java.lang.String</type>
+   </attribute>
+   
+   <attribute access="write-only" setMethod="setServer">
+       <description>Server object from which the OutputDirURL can be obtained if not directly configured</description>
+       <name>Server</name>
+       <type>org.jboss.bootstrap.spi.Server</type>
+   </attribute>
+   
+   <attribute access="read-write" getMethod="getBootstrapURL" setMethod="setBootstrapURL">
+      <description>URL that can be accessed to bootstrap a connection to the NamingService</description>
+      <name>BootstrapURL</name>
+      <type>java.lang.String</type>
+   </attribute>  
+   
+   <!-- Operations -->
+   <operation>
+       <description>The start lifecycle op</description>
+       <name>start</name>
+       <return-type>void</return-type>
+   </operation>
+   <operation>
+       <description>The stop lifecycle op</description>
+       <name>stop</name>
+       <return-type>void</return-type>
+   </operation>
+   
+</mbean>

Modified: trunk/server/src/etc/conf/all/xmdesc/NamingService-xmbean.xml
===================================================================
--- trunk/server/src/etc/conf/all/xmdesc/NamingService-xmbean.xml	2009-05-12 17:13:33 UTC (rev 88760)
+++ trunk/server/src/etc/conf/all/xmdesc/NamingService-xmbean.xml	2009-05-12 17:22:34 UTC (rev 88761)
@@ -85,6 +85,11 @@
       <name>JNPServerSocketFactoryBean</name>
       <type>javax.net.ServerSocketFactory</type>
    </attribute>
+   <attribute access="read-only" getMethod="getBootstrapURL">
+      <description>URL that can be accessed to bootstrap a connection to the NamingService</description>
+      <name>BootstrapURL</name>
+      <type>java.lang.String</type>
+   </attribute>  
    
    <attribute access="read-write" getMethod="getRmiPort" setMethod="setRmiPort">
       <description>The port of the RMI naming service, 0 == anonymous. This

Modified: trunk/server/src/etc/conf/minimal/jboss-service.xml
===================================================================
--- trunk/server/src/etc/conf/minimal/jboss-service.xml	2009-05-12 17:13:33 UTC (rev 88760)
+++ trunk/server/src/etc/conf/minimal/jboss-service.xml	2009-05-12 17:22:34 UTC (rev 88761)
@@ -93,6 +93,17 @@
       -->
       <depends optional-attribute-name="Naming"
          proxy-type="attribute">jboss:service=NamingBeanImpl</depends>
-   </mbean>   
+   </mbean>  
 
+   <!-- Writes the bootstrap URL for the NamingService in a known location,
+        so tools (e.g. Jopr) can use it as a java.naming.provider.url.
+   -->
+   <mbean code="org.jboss.naming.NamingProviderURLWriter"
+      name="jboss:service=NamingProviderURLWriter"
+      xmbean-dd="resource:xmdesc/NamingProviderURLWriter-xmbean.xml">
+      
+      <attribute name="Server"><inject bean="JBossServer"/></attribute>
+      <attribute name="BootstrapURL"><inject bean="jboss:service=Naming" property="bootstrapURL"/></attribute>
+   </mbean> 
+
 </server>

Copied: trunk/server/src/main/org/jboss/naming/NamingProviderURLWriter.java (from rev 88758, branches/Branch_5_x/server/src/main/org/jboss/naming/NamingProviderURLWriter.java)
===================================================================
--- trunk/server/src/main/org/jboss/naming/NamingProviderURLWriter.java	                        (rev 0)
+++ trunk/server/src/main/org/jboss/naming/NamingProviderURLWriter.java	2009-05-12 17:22:34 UTC (rev 88761)
@@ -0,0 +1,153 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 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.jboss.naming;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.net.URI;
+
+import org.jboss.bootstrap.spi.Server;
+import org.jboss.logging.Logger;
+
+/**
+ *
+ *
+ * @author Brian Stansberry
+ * 
+ * @version $Revision: $
+ */
+public class NamingProviderURLWriter
+{
+   public static final String DEFAULT_PERSIST_FILE_NAME = "jnp-service.url";
+   
+   private static final Logger log = Logger.getLogger(NamingProviderURLWriter.class);
+   
+   private String bootstrapUrl;
+   private Server server;
+   private URI outputDir;
+   private String filename = DEFAULT_PERSIST_FILE_NAME;
+   private File outputFile;
+
+   public URI getOutputDirURI()
+   {
+      return outputDir;
+   }
+
+   public void setOutputDirURL(URI dir)
+   {
+      this.outputDir = dir;
+   }
+
+   public String getOutputFileName()
+   {
+      return filename == null ? DEFAULT_PERSIST_FILE_NAME : filename;
+   }
+
+   public void setOutputFileName(String name)
+   {
+      this.filename = name;
+   }
+
+   public void setServer(Server server)
+   {
+      this.server = server;
+   }
+
+   public String getBootstrapURL()
+   {
+      return bootstrapUrl;
+   }
+   
+   public void setBootstrapURL(String url)
+   {
+      this.bootstrapUrl = url;      
+   }
+
+   public void start() throws Exception
+   {
+      if (bootstrapUrl != null)
+      {
+         File base = null;
+         if (outputDir == null)
+         {
+            if (server != null)
+            {
+               base =  server.getConfig().getServerDataDir();
+               outputDir = base.toURI();
+            }
+         }
+         else
+         {
+            base = new File(outputDir);
+         }
+         
+         if (base != null)
+         {
+            base.mkdirs();
+            
+            outputFile = new File(base, getOutputFileName());
+            if (outputFile.exists())
+            {
+               outputFile.delete();
+            }
+            if (log.isTraceEnabled())
+            {
+               log.trace("Creating file " + outputFile);
+            }
+            outputFile.createNewFile();            
+            PrintWriter writer = new PrintWriter(outputFile);
+            try
+            {
+               writer.println(bootstrapUrl);
+               writer.flush();
+            }
+            finally
+            {
+               outputFile.deleteOnExit();
+               writer.close();
+            }
+            
+            outputFile.deleteOnExit();
+         }
+         else
+         {
+            log.warn("No directory specified for " + getOutputFileName() + 
+                  " cannot write the naming service url. Please configure either " +
+                  "the 'server' property or the 'outputDir' property.");
+         }
+      }
+      else
+      {
+         log.debug("No URLs to write");
+      }
+   }
+
+   public void stop() throws Exception
+   {
+      if (outputFile != null)
+      {
+         outputFile.delete();
+      }
+   }
+
+}

Modified: trunk/server/src/main/org/jboss/naming/NamingService.java
===================================================================
--- trunk/server/src/main/org/jboss/naming/NamingService.java	2009-05-12 17:13:33 UTC (rev 88760)
+++ trunk/server/src/main/org/jboss/naming/NamingService.java	2009-05-12 17:22:34 UTC (rev 88761)
@@ -273,7 +273,17 @@
    {
       this.proxyFactory = proxyFactory;
    }
+   
+   public String getBootstrapURL()
+   {
+      return namingMain.getBootstrapURL();
+   }
 
+   public Exception getLookupListenerException()
+   {
+      return namingMain.getLookupListenerException();
+   }
+
    protected void startService()
       throws Exception
    {




More information about the jboss-cvs-commits mailing list