KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > java > plugin > tools > mocks > MockPluginFragment


1 /*****************************************************************************
2  * Java Plug-in Framework (JPF)
3  * Copyright (C) 2006 Dmitry Olshansky
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *****************************************************************************/

19 package org.java.plugin.tools.mocks;
20
21 import java.net.URL JavaDoc;
22
23 import org.java.plugin.registry.Documentation;
24 import org.java.plugin.registry.PluginDescriptor;
25 import org.java.plugin.registry.PluginFragment;
26 import org.java.plugin.registry.PluginRegistry;
27 import org.java.plugin.registry.Version;
28
29 /**
30  * @version $Id: MockPluginFragment.java,v 1.2 2006/09/14 18:10:39 ddimon Exp $
31  */

32 public class MockPluginFragment extends MockIdentity implements PluginFragment {
33     private URL JavaDoc location;
34     private String JavaDoc pluginId;
35     private Version pluginVersion;
36     private PluginRegistry registry;
37     private String JavaDoc vendor;
38     private Version version;
39     private String JavaDoc docsPath;
40     private Documentation documentation;
41
42     /**
43      * @see org.java.plugin.registry.PluginFragment#getLocation()
44      */

45     public URL JavaDoc getLocation() {
46         return location;
47     }
48     
49     /**
50      * @param value the location to set
51      * @return this instance
52      */

53     public MockPluginFragment setLocation(final URL JavaDoc value) {
54         location = value;
55         return this;
56     }
57
58     /**
59      * @see org.java.plugin.registry.PluginFragment#getPluginId()
60      */

61     public String JavaDoc getPluginId() {
62         return pluginId;
63     }
64     
65     /**
66      * @param value the plug-in ID to set
67      * @return this instance
68      */

69     public MockPluginFragment setPluginId(final String JavaDoc value) {
70         pluginId = value;
71         return this;
72     }
73
74     /**
75      * @see org.java.plugin.registry.PluginFragment#getPluginVersion()
76      */

77     public Version getPluginVersion() {
78         return pluginVersion;
79     }
80     
81     /**
82      * @param value the plug-in version to set
83      * @return this instance
84      */

85     public MockPluginFragment setPluginVersion(final Version value) {
86         pluginVersion = value;
87         return this;
88     }
89
90     /**
91      * @see org.java.plugin.registry.PluginFragment#getRegistry()
92      */

93     public PluginRegistry getRegistry() {
94         return registry;
95     }
96     
97     /**
98      * @param value the registry to set
99      * @return this instance
100      */

101     public MockPluginFragment setRegistry(final PluginRegistry value) {
102         registry = value;
103         return this;
104     }
105
106     /**
107      * @see org.java.plugin.registry.PluginFragment#getVendor()
108      */

109     public String JavaDoc getVendor() {
110         return vendor;
111     }
112     
113     /**
114      * @param value the vendor to set
115      * @return this instance
116      */

117     public MockPluginFragment setVendor(final String JavaDoc value) {
118         vendor = value;
119         return this;
120     }
121
122     /**
123      * @see org.java.plugin.registry.PluginFragment#getVersion()
124      */

125     public Version getVersion() {
126         return version;
127     }
128     
129     /**
130      * @param value the version to set
131      * @return this instance
132      */

133     public MockPluginFragment setVersion(final Version value) {
134         version = value;
135         return this;
136     }
137
138     /**
139      * @see org.java.plugin.registry.PluginFragment#matches(
140      * org.java.plugin.registry.PluginDescriptor)
141      */

142     public boolean matches(final PluginDescriptor descr) {
143         return getVersion().isCompatibleWith(descr.getVersion());
144     }
145
146     /**
147      * @see org.java.plugin.registry.UniqueIdentity#getUniqueId()
148      */

149     public String JavaDoc getUniqueId() {
150         return getId() + '@' + getVersion();
151     }
152
153     /**
154      * @see org.java.plugin.registry.Documentable#getDocsPath()
155      */

156     public String JavaDoc getDocsPath() {
157         return docsPath;
158     }
159     
160     /**
161      * @param value the docs path to set
162      * @return this instance
163      */

164     public MockPluginFragment setDocsPath(final String JavaDoc value) {
165         docsPath = value;
166         return this;
167     }
168
169     /**
170      * @see org.java.plugin.registry.Documentable#getDocumentation()
171      */

172     public Documentation getDocumentation() {
173         return documentation;
174     }
175
176     /**
177      * @param value the documentation to set
178      * @return this instance
179      */

180     public MockPluginFragment setDocumentation(final Documentation value) {
181         documentation = value;
182         return this;
183     }
184 }
185
Popular Tags