KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > plugin > packaging > AbstractDistributor


1 /**
2  *
3  * Copyright 2005 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.packaging;
19
20 import java.io.File JavaDoc;
21 import javax.management.MalformedObjectNameException JavaDoc;
22 import javax.management.ObjectName JavaDoc;
23
24 /**
25  * Base class for Distributors defining common attributes.
26  *
27  * @version $Rev: 158495 $ $Date: 2005-03-21 10:15:15 -0800 (Mon, 21 Mar 2005) $
28  */

29 public abstract class AbstractDistributor {
30     private String JavaDoc user;
31     private String JavaDoc password;
32     private String JavaDoc url;
33     private File JavaDoc artifact;
34     protected ObjectName JavaDoc storeName;
35
36     public String JavaDoc getUser() {
37         return user;
38     }
39
40     /**
41      * Set the username used to connect to the server.
42      *
43      * @param user the username
44      */

45     public void setUser(String JavaDoc user) {
46         this.user = user;
47     }
48
49     public String JavaDoc getPassword() {
50         return password;
51     }
52
53     /**
54      * Set the password used to connect to the server.
55      *
56      * @param password the password
57      */

58     public void setPassword(String JavaDoc password) {
59         this.password = password;
60     }
61
62     public String JavaDoc getUrl() {
63         return url;
64     }
65
66     /**
67      * Set the URL of the server.
68      *
69      * @param url the URL of the server
70      */

71     public void setUrl(String JavaDoc url) {
72         this.url = url;
73     }
74
75     public File JavaDoc getArtifact() {
76         return artifact;
77     }
78
79     /**
80      * Set the artifact to distribute.
81      *
82      * @param artifact the artifact to distribute
83      */

84     public void setArtifact(File JavaDoc artifact) {
85         this.artifact = artifact;
86     }
87
88     public String JavaDoc getStoreName() {
89         return storeName.toString();
90     }
91
92     /**
93      * Set the name of the ConfigurationStore in the server that the artifact
94      * should be installed in. This allows for server's that have multiple
95      * stores, although typical installation may only have one.
96      *
97      * @param storeName the name of the ConfigurationStore to distribute to
98      */

99     public void setStoreName(String JavaDoc storeName) {
100         try {
101             this.storeName = new ObjectName JavaDoc(storeName);
102         } catch (MalformedObjectNameException JavaDoc e) {
103             throw new IllegalArgumentException JavaDoc("Invalid storeName: " + storeName);
104         }
105     }
106
107     public abstract void execute() throws Exception JavaDoc;
108 }
109
Popular Tags