This is an automated email from the ASF dual-hosted git repository.
rzo1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomee.git
The following commit(s) were added to refs/heads/main by this push:
new 0c3d13e995 TOMEE-4702 - Drop openejb-common-cli (#2935)
0c3d13e995 is described below
commit 0c3d13e9957ea6d4b01b50cd2a494140a73cde5e
Author: Richard Zowalla <[email protected]>
AuthorDate: Fri Sep 11 20:37:34 2026 +0200
TOMEE-4702 - Drop openejb-common-cli (#2935)
---
server/openejb-common-cli/pom.xml | 75 ------
.../org/apache/openejb/server/cli/CliRunnable.java | 286 ---------------------
.../openejb/server/cli/CliRuntimeException.java | 23 --
.../apache/openejb/server/cli/StreamManager.java | 131 ----------
.../server/cli/command/AbstractCommand.java | 53 ----
.../openejb/server/cli/command/CatCommand.java | 64 -----
.../server/cli/command/ClassLoaderCommand.java | 109 --------
.../apache/openejb/server/cli/command/Command.java | 32 ---
.../apache/openejb/server/cli/command/Deploy.java | 32 ---
.../server/cli/command/DeployedAppCommand.java | 47 ----
.../openejb/server/cli/command/ExitCommand.java | 26 --
.../openejb/server/cli/command/HelpCommand.java | 42 ---
.../openejb/server/cli/command/ListCommand.java | 33 ---
.../server/cli/command/LocalJMXCommand.java | 266 -------------------
.../openejb/server/cli/command/LsCommand.java | 61 -----
.../openejb/server/cli/command/PartCommand.java | 111 --------
.../openejb/server/cli/command/PathCommand.java | 44 ----
.../server/cli/command/PropertiesCommand.java | 32 ---
.../openejb/server/cli/command/ScriptCommand.java | 50 ----
.../server/cli/command/ScriptFileCommand.java | 68 -----
.../openejb/server/cli/command/Undeploy.java | 32 ---
.../src/main/resources/META-INF/scan.xml | 23 --
.../src/main/resources/branding.properties | 28 --
.../java/org/apache/openejb/server/groovy/Bar.java | 26 --
.../server/groovy/BeanManagerHelperTest.java | 78 ------
.../java/org/apache/openejb/server/groovy/Foo.java | 29 ---
.../server/groovy/OpenEJBGroovyShellTest.java | 52 ----
.../src/test/resources/META-INF/beans.xml | 19 --
server/pom.xml | 1 -
29 files changed, 1873 deletions(-)
diff --git a/server/openejb-common-cli/pom.xml
b/server/openejb-common-cli/pom.xml
deleted file mode 100644
index 573635bfc9..0000000000
--- a/server/openejb-common-cli/pom.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>server</artifactId>
- <groupId>org.apache.tomee</groupId>
- <version>11.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>openejb-common-cli</artifactId>
- <name>TomEE :: Server :: Common CLI</name>
-
- <properties>
- <tomee.build.name>${project.groupId}.server.common.cli</tomee.build.name>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>openejb-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>openejb-loader</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- </dependency>
- <dependency>
- <groupId>com.google.code.gson</groupId>
- <artifactId>gson</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-reflect</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-finder-shaded</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- </dependency>
-
- <!-- Test scope -->
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <scope>test</scope>
- </dependency>
-
-
- </dependencies>
-</project>
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/CliRunnable.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/CliRunnable.java
deleted file mode 100644
index c07303afa8..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/CliRunnable.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * 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.server.cli;
-
-import jline.console.ConsoleReader;
-import jline.console.completer.FileNameCompleter;
-import jline.console.completer.StringsCompleter;
-import org.apache.openejb.config.ConfigurableClasspathArchive;
-import org.apache.openejb.server.cli.command.AbstractCommand;
-import org.apache.openejb.server.cli.command.Command;
-import org.apache.openejb.util.LogCategory;
-import org.apache.openejb.util.Logger;
-import org.apache.openejb.util.OpenEJBScripter;
-import org.apache.openejb.util.OpenEjbVersion;
-import org.apache.xbean.finder.Annotated;
-import org.apache.xbean.finder.AnnotationFinder;
-import org.apache.xbean.finder.IAnnotationFinder;
-import org.apache.xbean.finder.UrlSet;
-import org.apache.xbean.recipe.ObjectRecipe;
-import org.apache.xbean.recipe.Option;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TreeMap;
-
-public class CliRunnable implements Runnable {
-
- private static final Logger LOGGER =
Logger.getInstance(LogCategory.OPENEJB_SERVER, CliRunnable.class);
-
- private static final String BRANDING_FILE = "branding.properties";
- private static final String WELCOME_KEY_PREFIX = "welcome_";
- private static final String WELCOME_COMMON_KEY = WELCOME_KEY_PREFIX +
"common";
- private static final String WELCOME_OPENEJB_KEY = WELCOME_KEY_PREFIX +
"openejb";
- private static final String WELCOME_TOMEE_KEY = WELCOME_KEY_PREFIX +
"tomee";
-
- public static final String TOMEE_NAME = "TomEE";
- public static final String OPENEJB_NAME = "OpenEJB";
-
- public static final String EXIT_COMMAND = "exit";
- private static final String OS_LINE_SEP =
System.getProperty("line.separator");
- private static final String NAME;
- private static final String PROMPT;
- private static final String PROMPT_SUFFIX = "> ";
-
- private static final Properties PROPERTIES = new Properties();
- private static final boolean tomee;
- private static final Map<String, Class<?>> COMMANDS = new TreeMap<>();
- private static final OpenEJBScripter scripter = new OpenEJBScripter();
-
- static {
- String name = OPENEJB_NAME;
- try {
-
CliRunnable.class.getClassLoader().loadClass("org.apache.tomee.loader.TomcatHook");
- name = TOMEE_NAME;
- } catch (ClassNotFoundException cnfe) {
- // ignored, we are using a simple OpenEJB server
- }
- tomee = TOMEE_NAME.equals(name);
- NAME = name;
- PROMPT = NAME.toLowerCase() + PROMPT_SUFFIX;
-
- try {
-
PROPERTIES.load(CliRunnable.class.getClassLoader().getResourceAsStream(BRANDING_FILE));
- } catch (IOException e) {
- // no-op
- }
-
- final ClassLoader loader = CliRunnable.class.getClassLoader();
- try {
- UrlSet urlSet = new UrlSet(loader).excludeJvm();
- urlSet = urlSet.exclude(loader.getParent());
-
- //noinspection unchecked
- final IAnnotationFinder finder = new AnnotationFinder(new
ConfigurableClasspathArchive(new
ConfigurableClasspathArchive.FakeModule(loader, Collections.EMPTY_MAP),
- true,
- urlSet.getUrls()));
- for (final Annotated<Class<?>> cmd :
finder.findMetaAnnotatedClasses(Command.class)) {
- try {
- final Command annotation =
cmd.getAnnotation(Command.class);
- final String key = annotation.name();
- if (!COMMANDS.containsKey(key)) {
- COMMANDS.put(key, cmd.get());
- } else {
- LOGGER.warning("command " + key + " already exists,
this one will be ignored ( " + annotation.description() + ")");
- }
- } catch (Exception e) {
- // command ignored
- }
- }
- } catch (RuntimeException e) {
- LOGGER.error("an error occurred while getting commands", e);
- } catch (IOException e) {
- LOGGER.error("can't get commands");
- }
- }
-
- public String lineSep;
-
- private OutputStream err;
- private OutputStream out;
- private InputStream sin;
- private String username;
- private final String bind;
- private final int port;
-
- public CliRunnable(final String bind, final int port) {
- this(bind, port, PROMPT, null);
- }
-
- public CliRunnable(final String bind, final int port, final String
username, final String sep) {
- this.bind = bind;
- this.port = port;
- this.username = username;
-
- if (sep != null) { // workaround to force ConsoleReader to use another
line.separator
- lineSep = sep;
- System.setProperty("line.separator", sep);
- try {
- // just to force the loading of this class with the set
line.separator
- // because ConsoleReader.CR is a constant and we need
sometimes another value
- // not a big issue but keeping this as a workaround
- new ConsoleReader();
- } catch (IOException ignored) {
- // no-op
- } finally {
- System.setProperty("line.separator", OS_LINE_SEP);
- }
- } else {
- lineSep = OS_LINE_SEP;
- }
- }
-
- public void setUsername(final String username) {
- this.username = username;
- }
-
- public void setInputStream(final InputStream in) {
- sin = in;
- }
-
- public void setOutputStream(final OutputStream out) {
- this.out = out;
- }
-
- public void setErrorStream(final OutputStream err) {
- this.err = err;
- }
-
- public void start() throws IOException {
- new Thread(this, "OpenEJB Cli").start();
- }
-
- public void destroy() {
- // no-op
- }
-
- public void clean() {
- OpenEJBScripter.clearEngines();
- }
-
- @Override
- public void run() {
- clean();
-
- try {
- final StreamManager streamManager = new StreamManager(out, err,
lineSep);
-
- final ConsoleReader reader = new ConsoleReader(sin,
streamManager.getOut());
- reader.addCompleter(new FileNameCompleter());
- reader.addCompleter(new
StringsCompleter(COMMANDS.keySet().toArray(new String[COMMANDS.size()])));
- // TODO : add completers
-
- String line;
- final StringBuilder builtWelcome = new StringBuilder("Apache
OpenEJB ")
- .append(OpenEjbVersion.get().getVersion())
- .append(" build: ")
- .append(OpenEjbVersion.get().getDate())
- .append("-")
- .append(OpenEjbVersion.get().getTime())
- .append(lineSep);
- if (tomee) {
-
builtWelcome.append(OS_LINE_SEP).append(PROPERTIES.getProperty(WELCOME_TOMEE_KEY));
- } else {
-
builtWelcome.append(OS_LINE_SEP).append(PROPERTIES.getProperty(WELCOME_OPENEJB_KEY));
- }
-
builtWelcome.append(lineSep).append(PROPERTIES.getProperty(WELCOME_COMMON_KEY));
-
- streamManager.writeOut(OpenEjbVersion.get().getUrl());
- streamManager.writeOut(builtWelcome.toString()
- .replace("$bind", bind)
- .replace("$port", Integer.toString(port))
- .replace("$name", NAME)
- .replace(OS_LINE_SEP, lineSep));
-
- while ((line = reader.readLine(prompt())) != null) {
- // exit simply let us go out of the loop
- // do we need a command for it?
- if (EXIT_COMMAND.equals(line)) {
- break;
- }
-
- Class<?> cmdClass = null;
- String key = null;
- for (final Map.Entry<String, Class<?>> cmd :
COMMANDS.entrySet()) {
- if (line.startsWith(cmd.getKey())) {
- cmdClass = cmd.getValue();
- key = cmd.getKey();
- break;
- }
- }
-
- if (cmdClass != null) {
- final ObjectRecipe recipe = new ObjectRecipe(cmdClass);
- recipe.setProperty("streamManager", streamManager);
- recipe.setProperty("command", line);
- recipe.setProperty("scripter", scripter);
- recipe.setProperty("commands", COMMANDS);
-
- recipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
- recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
- recipe.allow(Option.NAMED_PARAMETERS);
-
- try {
- final AbstractCommand cmdInstance = (AbstractCommand)
recipe.create();
- cmdInstance.execute(trunc(line, key));
- } catch (Exception e) {
- streamManager.writeErr(e);
- }
- } else {
- streamManager.writeErr("sorry i don't understand '" + line
+ "'");
- }
- }
-
- clean();
- } catch (IOException e) {
- clean();
- throw new CliRuntimeException(e);
- }
- }
-
- private String trunc(final String line, final String cmd) {
- if (line.length() == cmd.length()) {
- return "";
- }
- final String trunc = line.substring(cmd.length());
- int idx = 0;
- while (trunc.charAt(idx) == ' ') {
- idx++;
- }
- if (idx < trunc.length()) {
- return trunc.substring(idx);
- }
- return "";
- }
-
- private String prompt() {
- final StringBuilder prompt = new StringBuilder("");
- if (username != null) {
- prompt.append(username);
- } else {
- prompt.append(PROMPT);
- }
- prompt.append(" @ ")
- .append(bind).append(":").append(port)
- .append(PROMPT_SUFFIX);
- return prompt.toString();
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/CliRuntimeException.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/CliRuntimeException.java
deleted file mode 100644
index 78a0752177..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/CliRuntimeException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.server.cli;
-
-public class CliRuntimeException extends RuntimeException {
- public CliRuntimeException(Exception e) {
- super(e);
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/StreamManager.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/StreamManager.java
deleted file mode 100644
index 886b91aadc..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/StreamManager.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.server.cli;
-
-import com.google.gson.GsonBuilder;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.util.Collection;
-
-public class StreamManager {
-
- private static final String OS_LINE_SEP =
System.getProperty("line.separator");
-
- private String lineSep;
- private OutputStreamWriter serr;
- private OutputStreamWriter sout;
- private OutputStream out;
- private OutputStream err;
-
- public StreamManager(final OutputStream out, final OutputStream err, final
String lineSep) {
- this.lineSep = lineSep;
- this.out = out;
- this.err = err;
- this.sout = new OutputStreamWriter(out);
- this.serr = new OutputStreamWriter(err);
- }
-
- private void write(final OutputStreamWriter writer, final String s) {
- for (final String l : s.split(lineSep)) {
- try {
- writer.write(l);
- writer.write(lineSep);
- writer.flush();
- } catch (IOException e) {
- // ignored
- }
- }
- }
-
- public void writeOut(final String s) {
- write(sout, s);
- }
-
- public void writeErr(final Exception e) {
- if (e.getStackTrace() == null) {
- write(serr, e.getMessage());
- } else {
- final StringBuilder error = new StringBuilder();
- error.append(e.getMessage()).append(lineSep);
- for (final StackTraceElement elt : e.getStackTrace()) {
- error.append(" ").append(elt.toString()).append(lineSep);
- }
- write(serr, error.toString());
- }
- }
-
- public String asString(final Object out) {
- if (out == null) {
- return "null";
- }
- if (out instanceof Collection) {
- final StringBuilder builder = new StringBuilder();
- for (final Object o : (Collection) out) {
- builder.append(string(o, lineSep)).append(lineSep);
- }
- return builder.toString();
- }
- return string(out, lineSep);
- }
-
- private static String string(final Object out, final String lineSep) {
- if (!out.getClass().getName().startsWith("java")) {
- try {
- return new
GsonBuilder().setPrettyPrinting().create().toJson(out)
- .replace(OS_LINE_SEP, lineSep);
- } catch (RuntimeException re) {
- return ToStringBuilder.reflectionToString(out,
ToStringStyle.SHORT_PREFIX_STYLE)
- .replace(OS_LINE_SEP, lineSep);
- }
- }
- return out.toString();
- }
-
- public OutputStream getOut() {
- return out;
- }
-
- public OutputStream getErr() {
- return err;
- }
-
- public OutputStreamWriter getSerr() {
- return serr;
- }
-
- public OutputStreamWriter getSout() {
- return sout;
- }
-
- public String getLineSep() {
- return lineSep;
- }
-
- public void writeErr(final String s) {
- write(serr, s);
- }
-
- public void writeOut(final String text, final String sep) {
- for (final String line : text.split(sep)) {
- writeOut(line);
- }
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/AbstractCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/AbstractCommand.java
deleted file mode 100644
index e77076628a..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/AbstractCommand.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import org.apache.openejb.core.LocalInitialContextFactory;
-import org.apache.openejb.server.cli.StreamManager;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.util.Properties;
-
-public abstract class AbstractCommand {
- protected StreamManager streamManager;
- protected String command;
-
- public abstract void execute(final String cmd);
-
- public void setStreamManager(StreamManager streamManager) {
- this.streamManager = streamManager;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- public <T> T lookup(final Class<T> clazz, final String jndiName) throws
NamingException {
- Properties p = new Properties();
- p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
LocalInitialContextFactory.class.getName());
-
- ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
-
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- try {
- return (T) new InitialContext(p).lookup(jndiName);
- } finally {
- Thread.currentThread().setContextClassLoader(oldCl);
- }
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/CatCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/CatCommand.java
deleted file mode 100644
index 0301a8362f..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/CatCommand.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import org.apache.openejb.loader.IO;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-@Command(name = "cat", usage = "cat <path>", description = "cat a file (in
tomee directories only)")
-public class CatCommand extends PathCommand {
- @Override
- public void execute(final String cmd) {
- final File file;
- try {
- file = resolve(cmd);
- } catch (IllegalArgumentException iae) {
- streamManager.writeErr(iae.getMessage());
- return;
- }
-
- if (file.isDirectory() && file.exists()) {
- streamManager.writeOut("file " + file.getPath() + " is a
directory, please specify a regular file");
- } else if (file.exists()) {
- try {
- cat(file);
- } catch (IOException e) {
- streamManager.writeErr(e);
- }
- } else {
- streamManager.writeOut("file " + file.getPath() + " doesn't
exist");
- }
- }
-
- private void cat(final File file) throws IOException {
- final BufferedReader br = new BufferedReader(new FileReader(file));
- String line;
- int lineNumber = 0;
- try {
- while ((line = br.readLine()) != null) {
- lineNumber++;
- streamManager.writeOut(String.format("%3d. %s", lineNumber,
line));
- }
- } finally {
- IO.close(br);
- }
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ClassLoaderCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ClassLoaderCommand.java
deleted file mode 100644
index 54904f6ce6..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ClassLoaderCommand.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import org.apache.openejb.AppContext;
-import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.spi.ContainerSystem;
-import org.apache.xbean.finder.UrlSet;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-@Command(name = ClassLoaderCommand.CLASSLOADER_CMD, usage =
ClassLoaderCommand.CLASSLOADER_CMD + " <app>", description = "print classloader
info")
-public class ClassLoaderCommand extends AbstractCommand {
- public static final String CLASSLOADER_CMD = "classloader";
- private static final String INDENT = " ";
-
- @Override
- public void execute(final String cmd) {
- final String appName = extractAppName(cmd);
- final ContainerSystem cs =
SystemInstance.get().getComponent(ContainerSystem.class);
- for (AppContext ctx : cs.getAppContexts()) {
- if (appName.equalsIgnoreCase(ctx.getId())) {
- dumpClassLoader(ctx.getClassLoader());
- return;
- }
- }
- streamManager.writeErr("can't find app " + appName);
- streamManager.writeErr("available apps are:");
- for (AppContext ctx : cs.getAppContexts()) {
- streamManager.writeErr("- " + ctx.getId());
- }
- }
-
- protected void dumpClassLoader(final ClassLoader classLoader) {
- final List<ClassLoader> classLoaders = new ArrayList<>();
- ClassLoader current = classLoader;
- while (current != null) {
- classLoaders.add(current);
- current = current.getParent();
- }
-
- Collections.reverse(classLoaders);
-
- for (ClassLoader cl : classLoaders) {
- streamManager.writeOut("+" + cl.toString());
-
- UrlSet urls;
- try {
- urls = new UrlSet(cl);
- if (cl.getParent() != null) {
- urls = urls.exclude(cl.getParent());
- }
- } catch (IOException e) {
- streamManager.writeErr(INDENT + "` can't get urls of this
classloader");
- continue;
- }
-
- final List<URL> listUrls = urls.getUrls();
- Collections.sort(listUrls, new URLComparator());
- final Iterator<URL> it = listUrls.iterator();
- while (it.hasNext()) {
- final String value = it.next().toExternalForm();
- final StringBuilder builder = new StringBuilder(INDENT);
- if (it.hasNext()) {
- builder.append('|');
- } else {
- builder.append('`');
- }
- builder.append(" ").append(value);
- streamManager.writeOut(builder.toString());
- }
- }
- }
-
- protected String extractAppName(final String raw) {
- final String cmd = raw.trim();
- if (0 == cmd.length()) {
- return "";
- }
- return cmd;
- }
-
- private class URLComparator implements Comparator<URL> {
- @Override
- public int compare(final URL o1, URL o2) {
- return o1.toExternalForm().compareTo(o2.toExternalForm());
- }
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/Command.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/Command.java
deleted file mode 100644
index acebdce031..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/Command.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.server.cli.command;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-public @interface Command {
- String usage() default "";
-
- String name() default "";
-
- String description() default "";
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/Deploy.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/Deploy.java
deleted file mode 100644
index 9dc486fda9..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/Deploy.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.server.cli.command;
-
-import org.apache.openejb.assembler.DeployerEjb;
-
-@Command(name = "deploy", usage = "deploy <location>", description = "deploy
an application")
-public class Deploy extends AbstractCommand {
- @Override
- public void execute(String cmd) {
- try {
- new DeployerEjb().deploy(cmd.trim());
- } catch (Exception e) {
- streamManager.writeErr(e);
- }
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/DeployedAppCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/DeployedAppCommand.java
deleted file mode 100644
index a3e4eb3f21..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/DeployedAppCommand.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import org.apache.openejb.AppContext;
-import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.spi.ContainerSystem;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-@Command(name = "apps", usage = "apps", description = "list deployed
applications")
-public class DeployedAppCommand extends PathCommand {
- @Override
- public void execute(final String cmd) {
- streamManager.writeOut("Deployed applications:");
- final List<AppContext> apps = new ArrayList<>(SystemInstance.get()
- .getComponent(ContainerSystem.class).getAppContexts());
- Collections.sort(apps, new AppContextComparable());
- for (AppContext appContext : apps) {
- streamManager.writeOut(" - " + appContext.getId());
- }
- }
-
- private class AppContextComparable implements Comparator<AppContext> {
- @Override
- public int compare(final AppContext o1, final AppContext o2) {
- return o1.getId().compareTo(o2.getId());
- }
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ExitCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ExitCommand.java
deleted file mode 100644
index 1e01963680..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ExitCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.server.cli.command;
-
-// just to get it in the help
-@Command(name = "exit", usage = "exit", description = "exit from the cli")
-public class ExitCommand extends AbstractCommand {
- @Override
- public void execute(String cmd) {
- throw new UnsupportedOperationException("shouldn't be called
directly");
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/HelpCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/HelpCommand.java
deleted file mode 100644
index 930c8f8aed..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/HelpCommand.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import java.util.Map;
-
-@Command(name = "help", usage = "help", description = "print this help")
-public class HelpCommand extends AbstractCommand {
- private Map<String, Class<?>> commands;
-
- @Override
- public void execute(final String cmd) {
- for (Map.Entry<String, Class<?>> command : commands.entrySet()) {
- try {
- final Class<?> clazz = command.getValue();
- final Command annotation = clazz.getAnnotation(Command.class);
- streamManager.writeOut(annotation.name() + ": " +
annotation.description());
- streamManager.writeOut("\tUsage: " + annotation.usage(), "\n");
- } catch (Exception e) {
- // ignored = command not available
- }
- }
- }
-
- public void setCommands(Map<String, Class<?>> commands) {
- this.commands = commands;
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ListCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ListCommand.java
deleted file mode 100644
index 119c690ba6..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ListCommand.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import org.apache.openejb.util.helper.CommandHelper;
-
-import java.io.PrintStream;
-
-@Command(name = "list", usage = "list", description = "list available ejbs")
-public class ListCommand extends AbstractCommand {
- @Override
- public void execute(final String cmd) {
- try {
- CommandHelper.listEJBs(streamManager.getLineSep()).print(new
PrintStream(streamManager.getOut()));
- } catch (Exception e) {
- streamManager.writeErr(e);
- }
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/LocalJMXCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/LocalJMXCommand.java
deleted file mode 100644
index 4d8dbf5590..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/LocalJMXCommand.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * 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.server.cli.command;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Set;
-import javax.management.Attribute;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-import javax.management.RuntimeMBeanException;
-
-import org.apache.openejb.monitoring.LocalMBeanServer;
-import org.apache.xbean.propertyeditor.PropertyEditorRegistry;
-
-// TODO: maybe find a better way to invoker get/set/invoke because currently
we limit a bit possible values
-@Command(name = "jmx", description = "consult/update a jmx information", usage
= "jmx <operation> <options>. " +
- "\n\t\tOperation can be set|get|invoke.\n\t\tLast value is always the
object name canonical path." +
- "\n\t\tSet takes the new value as last value and the name of the attribute
as second parameter." +
- "\n\t\tInvoke takes the method invocation as second parameter." +
- "\n\t\tSamples:" +
- "\n\t\t\tjmx get MyAttributeName foo:type=bar" +
- "\n\t\t\tjmx set MyAttributeName foo:type=bar NewValue" +
- "\n\t\t\tjmx invoke myMethod(arg1,arg2) foo:type=bar")
-public class LocalJMXCommand extends AbstractCommand {
-
- private final PropertyEditorRegistry propertyEditorRegistry = new
PropertyEditorRegistry();
-
- public LocalJMXCommand() {
- this.propertyEditorRegistry.registerDefaults();
- }
-
- @Override
- public void execute(final String cmd) {
- final String jmxCmd = cmd.trim();
- if ("list".equals(jmxCmd)) {
- listMBeans();
- return;
- }
-
- if (!jmxCmd.contains(" ")) {
- streamManager.writeErr("the command is not correct");
- return;
- }
-
- int space = jmxCmd.indexOf(" ");
- final String command = jmxCmd.substring(0, space);
- final String value = jmxCmd.substring(command.length()).trim();
- if ("get".equals(command)) {
- get(value);
- } else if ("set".equals(command)) {
- set(value);
- } else if ("invoke".equals(command)) {
- invoke(value);
- } else {
- streamManager.writeOut("unknown command '" + command + "'");
- }
- }
-
- private void invoke(final String value) {
- if (!value.contains("(") || !value.contains(")")) {
- streamManager.writeErr("method should follow the format:
<methoName>(<arg1>,<arg2>,...)");
- return;
- }
-
- int open = value.indexOf("(");
- int close = value.lastIndexOf(")");
-
- final String name = value.substring(0, open).trim();
- final String rawArgs = value.substring(open + 1, close).trim();
- final ObjectName on;
- try {
- on = new ObjectName(value.substring(close + 1).trim());
- } catch (MalformedObjectNameException e) {
- streamManager.writeErr(e);
- return;
- }
-
- final MBeanServer server = LocalMBeanServer.get();
- final String[] args;
- if (rawArgs == null || rawArgs.isEmpty()) {
- args = new String[0];
- } else {
- args = rawArgs.split(",");
- }
-
- try {
- final MBeanInfo minfo = server.getMBeanInfo(on);
- final MBeanOperationInfo[] methods = minfo.getOperations();
-
- MBeanOperationInfo operation = null;
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals(name)) {
- operation = methods[i];
- break;
- }
- }
-
- if (operation == null) {
- streamManager.writeErr("can't find operation '" + name + "'");
- return;
- }
-
- final Object[] passedArgs = new Object[args.length];
- final String[] passedArgTypes = new String[args.length];
- for (int i = 0; i < passedArgs.length; i++) {
- final String expected = operation.getSignature()[i].getType();
- if (!String.class.getName().equals(expected)) {
- passedArgs[i] = propertyEditorRegistry.getValue(expected,
args[i], Thread.currentThread().getContextClassLoader());
- } else {
- passedArgs[i] = args[i];
- }
- passedArgTypes[i] = expected;
- }
-
- streamManager.writeOut(stringify(server.invoke(on, name,
passedArgs, passedArgTypes)));
- } catch (Exception e) {
- streamManager.writeErr(e);
- return;
- }
- }
-
- private void get(final String cmd) {
- int space = cmd.indexOf(" ");
- if (space < 0) {
- streamManager.writeErr("you need to specify an attribute and an
objectname");
- return;
- }
-
- final String attr = cmd.substring(0, space);
- final String on = cmd.substring(space, cmd.length()).trim();
-
- final MBeanServer mBeanServer = LocalMBeanServer.get();
- try {
- final ObjectName oname = new ObjectName(on);
- final Object value = mBeanServer.getAttribute(oname, attr);
- streamManager.writeOut("Attribute [" + on + " -> " + attr + "] = "
+ stringify(value));
- } catch (Exception ex) {
- streamManager.writeErr(ex);
- }
- }
-
- private void set(final String cmd) {
- final String[] split = cmd.split(" ");
- if (split.length < 2) {
- streamManager.writeErr("you need to specify an attribute, an
objectname and a value");
- return;
- }
-
- final MBeanServer mBeanServer = LocalMBeanServer.get();
- final String newValue = cmd.substring(split[0].length() +
split[1].length() + 1).trim();
- try {
- final ObjectName oname = new ObjectName(split[1]);
- final MBeanInfo minfo = mBeanServer.getMBeanInfo(oname);
- final MBeanAttributeInfo attrs[] = minfo.getAttributes();
-
- String type = String.class.getName();
- for (int i = 0; i < attrs.length; i++) {
- if (attrs[i].getName().equals(split[0])) {
- type = attrs[i].getType();
- break;
- }
- }
-
- final Object valueObj = propertyEditorRegistry.getValue(type,
newValue, Thread.currentThread().getContextClassLoader());
- mBeanServer.setAttribute(oname, new Attribute(split[0], valueObj));
- streamManager.writeOut("done");
- } catch (Exception ex) {
- streamManager.writeOut("Error - " + ex.toString());
- }
- }
-
- private String stringify(final Object value) {
- if (value == null) {
- return "<null>";
- }
- if (value.getClass().isArray()) {
- return Arrays.asList((Object[]) value).toString();
- }
- return value.toString();
- }
-
- private void listMBeans() {
- final MBeanServer mBeanServer = LocalMBeanServer.get();
-
- final Set<ObjectName> names;
- try {
- names = mBeanServer.queryNames(null, null);
- } catch (Exception e) {
- streamManager.writeErr(e);
- return;
- }
-
- final Iterator<ObjectName> it = names.iterator();
- while (it.hasNext()) {
- ObjectName oname = it.next();
- streamManager.writeOut("Name: " + oname.toString());
-
- try {
- final MBeanInfo minfo = mBeanServer.getMBeanInfo(oname);
- String code = minfo.getClassName();
- if ("org.apache.commons.modeler.BaseModelMBean".equals(code)) {
- code = (String) mBeanServer.getAttribute(oname,
"modelerType");
- }
- streamManager.writeOut(" + modelerType: " + code);
-
- MBeanAttributeInfo attrs[] = minfo.getAttributes();
- Object value = null;
-
- for (int i = 0; i < attrs.length; i++) {
- if (!attrs[i].isReadable()) {
- continue;
- }
-
- final String attName = attrs[i].getName();
- if ("modelerType".equals(attName)) {
- continue;
- }
-
- if (attName.indexOf("=") >= 0 ||
- attName.indexOf(":") >= 0 ||
- attName.indexOf(" ") >= 0) {
- continue;
- }
-
- try {
- value = mBeanServer.getAttribute(oname, attName);
- } catch (RuntimeMBeanException uoe) {
- // ignored
- } catch (Throwable t) {
- streamManager.writeErr(new Exception(t));
- continue;
- }
-
- try {
- String valueString = stringify(value);
- streamManager.writeOut(" + " + attName + ": " +
valueString);
- } catch (Throwable t) {
- streamManager.writeErr(new Exception(t));
- }
- }
- } catch (Throwable t) {
- streamManager.writeErr(new Exception(t));
- }
- streamManager.writeOut("");
- }
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/LsCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/LsCommand.java
deleted file mode 100644
index 26f19c83ee..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/LsCommand.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import java.io.File;
-
-@Command(name = "ls", usage = "ls [<path>]", description = "list files (in
tomee directories only)")
-public class LsCommand extends PathCommand {
- @Override
- public void execute(final String cmd) {
- final File file;
- try {
- file = resolve(cmd);
- } catch (IllegalArgumentException iae) {
- streamManager.writeErr(iae.getMessage());
- return;
- }
-
- if (file.isDirectory() && file.exists()) {
- list(file.getAbsolutePath(), file);
- } else if (file.exists()) {
- streamManager.writeOut("file " + file.getPath() + " exists");
- } else {
- streamManager.writeOut("file " + file.getPath() + " doesn't
exist");
- }
- }
-
- private void list(final String base, final File dir) {
- String removed = base;
- if (!base.endsWith("/")) {
- removed = removed + "/";
- }
- final File[] files = dir.listFiles();
- if (files != null) {
- for (final File file : files) { // not recursive otherwise it
starts to be complicated
- streamManager.writeOut(type(file) + " " +
file.getAbsolutePath().replace(removed, ""));
- }
- }
- }
-
- private static String type(final File file) {
- if (file.isDirectory()) {
- return "D";
- }
- return "F";
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/PartCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/PartCommand.java
deleted file mode 100644
index 1410014abb..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/PartCommand.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import org.apache.openejb.loader.IO;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-@Command(name = "part", usage = "part <first line>-<last line> <path>",
description = "print the specified line range of a file (in tomee directories
only)")
-public class PartCommand extends PathCommand {
- private static final Pattern PATTERN = Pattern.compile("([0-9]*)-([0-9]*)
(.*)");
-
- @Override
- public void execute(final String cmd) {
- final Matcher matcher = PATTERN.matcher(cmd);
- if (!matcher.matches()) {
- streamManager.writeErr("you have to specify a numbe of line,
please see help for more information");
- return;
- }
-
- int firstLine;
- int secondLine;
- try {
- firstLine = getInt(matcher.group(1));
- secondLine = getInt(matcher.group(2));
- } catch (NumberFormatException nfe) {
- streamManager.writeErr("line number was not parsable");
- return;
- }
-
- final String path = matcher.group(3);
- final File file;
- try {
- file = resolve(path);
- } catch (IllegalArgumentException iae) {
- streamManager.writeErr(iae.getMessage());
- return;
- }
-
- if (file.isDirectory() && file.exists()) {
- streamManager.writeOut("file " + file.getPath() + " is a
directory, please specify a regular file");
- } else if (file.exists()) {
- try {
- part(file, firstLine, secondLine);
- } catch (IOException e) {
- streamManager.writeErr(e);
- }
- } else {
- streamManager.writeOut("file " + file.getPath() + " doesn't
exist");
- }
- }
-
- private int getInt(String group) {
- try {
- return Integer.parseInt(group);
- } catch (NumberFormatException nfe) {
- streamManager.writeErr("line number should be an integer");
- throw nfe;
- }
- }
-
- private void part(final File file, int firstLine, int secondLine) throws
IOException {
- BufferedReader br = new BufferedReader(new FileReader(file));
- String line;
- int totalLineNumber = 0;
- try {
- while (br.readLine() != null) {
- totalLineNumber++;
- }
- } finally {
- IO.close(br);
- }
-
- br = new BufferedReader(new FileReader(file));
- try {
- int firstLineToPrint = Math.max(1, firstLine);
- int lastLine = Math.min(totalLineNumber, secondLine);
- totalLineNumber = 0;
- while ((line = br.readLine()) != null) {
- totalLineNumber++;
- if (totalLineNumber >= firstLineToPrint && totalLineNumber <=
lastLine) {
- streamManager.writeOut(String.format("%3d. %s",
totalLineNumber, line));
- }
- if (totalLineNumber > lastLine) {
- break;
- }
- }
- } finally {
- IO.close(br);
- }
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/PathCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/PathCommand.java
deleted file mode 100644
index c12dce86ce..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/PathCommand.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import org.apache.openejb.loader.SystemInstance;
-
-import java.io.File;
-
-public abstract class PathCommand extends AbstractCommand {
- public static final String HOME = "$home";
- public static final String BASE = "$base";
-
- protected File resolve(final String cmd) {
- if (cmd == null || cmd.trim().isEmpty()) {
- return SystemInstance.get().getBase().getDirectory();
- }
- String path = cmd.trim();
- File workingFile = new File(path);
- if ((!path.startsWith(HOME) && !path.startsWith(BASE) &&
workingFile.getPath().equals(workingFile.getAbsolutePath())) ||
path.startsWith("..")) {
- throw new IllegalArgumentException("path should start with " +
BASE + " or " + HOME + " or be relative");
- }
-
- if (path.startsWith(HOME)) {
- return new File(path.replace(HOME,
SystemInstance.get().getHome().getDirectory().getAbsolutePath()));
- } else if (path.startsWith(BASE)) {
- return new File(path.replace(BASE,
SystemInstance.get().getBase().getDirectory().getAbsolutePath()));
- }
- return new
File(SystemInstance.get().getBase().getDirectory().getAbsolutePath(), path);
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/PropertiesCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/PropertiesCommand.java
deleted file mode 100644
index 0575c7730e..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/PropertiesCommand.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import org.apache.openejb.assembler.classic.OpenEjbConfiguration;
-import org.apache.openejb.assembler.classic.cmd.Info2Properties;
-import org.apache.openejb.loader.SystemInstance;
-
-import java.io.PrintStream;
-
-@Command(name = "properties", usage = "properties", description = "show
OpenEJB container properties")
-public class PropertiesCommand extends AbstractCommand {
- @Override
- public void execute(final String cmd) {
- final OpenEjbConfiguration config =
SystemInstance.get().getComponent(OpenEjbConfiguration.class);
- Info2Properties.printConfig(config, new
PrintStream(streamManager.getOut()), streamManager.getLineSep());
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ScriptCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ScriptCommand.java
deleted file mode 100644
index 41730e1a3c..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ScriptCommand.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import org.apache.openejb.util.OpenEJBScripter;
-
-@Command(name = "script", usage = "script <code>", description = "execute
script code in the specified language. ejb can be accessed through their ejb
name in the script.")
-public class ScriptCommand extends AbstractCommand {
- protected OpenEJBScripter scripter;
- protected String language;
- protected String script;
-
- @Override
- public void execute(final String cmd) {
- try {
- parse(cmd);
- final Object result = scripter.evaluate(language, script);
- streamManager.writeOut(streamManager.asString(result));
- } catch (Exception e) {
- streamManager.writeErr(e);
- }
- }
-
- private void parse(final String parseableCmd) {
- final int spaceIdx = parseableCmd.indexOf(" ");
- if (spaceIdx < 0) {
- throw new IllegalArgumentException("bad syntax, see help");
- }
- language = parseableCmd.substring(0, spaceIdx);
- script = parseableCmd.substring(spaceIdx + 1, parseableCmd.length());
- }
-
- public void setScripter(OpenEJBScripter scripter) {
- this.scripter = scripter;
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ScriptFileCommand.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ScriptFileCommand.java
deleted file mode 100644
index 14a4c6bc7b..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/ScriptFileCommand.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.server.cli.command;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-@Command(name = "script file", usage = "script file <path>", description =
"execute script code contained in a file in the specifid language. ejb can be
accessed through their ejb name in the script. The extension is used to detect
the file format.")
-public class ScriptFileCommand extends ScriptCommand {
- @Override
- public void execute(final String cmd) {
- try {
- parse(cmd);
- } catch (IllegalArgumentException iae) {
- streamManager.writeErr("script cmd " + cmd + " can't be parsed");
- return;
- }
-
- final File file = new File(script);
- if (!file.exists()) {
- streamManager.writeErr("script file " + file.getPath() + " doesn't
exist");
- return;
- }
-
- final StringBuilder builder = new StringBuilder(1024);
- builder.append("script ").append(language).append(" "); // we will run
the parent command
-
- try (BufferedReader reader = new BufferedReader(new FileReader(file)))
{
- char[] buf = new char[1024];
- int numRead;
- while ((numRead = reader.read(buf)) != -1) {
- String readData = String.valueOf(buf, 0, numRead);
- builder.append(readData);
- buf = new char[1024];
- }
- } catch (Exception e) {
- streamManager.writeErr(e);
- return;
- }
-
- super.execute(builder.toString());
- }
-
- private void parse(final String cmd) {
- script = cmd;
- final int dotIdx = script.lastIndexOf(".");
- if (dotIdx < 0) {
- throw new IllegalArgumentException("bad syntax, see help");
- }
- language = script.substring(dotIdx + 1, script.length());
- }
-}
diff --git
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/Undeploy.java
b/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/Undeploy.java
deleted file mode 100644
index d9bcf2c309..0000000000
---
a/server/openejb-common-cli/src/main/java/org/apache/openejb/server/cli/command/Undeploy.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.server.cli.command;
-
-import org.apache.openejb.assembler.DeployerEjb;
-
-@Command(name = "undeploy", usage = "undeploy <location>", description =
"undeploy an application. Note the location should be the same than for deploy")
-public class Undeploy extends AbstractCommand {
- @Override
- public void execute(String cmd) {
- try {
- new DeployerEjb().undeploy(cmd.trim());
- } catch (Exception e) {
- streamManager.writeErr(e);
- }
- }
-}
diff --git a/server/openejb-common-cli/src/main/resources/META-INF/scan.xml
b/server/openejb-common-cli/src/main/resources/META-INF/scan.xml
deleted file mode 100644
index c7015f18dd..0000000000
--- a/server/openejb-common-cli/src/main/resources/META-INF/scan.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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.
--->
-<scan>
- <packages>
- <package>org.apache.openejb.server.cli.command</package>
- </packages>
-</scan>
diff --git a/server/openejb-common-cli/src/main/resources/branding.properties
b/server/openejb-common-cli/src/main/resources/branding.properties
deleted file mode 100644
index 0d78674784..0000000000
--- a/server/openejb-common-cli/src/main/resources/branding.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-\#
-# 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.
-#
-welcome_common = Welcome on your $bind:$port $name server
-
-welcome_openejb = \ \ ___ ___ _ ___\r\n\
-\ / _ \\ _ __ ___ _ _ | __| | | _ )\r\n\
-| (_) | '_ \\/ -_) ' \\| _| || | _ \\ \r\n\
-\ \\___/| .__/\\___|_||_|___\\__/|___/\r\n\
-\ \ \ \ \ \ |_|
-
-welcome_tomee = \ _____ ___ ___\r\n\
-|_ _|__ _ __ | __| __|\r\n\
-\ \ | |/ _ \\ ' \\| _|| _|\r\n\
-\ \ |_|\\___/_|_|_|___|___|\r\n
diff --git
a/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/Bar.java
b/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/Bar.java
deleted file mode 100644
index fe5b33a23a..0000000000
---
a/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/Bar.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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.server.groovy;
-
-import jakarta.inject.Named;
-
-@Named
-public class Bar {
- public String test() {
- return "ok";
- }
-}
diff --git
a/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/BeanManagerHelperTest.java
b/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/BeanManagerHelperTest.java
deleted file mode 100644
index f685061324..0000000000
---
a/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/BeanManagerHelperTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * 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.server.groovy;
-
-import org.apache.openejb.jee.Beans;
-import org.apache.openejb.junit.ApplicationComposer;
-import org.apache.openejb.testing.Configuration;
-import org.apache.openejb.testing.Module;
-import org.apache.openejb.util.OpenEJBScripter;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import jakarta.inject.Named;
-
-import java.util.Properties;
-
-import static org.junit.Assert.assertEquals;
-
-@RunWith(ApplicationComposer.class)
-public class BeanManagerHelperTest {
- private static OpenEJBScripter.BeanManagerHelper helper = new
OpenEJBScripter.BeanManagerHelper();
-
- @Configuration
- public Properties config() {
- final Properties p = new Properties();
- p.setProperty("openejb.deployments.classpath.filter.systemapps",
"false");
- return p;
- }
-
- @Module
- public Beans ejbJar() {
- final Beans beans = new Beans();
- beans.addManagedClass(Pojo.class);
- return beans;
- }
-
- @Before
- public void resetID() {
- Pojo.ID = 5;
- }
-
- @Test
- public void getInstanceFromClass() {
- for (int i = 1; i < 5; i++) {
- final Pojo pojo = (Pojo)
helper.beanFromClass("BeanManagerHelperTest", Pojo.class.getName());
- assertEquals(5 + i, pojo.id);
- }
- }
-
- @Test
- public void getInstanceFromName() {
- for (int i = 1; i < 5; i++) {
- final Pojo pojo = (Pojo)
helper.beanFromName("BeanManagerHelperTest", "pojo");
- assertEquals(5 + i, pojo.id);
- }
- }
-
- @Named
- public static class Pojo {
- public static int ID;
- public int id = ++ID;
- }
-}
diff --git
a/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/Foo.java
b/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/Foo.java
deleted file mode 100644
index e592353fa0..0000000000
---
a/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/Foo.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.server.groovy;
-
-import jakarta.ejb.Lock;
-import jakarta.ejb.LockType;
-import jakarta.ejb.Singleton;
-
-@Singleton
-@Lock(LockType.READ)
-public class Foo {
- public String foo() {
- return "foo";
- }
-}
diff --git
a/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/OpenEJBGroovyShellTest.java
b/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/OpenEJBGroovyShellTest.java
deleted file mode 100644
index 368bcf6dc0..0000000000
---
a/server/openejb-common-cli/src/test/java/org/apache/openejb/server/groovy/OpenEJBGroovyShellTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.server.groovy;
-
-import java.util.Properties;
-import jakarta.ejb.embeddable.EJBContainer;
-import javax.script.ScriptException;
-
-import org.apache.openejb.util.OpenEJBScripter;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class OpenEJBGroovyShellTest {
- private static EJBContainer container;
-
- @BeforeClass
- public static void start() {
- final Properties properties = new Properties();
- properties.setProperty(EJBContainer.APP_NAME,
OpenEJBGroovyShellTest.class.getSimpleName());
-
properties.setProperty("openejb.deployments.classpath.filter.systemapps",
"false");
- container = EJBContainer.createEJBContainer(properties);
- }
-
- @AfterClass
- public static void close() {
- container.close();
- }
-
- @Test
- public void callUsingCDI() throws ScriptException {
- final OpenEJBScripter shell = new OpenEJBScripter();
- final Object out = shell.evaluate("groovy",
"bm.beanFromName('OpenEJBGroovyShellTest', 'bar').test()");
- assertEquals("ok", out);
- }
-}
diff --git a/server/openejb-common-cli/src/test/resources/META-INF/beans.xml
b/server/openejb-common-cli/src/test/resources/META-INF/beans.xml
deleted file mode 100644
index 9126ae7927..0000000000
--- a/server/openejb-common-cli/src/test/resources/META-INF/beans.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<!--
-
- 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.
--->
-<beans />
-
diff --git a/server/pom.xml b/server/pom.xml
index 6ee3642ecb..9527cf6b91 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -45,7 +45,6 @@
<module>openejb-cxf-rs</module>
<module>openejb-cxf-transport</module>
<module>openejb-rest</module>
- <module>openejb-common-cli</module>
<module>openejb-bonecp</module>
</modules>