KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > extensions > types > PluginDefinition


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.extensions.types;
21
22 import java.io.File JavaDoc;
23 import java.net.URL JavaDoc;
24 import java.util.ArrayList JavaDoc;
25 import java.util.Iterator JavaDoc;
26 import java.util.List JavaDoc;
27
28 import com.sslexplorer.extensions.ExtensionDescriptor;
29
30 /**
31  * @author Brett Smith <brett@3sp.com>
32  */

33 public class PluginDefinition implements Comparable JavaDoc {
34
35     private List JavaDoc<URL JavaDoc> classPath, resourceBases;
36     private String JavaDoc name, className;
37     private int order;
38     private PluginStatus status;
39     private ExtensionDescriptor descriptor;
40     private List JavaDoc nativeDirectories;
41
42     /**
43      * Constructor.
44      *
45      * @param descriptor
46      */

47     public PluginDefinition(ExtensionDescriptor descriptor) {
48         classPath = new ArrayList JavaDoc<URL JavaDoc>();
49         resourceBases = new ArrayList JavaDoc<URL JavaDoc>();
50         status = new PluginStatus();
51         nativeDirectories = new ArrayList JavaDoc();
52         this.descriptor = descriptor;
53     }
54     
55     public String JavaDoc getName() {
56         return name;
57     }
58
59     public void addResourceBase(URL JavaDoc url) {
60         resourceBases.add(url);
61     }
62
63     public void removeResourceBase(URL JavaDoc url) {
64         resourceBases.remove(url);
65     }
66
67     public void setDescriptor(ExtensionDescriptor descriptor) {
68         this.descriptor = descriptor;
69     }
70
71     public static void main(String JavaDoc[] args) {
72     }
73     /**
74      * @return Returns the className.
75      */

76     public String JavaDoc getClassName() {
77         return className;
78     }
79     /**
80      * @param className The className to set.
81      */

82     public void setName(String JavaDoc name) {
83         this.name = name;
84     }
85     /**
86      * @param className The className to set.
87      */

88     public void setClassName(String JavaDoc className) {
89         this.className = className;
90     }
91     /**
92      * @return Returns the classPath.
93      */

94     public List JavaDoc<URL JavaDoc> getClassPath() {
95         return classPath;
96     }
97     /**
98      * @param classPath The classPath to set.
99      */

100     public void setClassPath(List JavaDoc classPath) {
101         this.classPath = classPath;
102     }
103
104     /**
105      * @return Returns the descriptor.
106      */

107     public ExtensionDescriptor getDescriptor() {
108         return descriptor;
109     }
110     /**
111      * @param status The status to set.
112      */

113     public void setStatus(PluginStatus status) {
114         this.status = status;
115     }
116     /**
117      * @return Returns the order.
118      */

119     public int getOrder() {
120         return order;
121     }
122     /**
123      * @param order The order to set.
124      */

125     public void setOrder(int order) {
126         this.order = order;
127     }
128
129     /*
130      * (non-Javadoc)
131      *
132      * @see java.lang.Comparable#compareTo(java.lang.Object)
133      */

134     public int compareTo(Object JavaDoc arg0) {
135         return new Integer JavaDoc(getOrder()).compareTo(new Integer JavaDoc(((PluginDefinition) arg0).getOrder()));
136     }
137
138     public PluginStatus getStatus() {
139         return status;
140     }
141
142
143
144     public class PluginStatus {
145         Throwable JavaDoc exception;
146         int status;
147
148         public PluginStatus() {
149         }
150
151         public int getStatus() {
152             return status;
153         }
154
155         public Throwable JavaDoc getException() {
156             return exception;
157         }
158     }
159
160
161
162     /**
163      * @param url
164      */

165     public void addClassPath(URL JavaDoc url) {
166         classPath.add(url);
167     }
168
169     /**
170      * @return
171      */

172     public List JavaDoc<URL JavaDoc> getResourceBases() {
173         return resourceBases;
174     }
175
176     public void addNativeDirectory(File JavaDoc directory) {
177         nativeDirectories.add(directory);
178     }
179
180     /**
181      * @return
182      */

183     public Iterator JavaDoc getNativeDirectories() {
184         return nativeDirectories.iterator();
185     }
186 }
187
Popular Tags