EOL commit
Project: http://git-wip-us.apache.org/repos/asf/tomee/repo Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/3069db0b Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/3069db0b Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/3069db0b Branch: refs/heads/master Commit: 3069db0ba41c586c36e3070774443c70d7d3b926 Parents: 912db41 Author: Romain Manni-Bucau <[email protected]> Authored: Wed Nov 18 12:17:59 2015 -0800 Committer: Romain Manni-Bucau <[email protected]> Committed: Wed Nov 18 12:17:59 2015 -0800 ---------------------------------------------------------------------- .../openejb/tck/impl/ContainersImplTomEE.java | 340 ++++++------- .../openejb/tck/impl/FullRestartContainer.java | 274 +++++------ .../apache/openejb/tck/util/ServerLocal.java | 100 ++-- .../main/groovy/commands/SetupCommand.groovy | 236 ++++----- .../apache/tomee/RemoteTomEEEJBContainer.java | 338 ++++++------- .../apache-tomee/src/main/resources/service.bat | 452 ++++++++--------- .../main/resources/service.install.as.admin.bat | 64 +-- .../main/resources/service.remove.as.admin.bat | 64 +-- tomee/apache-tomee/src/main/resources/tomee.bat | 180 +++---- tomee/build.xml | 92 ++-- .../org/apache/tomee/catalina/Contexts.java | 330 ++++++------- .../tomee/catalina/TomEEWebappLoader.java | 242 +++++----- .../tomee/catalina/TomcatDeploymentLoader.java | 86 ++-- .../java/org/apache/tomee/embedded/Main.java | 268 +++++------ .../org/apache/tomee/configs/catalina.policy | 482 +++++++++---------- .../apache/tomee/configs/catalina.properties | 242 +++++----- .../java/org/apache/tomee/embedded/ABean.java | 52 +- .../src/test/resources/META-INF/beans.xml | 38 +- .../jul/formatter/AsyncConsoleHandler.java | 126 ++--- .../jul/formatter/SimpleTomEEFormatter.java | 96 ++-- .../tomee/jul/formatter/log/JULLogger.java | 360 +++++++------- .../tomee/jul/formatter/log/ReloadableLog.java | 232 ++++----- .../jul/formatter/SimpleTomEEFormatterTest.java | 160 +++--- .../TomEEFacesConfigurationProvider.java | 92 ++-- .../TomEEFacesConfigurationProviderFactory.java | 144 +++--- ...yfaces.spi.FacesConfigurationProviderFactory | 2 +- tomee/tomee-webaccess/src/main/java/readme.txt | 10 +- .../src/main/webapp/app/js/view/growl.js | 140 +++--- tomee/tomee-webaccess/src/test/java/readme.txt | 10 +- .../webapp/installer/InstallerServlet.java | 162 +++---- 30 files changed, 2707 insertions(+), 2707 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tomee/blob/3069db0b/tck/tck-common/src/main/java/org/apache/openejb/tck/impl/ContainersImplTomEE.java ---------------------------------------------------------------------- diff --git a/tck/tck-common/src/main/java/org/apache/openejb/tck/impl/ContainersImplTomEE.java b/tck/tck-common/src/main/java/org/apache/openejb/tck/impl/ContainersImplTomEE.java index 813ff75..f382b7a 100644 --- a/tck/tck-common/src/main/java/org/apache/openejb/tck/impl/ContainersImplTomEE.java +++ b/tck/tck-common/src/main/java/org/apache/openejb/tck/impl/ContainersImplTomEE.java @@ -1,170 +1,170 @@ -/* - * 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.openejb.tck.impl; - -import org.apache.openejb.assembler.Deployer; -import org.apache.openejb.assembler.classic.AppInfo; -import org.apache.openejb.client.RemoteInitialContextFactory; -import org.apache.openejb.config.RemoteServer; -import org.apache.openejb.config.ValidationException; -import org.apache.openejb.loader.Options; -import org.apache.openejb.tck.OpenEJBTCKRuntimeException; -import org.apache.openejb.tck.util.ServerLocal; -import org.jboss.testharness.api.DeploymentException; -import org.jboss.testharness.spi.Containers; - -import javax.naming.Context; -import javax.naming.InitialContext; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Arrays; -import java.util.Properties; - -/** - * @version $Rev$ $Date$ - */ -public class ContainersImplTomEE extends AbstractContainers implements Containers { - private static int count = 0; - private final RemoteServer server; - private Deployer deployer = null; - private Exception exception; - private AppInfo appInfo; - private File currentFile = null; - private final int port = ServerLocal.getPort(8080); - - private Deployer lookup() { - final Options options = new Options(System.getProperties()); - final Properties props = new Properties(); - props.put(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName()); - props.put(Context.PROVIDER_URL, options.get(Context.PROVIDER_URL, "http://localhost:" + port + "/tomee/ejb")); - - final String deployerJndi = System.getProperty("openejb.deployer.jndiname", "openejb/DeployerBusinessRemote"); - - try { - final InitialContext context = new InitialContext(props); - return (Deployer) context.lookup(deployerJndi); - } catch (final Exception e) { - throw new OpenEJBTCKRuntimeException(e); - } - } - - public ContainersImplTomEE() { - System.out.println("ContainersImpl=" + ContainersImplTomEE.class.getName()); - System.out.println("Initialized ContainersImplTomEE " + (++count) + ", wait port = " + port); - server = new RemoteServer(); - server.setPortStartup(this.port); - } - - @Override - public boolean deploy(final InputStream archive, final String name) throws IOException { - exception = null; - appInfo = null; - - System.out.println("Deploying " + archive + " with name " + name); - - currentFile = getFile(name); - System.out.println(currentFile); - writeToFile(currentFile, archive); - try { - if (deployer == null) { - deployer = lookup(); - } - appInfo = deployer.deploy(currentFile.getAbsolutePath()); - } catch (final Exception ex) { - Exception e = ex; - if (e.getCause() instanceof ValidationException) { - e = (Exception) e.getCause(); - } - - if (name.contains(".broken.")) { - // Tests that contain the name '.broken.' are expected to fail deployment - // This is how the TCK verifies the container is doing the required error checking - exception = (DeploymentException) new DeploymentException("deploy failed").initCause(e); - } else { - // This on the other hand is not good .... - System.out.println("FIX Deployment of " + name); - e.printStackTrace(); - exception = e; - } - - return false; - } - return true; - } - - @Override - public DeploymentException getDeploymentException() { - try { - return (DeploymentException) exception; - } catch (final Exception e) { - System.out.println("BADCAST"); - return new DeploymentException("", exception); - } - } - - @Override - public void undeploy(final String name) throws IOException { - if (appInfo == null) { - if (!(exception instanceof DeploymentException)) { - System.out.println("Nothing to undeploy" + name); - } - return; - } - - System.out.println("Undeploying " + name); - try { - deployer.undeploy(appInfo.path); - } catch (final Exception e) { - e.printStackTrace(); - throw new OpenEJBTCKRuntimeException(e); - } - - final File toDelete; - if (currentFile != null && (toDelete = currentFile.getParentFile()).exists()) { - System.out.println("deleting " + toDelete.getAbsolutePath()); - delete(toDelete); - } - } - - protected File getFile(final String name) { - final File dir = new File(tmpDir, Math.random() + ""); - if (!dir.exists() && !dir.mkdir()) { - throw new RuntimeException("Failed to create directory: " + dir); - } - dir.deleteOnExit(); - return new File(dir, name); - } - - @Override - public void setup() throws IOException { - System.out.println("Setup called"); - try { - server.start(Arrays.asList("-Dopenejb.classloader.forced-load=org.apache.openejb.tck"), "start", true); - } catch (final Exception e) { - cleanup(); - throw e; - } - System.out.println("Started"); - } - - @Override - public void cleanup() throws IOException { - System.out.println("Cleanup called"); - server.destroy(); - } -} +/* + * 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.openejb.tck.impl; + +import org.apache.openejb.assembler.Deployer; +import org.apache.openejb.assembler.classic.AppInfo; +import org.apache.openejb.client.RemoteInitialContextFactory; +import org.apache.openejb.config.RemoteServer; +import org.apache.openejb.config.ValidationException; +import org.apache.openejb.loader.Options; +import org.apache.openejb.tck.OpenEJBTCKRuntimeException; +import org.apache.openejb.tck.util.ServerLocal; +import org.jboss.testharness.api.DeploymentException; +import org.jboss.testharness.spi.Containers; + +import javax.naming.Context; +import javax.naming.InitialContext; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.Properties; + +/** + * @version $Rev$ $Date$ + */ +public class ContainersImplTomEE extends AbstractContainers implements Containers { + private static int count = 0; + private final RemoteServer server; + private Deployer deployer = null; + private Exception exception; + private AppInfo appInfo; + private File currentFile = null; + private final int port = ServerLocal.getPort(8080); + + private Deployer lookup() { + final Options options = new Options(System.getProperties()); + final Properties props = new Properties(); + props.put(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName()); + props.put(Context.PROVIDER_URL, options.get(Context.PROVIDER_URL, "http://localhost:" + port + "/tomee/ejb")); + + final String deployerJndi = System.getProperty("openejb.deployer.jndiname", "openejb/DeployerBusinessRemote"); + + try { + final InitialContext context = new InitialContext(props); + return (Deployer) context.lookup(deployerJndi); + } catch (final Exception e) { + throw new OpenEJBTCKRuntimeException(e); + } + } + + public ContainersImplTomEE() { + System.out.println("ContainersImpl=" + ContainersImplTomEE.class.getName()); + System.out.println("Initialized ContainersImplTomEE " + (++count) + ", wait port = " + port); + server = new RemoteServer(); + server.setPortStartup(this.port); + } + + @Override + public boolean deploy(final InputStream archive, final String name) throws IOException { + exception = null; + appInfo = null; + + System.out.println("Deploying " + archive + " with name " + name); + + currentFile = getFile(name); + System.out.println(currentFile); + writeToFile(currentFile, archive); + try { + if (deployer == null) { + deployer = lookup(); + } + appInfo = deployer.deploy(currentFile.getAbsolutePath()); + } catch (final Exception ex) { + Exception e = ex; + if (e.getCause() instanceof ValidationException) { + e = (Exception) e.getCause(); + } + + if (name.contains(".broken.")) { + // Tests that contain the name '.broken.' are expected to fail deployment + // This is how the TCK verifies the container is doing the required error checking + exception = (DeploymentException) new DeploymentException("deploy failed").initCause(e); + } else { + // This on the other hand is not good .... + System.out.println("FIX Deployment of " + name); + e.printStackTrace(); + exception = e; + } + + return false; + } + return true; + } + + @Override + public DeploymentException getDeploymentException() { + try { + return (DeploymentException) exception; + } catch (final Exception e) { + System.out.println("BADCAST"); + return new DeploymentException("", exception); + } + } + + @Override + public void undeploy(final String name) throws IOException { + if (appInfo == null) { + if (!(exception instanceof DeploymentException)) { + System.out.println("Nothing to undeploy" + name); + } + return; + } + + System.out.println("Undeploying " + name); + try { + deployer.undeploy(appInfo.path); + } catch (final Exception e) { + e.printStackTrace(); + throw new OpenEJBTCKRuntimeException(e); + } + + final File toDelete; + if (currentFile != null && (toDelete = currentFile.getParentFile()).exists()) { + System.out.println("deleting " + toDelete.getAbsolutePath()); + delete(toDelete); + } + } + + protected File getFile(final String name) { + final File dir = new File(tmpDir, Math.random() + ""); + if (!dir.exists() && !dir.mkdir()) { + throw new RuntimeException("Failed to create directory: " + dir); + } + dir.deleteOnExit(); + return new File(dir, name); + } + + @Override + public void setup() throws IOException { + System.out.println("Setup called"); + try { + server.start(Arrays.asList("-Dopenejb.classloader.forced-load=org.apache.openejb.tck"), "start", true); + } catch (final Exception e) { + cleanup(); + throw e; + } + System.out.println("Started"); + } + + @Override + public void cleanup() throws IOException { + System.out.println("Cleanup called"); + server.destroy(); + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/3069db0b/tck/tck-common/src/main/java/org/apache/openejb/tck/impl/FullRestartContainer.java ---------------------------------------------------------------------- diff --git a/tck/tck-common/src/main/java/org/apache/openejb/tck/impl/FullRestartContainer.java b/tck/tck-common/src/main/java/org/apache/openejb/tck/impl/FullRestartContainer.java index 98d00e6..2199ec2 100644 --- a/tck/tck-common/src/main/java/org/apache/openejb/tck/impl/FullRestartContainer.java +++ b/tck/tck-common/src/main/java/org/apache/openejb/tck/impl/FullRestartContainer.java @@ -1,137 +1,137 @@ -/* - * 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.openejb.tck.impl; - -import org.apache.openejb.client.RemoteInitialContextFactory; -import org.apache.openejb.config.RemoteServer; -import org.apache.openejb.loader.Options; -import org.apache.openejb.tck.OpenEJBTCKRuntimeException; -import org.apache.openejb.tck.util.ServerLocal; -import org.apache.tomee.catalina.facade.ExceptionManagerFacade; -import org.jboss.testharness.api.DeploymentException; -import org.jboss.testharness.spi.Containers; - -import javax.naming.Context; -import javax.naming.InitialContext; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -/** - * flow: - * - copy file - * - start the server - * - stop the server - * - remove the file - */ -public class FullRestartContainer extends AbstractContainers implements Containers { - private static final File WEBAPP_DIR = new File(System.getProperty("openejb.home"), "webapps/"); - private static final File APPS_DIR = new File(System.getProperty("openejb.home"), "apps/"); - - private RemoteServer server; - private Exception exception; - private File currentFile; - - public FullRestartContainer() { - System.out.println("ContainersImpl=" + FullRestartContainer.class.getName()); - } - - @Override - public DeploymentException getDeploymentException() { - if (exception instanceof DeploymentException) { - return (DeploymentException) exception; - } - System.out.println("BADCAST"); - return new DeploymentException("", exception); - } - - @Override - public boolean deploy(final InputStream archive, final String name) throws IOException { - if (name.endsWith("war")) { - currentFile = new File(WEBAPP_DIR, name); - } else { - currentFile = new File(APPS_DIR, name); - } - - System.out.println(currentFile); - writeToFile(currentFile, archive); - - final int port = ServerLocal.getPort(-1); - if (port > 0) { - server = new RemoteServer(100, true); - server.setPortStartup(port); - } else { - throw new OpenEJBTCKRuntimeException("Please set the tomee port using the system property 'server.http.port'"); - } - - try { - server.start(); - } catch (final Exception e) { - server.destroy(); - e.printStackTrace(); - throw e; - } - - return (exception = lookup().exception()) == null; - } - - @Override - public void undeploy(final String name) throws IOException { - - if (null != server) { - server.destroy(); - } - - final File folder = new File(currentFile.getParentFile(), currentFile.getName().substring(0, currentFile.getName().length() - 4)); - if (folder.exists()) { - delete(folder); - } - delete(currentFile); - } - - @Override - public void setup() throws IOException { - // no-op - } - - @Override - public void cleanup() throws IOException { - // no-op - } - - private ExceptionManagerFacade lookup() { - final Options options = new Options(System.getProperties()); - final Properties props = new Properties(); - props.put(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName()); - final int port = ServerLocal.getPort(-1); - if (port > 0) { - System.out.println("provider url = " + "http://localhost:" + port + "/tomee/ejb"); - props.put(Context.PROVIDER_URL, options.get(Context.PROVIDER_URL, "http://localhost:" + port + "/tomee/ejb")); - } else { - throw new OpenEJBTCKRuntimeException("Please set the tomee port using the system property 'server.http.port'"); - } - - try { - final InitialContext context = new InitialContext(props); - return (ExceptionManagerFacade) context.lookup("openejb/ExceptionManagerFacadeBusinessRemote"); - } catch (final Exception e) { - throw new OpenEJBTCKRuntimeException(e); - } - } -} +/* + * 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.openejb.tck.impl; + +import org.apache.openejb.client.RemoteInitialContextFactory; +import org.apache.openejb.config.RemoteServer; +import org.apache.openejb.loader.Options; +import org.apache.openejb.tck.OpenEJBTCKRuntimeException; +import org.apache.openejb.tck.util.ServerLocal; +import org.apache.tomee.catalina.facade.ExceptionManagerFacade; +import org.jboss.testharness.api.DeploymentException; +import org.jboss.testharness.spi.Containers; + +import javax.naming.Context; +import javax.naming.InitialContext; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +/** + * flow: + * - copy file + * - start the server + * - stop the server + * - remove the file + */ +public class FullRestartContainer extends AbstractContainers implements Containers { + private static final File WEBAPP_DIR = new File(System.getProperty("openejb.home"), "webapps/"); + private static final File APPS_DIR = new File(System.getProperty("openejb.home"), "apps/"); + + private RemoteServer server; + private Exception exception; + private File currentFile; + + public FullRestartContainer() { + System.out.println("ContainersImpl=" + FullRestartContainer.class.getName()); + } + + @Override + public DeploymentException getDeploymentException() { + if (exception instanceof DeploymentException) { + return (DeploymentException) exception; + } + System.out.println("BADCAST"); + return new DeploymentException("", exception); + } + + @Override + public boolean deploy(final InputStream archive, final String name) throws IOException { + if (name.endsWith("war")) { + currentFile = new File(WEBAPP_DIR, name); + } else { + currentFile = new File(APPS_DIR, name); + } + + System.out.println(currentFile); + writeToFile(currentFile, archive); + + final int port = ServerLocal.getPort(-1); + if (port > 0) { + server = new RemoteServer(100, true); + server.setPortStartup(port); + } else { + throw new OpenEJBTCKRuntimeException("Please set the tomee port using the system property 'server.http.port'"); + } + + try { + server.start(); + } catch (final Exception e) { + server.destroy(); + e.printStackTrace(); + throw e; + } + + return (exception = lookup().exception()) == null; + } + + @Override + public void undeploy(final String name) throws IOException { + + if (null != server) { + server.destroy(); + } + + final File folder = new File(currentFile.getParentFile(), currentFile.getName().substring(0, currentFile.getName().length() - 4)); + if (folder.exists()) { + delete(folder); + } + delete(currentFile); + } + + @Override + public void setup() throws IOException { + // no-op + } + + @Override + public void cleanup() throws IOException { + // no-op + } + + private ExceptionManagerFacade lookup() { + final Options options = new Options(System.getProperties()); + final Properties props = new Properties(); + props.put(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName()); + final int port = ServerLocal.getPort(-1); + if (port > 0) { + System.out.println("provider url = " + "http://localhost:" + port + "/tomee/ejb"); + props.put(Context.PROVIDER_URL, options.get(Context.PROVIDER_URL, "http://localhost:" + port + "/tomee/ejb")); + } else { + throw new OpenEJBTCKRuntimeException("Please set the tomee port using the system property 'server.http.port'"); + } + + try { + final InitialContext context = new InitialContext(props); + return (ExceptionManagerFacade) context.lookup("openejb/ExceptionManagerFacadeBusinessRemote"); + } catch (final Exception e) { + throw new OpenEJBTCKRuntimeException(e); + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/3069db0b/tck/tck-common/src/main/java/org/apache/openejb/tck/util/ServerLocal.java ---------------------------------------------------------------------- diff --git a/tck/tck-common/src/main/java/org/apache/openejb/tck/util/ServerLocal.java b/tck/tck-common/src/main/java/org/apache/openejb/tck/util/ServerLocal.java index 856c429..422b12b 100644 --- a/tck/tck-common/src/main/java/org/apache/openejb/tck/util/ServerLocal.java +++ b/tck/tck-common/src/main/java/org/apache/openejb/tck/util/ServerLocal.java @@ -1,50 +1,50 @@ -/* - * 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.openejb.tck.util; - -import org.apache.tomee.util.QuickServerXmlParser; - -import java.io.File; - -public class ServerLocal { - - private ServerLocal() { - } - - /** - * If the TCK is running against a local server extracted to the target dir - * then the server.xml will have the port defined already. - * - * @param def Default port to use if none is found - * @return The determined port, the value of 'server.http.port' or the provided default - */ - public static int getPort(final int def) { - final String home = System.getProperty("openejb.home", "empty"); - - if (!"empty".equals(home)) { - final File serverXml = new File(home, "conf/server.xml"); - - if (serverXml.exists() && serverXml.isFile()) { - final QuickServerXmlParser parser = QuickServerXmlParser.parse(serverXml); - - return Integer.parseInt(parser.http()); - } - } - - return Integer.getInteger("server.http.port", def); - } -} +/* + * 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.openejb.tck.util; + +import org.apache.tomee.util.QuickServerXmlParser; + +import java.io.File; + +public class ServerLocal { + + private ServerLocal() { + } + + /** + * If the TCK is running against a local server extracted to the target dir + * then the server.xml will have the port defined already. + * + * @param def Default port to use if none is found + * @return The determined port, the value of 'server.http.port' or the provided default + */ + public static int getPort(final int def) { + final String home = System.getProperty("openejb.home", "empty"); + + if (!"empty".equals(home)) { + final File serverXml = new File(home, "conf/server.xml"); + + if (serverXml.exists() && serverXml.isFile()) { + final QuickServerXmlParser parser = QuickServerXmlParser.parse(serverXml); + + return Integer.parseInt(parser.http()); + } + } + + return Integer.getInteger("server.http.port", def); + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/3069db0b/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy ---------------------------------------------------------------------- diff --git a/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy b/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy index 1350839..636e8dd 100644 --- a/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy +++ b/tomee/apache-tomee/src/main/groovy/commands/SetupCommand.groovy @@ -1,118 +1,118 @@ -/* - * 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 commands - -import org.apache.tomee.installer.Installer -import org.apache.tomee.installer.Paths -import org.apache.tools.ant.taskdefs.optional.net.SetProxy - -class SetupCommand { - - def pom - def log - def project - AntBuilder ant - def properties - - def require(String name) { - assert name != null - - def value = properties.getProperty(name) - if (!value || value == 'null') value = project.properties.getProperty(name) - if (!value || value == 'null') value = System.properties.getProperty(name) - if (value == 'null') value = null - log.debug("Require property $name = $value") - - if (!value) { - throw new Exception("Missing required property: $name (resolved to null)" as String) - } - return value - } - - def deleteWithRetry = { - try { - ant.delete(it) - } catch (e) { - log.warn("RETRY Deleting: ${it}") - ant.delete(it) - } - } - - def execute() { - String tomcatVersion = require('tomcat.version') - System.setProperty('tomcat.version', tomcatVersion) - - String tomeeVersion = require('tomee.version') - System.setProperty('tomee.version', tomeeVersion) - - String proxyHost = pom.settings.activeProxy?.host ?: '' - String proxyPort = pom.settings.activeProxy?.port ?: '' - if (proxyHost && proxyPort) { - log.info("Setting proxy host=${proxyHost} and proxy port=${proxyPort}") - new SetProxy( - proxyHost: proxyHost, - proxyPort: proxyPort as int, - proxyUser: pom.settings.activeProxy.username ?: '', - proxyPassword: pom.settings.activeProxy.password ?: '', - nonProxyHosts: pom.settings.activeProxy.nonProxyHosts ?: '' - ).execute() - } - - def workDir = require('tomee.workdir') - def webapp = require('tomee.webapp') - - def dest = "${workDir}/apache-tomcat-${tomcatVersion}.zip" as String - def catalinaHome = "${workDir}/apache-tomcat-${tomcatVersion}" as String - System.setProperty('catalina.home', catalinaHome) - System.setProperty('catalina.base', catalinaHome) - - log.info("extracting ${catalinaHome}") - ant.unzip(src: dest, dest: "${workDir}") - - log.info('Deploying the tomee war') - def localRepo = pom.settings.localRepository - ant.unzip(src: "${localRepo}/org/apache/tomee/${webapp}/${tomeeVersion}/${webapp}-${tomeeVersion}.war", - dest: "${workDir}/apache-tomcat-${tomcatVersion}/webapps/tomee") - - log.info("Installing to: ${catalinaHome}") - - - Paths paths = new Paths(new File("${catalinaHome}/webapps/tomee" as String)) - Installer installer = new Installer(paths, true) - installer.installFull() - - // clean up duplicate jars since in TomEE it is useless - // = gain of space ;) - deleteWithRetry(file: paths.getJAXBImpl()) - deleteWithRetry(file: paths.getOpenEJBTomcatLoaderJar()) - deleteWithRetry(file: paths.findTomEELibJar('jaxb-impl')) - deleteWithRetry(file: paths.findTomEELibJar("openejb-javaagent-${tomeeVersion}.jar" as String)) - // we need the one without version - - deleteWithRetry(file: paths.findOpenEJBWebJar('tomee-loader')) - deleteWithRetry(file: paths.findOpenEJBWebJar('swizzle-stream')) - - log.info('Assigning execute privileges to scripts in Tomcat bin directory') - ant.chmod(dir: "${workDir}/apache-tomcat-${tomcatVersion}/bin", perm: 'u+x', includes: '**/*.sh') - - deleteWithRetry(dir: "${workDir}/apache-tomcat-${tomcatVersion}/webapps/examples") - deleteWithRetry(dir: "${workDir}/apache-tomcat-${tomcatVersion}/webapps/tomee") - } -} - +/* + * 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 commands + +import org.apache.tomee.installer.Installer +import org.apache.tomee.installer.Paths +import org.apache.tools.ant.taskdefs.optional.net.SetProxy + +class SetupCommand { + + def pom + def log + def project + AntBuilder ant + def properties + + def require(String name) { + assert name != null + + def value = properties.getProperty(name) + if (!value || value == 'null') value = project.properties.getProperty(name) + if (!value || value == 'null') value = System.properties.getProperty(name) + if (value == 'null') value = null + log.debug("Require property $name = $value") + + if (!value) { + throw new Exception("Missing required property: $name (resolved to null)" as String) + } + return value + } + + def deleteWithRetry = { + try { + ant.delete(it) + } catch (e) { + log.warn("RETRY Deleting: ${it}") + ant.delete(it) + } + } + + def execute() { + String tomcatVersion = require('tomcat.version') + System.setProperty('tomcat.version', tomcatVersion) + + String tomeeVersion = require('tomee.version') + System.setProperty('tomee.version', tomeeVersion) + + String proxyHost = pom.settings.activeProxy?.host ?: '' + String proxyPort = pom.settings.activeProxy?.port ?: '' + if (proxyHost && proxyPort) { + log.info("Setting proxy host=${proxyHost} and proxy port=${proxyPort}") + new SetProxy( + proxyHost: proxyHost, + proxyPort: proxyPort as int, + proxyUser: pom.settings.activeProxy.username ?: '', + proxyPassword: pom.settings.activeProxy.password ?: '', + nonProxyHosts: pom.settings.activeProxy.nonProxyHosts ?: '' + ).execute() + } + + def workDir = require('tomee.workdir') + def webapp = require('tomee.webapp') + + def dest = "${workDir}/apache-tomcat-${tomcatVersion}.zip" as String + def catalinaHome = "${workDir}/apache-tomcat-${tomcatVersion}" as String + System.setProperty('catalina.home', catalinaHome) + System.setProperty('catalina.base', catalinaHome) + + log.info("extracting ${catalinaHome}") + ant.unzip(src: dest, dest: "${workDir}") + + log.info('Deploying the tomee war') + def localRepo = pom.settings.localRepository + ant.unzip(src: "${localRepo}/org/apache/tomee/${webapp}/${tomeeVersion}/${webapp}-${tomeeVersion}.war", + dest: "${workDir}/apache-tomcat-${tomcatVersion}/webapps/tomee") + + log.info("Installing to: ${catalinaHome}") + + + Paths paths = new Paths(new File("${catalinaHome}/webapps/tomee" as String)) + Installer installer = new Installer(paths, true) + installer.installFull() + + // clean up duplicate jars since in TomEE it is useless + // = gain of space ;) + deleteWithRetry(file: paths.getJAXBImpl()) + deleteWithRetry(file: paths.getOpenEJBTomcatLoaderJar()) + deleteWithRetry(file: paths.findTomEELibJar('jaxb-impl')) + deleteWithRetry(file: paths.findTomEELibJar("openejb-javaagent-${tomeeVersion}.jar" as String)) + // we need the one without version + + deleteWithRetry(file: paths.findOpenEJBWebJar('tomee-loader')) + deleteWithRetry(file: paths.findOpenEJBWebJar('swizzle-stream')) + + log.info('Assigning execute privileges to scripts in Tomcat bin directory') + ant.chmod(dir: "${workDir}/apache-tomcat-${tomcatVersion}/bin", perm: 'u+x', includes: '**/*.sh') + + deleteWithRetry(dir: "${workDir}/apache-tomcat-${tomcatVersion}/webapps/examples") + deleteWithRetry(dir: "${workDir}/apache-tomcat-${tomcatVersion}/webapps/tomee") + } +} + http://git-wip-us.apache.org/repos/asf/tomee/blob/3069db0b/tomee/apache-tomee/src/main/java/org/apache/tomee/RemoteTomEEEJBContainer.java ---------------------------------------------------------------------- diff --git a/tomee/apache-tomee/src/main/java/org/apache/tomee/RemoteTomEEEJBContainer.java b/tomee/apache-tomee/src/main/java/org/apache/tomee/RemoteTomEEEJBContainer.java index b9e36de..4327d82 100644 --- a/tomee/apache-tomee/src/main/java/org/apache/tomee/RemoteTomEEEJBContainer.java +++ b/tomee/apache-tomee/src/main/java/org/apache/tomee/RemoteTomEEEJBContainer.java @@ -1,169 +1,169 @@ -/** - * 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 - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * 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.tomee; - -import org.apache.geronimo.osgi.locator.ProviderLocator; -import org.apache.openejb.OpenEJBException; -import org.apache.openejb.assembler.Deployer; -import org.apache.openejb.assembler.DeployerEjb; -import org.apache.openejb.client.RemoteInitialContextFactory; -import org.apache.openejb.config.RemoteServer; -import org.apache.openejb.loader.IO; -import org.apache.tomee.util.QuickServerXmlParser; - -import javax.ejb.EJBException; -import javax.ejb.embeddable.EJBContainer; -import javax.ejb.spi.EJBContainerProvider; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.validation.ValidationException; -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -public class RemoteTomEEEJBContainer extends EJBContainer { - private static RemoteTomEEEJBContainer instance; - private RemoteServer container; - private InitialContext context; - - @Override - public void close() { - instance.container.destroy(); - instance.container = null; - } - - @Override - public Context getContext() { - return context; - } - - public static class Provider implements EJBContainerProvider { - private static final List<String> CONTAINER_NAMES = Arrays.asList(RemoteTomEEEJBContainer.class.getName(), "tomee-remote", "remote-tomee"); - - @Override - public EJBContainer createEJBContainer(final Map<?, ?> properties) { - final Object provider = properties.get(EJBContainer.PROVIDER); - int ejbContainerProviders = 1; - try { - ejbContainerProviders = ProviderLocator.getServices(EJBContainerProvider.class.getName(), EJBContainer.class, Thread.currentThread().getContextClassLoader()).size(); - } catch (final Exception e) { - // no-op - } - - if ((provider == null && ejbContainerProviders > 1) - || (!RemoteTomEEEJBContainer.class.equals(provider) - && !CONTAINER_NAMES.contains(String.valueOf(provider)))) { - return null; - } - - if (instance != null) { - return instance; - } - - final Object modules = properties.get(EJBContainer.MODULES); - - System.getProperties().putAll(properties); - final File home = new File(System.getProperty("openejb.home", "doesn't exist")); - if (!home.exists()) { - throw new IllegalArgumentException("You need to set openejb.home"); - } - - final QuickServerXmlParser parser = QuickServerXmlParser.parse(new File(home, "conf/server.xml")); - final String remoteEjb = System.getProperty(Context.PROVIDER_URL, "http://" + parser.host() + ":" + parser.http() + "/tomee/ejb"); - System.setProperty(RemoteServer.SERVER_SHUTDOWN_PORT, parser.stop()); - - try { - instance = new RemoteTomEEEJBContainer(); - instance.container = new RemoteServer(); - instance.container.setPortStartup(Integer.parseInt(parser.http())); - - try { - instance.container.start(Arrays.asList("-Dopenejb.system.apps=true", "-Dtomee.remote.support=true"), "start", true); - } catch (final Exception e) { - instance.container.destroy(); - throw e; - } - - instance.context = new InitialContext(new Properties() {{ - setProperty(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName()); - setProperty(Context.PROVIDER_URL, remoteEjb); - }}); - - Deployer deployer = null; - for (int i = 0; i < (properties.containsKey("retries") ? Integer.parseInt(String.class.cast(properties.get("retries"))) : 20); i++) { - deployer = Deployer.class.cast(instance.context.lookup("openejb/DeployerBusinessRemote")); - if (deployer != null) { - break; - } - } - if (deployer == null) { - throw new TomEERemoteEJBContainerException("Can't lookup deployer, eother increse retries or setup it correctly", new IllegalStateException()); - } - - if (modules instanceof File) { - final File file = File.class.cast(modules); - deployFile(deployer, file); - } else if (modules instanceof String) { - final String path = String.class.cast(modules); - final File file = new File(path); - deployFile(deployer, file); - } else if (modules instanceof String[]) { - for (final String path : (String[]) modules) { - deployFile(deployer, new File(path)); - } - } else if (modules instanceof File[]) { - for (final File file : (File[]) modules) { - deployFile(deployer, file); - } - } // else suppose already deployed - - return instance; - } catch (final OpenEJBException | MalformedURLException e) { - throw new EJBException(e); - } catch (final ValidationException ve) { - throw ve; - } catch (final Exception e) { - if (e instanceof EJBException) { - throw (EJBException) e; - } - throw new TomEERemoteEJBContainerException("initialization exception", e); - } - } - } - - private static void deployFile(final Deployer deployer, final File file) throws IOException, OpenEJBException { - if ("true".equalsIgnoreCase(System.getProperty(DeployerEjb.OPENEJB_USE_BINARIES, "false"))) { - final Properties props = new Properties(); - final byte[] slurpBinaries = IO.slurp(file).getBytes(); - props.put(DeployerEjb.OPENEJB_VALUE_BINARIES, slurpBinaries); - props.put(DeployerEjb.OPENEJB_PATH_BINARIES, file.getName()); - deployer.deploy(file.getAbsolutePath(), props); - } else { - deployer.deploy(file.getAbsolutePath()); - } - } - - protected static class TomEERemoteEJBContainerException extends RuntimeException { - protected TomEERemoteEJBContainerException(final String s, final Exception e) { - super(s, e); - } - } -} +/** + * 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 + * <p/> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p/> + * 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.tomee; + +import org.apache.geronimo.osgi.locator.ProviderLocator; +import org.apache.openejb.OpenEJBException; +import org.apache.openejb.assembler.Deployer; +import org.apache.openejb.assembler.DeployerEjb; +import org.apache.openejb.client.RemoteInitialContextFactory; +import org.apache.openejb.config.RemoteServer; +import org.apache.openejb.loader.IO; +import org.apache.tomee.util.QuickServerXmlParser; + +import javax.ejb.EJBException; +import javax.ejb.embeddable.EJBContainer; +import javax.ejb.spi.EJBContainerProvider; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.validation.ValidationException; +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +public class RemoteTomEEEJBContainer extends EJBContainer { + private static RemoteTomEEEJBContainer instance; + private RemoteServer container; + private InitialContext context; + + @Override + public void close() { + instance.container.destroy(); + instance.container = null; + } + + @Override + public Context getContext() { + return context; + } + + public static class Provider implements EJBContainerProvider { + private static final List<String> CONTAINER_NAMES = Arrays.asList(RemoteTomEEEJBContainer.class.getName(), "tomee-remote", "remote-tomee"); + + @Override + public EJBContainer createEJBContainer(final Map<?, ?> properties) { + final Object provider = properties.get(EJBContainer.PROVIDER); + int ejbContainerProviders = 1; + try { + ejbContainerProviders = ProviderLocator.getServices(EJBContainerProvider.class.getName(), EJBContainer.class, Thread.currentThread().getContextClassLoader()).size(); + } catch (final Exception e) { + // no-op + } + + if ((provider == null && ejbContainerProviders > 1) + || (!RemoteTomEEEJBContainer.class.equals(provider) + && !CONTAINER_NAMES.contains(String.valueOf(provider)))) { + return null; + } + + if (instance != null) { + return instance; + } + + final Object modules = properties.get(EJBContainer.MODULES); + + System.getProperties().putAll(properties); + final File home = new File(System.getProperty("openejb.home", "doesn't exist")); + if (!home.exists()) { + throw new IllegalArgumentException("You need to set openejb.home"); + } + + final QuickServerXmlParser parser = QuickServerXmlParser.parse(new File(home, "conf/server.xml")); + final String remoteEjb = System.getProperty(Context.PROVIDER_URL, "http://" + parser.host() + ":" + parser.http() + "/tomee/ejb"); + System.setProperty(RemoteServer.SERVER_SHUTDOWN_PORT, parser.stop()); + + try { + instance = new RemoteTomEEEJBContainer(); + instance.container = new RemoteServer(); + instance.container.setPortStartup(Integer.parseInt(parser.http())); + + try { + instance.container.start(Arrays.asList("-Dopenejb.system.apps=true", "-Dtomee.remote.support=true"), "start", true); + } catch (final Exception e) { + instance.container.destroy(); + throw e; + } + + instance.context = new InitialContext(new Properties() {{ + setProperty(Context.INITIAL_CONTEXT_FACTORY, RemoteInitialContextFactory.class.getName()); + setProperty(Context.PROVIDER_URL, remoteEjb); + }}); + + Deployer deployer = null; + for (int i = 0; i < (properties.containsKey("retries") ? Integer.parseInt(String.class.cast(properties.get("retries"))) : 20); i++) { + deployer = Deployer.class.cast(instance.context.lookup("openejb/DeployerBusinessRemote")); + if (deployer != null) { + break; + } + } + if (deployer == null) { + throw new TomEERemoteEJBContainerException("Can't lookup deployer, eother increse retries or setup it correctly", new IllegalStateException()); + } + + if (modules instanceof File) { + final File file = File.class.cast(modules); + deployFile(deployer, file); + } else if (modules instanceof String) { + final String path = String.class.cast(modules); + final File file = new File(path); + deployFile(deployer, file); + } else if (modules instanceof String[]) { + for (final String path : (String[]) modules) { + deployFile(deployer, new File(path)); + } + } else if (modules instanceof File[]) { + for (final File file : (File[]) modules) { + deployFile(deployer, file); + } + } // else suppose already deployed + + return instance; + } catch (final OpenEJBException | MalformedURLException e) { + throw new EJBException(e); + } catch (final ValidationException ve) { + throw ve; + } catch (final Exception e) { + if (e instanceof EJBException) { + throw (EJBException) e; + } + throw new TomEERemoteEJBContainerException("initialization exception", e); + } + } + } + + private static void deployFile(final Deployer deployer, final File file) throws IOException, OpenEJBException { + if ("true".equalsIgnoreCase(System.getProperty(DeployerEjb.OPENEJB_USE_BINARIES, "false"))) { + final Properties props = new Properties(); + final byte[] slurpBinaries = IO.slurp(file).getBytes(); + props.put(DeployerEjb.OPENEJB_VALUE_BINARIES, slurpBinaries); + props.put(DeployerEjb.OPENEJB_PATH_BINARIES, file.getName()); + deployer.deploy(file.getAbsolutePath(), props); + } else { + deployer.deploy(file.getAbsolutePath()); + } + } + + protected static class TomEERemoteEJBContainerException extends RuntimeException { + protected TomEERemoteEJBContainerException(final String s, final Exception e) { + super(s, e); + } + } +} http://git-wip-us.apache.org/repos/asf/tomee/blob/3069db0b/tomee/apache-tomee/src/main/resources/service.bat ---------------------------------------------------------------------- diff --git a/tomee/apache-tomee/src/main/resources/service.bat b/tomee/apache-tomee/src/main/resources/service.bat index 5d2efbd..900526b 100644 --- a/tomee/apache-tomee/src/main/resources/service.bat +++ b/tomee/apache-tomee/src/main/resources/service.bat @@ -1,226 +1,226 @@ -@echo off -rem Licensed to the Apache Software Foundation (ASF) under one or more -rem contributor license agreements. See the NOTICE file distributed with -rem this work for additional information regarding copyright ownership. -rem The ASF licenses this file to You under the Apache License, Version 2.0 -rem (the "License"); you may not use this file except in compliance with -rem the License. You may obtain a copy of the License at -rem -rem http://www.apache.org/licenses/LICENSE-2.0 -rem -rem Unless required by applicable law or agreed to in writing, software -rem distributed under the License is distributed on an "AS IS" BASIS, -rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -rem See the License for the specific language governing permissions and -rem limitations under the License. - -rem The following line can be used to define a specific jre or jdk path -rem set "JAVA_HOME=C:/JDK" - -REM Prefer a local JRE if we find one in the current bin directory -IF EXIST "%~dp0jre" ( - SET "JRE_HOME=%~dp0jre" -) - -REM Prefer a local JDK if we find one in the current bin directory -IF EXIST "%~dp0jdk" ( - SET "JAVA_HOME=%~dp0jdk" -) - -@IF DEFINED ECHO ECHO %ECHO% -@IF "%OS%" == "Windows_NT" setlocal - -IF "%OS%" == "Windows_NT" ( - SET "DIRNAME=%~dp0%" -) ELSE ( - SET DIRNAME=.\ -) - -pushd %DIRNAME% - -rem --------------------------------------------------------------------------- -rem NT Service Install/Uninstall script -rem -rem Options -rem install Install the service using TomEE as service name. -rem Service is installed using default settings. -rem remove Remove the service from the System. -rem -rem name (optional) If the second argument is present it is considered -rem to be new service name -rem -rem $Id: service.bat 1000718 2010-09-24 06:00:00Z mturk $ -rem --------------------------------------------------------------------------- - -SET proc=undefined - -IF /i %PROCESSOR_ARCHITECTURE% EQU X86 SET "proc=%~dp0TomEE.x86.exe" -IF /i %PROCESSOR_ARCHITECTURE% EQU AMD64 SET "proc=%~dp0TomEE.amd64.exe" -IF /i %PROCESSOR_ARCHITECTURE% EQU IA64 SET "proc=%~dp0TomEE.ia64.exe" - -IF /i "%proc%" EQU undefined ( - ECHO Failed to determine OS architecture - GOTO end -) - -set "SELF=%~dp0%service.bat" -rem Guess CATALINA_HOME if not defined -set "CURRENT_DIR=%cd%" -if DEFINED CATALINA_HOME goto gotHome -set "CATALINA_HOME=%cd%" -if exist "%CATALINA_HOME%\bin\service.bat" goto okHome -rem CD to the upper dir -cd .. -set "CATALINA_HOME=%cd%" -:gotHome -if exist "%CATALINA_HOME%\bin\service.bat" goto okHome -echo The service exe was not found... -echo The CATALINA_HOME environment variable is not defined correctly. -echo This environment variable is needed to run this program -goto end -:okHome -rem Make sure prerequisite environment variables are set -if DEFINED JAVA_HOME goto gotJdkHome -if DEFINED JRE_HOME goto gotJreHome -echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined -echo Service will try to guess them from the registry. -goto okJavaHome -:gotJreHome -if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome -if not exist "%JRE_HOME%\bin\javaw.exe" goto noJavaHome -goto okJavaHome -:gotJdkHome -if not exist "%JAVA_HOME%\jre\bin\java.exe" goto noJavaHome -if not exist "%JAVA_HOME%\jre\bin\javaw.exe" goto noJavaHome -if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome -if not "%JRE_HOME%" == "" goto okJavaHome -set "JRE_HOME=%JAVA_HOME%\jre" -goto okJavaHome -:noJavaHome -echo The JAVA_HOME environment variable is not defined correctly -echo This environment variable is needed to run this program -echo NB: JAVA_HOME should point to a JDK not a JRE -goto end -:okJavaHome -if DEFINED CATALINA_BASE goto gotBase -set "CATALINA_BASE=%CATALINA_HOME%" -:gotBase - -set "EXECUTABLE=%proc%" - -rem Set default Service name (If you change this then rename also TomEE.exe to the same name) -set SERVICE_NAME=TomEE -set PR_DISPLAYNAME=Apache TomEE - -if "x%1x" == "xx" goto displayUsage -set SERVICE_CMD=%1 -shift -if "x%1x" == "xx" goto checkServiceCmd -:checkUser -if "x%1x" == "x/userx" goto runAsUser -if "x%1x" == "x--userx" goto runAsUser -set SERVICE_NAME=%1 -set PR_DISPLAYNAME=Apache TomEE (%1) -shift -if "x%1x" == "xx" goto checkServiceCmd -goto checkUser -:runAsUser -shift -if "x%1x" == "xx" goto displayUsage -set SERVICE_USER=%1 -shift -runas /env /savecred /user:%SERVICE_USER% "%COMSPEC% /K \"%SELF%\" %SERVICE_CMD% %SERVICE_NAME%" -goto end -:checkServiceCmd -if /i %SERVICE_CMD% == install goto doInstall -if /i %SERVICE_CMD% == remove goto doRemove -if /i %SERVICE_CMD% == uninstall goto doRemove -echo Unknown parameter "%1" -:displayUsage -echo. -echo Usage: service.bat install/remove [service_name] [/user username] -goto end - -:doRemove -rem Remove the service -"%EXECUTABLE%" //DS//%SERVICE_NAME% -if not errorlevel 1 goto removed -echo Failed removing '%SERVICE_NAME%' service -goto end -:removed -echo The service '%SERVICE_NAME%' has been removed -goto end - -:doInstall -rem Install the service -echo Installing the service '%SERVICE_NAME%' ... -echo Using CATALINA_HOME: "%CATALINA_HOME%" -echo Using CATALINA_BASE: "%CATALINA_BASE%" -echo Using JAVA_HOME: "%JAVA_HOME%" -echo Using JRE_HOME: "%JRE_HOME%" - -rem Use the environment variables as an example -rem Each command line option is prefixed with PR_ - -set "PR_DESCRIPTION=Apache TomEE - http://tomee.apache.org/" -set "PR_INSTALL=%EXECUTABLE%" -set "PR_LOGPATH=%CATALINA_BASE%\logs" -set "PR_CLASSPATH=%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_BASE%\bin\tomcat-juli.jar;%CATALINA_HOME%\bin\tomcat-juli.jar" -rem Set the server jvm from JAVA_HOME -set "PR_JVM=%JRE_HOME%\bin\server\jvm.dll" -if exist "%PR_JVM%" goto foundJvm -rem Set the client jvm from JAVA_HOME -set "PR_JVM=%JRE_HOME%\bin\client\jvm.dll" -if exist "%PR_JVM%" goto foundJvm -set PR_JVM=auto -:foundJvm -echo Using JVM: "%PR_JVM%" - -"%EXECUTABLE%" //IS//%SERVICE_NAME% ^ - --DisplayName=%SERVICE_NAME% ^ - --StartClass org.apache.catalina.startup.Bootstrap ^ - --StopClass org.apache.catalina.startup.Bootstrap ^ - --StartParams start ^ - --StopParams stop ^ - --Startup auto ^ - --JvmMs=512 ^ - --JvmMx=1024 ^ - --JvmSs=2048 ^ - --StartMode jvm ^ - --StopMode jvm ^ - --LogLevel Info ^ - --LogPrefix TomEE - -echo Installed, will now configure TomEE - -if not errorlevel 1 goto installed -echo Failed installing '%SERVICE_NAME%' service -goto end - -:installed -rem Clear the environment variables. They are not needed any more. -set PR_DISPLAYNAME= -set PR_DESCRIPTION= -set PR_INSTALL= -set PR_LOGPATH= -set PR_CLASSPATH= -set PR_JVM= - -rem Set extra parameters -"%EXECUTABLE%" //US//%SERVICE_NAME% ^ - ++JvmOptions "-javaagent:%CATALINA_HOME%\lib\openejb-javaagent.jar;-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" - -rem More extra parameters -set "PR_LOGPATH=%CATALINA_BASE%\logs" -set PR_STDOUTPUT=auto -set PR_STDERROR=auto - -rem before this option was added: "++JvmOptions=-Djava.library.path="%CATALINA_BASE%\bin" ^" -rem the drawback was it was preventing custom native lib to be loaded even if added to Path -"%EXECUTABLE%" //US//%SERVICE_NAME% ^ - ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties;-Djava.awt.headless=true;-XX:+UseParallelGC;-XX:MaxPermSize=256M" - -echo The service '%SERVICE_NAME%' has been installed. - -:end -cd "%CURRENT_DIR%" +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +rem The following line can be used to define a specific jre or jdk path +rem set "JAVA_HOME=C:/JDK" + +REM Prefer a local JRE if we find one in the current bin directory +IF EXIST "%~dp0jre" ( + SET "JRE_HOME=%~dp0jre" +) + +REM Prefer a local JDK if we find one in the current bin directory +IF EXIST "%~dp0jdk" ( + SET "JAVA_HOME=%~dp0jdk" +) + +@IF DEFINED ECHO ECHO %ECHO% +@IF "%OS%" == "Windows_NT" setlocal + +IF "%OS%" == "Windows_NT" ( + SET "DIRNAME=%~dp0%" +) ELSE ( + SET DIRNAME=.\ +) + +pushd %DIRNAME% + +rem --------------------------------------------------------------------------- +rem NT Service Install/Uninstall script +rem +rem Options +rem install Install the service using TomEE as service name. +rem Service is installed using default settings. +rem remove Remove the service from the System. +rem +rem name (optional) If the second argument is present it is considered +rem to be new service name +rem +rem $Id: service.bat 1000718 2010-09-24 06:00:00Z mturk $ +rem --------------------------------------------------------------------------- + +SET proc=undefined + +IF /i %PROCESSOR_ARCHITECTURE% EQU X86 SET "proc=%~dp0TomEE.x86.exe" +IF /i %PROCESSOR_ARCHITECTURE% EQU AMD64 SET "proc=%~dp0TomEE.amd64.exe" +IF /i %PROCESSOR_ARCHITECTURE% EQU IA64 SET "proc=%~dp0TomEE.ia64.exe" + +IF /i "%proc%" EQU undefined ( + ECHO Failed to determine OS architecture + GOTO end +) + +set "SELF=%~dp0%service.bat" +rem Guess CATALINA_HOME if not defined +set "CURRENT_DIR=%cd%" +if DEFINED CATALINA_HOME goto gotHome +set "CATALINA_HOME=%cd%" +if exist "%CATALINA_HOME%\bin\service.bat" goto okHome +rem CD to the upper dir +cd .. +set "CATALINA_HOME=%cd%" +:gotHome +if exist "%CATALINA_HOME%\bin\service.bat" goto okHome +echo The service exe was not found... +echo The CATALINA_HOME environment variable is not defined correctly. +echo This environment variable is needed to run this program +goto end +:okHome +rem Make sure prerequisite environment variables are set +if DEFINED JAVA_HOME goto gotJdkHome +if DEFINED JRE_HOME goto gotJreHome +echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined +echo Service will try to guess them from the registry. +goto okJavaHome +:gotJreHome +if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome +if not exist "%JRE_HOME%\bin\javaw.exe" goto noJavaHome +goto okJavaHome +:gotJdkHome +if not exist "%JAVA_HOME%\jre\bin\java.exe" goto noJavaHome +if not exist "%JAVA_HOME%\jre\bin\javaw.exe" goto noJavaHome +if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome +if not "%JRE_HOME%" == "" goto okJavaHome +set "JRE_HOME=%JAVA_HOME%\jre" +goto okJavaHome +:noJavaHome +echo The JAVA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +echo NB: JAVA_HOME should point to a JDK not a JRE +goto end +:okJavaHome +if DEFINED CATALINA_BASE goto gotBase +set "CATALINA_BASE=%CATALINA_HOME%" +:gotBase + +set "EXECUTABLE=%proc%" + +rem Set default Service name (If you change this then rename also TomEE.exe to the same name) +set SERVICE_NAME=TomEE +set PR_DISPLAYNAME=Apache TomEE + +if "x%1x" == "xx" goto displayUsage +set SERVICE_CMD=%1 +shift +if "x%1x" == "xx" goto checkServiceCmd +:checkUser +if "x%1x" == "x/userx" goto runAsUser +if "x%1x" == "x--userx" goto runAsUser +set SERVICE_NAME=%1 +set PR_DISPLAYNAME=Apache TomEE (%1) +shift +if "x%1x" == "xx" goto checkServiceCmd +goto checkUser +:runAsUser +shift +if "x%1x" == "xx" goto displayUsage +set SERVICE_USER=%1 +shift +runas /env /savecred /user:%SERVICE_USER% "%COMSPEC% /K \"%SELF%\" %SERVICE_CMD% %SERVICE_NAME%" +goto end +:checkServiceCmd +if /i %SERVICE_CMD% == install goto doInstall +if /i %SERVICE_CMD% == remove goto doRemove +if /i %SERVICE_CMD% == uninstall goto doRemove +echo Unknown parameter "%1" +:displayUsage +echo. +echo Usage: service.bat install/remove [service_name] [/user username] +goto end + +:doRemove +rem Remove the service +"%EXECUTABLE%" //DS//%SERVICE_NAME% +if not errorlevel 1 goto removed +echo Failed removing '%SERVICE_NAME%' service +goto end +:removed +echo The service '%SERVICE_NAME%' has been removed +goto end + +:doInstall +rem Install the service +echo Installing the service '%SERVICE_NAME%' ... +echo Using CATALINA_HOME: "%CATALINA_HOME%" +echo Using CATALINA_BASE: "%CATALINA_BASE%" +echo Using JAVA_HOME: "%JAVA_HOME%" +echo Using JRE_HOME: "%JRE_HOME%" + +rem Use the environment variables as an example +rem Each command line option is prefixed with PR_ + +set "PR_DESCRIPTION=Apache TomEE - http://tomee.apache.org/" +set "PR_INSTALL=%EXECUTABLE%" +set "PR_LOGPATH=%CATALINA_BASE%\logs" +set "PR_CLASSPATH=%CATALINA_HOME%\bin\bootstrap.jar;%CATALINA_BASE%\bin\tomcat-juli.jar;%CATALINA_HOME%\bin\tomcat-juli.jar" +rem Set the server jvm from JAVA_HOME +set "PR_JVM=%JRE_HOME%\bin\server\jvm.dll" +if exist "%PR_JVM%" goto foundJvm +rem Set the client jvm from JAVA_HOME +set "PR_JVM=%JRE_HOME%\bin\client\jvm.dll" +if exist "%PR_JVM%" goto foundJvm +set PR_JVM=auto +:foundJvm +echo Using JVM: "%PR_JVM%" + +"%EXECUTABLE%" //IS//%SERVICE_NAME% ^ + --DisplayName=%SERVICE_NAME% ^ + --StartClass org.apache.catalina.startup.Bootstrap ^ + --StopClass org.apache.catalina.startup.Bootstrap ^ + --StartParams start ^ + --StopParams stop ^ + --Startup auto ^ + --JvmMs=512 ^ + --JvmMx=1024 ^ + --JvmSs=2048 ^ + --StartMode jvm ^ + --StopMode jvm ^ + --LogLevel Info ^ + --LogPrefix TomEE + +echo Installed, will now configure TomEE + +if not errorlevel 1 goto installed +echo Failed installing '%SERVICE_NAME%' service +goto end + +:installed +rem Clear the environment variables. They are not needed any more. +set PR_DISPLAYNAME= +set PR_DESCRIPTION= +set PR_INSTALL= +set PR_LOGPATH= +set PR_CLASSPATH= +set PR_JVM= + +rem Set extra parameters +"%EXECUTABLE%" //US//%SERVICE_NAME% ^ + ++JvmOptions "-javaagent:%CATALINA_HOME%\lib\openejb-javaagent.jar;-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" + +rem More extra parameters +set "PR_LOGPATH=%CATALINA_BASE%\logs" +set PR_STDOUTPUT=auto +set PR_STDERROR=auto + +rem before this option was added: "++JvmOptions=-Djava.library.path="%CATALINA_BASE%\bin" ^" +rem the drawback was it was preventing custom native lib to be loaded even if added to Path +"%EXECUTABLE%" //US//%SERVICE_NAME% ^ + ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties;-Djava.awt.headless=true;-XX:+UseParallelGC;-XX:MaxPermSize=256M" + +echo The service '%SERVICE_NAME%' has been installed. + +:end +cd "%CURRENT_DIR%" http://git-wip-us.apache.org/repos/asf/tomee/blob/3069db0b/tomee/apache-tomee/src/main/resources/service.install.as.admin.bat ---------------------------------------------------------------------- diff --git a/tomee/apache-tomee/src/main/resources/service.install.as.admin.bat b/tomee/apache-tomee/src/main/resources/service.install.as.admin.bat index 8569a4d..dcfbe6b 100644 --- a/tomee/apache-tomee/src/main/resources/service.install.as.admin.bat +++ b/tomee/apache-tomee/src/main/resources/service.install.as.admin.bat @@ -1,33 +1,33 @@ -@echo off -cls -REM================================================ -REM Licensed to the Apache Software Foundation (ASF) under one or more -REM contributor license agreements. See the NOTICE file distributed with -REM this work for additional information regarding copyright ownership. -REM The ASF licenses this file to You under the Apache License, Version 2.0 -REM (the "License"); you may not use this file except in compliance with -REM the License. You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. -REM _______________________________________________ -REM $Rev$ -REM================================================ - -@if not "%ECHO%" == "" echo %ECHO% -@if "%OS%" == "Windows_NT" setlocal - -if "%OS%" == "Windows_NT" ( - set "DIRNAME=%~dp0%" -) else ( - set DIRNAME=.\ -) - -pushd %DIRNAME% - +@echo off +cls +REM================================================ +REM Licensed to the Apache Software Foundation (ASF) under one or more +REM contributor license agreements. See the NOTICE file distributed with +REM this work for additional information regarding copyright ownership. +REM The ASF licenses this file to You under the Apache License, Version 2.0 +REM (the "License"); you may not use this file except in compliance with +REM the License. You may obtain a copy of the License at +REM +REM http://www.apache.org/licenses/LICENSE-2.0 +REM +REM Unless required by applicable law or agreed to in writing, software +REM distributed under the License is distributed on an "AS IS" BASIS, +REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +REM See the License for the specific language governing permissions and +REM limitations under the License. +REM _______________________________________________ +REM $Rev$ +REM================================================ + +@if not "%ECHO%" == "" echo %ECHO% +@if "%OS%" == "Windows_NT" setlocal + +if "%OS%" == "Windows_NT" ( + set "DIRNAME=%~dp0%" +) else ( + set DIRNAME=.\ +) + +pushd %DIRNAME% + service install \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/3069db0b/tomee/apache-tomee/src/main/resources/service.remove.as.admin.bat ---------------------------------------------------------------------- diff --git a/tomee/apache-tomee/src/main/resources/service.remove.as.admin.bat b/tomee/apache-tomee/src/main/resources/service.remove.as.admin.bat index 3b5d4ac..bc5fe0a 100644 --- a/tomee/apache-tomee/src/main/resources/service.remove.as.admin.bat +++ b/tomee/apache-tomee/src/main/resources/service.remove.as.admin.bat @@ -1,33 +1,33 @@ -@echo off -cls -REM================================================ -REM Licensed to the Apache Software Foundation (ASF) under one or more -REM contributor license agreements. See the NOTICE file distributed with -REM this work for additional information regarding copyright ownership. -REM The ASF licenses this file to You under the Apache License, Version 2.0 -REM (the "License"); you may not use this file except in compliance with -REM the License. You may obtain a copy of the License at -REM -REM http://www.apache.org/licenses/LICENSE-2.0 -REM -REM Unless required by applicable law or agreed to in writing, software -REM distributed under the License is distributed on an "AS IS" BASIS, -REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -REM See the License for the specific language governing permissions and -REM limitations under the License. -REM _______________________________________________ -REM $Rev$ -REM================================================ - -@if not "%ECHO%" == "" echo %ECHO% -@if "%OS%" == "Windows_NT" setlocal - -if "%OS%" == "Windows_NT" ( - set "DIRNAME=%~dp0%" -) else ( - set DIRNAME=.\ -) - -pushd %DIRNAME% - +@echo off +cls +REM================================================ +REM Licensed to the Apache Software Foundation (ASF) under one or more +REM contributor license agreements. See the NOTICE file distributed with +REM this work for additional information regarding copyright ownership. +REM The ASF licenses this file to You under the Apache License, Version 2.0 +REM (the "License"); you may not use this file except in compliance with +REM the License. You may obtain a copy of the License at +REM +REM http://www.apache.org/licenses/LICENSE-2.0 +REM +REM Unless required by applicable law or agreed to in writing, software +REM distributed under the License is distributed on an "AS IS" BASIS, +REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +REM See the License for the specific language governing permissions and +REM limitations under the License. +REM _______________________________________________ +REM $Rev$ +REM================================================ + +@if not "%ECHO%" == "" echo %ECHO% +@if "%OS%" == "Windows_NT" setlocal + +if "%OS%" == "Windows_NT" ( + set "DIRNAME=%~dp0%" +) else ( + set DIRNAME=.\ +) + +pushd %DIRNAME% + service remove \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/3069db0b/tomee/apache-tomee/src/main/resources/tomee.bat ---------------------------------------------------------------------- diff --git a/tomee/apache-tomee/src/main/resources/tomee.bat b/tomee/apache-tomee/src/main/resources/tomee.bat index ab1bc04..c3a3a5a 100644 --- a/tomee/apache-tomee/src/main/resources/tomee.bat +++ b/tomee/apache-tomee/src/main/resources/tomee.bat @@ -1,90 +1,90 @@ -@echo off -rem Licensed to the Apache Software Foundation (ASF) under one or more -rem contributor license agreements. See the NOTICE file distributed with -rem this work for additional information regarding copyright ownership. -rem The ASF licenses this file to You under the Apache License, Version 2.0 -rem (the "License"); you may not use this file except in compliance with -rem the License. You may obtain a copy of the License at -rem -rem http://www.apache.org/licenses/LICENSE-2.0 -rem -rem Unless required by applicable law or agreed to in writing, software -rem distributed under the License is distributed on an "AS IS" BASIS, -rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -rem See the License for the specific language governing permissions and -rem limitations under the License. - -if "%OS%" == "Windows_NT" setlocal - -set port=8080 - -rem Guess CATALINA_HOME if not defined -set "CURRENT_DIR=%cd%" -if DEFINED CATALINA_HOME goto gotHome -set "CATALINA_HOME=%CURRENT_DIR%" -if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome -cd .. -set "CATALINA_HOME=%cd%" -cd "%CURRENT_DIR%" -:gotHome - -if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome -echo The CATALINA_HOME environment variable is not defined correctly -echo This environment variable is needed to run this program -goto end -:okHome - -rem Copy CATALINA_BASE from CATALINA_HOME if not defined -if DEFINED CATALINA_BASE goto gotBase -set "CATALINA_BASE=%CATALINA_HOME%" -:gotBase - -rem Ensure that any user defined CLASSPATH variables are not used on startup, -rem but allow them to be specified in setenv.bat, in rare case when it is needed. -set CLASSPATH= - -rem Get standard Java environment variables -if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath -echo Cannot find "%CATALINA_HOME%\bin\setclasspath.bat" -echo This file is needed to run this program -goto end -:okSetclasspath -call "%CATALINA_HOME%\bin\setclasspath.bat" %1 -if errorlevel 1 goto end - -if DEFINED CATALINA_TMPDIR goto gotTmpdir -set "CATALINA_TMPDIR=%CATALINA_BASE%\temp" -:gotTmpdir - - -rem create classpath -setlocal enabledelayedexpansion - -set "CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\tomcat-juli.jar" -set lib="%CATALINA_HOME%\lib\" -echo %lib% -for %%F in (%lib%/*.jar) do ( - set CLASSPATH=!CLASSPATH!;%%F% -) - -if ""%1"" == ""deploy"" goto doDeploy -if ""%1"" == ""undeploy"" goto doUndeploy -if ""%1"" == ""start"" goto unsupportedCmd -if ""%1"" == ""stop"" goto unsupportedCmd -goto doExec - -:doDeploy -:doUndeploy -"%_RUNJAVA%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" org.apache.openejb.cli.Bootstrap %1 -s http://localhost:%port%/tomee/ejb %2 -goto end - -:unsupportedCmd -echo start/stop commands are not compatible with tomee.bat, please use catalina.bar/startup.bat/shutdown.bat -goto end - -:doExec -"%_RUNJAVA%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" org.apache.openejb.cli.Bootstrap %* -goto end - -:end - +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +if "%OS%" == "Windows_NT" setlocal + +set port=8080 + +rem Guess CATALINA_HOME if not defined +set "CURRENT_DIR=%cd%" +if DEFINED CATALINA_HOME goto gotHome +set "CATALINA_HOME=%CURRENT_DIR%" +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +cd .. +set "CATALINA_HOME=%cd%" +cd "%CURRENT_DIR%" +:gotHome + +if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome +echo The CATALINA_HOME environment variable is not defined correctly +echo This environment variable is needed to run this program +goto end +:okHome + +rem Copy CATALINA_BASE from CATALINA_HOME if not defined +if DEFINED CATALINA_BASE goto gotBase +set "CATALINA_BASE=%CATALINA_HOME%" +:gotBase + +rem Ensure that any user defined CLASSPATH variables are not used on startup, +rem but allow them to be specified in setenv.bat, in rare case when it is needed. +set CLASSPATH= + +rem Get standard Java environment variables +if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath +echo Cannot find "%CATALINA_HOME%\bin\setclasspath.bat" +echo This file is needed to run this program +goto end +:okSetclasspath +call "%CATALINA_HOME%\bin\setclasspath.bat" %1 +if errorlevel 1 goto end + +if DEFINED CATALINA_TMPDIR goto gotTmpdir +set "CATALINA_TMPDIR=%CATALINA_BASE%\temp" +:gotTmpdir + + +rem create classpath +setlocal enabledelayedexpansion + +set "CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\tomcat-juli.jar" +set lib="%CATALINA_HOME%\lib\" +echo %lib% +for %%F in (%lib%/*.jar) do ( + set CLASSPATH=!CLASSPATH!;%%F% +) + +if ""%1"" == ""deploy"" goto doDeploy +if ""%1"" == ""undeploy"" goto doUndeploy +if ""%1"" == ""start"" goto unsupportedCmd +if ""%1"" == ""stop"" goto unsupportedCmd +goto doExec + +:doDeploy +:doUndeploy +"%_RUNJAVA%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" org.apache.openejb.cli.Bootstrap %1 -s http://localhost:%port%/tomee/ejb %2 +goto end + +:unsupportedCmd +echo start/stop commands are not compatible with tomee.bat, please use catalina.bar/startup.bat/shutdown.bat +goto end + +:doExec +"%_RUNJAVA%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" org.apache.openejb.cli.Bootstrap %* +goto end + +:end +
