KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > plugin > assembly > LocalConfigInstaller


1 /**
2  *
3  * Copyright 2003-2004 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * 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.plugin.assembly;
19
20 import java.io.File JavaDoc;
21 import java.net.URI JavaDoc;
22
23 import org.apache.geronimo.system.configuration.LocalConfigStore;
24
25 /**
26  * JellyBean that installs configuration artifacts into a LocalConfigurationStore
27  *
28  * @version $Rev: 156292 $ $Date: 2005-03-05 18:48:02 -0800 (Sat, 05 Mar 2005) $
29  */

30 public class LocalConfigInstaller {
31     private File JavaDoc root;
32     private File JavaDoc artifact;
33
34     public File JavaDoc getRoot() {
35         return root;
36     }
37
38     public void setRoot(File JavaDoc root) {
39         this.root = root;
40     }
41
42     public File JavaDoc getArtifact() {
43         return artifact;
44     }
45
46     public void setArtifact(File JavaDoc artifact) {
47         this.artifact = artifact;
48     }
49
50     public void execute() throws Exception JavaDoc {
51         LocalConfigStore store = new LocalConfigStore(root);
52         store.doStart();
53         try {
54             URI JavaDoc uri = store.install(artifact.toURL());
55             System.out.println("Installed configuration " + uri);
56         } finally{
57             store.doStop();
58         }
59     }
60 }
61
Popular Tags