01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.openejb.server.telnet;
17:
18: import java.io.DataInputStream;
19: import java.io.IOException;
20: import java.io.PrintStream;
21:
22: import org.apache.openejb.Container;
23: import org.apache.openejb.DeploymentInfo;
24: import org.apache.openejb.loader.SystemInstance;
25: import org.apache.openejb.spi.ContainerSystem;
26:
27: public class Ls extends Command {
28:
29: public static void register() {
30: Ls cmd = new Ls();
31: Command.register("system", cmd);
32:
33: }
34:
35: public void exec(Arguments args, DataInputStream in, PrintStream out)
36: throws IOException {
37:
38: ContainerSystem containerSystem1 = SystemInstance.get()
39: .getComponent(ContainerSystem.class);
40: Container[] c = containerSystem1.containers();
41: out.println("Containers:");
42:
43: for (int i = 0; i < c.length; i++) {
44: out.print(" " + c[i].getContainerID());
45: out.println("");
46: }
47: out.println("");
48:
49: out.println("Deployments:");
50:
51: ContainerSystem containerSystem = SystemInstance.get()
52: .getComponent(ContainerSystem.class);
53: DeploymentInfo[] d = containerSystem.deployments();
54: for (int i = 0; i < d.length; i++) {
55: out.print(" " + d[i].getDeploymentID());
56: out.println("");
57: }
58: }
59:
60: }
|