http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/arquillian/arquillian-tomee-webapp-remote/src/main/java/org/apache/tomee/arquillian/webapp/TomEEWebappContainer.java ---------------------------------------------------------------------- diff --git a/arquillian/arquillian-tomee-webapp-remote/src/main/java/org/apache/tomee/arquillian/webapp/TomEEWebappContainer.java b/arquillian/arquillian-tomee-webapp-remote/src/main/java/org/apache/tomee/arquillian/webapp/TomEEWebappContainer.java index 738e375..381be1e 100644 --- a/arquillian/arquillian-tomee-webapp-remote/src/main/java/org/apache/tomee/arquillian/webapp/TomEEWebappContainer.java +++ b/arquillian/arquillian-tomee-webapp-remote/src/main/java/org/apache/tomee/arquillian/webapp/TomEEWebappContainer.java @@ -1,247 +1,247 @@ -/* - * 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.tomee.arquillian.webapp; - -import org.apache.openejb.arquillian.common.ArquillianFilterRunner; -import org.apache.openejb.arquillian.common.Files; -import org.apache.openejb.arquillian.common.IO; -import org.apache.openejb.arquillian.common.Setup; -import org.apache.openejb.arquillian.common.TomEEContainer; -import org.apache.openejb.arquillian.common.Zips; -import org.apache.openejb.config.RemoteServer; -import org.apache.tomee.installer.Installer; -import org.apache.tomee.installer.Paths; -import org.jboss.arquillian.container.spi.client.container.LifecycleException; -import org.jboss.arquillian.protocol.servlet.ServletMethodExecutor; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.util.Arrays; -import java.util.Map; -import java.util.TreeMap; -import java.util.logging.Level; -import java.util.logging.Logger; - -/* - * TODO: delete old embedded adapter, move the tests and set those up - */ -public class TomEEWebappContainer extends TomEEContainer<TomEEWebappConfiguration> { - - private static final Logger logger = Logger.getLogger(TomEEWebappContainer.class.getName()); - - private RemoteServer container; - private boolean shutdown; - private File openejbHome; - private boolean wereOpenejbHomeSet = true; - - @Override - public void start() throws LifecycleException { - // see if TomEE is already running by checking the http port - final int httpPort = configuration.getHttpPort(); - if (Setup.isRunning(configuration.getHost(), httpPort)) { - - logger.info(String.format("Tomcat found running on port %s", httpPort)); - - return; - } - - shutdown = true; - - final String s = File.separator; - try { - final File workingDirectory = new File(configuration.getDir()); - - if (workingDirectory.exists()) { - - Files.assertDir(workingDirectory); - - } else { - - Files.mkdir(workingDirectory); - Files.deleteOnExit(workingDirectory); - } - - Files.readable(workingDirectory); - Files.writable(workingDirectory); - - openejbHome = Setup.findHome(workingDirectory); - Installer installer = null; - - if (openejbHome == null) { - - downloadTomcat(workingDirectory, configuration.getTomcatVersion()); - - openejbHome = Setup.findHome(workingDirectory); - - Files.deleteOnExit(openejbHome); - - final File webapp = new File(openejbHome, "webapps" + s + "tomee"); - - Files.mkdir(webapp); - downloadOpenEJBWebapp(webapp); - - System.setProperty("catalina.home", openejbHome.getAbsolutePath()); - System.setProperty("catalina.base", openejbHome.getAbsolutePath()); - - System.setProperty("openejb.deploymentId.format", System.getProperty("openejb.deploymentId.format", "{appId}/{ejbJarId}/{ejbName}")); - - final Paths paths = new Paths(webapp); - installer = new Installer(paths, true); - if (!configuration.isUseInstallerServlet()) { - installer.installAll(); - - } - - wereOpenejbHomeSet = false; - } - - Files.assertDir(openejbHome); - Files.readable(openejbHome); - Files.writable(openejbHome); - - Setup.configureServerXml(openejbHome, configuration); - Setup.configureSystemProperties(openejbHome, configuration); - - Setup.exportProperties(openejbHome, configuration, true); - - final URL logging = Thread.currentThread().getContextClassLoader().getResource("default.remote.logging.properties"); - if (logging != null) { - write(logging, new File(openejbHome, "conf" + s + "logging.properties")); - } - - if (configuration.isRemoveUnusedWebapps()) { - Setup.removeUselessWebapps(openejbHome, "tomee"); - } - - if (logger.isLoggable(Level.FINE)) { - final Map<Object, Object> map = new TreeMap<Object, Object>(System.getProperties()); - for (final Map.Entry<Object, Object> entry : map.entrySet()) { - System.out.printf("%s = %s\n", entry.getKey(), entry.getValue()); - } - } - - Setup.installArquillianBeanDiscoverer(openejbHome); - - if (!wereOpenejbHomeSet && configuration.isUseInstallerServlet()) { - // instead of calling the Installer, let's just do like users do - // call the servlet installer instead - final String baseUrl = "http://" + configuration.getHost() + ":" + httpPort + "/tomee/installer"; - - assert installer != null; - installer.addTomEEAdminConfInTomcatUsers(true); - - final RemoteServer tmpContainer = new RemoteServer(); - tmpContainer.setPortStartup(httpPort); - try { - tmpContainer.start(); - } catch (final Exception e) { - tmpContainer.destroy(); - throw e; - } - - final URL url = new URL(baseUrl); - logger.info("Calling TomEE Installer Servlet on " + url); - - for (int i = 0; i < 3; i++) { - final URLConnection uc = url.openConnection(); - // dG9tZWU6dG9tZWU= --> Base64 of tomee:tomee - final String authorizationString = "Basic dG9tZWU6dG9tZWU="; - uc.setRequestProperty("Authorization", authorizationString); - try { - final InputStream is = uc.getInputStream(); - org.apache.openejb.loader.IO.slurp(is); - is.close(); - break; - } catch (final Exception e) { - logger.warning(e.getMessage()); - Thread.sleep(1000); - } - } - - tmpContainer.stop(); - tmpContainer.getServer().waitFor(); - } - - container = new RemoteServer(); - container.setPortStartup(httpPort); - container.start(Arrays.asList("-Dorg.apache.openejb.servlet.filters=" + ArquillianFilterRunner.class.getName() + "=" + ServletMethodExecutor.ARQUILLIAN_SERVLET_MAPPING), "start", true); - container.killOnExit(); - } catch (final Exception e) { - container.destroy(); - throw new LifecycleException("Unable to start remote container", e); - } - } - - private static void write(final URL resource, final File file) throws IOException { - if (file.exists()) { - Files.delete(file); - } - final InputStream is = org.apache.openejb.loader.IO.read(resource); - - try { - IO.copy(is, file); - } finally { - is.close(); - } - } - - protected void downloadOpenEJBWebapp(final File targetDirectory) throws LifecycleException { - final String artifactName = configuration.getArtifactName(); - final File zipFile = Setup.downloadFile(artifactName, null); - Zips.unzip(zipFile, targetDirectory); - } - - protected void downloadTomcat(final File catalinaDirectory, final String tomcatVersion) throws LifecycleException { - String source = null; - - if (tomcatVersion.startsWith("7.")) { - source = "http://archive.apache.org/dist/tomcat/tomcat-7/v" + tomcatVersion + "/bin/apache-tomcat-" + tomcatVersion + ".zip"; - } - - if (tomcatVersion.startsWith("6.")) { - source = "http://archive.apache.org/dist/tomcat/tomcat-6/v" + tomcatVersion + "/bin/apache-tomcat-" + tomcatVersion + ".zip"; - } - - if (tomcatVersion.startsWith("5.5")) { - source = "http://archive.apache.org/dist/tomcat/tomcat-5/v" + tomcatVersion + "/bin/apache-tomcat-" + tomcatVersion + ".zip"; - } - - if (source == null) { - throw new LifecycleException("Unable to find URL for Tomcat " + tomcatVersion); - } - - final File zipFile = Setup.downloadFile("org.apache.tomcat:tomcat:" + tomcatVersion + ":zip", source); - Zips.unzip(zipFile, catalinaDirectory); - } - - @Override - public void stop() throws LifecycleException { - // only stop the container if we started it - if (shutdown) { - Setup.removeArquillianBeanDiscoverer(openejbHome); - container.destroy(); - } - } - - @Override - public Class<TomEEWebappConfiguration> getConfigurationClass() { - return TomEEWebappConfiguration.class; - } -} +/* + * 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.tomee.arquillian.webapp; + +import org.apache.openejb.arquillian.common.ArquillianFilterRunner; +import org.apache.openejb.arquillian.common.Files; +import org.apache.openejb.arquillian.common.IO; +import org.apache.openejb.arquillian.common.Setup; +import org.apache.openejb.arquillian.common.TomEEContainer; +import org.apache.openejb.arquillian.common.Zips; +import org.apache.openejb.config.RemoteServer; +import org.apache.tomee.installer.Installer; +import org.apache.tomee.installer.Paths; +import org.jboss.arquillian.container.spi.client.container.LifecycleException; +import org.jboss.arquillian.protocol.servlet.ServletMethodExecutor; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.net.URLConnection; +import java.util.Arrays; +import java.util.Map; +import java.util.TreeMap; +import java.util.logging.Level; +import java.util.logging.Logger; + +/* + * TODO: delete old embedded adapter, move the tests and set those up + */ +public class TomEEWebappContainer extends TomEEContainer<TomEEWebappConfiguration> { + + private static final Logger logger = Logger.getLogger(TomEEWebappContainer.class.getName()); + + private RemoteServer container; + private boolean shutdown; + private File openejbHome; + private boolean wereOpenejbHomeSet = true; + + @Override + public void start() throws LifecycleException { + // see if TomEE is already running by checking the http port + final int httpPort = configuration.getHttpPort(); + if (Setup.isRunning(configuration.getHost(), httpPort)) { + + logger.info(String.format("Tomcat found running on port %s", httpPort)); + + return; + } + + shutdown = true; + + final String s = File.separator; + try { + final File workingDirectory = new File(configuration.getDir()); + + if (workingDirectory.exists()) { + + Files.assertDir(workingDirectory); + + } else { + + Files.mkdir(workingDirectory); + Files.deleteOnExit(workingDirectory); + } + + Files.readable(workingDirectory); + Files.writable(workingDirectory); + + openejbHome = Setup.findHome(workingDirectory); + Installer installer = null; + + if (openejbHome == null) { + + downloadTomcat(workingDirectory, configuration.getTomcatVersion()); + + openejbHome = Setup.findHome(workingDirectory); + + Files.deleteOnExit(openejbHome); + + final File webapp = new File(openejbHome, "webapps" + s + "tomee"); + + Files.mkdir(webapp); + downloadOpenEJBWebapp(webapp); + + System.setProperty("catalina.home", openejbHome.getAbsolutePath()); + System.setProperty("catalina.base", openejbHome.getAbsolutePath()); + + System.setProperty("openejb.deploymentId.format", System.getProperty("openejb.deploymentId.format", "{appId}/{ejbJarId}/{ejbName}")); + + final Paths paths = new Paths(webapp); + installer = new Installer(paths, true); + if (!configuration.isUseInstallerServlet()) { + installer.installAll(); + + } + + wereOpenejbHomeSet = false; + } + + Files.assertDir(openejbHome); + Files.readable(openejbHome); + Files.writable(openejbHome); + + Setup.configureServerXml(openejbHome, configuration); + Setup.configureSystemProperties(openejbHome, configuration); + + Setup.exportProperties(openejbHome, configuration, true); + + final URL logging = Thread.currentThread().getContextClassLoader().getResource("default.remote.logging.properties"); + if (logging != null) { + write(logging, new File(openejbHome, "conf" + s + "logging.properties")); + } + + if (configuration.isRemoveUnusedWebapps()) { + Setup.removeUselessWebapps(openejbHome, "tomee"); + } + + if (logger.isLoggable(Level.FINE)) { + final Map<Object, Object> map = new TreeMap<Object, Object>(System.getProperties()); + for (final Map.Entry<Object, Object> entry : map.entrySet()) { + System.out.printf("%s = %s\n", entry.getKey(), entry.getValue()); + } + } + + Setup.installArquillianBeanDiscoverer(openejbHome); + + if (!wereOpenejbHomeSet && configuration.isUseInstallerServlet()) { + // instead of calling the Installer, let's just do like users do + // call the servlet installer instead + final String baseUrl = "http://" + configuration.getHost() + ":" + httpPort + "/tomee/installer"; + + assert installer != null; + installer.addTomEEAdminConfInTomcatUsers(true); + + final RemoteServer tmpContainer = new RemoteServer(); + tmpContainer.setPortStartup(httpPort); + try { + tmpContainer.start(); + } catch (final Exception e) { + tmpContainer.destroy(); + throw e; + } + + final URL url = new URL(baseUrl); + logger.info("Calling TomEE Installer Servlet on " + url); + + for (int i = 0; i < 3; i++) { + final URLConnection uc = url.openConnection(); + // dG9tZWU6dG9tZWU= --> Base64 of tomee:tomee + final String authorizationString = "Basic dG9tZWU6dG9tZWU="; + uc.setRequestProperty("Authorization", authorizationString); + try { + final InputStream is = uc.getInputStream(); + org.apache.openejb.loader.IO.slurp(is); + is.close(); + break; + } catch (final Exception e) { + logger.warning(e.getMessage()); + Thread.sleep(1000); + } + } + + tmpContainer.stop(); + tmpContainer.getServer().waitFor(); + } + + container = new RemoteServer(); + container.setPortStartup(httpPort); + container.start(Arrays.asList("-Dorg.apache.openejb.servlet.filters=" + ArquillianFilterRunner.class.getName() + "=" + ServletMethodExecutor.ARQUILLIAN_SERVLET_MAPPING), "start", true); + container.killOnExit(); + } catch (final Exception e) { + container.destroy(); + throw new LifecycleException("Unable to start remote container", e); + } + } + + private static void write(final URL resource, final File file) throws IOException { + if (file.exists()) { + Files.delete(file); + } + final InputStream is = org.apache.openejb.loader.IO.read(resource); + + try { + IO.copy(is, file); + } finally { + is.close(); + } + } + + protected void downloadOpenEJBWebapp(final File targetDirectory) throws LifecycleException { + final String artifactName = configuration.getArtifactName(); + final File zipFile = Setup.downloadFile(artifactName, null); + Zips.unzip(zipFile, targetDirectory); + } + + protected void downloadTomcat(final File catalinaDirectory, final String tomcatVersion) throws LifecycleException { + String source = null; + + if (tomcatVersion.startsWith("7.")) { + source = "http://archive.apache.org/dist/tomcat/tomcat-7/v" + tomcatVersion + "/bin/apache-tomcat-" + tomcatVersion + ".zip"; + } + + if (tomcatVersion.startsWith("6.")) { + source = "http://archive.apache.org/dist/tomcat/tomcat-6/v" + tomcatVersion + "/bin/apache-tomcat-" + tomcatVersion + ".zip"; + } + + if (tomcatVersion.startsWith("5.5")) { + source = "http://archive.apache.org/dist/tomcat/tomcat-5/v" + tomcatVersion + "/bin/apache-tomcat-" + tomcatVersion + ".zip"; + } + + if (source == null) { + throw new LifecycleException("Unable to find URL for Tomcat " + tomcatVersion); + } + + final File zipFile = Setup.downloadFile("org.apache.tomcat:tomcat:" + tomcatVersion + ":zip", source); + Zips.unzip(zipFile, catalinaDirectory); + } + + @Override + public void stop() throws LifecycleException { + // only stop the container if we started it + if (shutdown) { + Setup.removeArquillianBeanDiscoverer(openejbHome); + container.destroy(); + } + } + + @Override + public Class<TomEEWebappConfiguration> getConfigurationClass() { + return TomEEWebappConfiguration.class; + } +}
http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/assembly/openejb-standalone/README.html ---------------------------------------------------------------------- diff --git a/assembly/openejb-standalone/README.html b/assembly/openejb-standalone/README.html index aaeb6a5..04f4504 100644 --- a/assembly/openejb-standalone/README.html +++ b/assembly/openejb-standalone/README.html @@ -1,24 +1,24 @@ -<!-- - - 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. - ---> - -<!-- $Rev$ $Date$ --> - +<!-- + + 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. + +--> + +<!-- $Rev$ $Date$ --> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>Apache OpenEJB 6.0.14</TITLE> <META http-equiv=Content-Type content="text/html"> http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/assembly/openejb-standalone/src/main/assembly/component.xml ---------------------------------------------------------------------- diff --git a/assembly/openejb-standalone/src/main/assembly/component.xml b/assembly/openejb-standalone/src/main/assembly/component.xml index 81e9b5c..9687511 100644 --- a/assembly/openejb-standalone/src/main/assembly/component.xml +++ b/assembly/openejb-standalone/src/main/assembly/component.xml @@ -1,22 +1,22 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<component> - +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<component> + </component> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/assembly/openejb-standalone/src/main/assembly/dos.xml ---------------------------------------------------------------------- diff --git a/assembly/openejb-standalone/src/main/assembly/dos.xml b/assembly/openejb-standalone/src/main/assembly/dos.xml index b2b5e46..538e924 100644 --- a/assembly/openejb-standalone/src/main/assembly/dos.xml +++ b/assembly/openejb-standalone/src/main/assembly/dos.xml @@ -1,125 +1,125 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - 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. ---> - -<!-- $Rev: 1482826 $ $Date: 2013-05-15 15:31:58 +0200 (Wed, 15 May 2013) $ --> - -<assembly> - <id>bin-dos</id> - <formats> - <format>zip</format> - </formats> - <fileSets> - <fileSet> - <lineEnding>dos</lineEnding> - <directory>${basedir}/target/classes</directory> - <outputDirectory>/</outputDirectory> - <includes> - <include>README.txt</include> - <include>NOTICE</include> - <include>LICENSE</include> - </includes> - </fileSet> - <fileSet> - <directory>${basedir}/target/classes</directory> - <outputDirectory>bin/</outputDirectory> - <includes> - <include>*.bat</include> - <include>service.readme.txt</include> - </includes> - <lineEnding>dos</lineEnding> - <fileMode>0755</fileMode> - </fileSet> - <fileSet> - <directory>${basedir}/target/classes</directory> - <outputDirectory>bin/</outputDirectory> - <includes> - <include>openejb</include> - </includes> - <lineEnding>unix</lineEnding> - <fileMode>0755</fileMode> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/resources</directory> - <outputDirectory>bin/</outputDirectory> - <includes> - <include>*.exe</include> - </includes> - </fileSet> - <fileSet> - <lineEnding>dos</lineEnding> - <directory>${basedir}/src/main/conf</directory> - <includes> - <include>README.txt</include> - <include>logging.properties</include> - <include>system.properties</include> - </includes> - <outputDirectory>conf/</outputDirectory> - </fileSet> - <fileSet> - <lineEnding>dos</lineEnding> - <outputDirectory>logs/</outputDirectory> - <directory>${project.basedir}/src/main/assembly</directory> - <excludes> - <exclude>component.xml</exclude> - <exclude>dos.xml</exclude> - <exclude>unix.xml</exclude> - </excludes> - </fileSet> - <fileSet> - <lineEnding>dos</lineEnding> - <outputDirectory>apps/</outputDirectory> - <directory>${project.basedir}/src/main/assembly</directory> - <excludes> - <exclude>component.xml</exclude> - <exclude>dos.xml</exclude> - <exclude>unix.xml</exclude> - </excludes> - </fileSet> - <fileSet> - <outputDirectory>data/</outputDirectory> - <directory>${project.basedir}/src/main/assembly</directory> - <excludes> - <exclude>component.xml</exclude> - <exclude>dos.xml</exclude> - <exclude>unix.xml</exclude> - </excludes> - </fileSet> - </fileSets> - <files> - <file> - <lineEnding>dos</lineEnding> - <source>${basedir}/target/classes/DATA-README.txt</source> - <outputDirectory>data/</outputDirectory> - <destName>README.txt</destName> - <fileMode>0755</fileMode> - </file> - </files> - <dependencySets> - <dependencySet> - <outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} - </outputFileNameMapping> - <outputDirectory>lib</outputDirectory> - <scope>runtime</scope> - <excludes> - <exclude>junit:junit</exclude> - </excludes> - </dependencySet> - </dependencySets> -</assembly> - +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. +--> + +<!-- $Rev: 1482826 $ $Date: 2013-05-15 15:31:58 +0200 (Wed, 15 May 2013) $ --> + +<assembly> + <id>bin-dos</id> + <formats> + <format>zip</format> + </formats> + <fileSets> + <fileSet> + <lineEnding>dos</lineEnding> + <directory>${basedir}/target/classes</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>README.txt</include> + <include>NOTICE</include> + <include>LICENSE</include> + </includes> + </fileSet> + <fileSet> + <directory>${basedir}/target/classes</directory> + <outputDirectory>bin/</outputDirectory> + <includes> + <include>*.bat</include> + <include>service.readme.txt</include> + </includes> + <lineEnding>dos</lineEnding> + <fileMode>0755</fileMode> + </fileSet> + <fileSet> + <directory>${basedir}/target/classes</directory> + <outputDirectory>bin/</outputDirectory> + <includes> + <include>openejb</include> + </includes> + <lineEnding>unix</lineEnding> + <fileMode>0755</fileMode> + </fileSet> + <fileSet> + <directory>${basedir}/src/main/resources</directory> + <outputDirectory>bin/</outputDirectory> + <includes> + <include>*.exe</include> + </includes> + </fileSet> + <fileSet> + <lineEnding>dos</lineEnding> + <directory>${basedir}/src/main/conf</directory> + <includes> + <include>README.txt</include> + <include>logging.properties</include> + <include>system.properties</include> + </includes> + <outputDirectory>conf/</outputDirectory> + </fileSet> + <fileSet> + <lineEnding>dos</lineEnding> + <outputDirectory>logs/</outputDirectory> + <directory>${project.basedir}/src/main/assembly</directory> + <excludes> + <exclude>component.xml</exclude> + <exclude>dos.xml</exclude> + <exclude>unix.xml</exclude> + </excludes> + </fileSet> + <fileSet> + <lineEnding>dos</lineEnding> + <outputDirectory>apps/</outputDirectory> + <directory>${project.basedir}/src/main/assembly</directory> + <excludes> + <exclude>component.xml</exclude> + <exclude>dos.xml</exclude> + <exclude>unix.xml</exclude> + </excludes> + </fileSet> + <fileSet> + <outputDirectory>data/</outputDirectory> + <directory>${project.basedir}/src/main/assembly</directory> + <excludes> + <exclude>component.xml</exclude> + <exclude>dos.xml</exclude> + <exclude>unix.xml</exclude> + </excludes> + </fileSet> + </fileSets> + <files> + <file> + <lineEnding>dos</lineEnding> + <source>${basedir}/target/classes/DATA-README.txt</source> + <outputDirectory>data/</outputDirectory> + <destName>README.txt</destName> + <fileMode>0755</fileMode> + </file> + </files> + <dependencySets> + <dependencySet> + <outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} + </outputFileNameMapping> + <outputDirectory>lib</outputDirectory> + <scope>runtime</scope> + <excludes> + <exclude>junit:junit</exclude> + </excludes> + </dependencySet> + </dependencySets> +</assembly> + http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/assembly/openejb-standalone/src/main/assembly/unix.xml ---------------------------------------------------------------------- diff --git a/assembly/openejb-standalone/src/main/assembly/unix.xml b/assembly/openejb-standalone/src/main/assembly/unix.xml index 8830f5a..77ab54c 100644 --- a/assembly/openejb-standalone/src/main/assembly/unix.xml +++ b/assembly/openejb-standalone/src/main/assembly/unix.xml @@ -1,124 +1,124 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - 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. ---> - -<!-- $Rev: 1482826 $ $Date: 2013-05-15 15:31:58 +0200 (Wed, 15 May 2013) $ --> - -<assembly> - <id>bin-unix</id> - <formats> - <format>tar.gz</format> - </formats> - <fileSets> - <fileSet> - <lineEnding>unix</lineEnding> - <directory>${basedir}/target/classes</directory> - <outputDirectory>/</outputDirectory> - <includes> - <include>README.txt</include> - <include>NOTICE</include> - <include>LICENSE</include> - </includes> - </fileSet> - <fileSet> - <directory>${basedir}/target/classes</directory> - <outputDirectory>bin/</outputDirectory> - <includes> - <include>*.bat</include> - <include>service.readme.txt</include> - </includes> - <lineEnding>dos</lineEnding> - <fileMode>0755</fileMode> - </fileSet> - <fileSet> - <directory>${basedir}/target/classes</directory> - <outputDirectory>bin/</outputDirectory> - <includes> - <include>openejb</include> - </includes> - <lineEnding>unix</lineEnding> - <fileMode>0755</fileMode> - </fileSet> - <fileSet> - <directory>${basedir}/src/main/resources</directory> - <outputDirectory>bin/</outputDirectory> - <includes> - <include>*.exe</include> - </includes> - </fileSet> - <fileSet> - <lineEnding>unix</lineEnding> - <directory>${basedir}/src/main/conf</directory> - <includes> - <include>README.txt</include> - <include>logging.properties</include> - <include>system.properties</include> - </includes> - <outputDirectory>conf/</outputDirectory> - </fileSet> - <fileSet> - <lineEnding>unix</lineEnding> - <outputDirectory>logs/</outputDirectory> - <directory>${project.basedir}/src/main/assembly</directory> - <excludes> - <exclude>component.xml</exclude> - <exclude>dos.xml</exclude> - <exclude>unix.xml</exclude> - </excludes> - </fileSet> - <fileSet> - <lineEnding>unix</lineEnding> - <outputDirectory>apps/</outputDirectory> - <directory>${project.basedir}/src/main/assembly</directory> - <excludes> - <exclude>component.xml</exclude> - <exclude>dos.xml</exclude> - <exclude>unix.xml</exclude> - </excludes> - </fileSet> - <fileSet> - <outputDirectory>data/</outputDirectory> - <directory>${project.basedir}/src/main/assembly</directory> - <excludes> - <exclude>component.xml</exclude> - <exclude>dos.xml</exclude> - <exclude>unix.xml</exclude> - </excludes> - </fileSet> - </fileSets> - <files> - <file> - <lineEnding>unix</lineEnding> - <source>${basedir}/target/classes/DATA-README.txt</source> - <outputDirectory>data/</outputDirectory> - <destName>README.txt</destName> - <fileMode>0755</fileMode> - </file> - </files> - <dependencySets> - <dependencySet> - <outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} - </outputFileNameMapping> - <outputDirectory>lib</outputDirectory> - <scope>runtime</scope> - <excludes> - <exclude>junit:junit</exclude> - </excludes> - </dependencySet> - </dependencySets> +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. +--> + +<!-- $Rev: 1482826 $ $Date: 2013-05-15 15:31:58 +0200 (Wed, 15 May 2013) $ --> + +<assembly> + <id>bin-unix</id> + <formats> + <format>tar.gz</format> + </formats> + <fileSets> + <fileSet> + <lineEnding>unix</lineEnding> + <directory>${basedir}/target/classes</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>README.txt</include> + <include>NOTICE</include> + <include>LICENSE</include> + </includes> + </fileSet> + <fileSet> + <directory>${basedir}/target/classes</directory> + <outputDirectory>bin/</outputDirectory> + <includes> + <include>*.bat</include> + <include>service.readme.txt</include> + </includes> + <lineEnding>dos</lineEnding> + <fileMode>0755</fileMode> + </fileSet> + <fileSet> + <directory>${basedir}/target/classes</directory> + <outputDirectory>bin/</outputDirectory> + <includes> + <include>openejb</include> + </includes> + <lineEnding>unix</lineEnding> + <fileMode>0755</fileMode> + </fileSet> + <fileSet> + <directory>${basedir}/src/main/resources</directory> + <outputDirectory>bin/</outputDirectory> + <includes> + <include>*.exe</include> + </includes> + </fileSet> + <fileSet> + <lineEnding>unix</lineEnding> + <directory>${basedir}/src/main/conf</directory> + <includes> + <include>README.txt</include> + <include>logging.properties</include> + <include>system.properties</include> + </includes> + <outputDirectory>conf/</outputDirectory> + </fileSet> + <fileSet> + <lineEnding>unix</lineEnding> + <outputDirectory>logs/</outputDirectory> + <directory>${project.basedir}/src/main/assembly</directory> + <excludes> + <exclude>component.xml</exclude> + <exclude>dos.xml</exclude> + <exclude>unix.xml</exclude> + </excludes> + </fileSet> + <fileSet> + <lineEnding>unix</lineEnding> + <outputDirectory>apps/</outputDirectory> + <directory>${project.basedir}/src/main/assembly</directory> + <excludes> + <exclude>component.xml</exclude> + <exclude>dos.xml</exclude> + <exclude>unix.xml</exclude> + </excludes> + </fileSet> + <fileSet> + <outputDirectory>data/</outputDirectory> + <directory>${project.basedir}/src/main/assembly</directory> + <excludes> + <exclude>component.xml</exclude> + <exclude>dos.xml</exclude> + <exclude>unix.xml</exclude> + </excludes> + </fileSet> + </fileSets> + <files> + <file> + <lineEnding>unix</lineEnding> + <source>${basedir}/target/classes/DATA-README.txt</source> + <outputDirectory>data/</outputDirectory> + <destName>README.txt</destName> + <fileMode>0755</fileMode> + </file> + </files> + <dependencySets> + <dependencySet> + <outputFileNameMapping>${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} + </outputFileNameMapping> + <outputDirectory>lib</outputDirectory> + <scope>runtime</scope> + <excludes> + <exclude>junit:junit</exclude> + </excludes> + </dependencySet> + </dependencySets> </assembly> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/assembly/openejb-standalone/src/main/resources/Start.bat ---------------------------------------------------------------------- diff --git a/assembly/openejb-standalone/src/main/resources/Start.bat b/assembly/openejb-standalone/src/main/resources/Start.bat index f8804e1..9bd7d9a 100644 --- a/assembly/openejb-standalone/src/main/resources/Start.bat +++ b/assembly/openejb-standalone/src/main/resources/Start.bat @@ -1,34 +1,34 @@ -@echo off -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%" - -cd .. - +@echo off +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%" + +cd .. + cmd /C ".\bin\openejb.bat start" \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/assembly/openejb-standalone/src/main/resources/Stop.bat ---------------------------------------------------------------------- diff --git a/assembly/openejb-standalone/src/main/resources/Stop.bat b/assembly/openejb-standalone/src/main/resources/Stop.bat index 66cdd00..50130c2 100644 --- a/assembly/openejb-standalone/src/main/resources/Stop.bat +++ b/assembly/openejb-standalone/src/main/resources/Stop.bat @@ -1,34 +1,34 @@ -@echo off -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%" - -cd .. - +@echo off +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%" + +cd .. + cmd /C ".\bin\openejb.bat stop" \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/assembly/openejb-standalone/src/main/resources/service.install.as.admin.bat ---------------------------------------------------------------------- diff --git a/assembly/openejb-standalone/src/main/resources/service.install.as.admin.bat b/assembly/openejb-standalone/src/main/resources/service.install.as.admin.bat index 62ec736..678ff74 100644 --- a/assembly/openejb-standalone/src/main/resources/service.install.as.admin.bat +++ b/assembly/openejb-standalone/src/main/resources/service.install.as.admin.bat @@ -1,151 +1,151 @@ -@ECHO off -CLS -setlocal -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% - -SET proc=undefined - -IF /i %PROCESSOR_ARCHITECTURE% EQU X86 SET proc="%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" -IF /i %PROCESSOR_ARCHITECTURE% EQU AMD64 SET proc="%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" -IF /i %PROCESSOR_ARCHITECTURE% EQU IA64 SET proc="%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" - -IF /i %proc% EQU undefined ( - ECHO Failed to determine OS architecture - GOTO failed -) - -SET jvm=auto -REM SET JAVA_HOME=[Full path to JDK or JRE] - -REM Prefer a local JRE or JDK if we find one in the current or parent directory -pushd.. -set dir=%cd% -popd - -IF EXIST "%dir%\jre" ( - SET JAVA_HOME="%dir%" - ECHO Found local JRE - GOTO found_java_home -) - -IF EXIST "%dir%\jdk" ( - SET JAVA_HOME="%dir%\jdk" - ECHO Found local JDK - GOTO found_java_home -) - -if not "%JAVA_HOME%" == "" GOTO found_java_home - -ECHO Environment variable JAVA_HOME is not set and no local JRE was found. -ECHO Please set JAVA_HOME to the directory of your local JDK or JRE to avoid this message. -GOTO skip_java_home - -:found_java_home - -REM Make an attempt to find either the server or client jvm.dll -IF EXIST "%JAVA_HOME%\jre\bin\server\jvm.dll" ( - SET jvm="%JAVA_HOME%\jre\bin\server\jvm.dll" -) ELSE ( - IF EXIST "%JAVA_HOME%\jre\bin\client\jvm.dll" ( - SET jvm="%JAVA_HOME%\jre\bin\client\jvm.dll" - ) ELSE ( - IF EXIST "%JAVA_HOME%\bin\server\jvm.dll" ( - SET jvm="%JAVA_HOME%\bin\server\jvm.dll" - ) ELSE ( - IF EXIST "%JAVA_HOME%\bin\client\jvm.dll" ( - SET jvm="%JAVA_HOME%\bin\client\jvm.dll" - ) ELSE ( - ECHO Cannot locate a jvm.dll - Are you sure JAVA_HOME is set correctly? - ECHO The service installer will now attempt to locate and use 'any' JVM. - ) - ) - ) -) - -:skip_java_home - -SET openejb=. -CD .. - -SET "openejb=%CD%" -SET logs=%openejb%\logs -SET lib=%openejb%\lib -SET corejar="%lib%\openejb-core-*.jar" -SET daemonjar="%lib%\openejb-daemon-*.jar" - -FOR %%a IN (%corejar%) DO ( - SET corejar="%%a" -) - -FOR %%a IN (%daemonjar%) DO ( - SET daemonjar="%%a" -) - -SET classpath="%corejar%;%daemonjar%" - -ECHO Installing service using JVM: %jvm% - -REM Allow file access to Local System -cacls "%openejb%" /E /P System:F - -REM Extensive documentation can be found here - http://commons.apache.org/daemon/procrun.html - -%proc% //IS//OpenEJBServer --DisplayName="OpenEJB Server" ^ - --Install=%proc% ^ - --Startup auto ^ - --StartPath="%openejb%" ^ - --Description="OpenEJB Server Service" ^ - --Jvm="%jvm%" ^ - --Classpath=%classpath% ^ - --StartMode=jvm ^ - --StartClass=org.apache.openejb.daemon.NTService --StartMethod=start ^ - --StopMode=jvm ^ - --JvmMs=512 ^ - --JvmMx=1024 ^ - --JvmSs=2048 ^ - --StopClass=org.apache.openejb.daemon.NTService --StopMethod=stop ^ - --LogPrefix=service ^ - --LogPath="%logs%" --StdOutput="%logs%\service.out.log" --StdError="%logs%\service.err.log" --PidFile=service.pid ^ - --LogLevel=Info ^ - --LibraryPath="%openejb%\bin" ^ - ++JvmOptions=-Dopenejb.home="%openejb%";-XX:MaxPermSize=256M - REM ++DependsOn=AnotherServiceName - REM Add ^ symbol to end of ++JvmOptions line if ++DependsOn is uncommented - -NET START OpenEJBServer - -GOTO complete - -:failed - -ECHO Failed to install service - +@ECHO off +CLS +setlocal +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% + +SET proc=undefined + +IF /i %PROCESSOR_ARCHITECTURE% EQU X86 SET proc="%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" +IF /i %PROCESSOR_ARCHITECTURE% EQU AMD64 SET proc="%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" +IF /i %PROCESSOR_ARCHITECTURE% EQU IA64 SET proc="%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" + +IF /i %proc% EQU undefined ( + ECHO Failed to determine OS architecture + GOTO failed +) + +SET jvm=auto +REM SET JAVA_HOME=[Full path to JDK or JRE] + +REM Prefer a local JRE or JDK if we find one in the current or parent directory +pushd.. +set dir=%cd% +popd + +IF EXIST "%dir%\jre" ( + SET JAVA_HOME="%dir%" + ECHO Found local JRE + GOTO found_java_home +) + +IF EXIST "%dir%\jdk" ( + SET JAVA_HOME="%dir%\jdk" + ECHO Found local JDK + GOTO found_java_home +) + +if not "%JAVA_HOME%" == "" GOTO found_java_home + +ECHO Environment variable JAVA_HOME is not set and no local JRE was found. +ECHO Please set JAVA_HOME to the directory of your local JDK or JRE to avoid this message. +GOTO skip_java_home + +:found_java_home + +REM Make an attempt to find either the server or client jvm.dll +IF EXIST "%JAVA_HOME%\jre\bin\server\jvm.dll" ( + SET jvm="%JAVA_HOME%\jre\bin\server\jvm.dll" +) ELSE ( + IF EXIST "%JAVA_HOME%\jre\bin\client\jvm.dll" ( + SET jvm="%JAVA_HOME%\jre\bin\client\jvm.dll" + ) ELSE ( + IF EXIST "%JAVA_HOME%\bin\server\jvm.dll" ( + SET jvm="%JAVA_HOME%\bin\server\jvm.dll" + ) ELSE ( + IF EXIST "%JAVA_HOME%\bin\client\jvm.dll" ( + SET jvm="%JAVA_HOME%\bin\client\jvm.dll" + ) ELSE ( + ECHO Cannot locate a jvm.dll - Are you sure JAVA_HOME is set correctly? + ECHO The service installer will now attempt to locate and use 'any' JVM. + ) + ) + ) +) + +:skip_java_home + +SET openejb=. +CD .. + +SET "openejb=%CD%" +SET logs=%openejb%\logs +SET lib=%openejb%\lib +SET corejar="%lib%\openejb-core-*.jar" +SET daemonjar="%lib%\openejb-daemon-*.jar" + +FOR %%a IN (%corejar%) DO ( + SET corejar="%%a" +) + +FOR %%a IN (%daemonjar%) DO ( + SET daemonjar="%%a" +) + +SET classpath="%corejar%;%daemonjar%" + +ECHO Installing service using JVM: %jvm% + +REM Allow file access to Local System +cacls "%openejb%" /E /P System:F + +REM Extensive documentation can be found here - http://commons.apache.org/daemon/procrun.html + +%proc% //IS//OpenEJBServer --DisplayName="OpenEJB Server" ^ + --Install=%proc% ^ + --Startup auto ^ + --StartPath="%openejb%" ^ + --Description="OpenEJB Server Service" ^ + --Jvm="%jvm%" ^ + --Classpath=%classpath% ^ + --StartMode=jvm ^ + --StartClass=org.apache.openejb.daemon.NTService --StartMethod=start ^ + --StopMode=jvm ^ + --JvmMs=512 ^ + --JvmMx=1024 ^ + --JvmSs=2048 ^ + --StopClass=org.apache.openejb.daemon.NTService --StopMethod=stop ^ + --LogPrefix=service ^ + --LogPath="%logs%" --StdOutput="%logs%\service.out.log" --StdError="%logs%\service.err.log" --PidFile=service.pid ^ + --LogLevel=Info ^ + --LibraryPath="%openejb%\bin" ^ + ++JvmOptions=-Dopenejb.home="%openejb%";-XX:MaxPermSize=256M + REM ++DependsOn=AnotherServiceName + REM Add ^ symbol to end of ++JvmOptions line if ++DependsOn is uncommented + +NET START OpenEJBServer + +GOTO complete + +:failed + +ECHO Failed to install service + :complete \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/assembly/openejb-standalone/src/main/resources/service.remove.as.admin.bat ---------------------------------------------------------------------- diff --git a/assembly/openejb-standalone/src/main/resources/service.remove.as.admin.bat b/assembly/openejb-standalone/src/main/resources/service.remove.as.admin.bat index d3f2fdd..b7794fc 100644 --- a/assembly/openejb-standalone/src/main/resources/service.remove.as.admin.bat +++ b/assembly/openejb-standalone/src/main/resources/service.remove.as.admin.bat @@ -1,49 +1,49 @@ -@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% - -SET proc=undefined - -if /i %PROCESSOR_ARCHITECTURE% EQU X86 SET proc="%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" -if /i %PROCESSOR_ARCHITECTURE% EQU AMD64 SET proc="%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" -if /i %PROCESSOR_ARCHITECTURE% EQU IA64 SET proc=%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" - -if /i %proc% EQU undefined GOTO failed - -%proc% //DS//OpenEJBServer - -GOTO complete - -:failed - -ECHO Failed to determine OS architecture - +@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% + +SET proc=undefined + +if /i %PROCESSOR_ARCHITECTURE% EQU X86 SET proc="%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" +if /i %PROCESSOR_ARCHITECTURE% EQU AMD64 SET proc="%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" +if /i %PROCESSOR_ARCHITECTURE% EQU IA64 SET proc=%~dp0OpenEJB.%PROCESSOR_ARCHITECTURE%.exe" + +if /i %proc% EQU undefined GOTO failed + +%proc% //DS//OpenEJBServer + +GOTO complete + +:failed + +ECHO Failed to determine OS architecture + :complete \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java index b8b6721..cb5706b 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java @@ -1,101 +1,101 @@ -/* - * 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.assembler.classic; - -import org.apache.openejb.loader.SystemInstance; -import org.apache.openejb.persistence.PersistenceUnitInfoImpl; - -import javax.persistence.EntityManagerFactory; -import javax.persistence.ValidationMode; -import javax.persistence.spi.PersistenceProvider; -import javax.validation.ValidatorFactory; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Callable; - -public class EntityManagerFactoryCallable implements Callable<EntityManagerFactory> { - public static final String OPENEJB_JPA_INIT_ENTITYMANAGER = "openejb.jpa.init-entitymanager"; - public static final String OPENJPA_ENTITY_MANAGER_FACTORY_POOL = "openjpa.EntityManagerFactoryPool"; - - private final String persistenceProviderClassName; - private final PersistenceUnitInfoImpl unitInfo; - private final Map<ComparableValidationConfig, ValidatorFactory> potentialValidators; - private ClassLoader appClassLoader; - - public EntityManagerFactoryCallable(final String persistenceProviderClassName, final PersistenceUnitInfoImpl unitInfo, - final ClassLoader cl, final Map<ComparableValidationConfig, ValidatorFactory> validators) { - this.persistenceProviderClassName = persistenceProviderClassName; - this.unitInfo = unitInfo; - this.appClassLoader = cl; - this.potentialValidators = validators; - } - - @Override - public EntityManagerFactory call() throws Exception { - final ClassLoader old = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(appClassLoader); - try { - final Class<?> clazz = appClassLoader.loadClass(persistenceProviderClassName); - final PersistenceProvider persistenceProvider = (PersistenceProvider) clazz.newInstance(); - - // Create entity manager factories with the validator factory - final Map<String, Object> properties = new HashMap<String, Object>(); - if (!ValidationMode.NONE.equals(unitInfo.getValidationMode())) { - properties.put("javax.persistence.validation.factory", new ValidatorFactoryWrapper(potentialValidators)); - } - - customizeProperties(properties); - - final EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo, properties); - - if (unitInfo.getProperties() != null - && "true".equalsIgnoreCase(unitInfo.getProperties().getProperty(OPENEJB_JPA_INIT_ENTITYMANAGER)) - || SystemInstance.get().getOptions().get(OPENEJB_JPA_INIT_ENTITYMANAGER, false)) { - emf.createEntityManager().close(); - } - - if (unitInfo.getNonJtaDataSource() != null) { - final ImportSql importer = new ImportSql(appClassLoader, unitInfo.getPersistenceUnitName(), unitInfo.getNonJtaDataSource()); - if (importer.hasSomethingToImport()) { - emf.createEntityManager().close(); // to let OpenJPA create the database if configured this way - importer.doImport(); - } - } - - return emf; - } finally { - Thread.currentThread().setContextClassLoader(old); - } - } - - // properties that have to be passed to properties parameters and not unit properties - private void customizeProperties(final Map<String, Object> properties) { - final String pool = SystemInstance.get().getProperty(OPENJPA_ENTITY_MANAGER_FACTORY_POOL); - if (pool != null) { - properties.put(OPENJPA_ENTITY_MANAGER_FACTORY_POOL, pool); - } - } - - public PersistenceUnitInfoImpl getUnitInfo() { - return unitInfo; - } - - public void overrideClassLoader(final ClassLoader loader) { - appClassLoader = loader; - } -} +/* + * 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.assembler.classic; + +import org.apache.openejb.loader.SystemInstance; +import org.apache.openejb.persistence.PersistenceUnitInfoImpl; + +import javax.persistence.EntityManagerFactory; +import javax.persistence.ValidationMode; +import javax.persistence.spi.PersistenceProvider; +import javax.validation.ValidatorFactory; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Callable; + +public class EntityManagerFactoryCallable implements Callable<EntityManagerFactory> { + public static final String OPENEJB_JPA_INIT_ENTITYMANAGER = "openejb.jpa.init-entitymanager"; + public static final String OPENJPA_ENTITY_MANAGER_FACTORY_POOL = "openjpa.EntityManagerFactoryPool"; + + private final String persistenceProviderClassName; + private final PersistenceUnitInfoImpl unitInfo; + private final Map<ComparableValidationConfig, ValidatorFactory> potentialValidators; + private ClassLoader appClassLoader; + + public EntityManagerFactoryCallable(final String persistenceProviderClassName, final PersistenceUnitInfoImpl unitInfo, + final ClassLoader cl, final Map<ComparableValidationConfig, ValidatorFactory> validators) { + this.persistenceProviderClassName = persistenceProviderClassName; + this.unitInfo = unitInfo; + this.appClassLoader = cl; + this.potentialValidators = validators; + } + + @Override + public EntityManagerFactory call() throws Exception { + final ClassLoader old = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(appClassLoader); + try { + final Class<?> clazz = appClassLoader.loadClass(persistenceProviderClassName); + final PersistenceProvider persistenceProvider = (PersistenceProvider) clazz.newInstance(); + + // Create entity manager factories with the validator factory + final Map<String, Object> properties = new HashMap<String, Object>(); + if (!ValidationMode.NONE.equals(unitInfo.getValidationMode())) { + properties.put("javax.persistence.validation.factory", new ValidatorFactoryWrapper(potentialValidators)); + } + + customizeProperties(properties); + + final EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo, properties); + + if (unitInfo.getProperties() != null + && "true".equalsIgnoreCase(unitInfo.getProperties().getProperty(OPENEJB_JPA_INIT_ENTITYMANAGER)) + || SystemInstance.get().getOptions().get(OPENEJB_JPA_INIT_ENTITYMANAGER, false)) { + emf.createEntityManager().close(); + } + + if (unitInfo.getNonJtaDataSource() != null) { + final ImportSql importer = new ImportSql(appClassLoader, unitInfo.getPersistenceUnitName(), unitInfo.getNonJtaDataSource()); + if (importer.hasSomethingToImport()) { + emf.createEntityManager().close(); // to let OpenJPA create the database if configured this way + importer.doImport(); + } + } + + return emf; + } finally { + Thread.currentThread().setContextClassLoader(old); + } + } + + // properties that have to be passed to properties parameters and not unit properties + private void customizeProperties(final Map<String, Object> properties) { + final String pool = SystemInstance.get().getProperty(OPENJPA_ENTITY_MANAGER_FACTORY_POOL); + if (pool != null) { + properties.put(OPENJPA_ENTITY_MANAGER_FACTORY_POOL, pool); + } + } + + public PersistenceUnitInfoImpl getUnitInfo() { + return unitInfo; + } + + public void overrideClassLoader(final ClassLoader loader) { + appClassLoader = loader; + } +}