1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.geronimo.st.v11.core; 18 19 import javax.enterprise.deploy.spi.DeploymentManager; 20 import javax.enterprise.deploy.spi.factories.DeploymentFactory; 21 22 import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl; 23 import org.apache.geronimo.deployment.plugin.jmx.JMXDeploymentManager; 24 import org.apache.geronimo.st.core.GeronimoServerDelegate; 25 import org.apache.geronimo.st.core.IGeronimoVersionHandler; 26 import org.eclipse.core.runtime.IPath; 27 import org.eclipse.wst.server.core.IModule; 28 import org.eclipse.wst.server.core.util.SocketUtil; 29 30 /** 31 * @version $Rev: 510504 $ $Date: 2007-02-22 08:38:06 -0500 (Thu, 22 Feb 2007) $ 32 */ 33 public class GeronimoServer extends GeronimoServerDelegate { 34 35 private static IGeronimoVersionHandler versionHandler = null; 36 37 private static DeploymentFactory deploymentFactory; 38 39 static { 40 deploymentFactory = new DeploymentFactoryImpl(); 41 } 42 43 /* (non-Javadoc) 44 * @see org.apache.geronimo.st.core.GenericGeronimoServer#getContextRoot(org.eclipse.wst.server.core.IModule) 45 */ 46 public String getContextRoot(IModule module) throws Exception { 47 return GeronimoV11Utils.getContextRoot(module); 48 } 49 50 /* 51 * (non-Javadoc) 52 * 53 * @see org.apache.geronimo.st.core.IGeronimoServer#getDeployerURL() 54 */ 55 public String getDeployerURL() { 56 return "deployer:geronimo:jmx://" + getServer().getHost() + ":" + getRMINamingPort(); 57 } 58 59 /* 60 * (non-Javadoc) 61 * 62 * @see org.apache.geronimo.st.core.IGeronimoServer#getJMXServiceURL() 63 */ 64 public String getJMXServiceURL() { 65 String host = getServer().getHost(); 66 return "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + getRMINamingPort() + "/JMXConnector"; 67 } 68 69 /* 70 * (non-Javadoc) 71 * 72 * @see org.apache.geronimo.st.core.IGeronimoServer#getJSR88DeployerJar() 73 */ 74 public IPath getJSR88DeployerJar() { 75 return getServer().getRuntime().getLocation().append("/lib/geronimo-deploy-jsr88-1.1.jar"); 76 } 77 78 /* 79 * (non-Javadoc) 80 * 81 * @see org.apache.geronimo.st.core.IGeronimoServer#getDeploymentFactory() 82 */ 83 public DeploymentFactory getDeploymentFactory() { 84 return deploymentFactory; 85 } 86 87 /* 88 * (non-Javadoc) 89 * 90 * @see org.apache.geronimo.st.core.IGeronimoServer#configureDeploymentManager(javax.enterprise.deploy.spi.DeploymentManager) 91 */ 92 public void configureDeploymentManager(DeploymentManager dm) { 93 ((JMXDeploymentManager) dm).setLogConfiguration(true, true); 94 boolean enableInPlace = SocketUtil.isLocalhost(getServer().getHost()) && isRunFromWorkspace(); 95 setInPlaceDeployment(dm, enableInPlace); 96 } 97 98 /* 99 * (non-Javadoc) 100 * 101 * @see org.apache.geronimo.st.core.IGeronimoServer#getVersionHandler() 102 */ 103 public IGeronimoVersionHandler getVersionHandler() { 104 if (versionHandler == null) 105 versionHandler = new GeronimoV11VersionHandler(); 106 return versionHandler; 107 } 108 109 public void setInPlaceDeployment(DeploymentManager dm, boolean enable) { 110 ((JMXDeploymentManager) dm).setInPlace(enable); 111 } 112 113 public boolean isNotRedeployJSPFiles() { 114 return getAttribute(PROPERTY_NOT_REDEPLOY_JSP_FILES,false); 115 } 116 }