[jboss-svn-commits] JBL Code SVN: r15205 - in labs/jbosslabs/trunk/portal-extensions: forge-common/src/java/org/jboss/forge/common/ejb3 and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Sep 18 10:39:58 EDT 2007


Author: wrzep
Date: 2007-09-18 10:39:58 -0400 (Tue, 18 Sep 2007)
New Revision: 15205

Added:
   labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/MetricsProjectsService.java
   labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/MetricsProjectsServiceImpl.java
Modified:
   labs/jbosslabs/trunk/portal-extensions/forge-common/project.xml
   labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml
   labs/jbosslabs/trunk/portal-extensions/forge-sar/src/forge-service.xml
Log:
JBLAB-891
bringing RMI back to work to access downloads at labs box


Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/project.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/project.xml	2007-09-18 13:50:45 UTC (rev 15204)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/project.xml	2007-09-18 14:39:58 UTC (rev 15205)
@@ -134,6 +134,11 @@
 		<jar>jboss-annotations-ejb3.jar</jar>
     </dependency>
     	<dependency>
+    			<groupId>jboss</groupId>
+    			<artifactId>jbossall-client</artifactId>
+    			<version>3.2.3</version>
+    		</dependency>
+    	<dependency>
             <groupId>myfaces</groupId>
             <artifactId>myfaces-all</artifactId>
             <version>1.1.1</version>

Added: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/MetricsProjectsService.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/MetricsProjectsService.java	                        (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/ejb3/MetricsProjectsService.java	2007-09-18 14:39:58 UTC (rev 15205)
@@ -0,0 +1,40 @@
+ /*
+  * 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.forge.common.ejb3;
+
+import org.jboss.invocation.Invocation;
+
+public interface MetricsProjectsService {
+
+	public static final String METRICS_PROJECTS_SERVICE = "labs:service=metricsProjects";
+	
+	public void ping();
+	
+	public Object invoke(Invocation mi) throws Exception;
+	
+    //	 Life cycle methods
+	
+    public void start () throws Exception;
+	
+	public void stop () throws Exception;
+}

Modified: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml	2007-09-18 13:50:45 UTC (rev 15204)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/project.xml	2007-09-18 14:39:58 UTC (rev 15205)
@@ -42,6 +42,11 @@
             <artifactId>jboss-annotations-ejb3</artifactId>
             <jar>jboss-annotations-ejb3.jar</jar>
         </dependency>
+    	<dependency>
+    			<groupId>jboss</groupId>
+    			<artifactId>jbossall-client</artifactId>
+    			<version>3.2.3</version>
+    		</dependency>
         <dependency>
             <groupId>jboss</groupId>
             <artifactId>portal-security-lib</artifactId>

Added: labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/MetricsProjectsServiceImpl.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/MetricsProjectsServiceImpl.java	                        (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-ejb3/src/java/org/jboss/forge/ejb3/projects/MetricsProjectsServiceImpl.java	2007-09-18 14:39:58 UTC (rev 15205)
@@ -0,0 +1,132 @@
+ /*
+  * 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.forge.ejb3.projects;
+
+import java.rmi.RMISecurityManager;
+import java.util.Map;
+
+import javax.ejb.Remote;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.jboss.annotation.ejb.Management;
+import org.jboss.annotation.ejb.Service;
+import org.jboss.forge.common.ejb3.MetricsProjectsService;
+import org.jboss.invocation.Invocation;
+import org.jboss.logging.Logger;
+import org.jboss.mx.util.MBeanServerLocator;
+
+
+/**
+ * @author <a href="mailto:ryszard.kozmik at jboss.com">Ryszard Kozmik</a>
+ * @author <a href="mailto:adamw at aster.pl">Adam Warski</a>
+ * @author Pawel Wrzeszcz (pawe . wrzeszcz [at] gmail . com)
+ */
+ at Service(objectName = MetricsProjectsService.METRICS_PROJECTS_SERVICE)
+ at Management(MetricsProjectsService.class)
+ at Remote(MetricsProjectsService.class)
+public class MetricsProjectsServiceImpl implements MetricsProjectsService {
+	
+    private static final Logger log = Logger.getLogger(MetricsProjectsService.class);
+ 
+    
+	public void start() throws Exception {
+		
+		log.info("Starting...");
+		
+		//System.setProperty("java.security.policy", "client.policy");
+		/*if (System.getSecurityManager() == null) {
+			System.out.println("RMISecurityManager");
+			System.setSecurityManager(new RMISecurityManager()); 
+		}*/
+		System.out.println("SecurityManager: " + System.getSecurityManager());
+		
+		startJMXService("service:jmx:rmi://localhost");
+		log.info("TestProjects service started");
+	}
+	
+	public void stop() throws Exception {
+		
+		log.info("TestProjects service stopped");
+	}
+
+	 public Object invoke(Invocation mi) throws Exception {
+		 
+		 Object ret;
+		 
+		 try {
+			 log.debug("MetricsProjectsService.invoke> method=" + mi.getMethod().getName());
+			 ret = mi.getMethod().invoke(this,mi.getArguments());
+			 
+		 } catch (Exception e) {
+			 
+			 log.warn("Failed to invoke method " + mi.getMethod().getName(), e);
+			 throw e;
+		 }
+		 
+		 return ret;
+	   }
+	
+	public void ping() {
+		
+		log.info("P I N G ! ! ! ! !");
+	}
+	
+	public static void startJMXService(String jmxServiceURL) {
+		
+		try {
+			//		The MBeanServer to which the JMXConnectorServer will be registered in
+			MBeanServer server = MBeanServerLocator.locate();
+			
+			// 		Make sure the RMI connector isn't already registered
+			ObjectName cntorServerName = ObjectName.getInstance("connectors:protocol=rmi");
+			if (server.isRegistered(cntorServerName)) {
+				
+				log.warn("MBeanRemoteProxy already registred. Unregistering.");	
+				server.unregisterMBean(cntorServerName);
+			}
+			
+			//		 The address of the connector
+			JMXServiceURL address = new JMXServiceURL(jmxServiceURL);
+			
+			//		 The environment map, null in this case
+			Map<String,Object> environment = null;
+
+			JMXConnectorServer cntorServer = JMXConnectorServerFactory.newJMXConnectorServer(address, environment, null);
+
+			//		 Register the JMXConnectorServer in the MBeanServer
+			server.registerMBean(cntorServer, cntorServerName);
+
+			//		 Start the JMXConnectorServer
+			cntorServer.start();
+		
+			log.info("MBeanRemoteProxy created successfully.");
+			
+		} catch (Exception e) {
+			log.error("Unable to start MBeanRemoteProxy", e);
+		}
+	}
+}

Modified: labs/jbosslabs/trunk/portal-extensions/forge-sar/src/forge-service.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-sar/src/forge-service.xml	2007-09-18 13:50:45 UTC (rev 15204)
+++ labs/jbosslabs/trunk/portal-extensions/forge-sar/src/forge-service.xml	2007-09-18 14:39:58 UTC (rev 15205)
@@ -1,16 +1,16 @@
- <!-- Proxy factory for ProjectsService that will call invoke(Invocation mi) on the target service -->
+ <!-- Proxy factory for MetricsProjectsService that will call invoke(Invocation mi) on the target service -->
    <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory"
-      name="jboss.jmx:type=adaptor,name=ProjectsService,protocol=jrmp,service=proxyFactory">
+      name="jboss.jmx:type=adaptor,name=MetricsProjectsService,protocol=jrmp,service=proxyFactory">
       <!-- Use the standard JRMPInvoker from conf/jboss-service.xxml -->
       <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends>
       <!-- The target MBean -->
-      <depends optional-attribute-name="TargetName">labs:service=projects</depends>
+      <depends optional-attribute-name="TargetName">labs:service=metricsProjects</depends>
       <!-- Where to bind the proxy factory -->
-      <attribute name="JndiName">ProjectsService</attribute>
+      <attribute name="JndiName">MetricsProjectsService</attribute>
       <!-- Invoke invoke(Invocation mi) operation or the target method -->
-      <attribute name="InvokeTargetMethod">true</attribute>
+      <attribute name="InvokeTargetMethod">false</attribute>
       <!-- MyService interface -->
-      <attribute name="ExportedInterfaces">org.jboss.forge.common.ejb3.ProjectsService</attribute>
+      <attribute name="ExportedInterfaces">org.jboss.forge.common.ejb3.MetricsProjectsService</attribute>
       <attribute name="ClientInterceptors">
           <interceptors>
              <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor>




More information about the jboss-svn-commits mailing list