001: /*****************************************************************************
002: * Java Plug-in Framework (JPF)
003: * Copyright (C) 2006-2007 Dmitry Olshansky
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: *****************************************************************************/package org.java.plugin.tools.mocks;
019:
020: import java.net.URL;
021:
022: import org.java.plugin.registry.Documentation;
023: import org.java.plugin.registry.MatchingRule;
024: import org.java.plugin.registry.PluginDescriptor;
025: import org.java.plugin.registry.PluginFragment;
026: import org.java.plugin.registry.PluginRegistry;
027: import org.java.plugin.registry.Version;
028:
029: /**
030: * @version $Id$
031: */
032: public class MockPluginFragment extends MockIdentity implements
033: PluginFragment {
034: private URL location;
035: private String pluginId;
036: private Version pluginVersion;
037: private PluginRegistry registry;
038: private String vendor;
039: private Version version;
040: private String docsPath;
041: private Documentation<PluginFragment> documentation;
042: private MatchingRule matchingRule;
043:
044: /**
045: * @see org.java.plugin.registry.PluginFragment#getLocation()
046: */
047: public URL getLocation() {
048: return location;
049: }
050:
051: /**
052: * @param value the location to set
053: * @return this instance
054: */
055: public MockPluginFragment setLocation(final URL value) {
056: location = value;
057: return this ;
058: }
059:
060: /**
061: * @see org.java.plugin.registry.PluginFragment#getPluginId()
062: */
063: public String getPluginId() {
064: return pluginId;
065: }
066:
067: /**
068: * @param value the plug-in ID to set
069: * @return this instance
070: */
071: public MockPluginFragment setPluginId(final String value) {
072: pluginId = value;
073: return this ;
074: }
075:
076: /**
077: * @see org.java.plugin.registry.PluginFragment#getPluginVersion()
078: */
079: public Version getPluginVersion() {
080: return pluginVersion;
081: }
082:
083: /**
084: * @param value the plug-in version to set
085: * @return this instance
086: */
087: public MockPluginFragment setPluginVersion(final Version value) {
088: pluginVersion = value;
089: return this ;
090: }
091:
092: /**
093: * @see org.java.plugin.registry.PluginFragment#getRegistry()
094: */
095: public PluginRegistry getRegistry() {
096: return registry;
097: }
098:
099: /**
100: * @param value the registry to set
101: * @return this instance
102: */
103: public MockPluginFragment setRegistry(final PluginRegistry value) {
104: registry = value;
105: return this ;
106: }
107:
108: /**
109: * @see org.java.plugin.registry.PluginFragment#getVendor()
110: */
111: public String getVendor() {
112: return vendor;
113: }
114:
115: /**
116: * @param value the vendor to set
117: * @return this instance
118: */
119: public MockPluginFragment setVendor(final String value) {
120: vendor = value;
121: return this ;
122: }
123:
124: /**
125: * @see org.java.plugin.registry.PluginFragment#getVersion()
126: */
127: public Version getVersion() {
128: return version;
129: }
130:
131: /**
132: * @param value the version to set
133: * @return this instance
134: */
135: public MockPluginFragment setVersion(final Version value) {
136: version = value;
137: return this ;
138: }
139:
140: /**
141: * @see org.java.plugin.registry.PluginFragment#matches(
142: * org.java.plugin.registry.PluginDescriptor)
143: */
144: public boolean matches(final PluginDescriptor descr) {
145: return getVersion().isCompatibleWith(descr.getVersion());
146: }
147:
148: /**
149: * @see org.java.plugin.registry.PluginFragment#getMatchingRule()
150: */
151: public MatchingRule getMatchingRule() {
152: return matchingRule;
153: }
154:
155: /**
156: * @param value the matching rule to set
157: * @return this instance
158: */
159: public MockPluginFragment setMatchingRule(final MatchingRule value) {
160: matchingRule = value;
161: return this ;
162: }
163:
164: /**
165: * @see org.java.plugin.registry.UniqueIdentity#getUniqueId()
166: */
167: public String getUniqueId() {
168: return getId() + '@' + getVersion();
169: }
170:
171: /**
172: * @see org.java.plugin.registry.Documentable#getDocsPath()
173: */
174: public String getDocsPath() {
175: return docsPath;
176: }
177:
178: /**
179: * @param value the docs path to set
180: * @return this instance
181: */
182: public MockPluginFragment setDocsPath(final String value) {
183: docsPath = value;
184: return this ;
185: }
186:
187: /**
188: * @see org.java.plugin.registry.Documentable#getDocumentation()
189: */
190: public Documentation<PluginFragment> getDocumentation() {
191: return documentation;
192: }
193:
194: /**
195: * @param value the documentation to set
196: * @return this instance
197: */
198: public MockPluginFragment setDocumentation(
199: final Documentation<PluginFragment> value) {
200: documentation = value;
201: return this;
202: }
203: }
|