You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sp...@apache.org on 2006/05/03 15:51:16 UTC

svn commit: r399307 - in /geronimo/devtools/eclipse-plugin/trunk: config-store-service/src/main/java/org/apache/geronimo/devtools/ config-store-service/src/main/resources/ plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/

Author: sppatel
Date: Wed May  3 06:51:04 2006
New Revision: 399307

URL: http://svn.apache.org/viewcvs?rev=399307&view=rev
Log:
fix protocol not found error, drop jars in repo instead of sharedLib

Modified:
    geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/java/org/apache/geronimo/devtools/EclipseAwareConfigurationStore.java
    geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/resources/plan.xml
    geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/ServerLifeCycleListener.java

Modified: geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/java/org/apache/geronimo/devtools/EclipseAwareConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/java/org/apache/geronimo/devtools/EclipseAwareConfigurationStore.java?rev=399307&r1=399306&r2=399307&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/java/org/apache/geronimo/devtools/EclipseAwareConfigurationStore.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/java/org/apache/geronimo/devtools/EclipseAwareConfigurationStore.java Wed May  3 06:51:04 2006
@@ -17,12 +17,15 @@
 
 import java.io.IOException;
 import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Set;
 
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXConnectorServerFactory;
 import javax.management.remote.JMXServiceURL;
 
 import org.apache.commons.logging.Log;
@@ -62,9 +65,12 @@
 		JMXConnector connector = null;
 
 		try {
+			
+			Map env = new HashMap();
+			env.put(JMXConnectorServerFactory.PROTOCOL_PROVIDER_CLASS_LOADER, this.getClass().getClassLoader());
 
 			JMXServiceURL address = new JMXServiceURL("hessian", null, 8090, "/hessian");
-			connector = JMXConnectorFactory.connect(address);
+			connector = JMXConnectorFactory.connect(address, env);
 			MBeanServerConnection connection = connector.getMBeanServerConnection();
 			ObjectName on = ObjectName.getInstance("ConfigStoreResolver:name=resolver");
 

Modified: geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/resources/plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/resources/plan.xml?rev=399307&r1=399306&r2=399307&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/resources/plan.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/resources/plan.xml Wed May  3 06:51:04 2006
@@ -38,38 +38,42 @@
                 <groupId>mx4j</groupId>
                 <artifactId>mx4j</artifactId>
                 <type>jar</type>
+                <import>classes</import>
             </dependency>
             <dependency>
                 <groupId>mx4j</groupId>
                 <artifactId>mx4j-remote</artifactId>
                 <type>jar</type>
+                <import>classes</import>
             </dependency>
-            <!--<dependency>
+            <dependency>
                 <groupId>mx4j</groupId>
                 <artifactId>mx4j-tools</artifactId>
                 <type>jar</type>
+                <import>classes</import>
             </dependency>
             <dependency>
                 <groupId>hessian</groupId>
                 <artifactId>hessian</artifactId>
                 <type>jar</type>
-            </dependency>-->
+                <import>classes</import>
+            </dependency>
         </dependencies>
   	</environment>
   	
-  	<!--<gbean name="ExternalEclipseRepository" class="org.apache.geronimo.devtools.ExternalEclipseRepository">
+  	<gbean name="ExternalEclipseRepository" class="org.apache.geronimo.devtools.ExternalEclipseRepository">
     	<attribute name="root">eclipse-repository/</attribute>
     	<reference name="ServerInfo">
      		<name>ServerInfo</name>
     	</reference>
-  	</gbean>-->
+  	</gbean>
   	
-  	<gbean name="ExternalEclipseRepository" class="org.apache.geronimo.system.repository.Maven2Repository">
+  	<!--<gbean name="ExternalEclipseRepository" class="org.apache.geronimo.system.repository.Maven2Repository">
     	<attribute name="root">eclipse-repository/</attribute>
     	<reference name="ServerInfo">
      		<name>ServerInfo</name>
     	</reference>
-  	</gbean>
+  	</gbean>-->
 
     <!--Configuration Store service-->
     <gbean name="EclipseConfigStore" class="org.apache.geronimo.devtools.EclipseAwareConfigurationStore">

Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/ServerLifeCycleListener.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/ServerLifeCycleListener.java?rev=399307&r1=399306&r2=399307&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/ServerLifeCycleListener.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.v11.core/src/org/apache/geronimo/st/v11/core/ServerLifeCycleListener.java Wed May  3 06:51:04 2006
@@ -23,10 +23,8 @@
 import org.apache.geronimo.st.jmxagent.Activator;
 import org.apache.geronimo.st.v11.core.internal.Trace;
 import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.wst.server.core.IServer;
-
 import org.eclipse.wst.server.core.IServerLifecycleListener;
 import org.eclipse.wst.server.core.util.SocketUtil;
 
@@ -39,7 +37,7 @@
 	 */
 	public void serverAdded(IServer server) {
 		Trace.trace(Trace.INFO, "--> ServerLifeCycleListener.serverAdded()");
-		copyJars(server);
+		copyToRepository(server);
 	}
 
 	/*
@@ -49,7 +47,7 @@
 	 */
 	public void serverChanged(IServer server) {
 		Trace.trace(Trace.INFO, "--> ServerLifeCycleListener.serverChanged()");
-		copyJars(server);
+		copyToRepository(server);
 	}
 
 	/*
@@ -60,35 +58,41 @@
 	public void serverRemoved(IServer server) {
 
 	}
+	
+	private void copyToRepository(IServer server) {
+		if (isSupportedServer(server)) {
+			IPath repo = server.getRuntime().getLocation().append("repository");
 
-	private void copyToSharedLib(IServer server, String path) {
-		IPath sharedLib = server.getRuntime().getLocation().append(
-				new Path("/var/shared"));
-
-		IPath destFile = sharedLib.append(path);
-
-		if (!destFile.toFile().exists()) {
-			try {
-				URL url = Platform.resolve(Activator.getDefault().getBundle()
-						.getEntry(path));
-				Trace.trace(Trace.INFO, "copying " + path + " to shared lib");
-				IOUtil.copyFile(new File(url.getFile()), destFile.toFile());
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
+			IPath path = repo.append("/hessian/hessian/3.0.8/hessian-3.0.8.jar");
+			copyFile(getFileFromBundle("lib/hessian-3.0.8.jar"), path.toFile());
+
+			path = repo.append("/mx4j/mx4j-tools/3.0.1/mx4j-tools-3.0.1.jar");
+			copyFile(getFileFromBundle("lib/mx4j-tools-3.0.1.jar"), path.toFile());
 		}
 	}
 
-	private boolean isSupportedServer(IServer server) {
-		return "1.1".equals(server.getServerType().getRuntimeType()
-				.getVersion())
-				&& SocketUtil.isLocalhost(server.getHost());
+	private static void copyFile(File src, File dest) {
+		try {
+			if (!dest.exists()) {
+				Trace.trace(Trace.INFO, "adding " + dest);
+				IOUtil.copyFile(src, dest);
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
 	}
 
-	private void copyJars(IServer server) {
-		if (isSupportedServer(server)) {
-			copyToSharedLib(server, "lib/hessian-3.0.8.jar");
-			copyToSharedLib(server, "lib/mx4j-tools-3.0.1.jar");
+	private File getFileFromBundle(String path) {
+		try {
+			URL url = Platform.resolve(Activator.getDefault().getBundle().getEntry(path));
+			return new File(url.getFile());
+		} catch (IOException e) {
+			e.printStackTrace();
 		}
+		return null;
+	}
+
+	private boolean isSupportedServer(IServer server) {
+		return "1.1".equals(server.getServerType().getRuntimeType().getVersion()) && SocketUtil.isLocalhost(server.getHost());
 	}
 }