[jboss-cvs] JBossAS SVN: r100443 - in trunk/server/src: etc/conf/standard and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 4 18:11:36 EST 2010


Author: bstansberry at jboss.com
Date: 2010-02-04 18:11:36 -0500 (Thu, 04 Feb 2010)
New Revision: 100443

Added:
   trunk/server/src/main/java/org/jboss/web/RMICodebaseConfigurer.java
   trunk/server/src/main/java/org/jboss/web/RMICodebaseConfigurerMBean.java
Modified:
   trunk/server/src/etc/conf/all/jboss-service.xml
   trunk/server/src/etc/conf/standard/jboss-service.xml
Log:
[JBAS-7274] Set java.rmi.server.codebase in conf/jboss-service.xml phase

Modified: trunk/server/src/etc/conf/all/jboss-service.xml
===================================================================
--- trunk/server/src/etc/conf/all/jboss-service.xml	2010-02-04 22:50:59 UTC (rev 100442)
+++ trunk/server/src/etc/conf/all/jboss-service.xml	2010-02-04 23:11:36 UTC (rev 100443)
@@ -16,4 +16,18 @@
    <classpath codebase="${jboss.server.lib.url}" archives="*"/>
    <classpath codebase="${jboss.common.lib.url}" archives="*"/>
 
+   <!-- 
+        JBAS-JBAS-7274. Temporary workaround to set java.rmi.server.codebase
+        early in the startup process. Will be removed before AS 6.0.0.CR1
+   -->
+   <mbean code="org.jboss.web.RMICodebaseConfigurer"
+      name="jboss:service=RMICodebaseConfigurer">
+      
+      <attribute name="CodebaseHost">${java.rmi.server.hostname}</attribute>      
+      <attribute name="CodebasePort">
+         <!-- Get the port to use from ServiceBindingManager. -->
+         <value-factory bean="ServiceBindingManager" method="getIntBinding" parameter="jboss:service=WebService"/>
+      </attribute>
+   </mbean>
+
 </server>

Modified: trunk/server/src/etc/conf/standard/jboss-service.xml
===================================================================
--- trunk/server/src/etc/conf/standard/jboss-service.xml	2010-02-04 22:50:59 UTC (rev 100442)
+++ trunk/server/src/etc/conf/standard/jboss-service.xml	2010-02-04 23:11:36 UTC (rev 100443)
@@ -14,6 +14,20 @@
    -->
    <classpath codebase="${jboss.server.lib.url}" archives="*"/>
    <classpath codebase="${jboss.common.lib.url}" archives="*"/>
+
+   <!-- 
+        JBAS-JBAS-7274. Temporary workaround to set java.rmi.server.codebase
+        early in the startup process. Will be removed before AS 6.0.0.CR1
+   -->
+   <mbean code="org.jboss.web.RMICodebaseConfigurer"
+      name="jboss:service=RMICodebaseConfigurer">
+      
+      <attribute name="CodebaseHost">${java.rmi.server.hostname}</attribute>      
+      <attribute name="CodebasePort">
+         <!-- Get the port to use from ServiceBindingManager. -->
+         <value-factory bean="ServiceBindingManager" method="getIntBinding" parameter="jboss:service=WebService"/>
+      </attribute>
+   </mbean>
    
 
 </server>

Added: trunk/server/src/main/java/org/jboss/web/RMICodebaseConfigurer.java
===================================================================
--- trunk/server/src/main/java/org/jboss/web/RMICodebaseConfigurer.java	                        (rev 0)
+++ trunk/server/src/main/java/org/jboss/web/RMICodebaseConfigurer.java	2010-02-04 23:11:36 UTC (rev 100443)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc. 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.web;
+
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * Sets system property java.rmi.server.codebase to a URL derived from injected
+ * values. Hack temporary fix for https://jira.jboss.org/jira/browse/JBAS-7274 
+ * intended to be deployed early in the AS boot, but after ServiceBindingManager
+ * (i.e. in conf/jboss-service.xml).
+ *
+ * @author Brian Stansberry
+ * 
+ * @version $Revision$
+ * 
+ * @deprecated will be removed before JBoss AS 6.0.0.CR1
+ */
+public class RMICodebaseConfigurer extends ServiceMBeanSupport implements RMICodebaseConfigurerMBean
+{
+   private String host;
+   private int port = -1;
+   
+   public String getCodebaseHost()
+   {
+      return host;
+   }
+
+   public int getCodebasePort()
+   {
+      return port;
+   }
+
+   public void setCodebaseHost(String host)
+   {
+      this.host = host;
+   }
+
+   public void setCodebasePort(int port)
+   {
+      this.port = port;
+   }
+
+   /**
+    * Sets property java.rmi.server.codebase if not already set
+    */
+   @Override
+   protected void startService() throws Exception
+   {
+      // Set the rmi codebase if it is not already set
+      String codebase = System.getProperty("java.rmi.server.codebase");
+      if (codebase == null)
+      {
+         if (host != null)
+         {
+            codebase = "http://" + getHostPortion() + getPortPortion() + "/";
+            System.setProperty("java.rmi.server.codebase", codebase);
+         }
+         else
+         {
+            getLog().warn("Property codebaseHost has not been set; cannot set java.rmi.server.codebase");
+         }
+      }
+   }
+
+   private String getHostPortion()
+   {
+      if (host.indexOf(':') > -1 && host.indexOf('[') != 0)
+      {
+         return "[" + host + "]";
+      }
+      return host;
+   }
+   
+   private String getPortPortion()
+   {
+      if (port > 0)
+      {
+         return ":" + port;
+      }
+      return "";
+   }
+
+   
+}


Property changes on: trunk/server/src/main/java/org/jboss/web/RMICodebaseConfigurer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision

Added: trunk/server/src/main/java/org/jboss/web/RMICodebaseConfigurerMBean.java
===================================================================
--- trunk/server/src/main/java/org/jboss/web/RMICodebaseConfigurerMBean.java	                        (rev 0)
+++ trunk/server/src/main/java/org/jboss/web/RMICodebaseConfigurerMBean.java	2010-02-04 23:11:36 UTC (rev 100443)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc. 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.web;
+
+import org.jboss.system.ServiceMBean;
+
+
+/**
+ * Standard MBean interface for RMICodebaseConfigurer
+ *
+ * @author Brian Stansberry
+ * 
+ * @version $Revision$
+ * 
+ * @deprecated will be removed before JBoss AS 6.0.0.CR1
+ */
+public interface RMICodebaseConfigurerMBean extends ServiceMBean
+{
+   /** 
+    * Gets the host portion of the codebase URL
+    *
+    * @return the address, or <code>null</code> if not set
+    */
+   String getCodebaseHost();
+   
+   /** 
+    * Sets the host portion of the codebase URL
+    *
+    * @param host the host
+    */
+   void setCodebaseHost(String host);
+   
+   /**
+    * Gets the port portion of the codebase URL
+    *
+    * @return the port, or -1 if not configured
+    */
+   int getCodebasePort();
+   
+   /**
+    * Sets the port portion of the codebase URL
+    *
+    * @param port the port
+    */
+   void setCodebasePort(int port);
+}


Property changes on: trunk/server/src/main/java/org/jboss/web/RMICodebaseConfigurerMBean.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision




More information about the jboss-cvs-commits mailing list