KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > deployment > cli > CommandDeploy


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 package org.apache.geronimo.deployment.cli;
19
20 import org.apache.geronimo.common.DeploymentException;
21
22 import javax.enterprise.deploy.spi.DeploymentManager JavaDoc;
23 import javax.enterprise.deploy.spi.Target JavaDoc;
24 import javax.enterprise.deploy.spi.status.ProgressObject JavaDoc;
25 import java.io.File JavaDoc;
26 import java.io.PrintWriter JavaDoc;
27
28 /**
29  * The CLI deployer logic to deploy (distribute plus start).
30  *
31  * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
32  */

33 public class CommandDeploy extends CommandDistribute {
34     public CommandDeploy() {
35         super("deploy", "1. Common Commands", "[--inPlace] [--targets target;target;...] [module] [plan]",
36                 "Normally both a module and plan are passed to the deployer. " +
37                 "Sometimes the module contains a plan, or requires no plan, in which case " +
38                 "the plan may be omitted. Sometimes the plan references a module already " +
39                 "deployed in the Geronimo server environment, in which case a module does " +
40                 "not need to be provided.\n" +
41                 "If no targets are provided, the module is deployed to all available " +
42                 "targets. Geronimo only provides one target (ever), so this is primarily " +
43                 "useful when using a different driver.");
44     }
45
46     protected String JavaDoc getAction() {
47         return "Deployed";
48     }
49
50     protected ProgressObject JavaDoc runCommand(DeploymentManager JavaDoc mgr, PrintWriter JavaDoc out, boolean inPlace, Target JavaDoc[] tlist, File JavaDoc module, File JavaDoc plan) throws DeploymentException {
51         ProgressObject JavaDoc po = super.runCommand(mgr, out, inPlace, tlist, module, plan);
52         waitForProgress(out, po);
53         if(po.getDeploymentStatus().isFailed()) {
54             throw new DeploymentException("Unable to distribute "+(module == null ? plan.getName() : module.getName())+": "+po.getDeploymentStatus().getMessage());
55         }
56         return mgr.start(po.getResultTargetModuleIDs());
57     }
58
59     public void execute(PrintWriter JavaDoc out, ServerConnection connection, String JavaDoc[] args) throws DeploymentException {
60         super.execute(out, connection, args);
61     }
62 }
63
Popular Tags