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 21:46:18 UTC
svn commit: r399390 - in /geronimo/devtools/eclipse-plugin/trunk:
config-store-service/src/main/java/org/apache/geronimo/devtools/
plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/
plugins/org.apache.geronimo.st.jmxagent/ plugins/org...
Author: sppatel
Date: Wed May 3 12:46:14 2006
New Revision: 399390
URL: http://svn.apache.org/viewcvs?rev=399390&view=rev
Log:
need to serialize IServer-IProject-ConfigID mappings
Added:
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ModuleArtifactMapper.java (with props)
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/Trace.java (with props)
Modified:
geronimo/devtools/eclipse-plugin/trunk/config-store-service/src/main/java/org/apache/geronimo/devtools/EclipseAwareConfigurationStore.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/Activator.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServerBehaviour.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/META-INF/MANIFEST.MF
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/build.properties
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/ConfigurationStoreResolver.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/ConfigurationStoreResolverMBean.java
geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/JMXAgent.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=399390&r1=399389&r2=399390&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 12:46:14 2006
@@ -48,7 +48,6 @@
public EclipseAwareConfigurationStore(Kernel kernel, String objectName, WritableListableRepository repository) {
super(kernel, objectName, repository);
- log.debug("EclipseAwareConfigurationStore()");
}
/*
@@ -74,9 +73,10 @@
MBeanServerConnection connection = connector.getMBeanServerConnection();
ObjectName on = ObjectName.getInstance("ConfigStoreResolver:name=resolver");
- log.debug("Resolving: " + artifact + " " + module + " " + path);
+ String configId = getConfigId(artifact);
+ log.debug("Resolving: " + configId + " " + module + " " + path);
- result = (Set) connection.invoke(on, "resolve", new Object[] { artifact, module, path }, new String[] { "java.lang.String", "java.lang.String", "java.lang.String" });
+ result = (Set) connection.invoke(on, "resolve", new Object[] { configId, module, path }, new String[] { "java.lang.String", "java.lang.String", "java.lang.String" });
log.debug("Resolved to: " + result);
@@ -91,6 +91,18 @@
}
}
return result;
+ }
+
+ private String getConfigId(Artifact artifact) {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(artifact.getGroupId());
+ buffer.append("/");
+ buffer.append(artifact.getArtifactId());
+ buffer.append("/");
+ buffer.append(artifact.getVersion());
+ buffer.append("/");
+ buffer.append(artifact.getType());
+ return buffer.toString();
}
public static final GBeanInfo GBEAN_INFO;
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/Activator.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/Activator.java?rev=399390&r1=399389&r2=399390&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/Activator.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/Activator.java Wed May 3 12:46:14 2006
@@ -37,6 +37,7 @@
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
+ ModuleArtifactMapper.getInstance().save();
super.stop(context);
plugin = null;
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServerBehaviour.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServerBehaviour.java?rev=399390&r1=399389&r2=399390&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServerBehaviour.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/GenericGeronimoServerBehaviour.java Wed May 3 12:46:14 2006
@@ -22,6 +22,7 @@
import javax.enterprise.deploy.spi.DeploymentManager;
import javax.enterprise.deploy.spi.TargetModuleID;
+import org.apache.geronimo.st.core.commands.DeploymentCmdStatus;
import org.apache.geronimo.st.core.commands.DeploymentCommandFactory;
import org.apache.geronimo.st.core.commands.IDeploymentCommand;
import org.apache.geronimo.st.core.commands.TargetModuleIdNotFoundException;
@@ -134,6 +135,12 @@
IStatus status = distribute(module);
if (!status.isOK()) {
doFail(status, Messages.DISTRIBUTE_FAIL);
+ }
+
+ TargetModuleID[] ids = ((DeploymentCmdStatus) status).getResultTargetModuleIDs();
+ ModuleArtifactMapper mapper = ModuleArtifactMapper.getInstance();
+ for(int i = 0; i < ids.length; i++) {
+ mapper.addEntry(getServer(), module.getProject(), ids[i].getModuleID());
}
status = start(module);
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ModuleArtifactMapper.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ModuleArtifactMapper.java?rev=399390&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ModuleArtifactMapper.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ModuleArtifactMapper.java Wed May 3 12:46:14 2006
@@ -0,0 +1,121 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.core;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+
+public class ModuleArtifactMapper {
+
+ private static ModuleArtifactMapper instance = new ModuleArtifactMapper();
+
+ private static final String FILE_NAME = "servermodule.info";
+
+ HashMap serverEntries;
+
+ private ModuleArtifactMapper() {
+ load();
+ if (serverEntries == null)
+ serverEntries = new HashMap();
+ }
+
+ public static ModuleArtifactMapper getInstance() {
+ return instance;
+ }
+
+ public IProject resolve(IServer server, String configId) {
+ Map artifactEntries = (Map) serverEntries.get(server.getId());
+ if (artifactEntries != null) {
+ String projectName = (String) artifactEntries.get(configId);
+ if (projectName != null)
+ return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ }
+ return null;
+ }
+
+ public void addEntry(IServer server, IProject project, String configId) {
+ Map artifactEntries = (Map) serverEntries.get(server.getId());
+ if (artifactEntries == null) {
+ artifactEntries = new HashMap();
+ serverEntries.put(server.getId(), artifactEntries);
+ }
+ artifactEntries.put(configId, project.getName());
+ }
+
+ public IProject resolve(String serverId, String configId) {
+ IServer server = ServerCore.findServer(serverId);
+ return resolve(server, configId);
+ }
+
+ public void save() {
+ ObjectOutput output = null;
+ try {
+ IPath dest = Activator.getDefault().getStateLocation().append(FILE_NAME);
+ OutputStream file = new FileOutputStream(dest.toFile());
+ OutputStream buffer = new BufferedOutputStream(file);
+ output = new ObjectOutputStream(buffer);
+ output.writeObject(serverEntries);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (output != null)
+ output.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void load() {
+ ObjectInput input = null;
+ try {
+ IPath dest = Activator.getDefault().getStateLocation().append(FILE_NAME);
+ if (dest.toFile().exists()) {
+ InputStream file = new FileInputStream(dest.toFile());
+ InputStream buffer = new BufferedInputStream(file);
+ input = new ObjectInputStream(buffer);
+ serverEntries = (HashMap) input.readObject();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ if (input != null)
+ input.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ModuleArtifactMapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ModuleArtifactMapper.java
------------------------------------------------------------------------------
svn:keywords = Date Rev
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.core/src/org/apache/geronimo/st/core/ModuleArtifactMapper.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/META-INF/MANIFEST.MF?rev=399390&r1=399389&r2=399390&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/META-INF/MANIFEST.MF (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/META-INF/MANIFEST.MF Wed May 3 12:46:14 2006
@@ -12,7 +12,9 @@
org.eclipse.wst.common.modulecore,
org.eclipse.wst.common.project.facet.core,
org.eclipse.jem.util,
- org.eclipse.emf.ecore
+ org.eclipse.emf.ecore,
+ org.apache.geronimo.st.core,
+ org.eclipse.wst.server.core
Eclipse-AutoStart: true
Export-Package:
org.apache.geronimo.st.jmxagent
@@ -22,5 +24,4 @@
lib/mx4j-tools-3.0.1.jar,
lib/hessian-3.0.8.jar,
lib/geronimo-servlet_2.4_spec-1.0.jar,
- lib/commons-logging-1.0.4.jar,
- .
+ lib/commons-logging-1.0.4.jar
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/build.properties
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/build.properties?rev=399390&r1=399389&r2=399390&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/build.properties (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/build.properties Wed May 3 12:46:14 2006
@@ -1,5 +1,3 @@
-source.. = src/
output.. = target/classes/
bin.includes = META-INF/,\
- .,\
lib/commons-logging-1.0.4.jar
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/ConfigurationStoreResolver.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/ConfigurationStoreResolver.java?rev=399390&r1=399389&r2=399390&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/ConfigurationStoreResolver.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/ConfigurationStoreResolver.java Wed May 3 12:46:14 2006
@@ -20,6 +20,7 @@
import java.util.HashSet;
import java.util.Set;
+import org.apache.geronimo.st.core.ModuleArtifactMapper;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
@@ -32,11 +33,14 @@
public class ConfigurationStoreResolver implements ConfigurationStoreResolverMBean {
- public Set resolve(String configId, String module, String path) {
- IProject project = getProject(configId);
+ public Set resolve(String configId, String module, String path) throws Exception {
+
+ Trace.trace(Trace.INFO, "ConfigStore Resolve Query: " + configId + ":" + module + ":" + path);
+
+ IProject project = ModuleArtifactMapper.getInstance().resolve("", configId);
if (project == null) {
- // error couldn't find project for artifact throw exception
+ throw new Exception("Could not find project in workspace for configId " + configId);
}
if (module != null && J2EEProjectUtilities.isEARProject(project)) {
@@ -86,13 +90,10 @@
}
}
}
+
+ Trace.trace(Trace.INFO, "ConfigStore Resolve Result: " + urls);
return urls;
- }
-
- public IProject getProject(String configId) {
- // get IProject from IModule with persisted configID
- return null;
}
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/ConfigurationStoreResolverMBean.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/ConfigurationStoreResolverMBean.java?rev=399390&r1=399389&r2=399390&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/ConfigurationStoreResolverMBean.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/ConfigurationStoreResolverMBean.java Wed May 3 12:46:14 2006
@@ -19,6 +19,6 @@
public interface ConfigurationStoreResolverMBean {
- public Set resolve(String configId, String module, String path);
+ public Set resolve(String configId, String module, String path) throws Exception;
}
Modified: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/JMXAgent.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/JMXAgent.java?rev=399390&r1=399389&r2=399390&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/JMXAgent.java (original)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/JMXAgent.java Wed May 3 12:46:14 2006
@@ -63,16 +63,7 @@
}
if (!connectorServer.isActive()) {
- Thread thread = new Thread() {
- public void run() {
- try {
- connectorServer.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- };
- thread.start();
+ connectorServer.start();
}
}
Added: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/Trace.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/Trace.java?rev=399390&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/Trace.java (added)
+++ geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/Trace.java Wed May 3 12:46:14 2006
@@ -0,0 +1,76 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.st.jmxagent;
+
+
+/**
+ * Helper class to route trace output.
+ */
+public class Trace {
+
+ /**
+ * Finest trace event.
+ */
+ public static byte INFO = 0;
+
+ /**
+ * Warning trace event.
+ */
+ public static byte WARNING = 1;
+
+ /**
+ * Severe trace event.
+ */
+ public static byte SEVERE = 2;
+
+ /**
+ * Trace constructor comment.
+ */
+ private Trace() {
+ super();
+ }
+
+ /**
+ * Trace the given text.
+ *
+ * @param level
+ * the trace level
+ * @param s
+ * a message
+ */
+ public static void trace(byte level, String s) {
+ trace(level, s, null);
+ }
+
+ /**
+ * Trace the given message and exception.
+ *
+ * @param level
+ * the trace level
+ * @param s
+ * a message
+ * @param t
+ * a throwable
+ */
+ public static void trace(byte level, String s, Throwable t) {
+ if (!Activator.getDefault().isDebugging())
+ return;
+
+ System.out.println(Activator.PLUGIN_ID + ": " + s);
+ if (t != null)
+ t.printStackTrace();
+ }
+}
\ No newline at end of file
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/Trace.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/Trace.java
------------------------------------------------------------------------------
svn:keywords = Date Rev
Propchange: geronimo/devtools/eclipse-plugin/trunk/plugins/org.apache.geronimo.st.jmxagent/src/org/apache/geronimo/st/jmxagent/Trace.java
------------------------------------------------------------------------------
svn:mime-type = text/plain