Return-Path: X-Original-To: apmail-geronimo-scm-archive@www.apache.org Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E3F777040 for ; Thu, 17 Nov 2011 02:21:16 +0000 (UTC) Received: (qmail 46819 invoked by uid 500); 17 Nov 2011 02:21:16 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 46743 invoked by uid 500); 17 Nov 2011 02:21:16 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 46736 invoked by uid 99); 17 Nov 2011 02:21:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Nov 2011 02:21:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Nov 2011 02:20:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 48EF92388C72; Thu, 17 Nov 2011 02:19:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1203020 [23/29] - in /geronimo/devtools/eclipse-plugin/branches/3.0-beta-1: eclipse/ plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/ plugins/org.apache.geronimo.j2ee.v11.jaxbmodel/src/test/resources/application/ plugins/org.apache.geronimo... Date: Thu, 17 Nov 2011 02:19:27 -0000 To: scm@geronimo.apache.org From: gawor@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111117021941.48EF92388C72@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ServiceRefWizard.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ServiceRefWizard.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v21.ui/src/main/java/org/apache/geronimo/st/v21/ui/wizards/ServiceRefWizard.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/plugin.xml URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/plugin.xml?rev=1203020&r1=1203019&r2=1203020&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/plugin.xml (original) +++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/plugin.xml Thu Nov 17 02:19:12 2011 @@ -17,7 +17,7 @@ ~ limitations under the License. --> - + Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/plugin.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/plugin.xml ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/plugin.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/pom.xml URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/pom.xml?rev=1203020&r1=1203019&r2=1203020&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/pom.xml (original) +++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/pom.xml Thu Nov 17 02:19:12 2011 @@ -14,7 +14,7 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + 4.0.0 Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/pom.xml ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/pom.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/Activator.java URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/Activator.java?rev=1203020&r1=1203019&r2=1203020&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/Activator.java (original) +++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/Activator.java Thu Nov 17 02:19:12 2011 @@ -1,127 +1,127 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.v22.core; - -import org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate; -import org.apache.geronimo.st.core.ModuleArtifactMapper; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.IServerLifecycleListener; -import org.eclipse.wst.server.core.ServerCore; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - * - * @version $Rev: 499184 $ $Date: 2007-01-23 18:36:18 -0500 (Tue, 23 Jan 2007) $ - */ -public class Activator extends Plugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.apache.geronimo.st.v22.core"; - - // The shared instance - private static Activator plugin; - - /** - * The constructor - */ - public Activator() { - plugin = this; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - - ServerCore.addServerLifecycleListener(new IServerLifecycleListener() { - public void serverAdded(IServer server) { - triggerStartUpdateServerTask(server); - } - - public void serverChanged(IServer server) { - - } - - public void serverRemoved(IServer server) { - } - }); - IServer[] servers = ServerCore.getServers(); - for(int i = 0; i < servers.length; i++) { - triggerStartUpdateServerTask(servers[i]); - } - } - - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * triggerStartUpdateServerTask is invoked from: - *
    - *
  • The WTP ResourceManager after a new server has been defined (via the WTP NewServerWizard) - *
  • When a server lifecycle listener has been added (see above) - *
- * - * @param server - */ - private void triggerStartUpdateServerTask(IServer server) { - GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server.getAdapter(GeronimoServerBehaviourDelegate.class); - if (delegate == null) { - delegate = (GeronimoServerBehaviourDelegate) server.loadAdapter(GeronimoServerBehaviourDelegate.class, null); - } - if (delegate != null) { - delegate.startUpdateServerStateTask(); - } - } - - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - IServer[] servers = ServerCore.getServers(); - for(int i = 0; i < servers.length; i++) { - GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) servers[i].getAdapter(GeronimoServerBehaviourDelegate.class); - if(delegate != null) { - delegate.stopUpdateServerStateTask(); - } - } - ModuleArtifactMapper.getInstance().save(); - super.stop(context); - plugin = null; - } - - public static void log(int severity, String message, Throwable throwable) { - plugin.getLog().log(new Status(severity, PLUGIN_ID, 0, message, throwable)); - - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.v22.core; + +import org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate; +import org.apache.geronimo.st.core.ModuleArtifactMapper; +import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Status; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.IServerLifecycleListener; +import org.eclipse.wst.server.core.ServerCore; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + * + * @version $Rev$ $Date$ + */ +public class Activator extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.apache.geronimo.st.v22.core"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + + ServerCore.addServerLifecycleListener(new IServerLifecycleListener() { + public void serverAdded(IServer server) { + triggerStartUpdateServerTask(server); + } + + public void serverChanged(IServer server) { + + } + + public void serverRemoved(IServer server) { + } + }); + IServer[] servers = ServerCore.getServers(); + for(int i = 0; i < servers.length; i++) { + triggerStartUpdateServerTask(servers[i]); + } + } + + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * triggerStartUpdateServerTask is invoked from: + *
    + *
  • The WTP ResourceManager after a new server has been defined (via the WTP NewServerWizard) + *
  • When a server lifecycle listener has been added (see above) + *
+ * + * @param server + */ + private void triggerStartUpdateServerTask(IServer server) { + GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) server.getAdapter(GeronimoServerBehaviourDelegate.class); + if (delegate == null) { + delegate = (GeronimoServerBehaviourDelegate) server.loadAdapter(GeronimoServerBehaviourDelegate.class, null); + } + if (delegate != null) { + delegate.startUpdateServerStateTask(); + } + } + + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + IServer[] servers = ServerCore.getServers(); + for(int i = 0; i < servers.length; i++) { + GeronimoServerBehaviourDelegate delegate = (GeronimoServerBehaviourDelegate) servers[i].getAdapter(GeronimoServerBehaviourDelegate.class); + if(delegate != null) { + delegate.stopUpdateServerStateTask(); + } + } + ModuleArtifactMapper.getInstance().save(); + super.stop(context); + plugin = null; + } + + public static void log(int severity, String message, Throwable throwable) { + plugin.getLog().log(new Status(severity, PLUGIN_ID, 0, message, throwable)); + + } + +} Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/Activator.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/Activator.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/Activator.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoServerBehaviour.java URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoServerBehaviour.java?rev=1203020&r1=1203019&r2=1203020&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoServerBehaviour.java (original) +++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoServerBehaviour.java Thu Nov 17 02:19:12 2011 @@ -1,234 +1,234 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.v22.core; - -import java.net.URL; -import java.util.List; -import java.util.Set; - -import javax.management.MBeanServerConnection; -import javax.naming.directory.NoSuchAttributeException; - -import org.apache.geronimo.gbean.AbstractName; -import org.apache.geronimo.gbean.AbstractNameQuery; -import org.apache.geronimo.gbean.GBeanData; -import org.apache.geronimo.kernel.GBeanNotFoundException; -import org.apache.geronimo.kernel.InternalKernelException; -import org.apache.geronimo.kernel.Kernel; -import org.apache.geronimo.kernel.config.Configuration; -import org.apache.geronimo.kernel.config.InvalidConfigException; -import org.apache.geronimo.kernel.config.PersistentConfigurationList; -import org.apache.geronimo.kernel.repository.Artifact; -import org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate; -import org.apache.geronimo.st.v21.core.internal.DependencyHelper; -import org.apache.geronimo.st.v22.core.internal.Trace; -import org.apache.geronimo.system.jmx.KernelDelegate; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.server.core.IModule; -import org.eclipse.wst.server.core.IServer; -import org.eclipse.wst.server.core.internal.IModulePublishHelper; -import org.apache.geronimo.st.v21.core.Activator; -/** - * @version $Rev: 540136 $ $Date: 2007-05-21 09:15:31 -0400 (Mon, 21 May 2007) $ - */ -public class GeronimoServerBehaviour extends GeronimoServerBehaviourDelegate implements IModulePublishHelper { - - private Kernel kernel = null; - - public GeronimoServerBehaviour() { - super(); - } - - /* (non-Javadoc) - * @see org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate#stopKernel() - */ - protected void stopKernel() { - if (kernel != null) { - kernel.shutdown(); - kernel = null; - } - } - - /** - * @return - * @throws SecurityException - */ - protected Kernel getKernel() throws SecurityException { - if (kernel == null) { - try { - MBeanServerConnection connection = getServerConnection(); - if (connection != null) - kernel = new KernelDelegate(connection); - } catch (SecurityException e) { - throw e; - } catch (Exception e) { - Trace.trace(Trace.WARNING, "Kernel connection failed. " - + e.getMessage(), Activator.traceCore); - } - } - return kernel; - } - - /* - * (non-Javadoc) - * - * @see org.apache.geronimo.st.v21.core.IGeronimoServerBehavior#isKernelAlive() - */ - public boolean isKernelAlive() { - try { - return getKernel() != null && kernel.isRunning(); - } catch (SecurityException e) { - Trace.trace(Trace.ERROR, "Invalid username and/or password.", e, Activator.logCore); - - pingThread.interrupt(); - if (getServer().getServerState() != IServer.STATE_STOPPED) { - forceStopJob(true,e); - - } - } catch (Exception e) { - Trace.trace(Trace.WARNING, "Geronimo Server may have been terminated manually outside of workspace.", e, Activator.logCore); - kernel = null; - } - return false; - } - - private void forceStopJob(boolean b, final SecurityException e) { - /* - * - * Currently, there is another Status is returned by StartJob in Server. - * The message doesn't contain reason for the exception. - * So this job is created to show a message(Invalid username and/or password) to user. - * - * TODO: Need a method to remove the error message thrown by StartJob in Server. - * - */ - - String jobName = NLS.bind(org.eclipse.wst.server.core.internal.Messages.errorStartFailed, getServer().getName()); - - //This message has different variable names in WTP 3.0 and 3.1, so we define it here instead of using that in WTP - final String jobStartingName = NLS.bind("Starting {0}", getServer().getName()); - - new Job(jobName){ - - @Override - protected IStatus run(IProgressMonitor monitor) { - MultiStatus multiStatus = new MultiStatus(Activator.PLUGIN_ID, 0, jobStartingName, null); - multiStatus.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"Invalid username and/or password.",e)); - try{ - GeronimoServerBehaviour.this.stop(true); - }catch (Exception e){ - multiStatus.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"Failed to stop server",e)); - } - - return multiStatus; - } - }.schedule(); - - } - - /* - * (non-Javadoc) - * - * @see org.apache.geronimo.st.v21.core.IGeronimoServerBehavior#isFullyStarted() - */ - public boolean isFullyStarted() { - if (isKernelAlive()) { - AbstractNameQuery query = new AbstractNameQuery(PersistentConfigurationList.class.getName()); - Set configLists = kernel.listGBeans(query); - if (!configLists.isEmpty()) { - AbstractName on = (AbstractName) configLists.toArray()[0]; - try { - Boolean b = (Boolean) kernel.getAttribute(on, "kernelFullyStarted"); - return b.booleanValue(); - } catch (GBeanNotFoundException e) { - // ignore - } catch (NoSuchAttributeException e) { - // ignore - } catch (Exception e) { - e.printStackTrace(); - } - } else { - Trace.trace(Trace.INFO, "configLists is empty", Activator.traceCore); - } - } - return false; - } - - /* (non-Javadoc) - * @see org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate#getRuntimeClass() - */ - public String getRuntimeClass() { - return "org.apache.geronimo.cli.daemon.DaemonCLI"; - } - - public IPath getPublishDirectory(IModule[] module) { - if (module == null || module.length == 0) - return null; - - if (getGeronimoServer().isRunFromWorkspace()) { - // TODO fix me, see if project root, component root, or output - // container should be returned - return module[module.length - 1].getProject().getLocation(); - } else { - ClassLoader old = Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(getContextClassLoader()); - String configId = getConfigId(module[0]); - Artifact artifact = Artifact.create(configId); - AbstractName name = Configuration.getConfigurationAbstractName(artifact); - GBeanData data = kernel.getGBeanData(name); - URL url = (URL) data.getAttribute("baseURL"); - return getModulePath(module, url); - } catch (InvalidConfigException e) { - e.printStackTrace(); - } catch (GBeanNotFoundException e) { - e.printStackTrace(); - } catch (InternalKernelException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - Thread.currentThread().setContextClassLoader(old); - } - } - - return null; - } - - /* - * (non-Javadoc) - * - * @see org.apache.geronimo.st.core.GenericGeronimoServerBehaviour#getContextClassLoader() - */ - protected ClassLoader getContextClassLoader() { - return Kernel.class.getClassLoader(); - } - - @Override - protected List getOrderedModules(IServer server, List modules, - List deltaKind) { - DependencyHelper dh = new DependencyHelper(); - List list = dh.reorderModules(this.getServer(),modules, deltaKind); - return list; - } +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.v22.core; + +import java.net.URL; +import java.util.List; +import java.util.Set; + +import javax.management.MBeanServerConnection; +import javax.naming.directory.NoSuchAttributeException; + +import org.apache.geronimo.gbean.AbstractName; +import org.apache.geronimo.gbean.AbstractNameQuery; +import org.apache.geronimo.gbean.GBeanData; +import org.apache.geronimo.kernel.GBeanNotFoundException; +import org.apache.geronimo.kernel.InternalKernelException; +import org.apache.geronimo.kernel.Kernel; +import org.apache.geronimo.kernel.config.Configuration; +import org.apache.geronimo.kernel.config.InvalidConfigException; +import org.apache.geronimo.kernel.config.PersistentConfigurationList; +import org.apache.geronimo.kernel.repository.Artifact; +import org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate; +import org.apache.geronimo.st.v21.core.internal.DependencyHelper; +import org.apache.geronimo.st.v22.core.internal.Trace; +import org.apache.geronimo.system.jmx.KernelDelegate; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.osgi.util.NLS; +import org.eclipse.wst.server.core.IModule; +import org.eclipse.wst.server.core.IServer; +import org.eclipse.wst.server.core.internal.IModulePublishHelper; +import org.apache.geronimo.st.v21.core.Activator; +/** + * @version $Rev$ $Date$ + */ +public class GeronimoServerBehaviour extends GeronimoServerBehaviourDelegate implements IModulePublishHelper { + + private Kernel kernel = null; + + public GeronimoServerBehaviour() { + super(); + } + + /* (non-Javadoc) + * @see org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate#stopKernel() + */ + protected void stopKernel() { + if (kernel != null) { + kernel.shutdown(); + kernel = null; + } + } + + /** + * @return + * @throws SecurityException + */ + protected Kernel getKernel() throws SecurityException { + if (kernel == null) { + try { + MBeanServerConnection connection = getServerConnection(); + if (connection != null) + kernel = new KernelDelegate(connection); + } catch (SecurityException e) { + throw e; + } catch (Exception e) { + Trace.trace(Trace.WARNING, "Kernel connection failed. " + + e.getMessage(), Activator.traceCore); + } + } + return kernel; + } + + /* + * (non-Javadoc) + * + * @see org.apache.geronimo.st.v21.core.IGeronimoServerBehavior#isKernelAlive() + */ + public boolean isKernelAlive() { + try { + return getKernel() != null && kernel.isRunning(); + } catch (SecurityException e) { + Trace.trace(Trace.ERROR, "Invalid username and/or password.", e, Activator.logCore); + + pingThread.interrupt(); + if (getServer().getServerState() != IServer.STATE_STOPPED) { + forceStopJob(true,e); + + } + } catch (Exception e) { + Trace.trace(Trace.WARNING, "Geronimo Server may have been terminated manually outside of workspace.", e, Activator.logCore); + kernel = null; + } + return false; + } + + private void forceStopJob(boolean b, final SecurityException e) { + /* + * + * Currently, there is another Status is returned by StartJob in Server. + * The message doesn't contain reason for the exception. + * So this job is created to show a message(Invalid username and/or password) to user. + * + * TODO: Need a method to remove the error message thrown by StartJob in Server. + * + */ + + String jobName = NLS.bind(org.eclipse.wst.server.core.internal.Messages.errorStartFailed, getServer().getName()); + + //This message has different variable names in WTP 3.0 and 3.1, so we define it here instead of using that in WTP + final String jobStartingName = NLS.bind("Starting {0}", getServer().getName()); + + new Job(jobName){ + + @Override + protected IStatus run(IProgressMonitor monitor) { + MultiStatus multiStatus = new MultiStatus(Activator.PLUGIN_ID, 0, jobStartingName, null); + multiStatus.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"Invalid username and/or password.",e)); + try{ + GeronimoServerBehaviour.this.stop(true); + }catch (Exception e){ + multiStatus.add(new Status(IStatus.ERROR,Activator.PLUGIN_ID,0,"Failed to stop server",e)); + } + + return multiStatus; + } + }.schedule(); + + } + + /* + * (non-Javadoc) + * + * @see org.apache.geronimo.st.v21.core.IGeronimoServerBehavior#isFullyStarted() + */ + public boolean isFullyStarted() { + if (isKernelAlive()) { + AbstractNameQuery query = new AbstractNameQuery(PersistentConfigurationList.class.getName()); + Set configLists = kernel.listGBeans(query); + if (!configLists.isEmpty()) { + AbstractName on = (AbstractName) configLists.toArray()[0]; + try { + Boolean b = (Boolean) kernel.getAttribute(on, "kernelFullyStarted"); + return b.booleanValue(); + } catch (GBeanNotFoundException e) { + // ignore + } catch (NoSuchAttributeException e) { + // ignore + } catch (Exception e) { + e.printStackTrace(); + } + } else { + Trace.trace(Trace.INFO, "configLists is empty", Activator.traceCore); + } + } + return false; + } + + /* (non-Javadoc) + * @see org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate#getRuntimeClass() + */ + public String getRuntimeClass() { + return "org.apache.geronimo.cli.daemon.DaemonCLI"; + } + + public IPath getPublishDirectory(IModule[] module) { + if (module == null || module.length == 0) + return null; + + if (getGeronimoServer().isRunFromWorkspace()) { + // TODO fix me, see if project root, component root, or output + // container should be returned + return module[module.length - 1].getProject().getLocation(); + } else { + ClassLoader old = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(getContextClassLoader()); + String configId = getConfigId(module[0]); + Artifact artifact = Artifact.create(configId); + AbstractName name = Configuration.getConfigurationAbstractName(artifact); + GBeanData data = kernel.getGBeanData(name); + URL url = (URL) data.getAttribute("baseURL"); + return getModulePath(module, url); + } catch (InvalidConfigException e) { + e.printStackTrace(); + } catch (GBeanNotFoundException e) { + e.printStackTrace(); + } catch (InternalKernelException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + Thread.currentThread().setContextClassLoader(old); + } + } + + return null; + } + + /* + * (non-Javadoc) + * + * @see org.apache.geronimo.st.core.GenericGeronimoServerBehaviour#getContextClassLoader() + */ + protected ClassLoader getContextClassLoader() { + return Kernel.class.getClassLoader(); + } + + @Override + protected List getOrderedModules(IServer server, List modules, + List deltaKind) { + DependencyHelper dh = new DependencyHelper(); + List list = dh.reorderModules(this.getServer(),modules, deltaKind); + return list; + } } \ No newline at end of file Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoServerBehaviour.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoServerBehaviour.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoServerBehaviour.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22ServerInfo.java URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22ServerInfo.java?rev=1203020&r1=1203019&r2=1203020&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22ServerInfo.java (original) +++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22ServerInfo.java Thu Nov 17 02:19:12 2011 @@ -53,7 +53,7 @@ import org.eclipse.wst.server.core.IServ import org.eclipse.wst.server.core.ServerCore; /** - * @version $Rev: 952535 $ $Date: 2010-06-08 12:40:16 +0800 (Tue, 08 Jun 2010) $ + * @version $Rev$ $Date$ */ public class GeronimoV22ServerInfo implements IGeronimoServerInfo{ static final long serialVersionUID = 1L; Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22ServerInfo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22ServerInfo.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22ServerInfo.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22VersionHandler.java URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22VersionHandler.java?rev=1203020&r1=1203019&r2=1203020&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22VersionHandler.java (original) +++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22VersionHandler.java Thu Nov 17 02:19:12 2011 @@ -1,46 +1,46 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.v22.core; - -import javax.enterprise.deploy.spi.TargetModuleID; - -import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl; -import org.apache.geronimo.st.v21.core.GeronimoV21Utils; -import org.apache.geronimo.st.core.IGeronimoVersionHandler; -import org.eclipse.wst.server.core.IModule; - -/** - * @version $Rev: 513891 $ $Date: 2007-03-02 14:09:25 -0500 (Fri, 02 Mar 2007) $ - */ -public class GeronimoV22VersionHandler implements IGeronimoVersionHandler { - - /* - * (non-Javadoc) - * - * @see org.apache.geronimo.st.core.IGeronimoVersionHandler#getConfigID(org.eclipse.wst.server.core.IModule) - */ - public String getConfigID(IModule module) throws Exception { - return GeronimoV21Utils.getConfigId(module); - } - - /* (non-Javadoc) - * @see org.apache.geronimo.st.core.IGeronimoVersionHandler#createTargetModuleId(java.lang.String) - */ - public TargetModuleID createTargetModuleId(String configId) { - return new TargetModuleIDImpl(null, configId); - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.v22.core; + +import javax.enterprise.deploy.spi.TargetModuleID; + +import org.apache.geronimo.deployment.plugin.TargetModuleIDImpl; +import org.apache.geronimo.st.v21.core.GeronimoV21Utils; +import org.apache.geronimo.st.core.IGeronimoVersionHandler; +import org.eclipse.wst.server.core.IModule; + +/** + * @version $Rev$ $Date$ + */ +public class GeronimoV22VersionHandler implements IGeronimoVersionHandler { + + /* + * (non-Javadoc) + * + * @see org.apache.geronimo.st.core.IGeronimoVersionHandler#getConfigID(org.eclipse.wst.server.core.IModule) + */ + public String getConfigID(IModule module) throws Exception { + return GeronimoV21Utils.getConfigId(module); + } + + /* (non-Javadoc) + * @see org.apache.geronimo.st.core.IGeronimoVersionHandler#createTargetModuleId(java.lang.String) + */ + public TargetModuleID createTargetModuleId(String configId) { + return new TargetModuleIDImpl(null, configId); + } +} Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22VersionHandler.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22VersionHandler.java ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/GeronimoV22VersionHandler.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/internal/Trace.java URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/internal/Trace.java?rev=1203020&r1=1203019&r2=1203020&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/internal/Trace.java (original) +++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.core/src/main/java/org/apache/geronimo/st/v22/core/internal/Trace.java Thu Nov 17 02:19:12 2011 @@ -1,125 +1,125 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.v22.core.internal; - -import org.apache.geronimo.runtime.common.log.Logger; -import org.apache.geronimo.st.v21.core.Activator; -import org.eclipse.core.runtime.IStatus; - -/** - * Helper class to route trace output. - * - * @version $Rev: 589873 $ $Date: 2007-10-29 17:48:35 -0400 (Mon, 29 Oct 2007) $ - */ -public class Trace { - - /** - * Finest trace event. - */ - public static int INFO = 1; - - /** - * Warning trace event. - */ - public static int WARNING = 2; - - /** - * error trace event. - */ - public static int ERROR = 4; - /** - * cancel trace event. - */ - public static int CANCEL = 8; - - /** - * Trace constructor comment. - */ - private static Logger log; - static { - log = Logger.getInstance(); - } - private Trace() { - super(); - } - - /** - * Trace the given text. - * - * @param level - * the trace level - * @param s - * a message - */ - public static void trace(int level, String s, boolean opt) { - trace(level, s, null, opt); - } - - /** - * Trace the given message and exception. - * - * @param level - * the trace level - * @param s - * a message - * @param t - * a throwable - */ - public static void trace(int level, String s, Throwable t, boolean opt) { - if (Activator.getDefault() == null || !Activator.getDefault().isDebugging()) - return; - if(opt) { - log.trace(level, Activator.PLUGIN_ID, s, t); - } - if(Activator.console) { - System.out.println(Activator.PLUGIN_ID + ": " + s); - if (t != null) - t.printStackTrace(); - } - } - - /** - * Trace the given message - * - * @param tracePoint - * The trace point (e.g., "Exit", "Entry", "Constructor", etc.... - * - * @param classDotMethod - * The class name + method name (e.g., "Class.method()") - * - * @param parms - * Method parameter(s) if the trace point is an "Entry" - * or - * Return value if the trace point is an "Exit" - */ - public static void tracePoint(String tracePoint, String classDotMethod, boolean opt) { - trace(Trace.INFO, tracePoint + ": " + classDotMethod + "()", opt); - } - public static void tracePoint(String tracePoint, boolean opt, String classDotMethod, Object... parms) { - if ( parms == null ) { - trace(Trace.INFO, tracePoint + ": " + classDotMethod + "( null )" , opt); - } - else { - trace(Trace.INFO, tracePoint + ": " + classDotMethod + "(" , opt); - for ( int ii=0; ii - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.ui/plugin.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.ui/plugin.xml ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.ui/plugin.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.ui/pom.xml URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.ui/pom.xml?rev=1203020&r1=1203019&r2=1203020&view=diff ============================================================================== --- geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.ui/pom.xml (original) +++ geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.ui/pom.xml Thu Nov 17 02:19:12 2011 @@ -14,7 +14,7 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + 4.0.0 Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.ui/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.ui/pom.xml ------------------------------------------------------------------------------ svn:keywords = Date Revision Propchange: geronimo/devtools/eclipse-plugin/branches/3.0-beta-1/plugins/org.apache.geronimo.st.v22.ui/pom.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml