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 org.java.plugin.registry.MatchingRule;
021: import org.java.plugin.registry.PluginPrerequisite;
022: import org.java.plugin.registry.Version;
023:
024: /**
025: * @version $Id$
026: */
027: public class MockPluginPrerequisite extends
028: MockPluginElement<PluginPrerequisite> implements
029: PluginPrerequisite {
030: private String pluginId;
031: private Version pluginVersion;
032: private boolean isExported;
033: private boolean isOptional;
034: private boolean isReverseLookup;
035: private boolean matches = true;
036: private MatchingRule matchingRule;
037:
038: /**
039: * @see org.java.plugin.registry.PluginPrerequisite#getPluginId()
040: */
041: public String getPluginId() {
042: return pluginId;
043: }
044:
045: /**
046: * @param value the plug-in id to set
047: * @return this instance
048: */
049: public MockPluginPrerequisite setPluginId(final String value) {
050: pluginId = value;
051: return this ;
052: }
053:
054: /**
055: * @see org.java.plugin.registry.PluginPrerequisite#getPluginVersion()
056: */
057: public Version getPluginVersion() {
058: return pluginVersion;
059: }
060:
061: /**
062: * @param value the plug-in version to set
063: * @return this instance
064: */
065: public MockPluginPrerequisite setPluginVersion(final Version value) {
066: pluginVersion = value;
067: return this ;
068: }
069:
070: /**
071: * @see org.java.plugin.registry.PluginPrerequisite#isExported()
072: */
073: public boolean isExported() {
074: return isExported;
075: }
076:
077: /**
078: * @param value the exported flag to set
079: * @return this instance
080: */
081: public MockPluginPrerequisite setExported(final boolean value) {
082: isExported = value;
083: return this ;
084: }
085:
086: /**
087: * @see org.java.plugin.registry.PluginPrerequisite#isOptional()
088: */
089: public boolean isOptional() {
090: return isOptional;
091: }
092:
093: /**
094: * @param value the optional flag to set
095: * @return this instance
096: */
097: public MockPluginPrerequisite setOptional(final boolean value) {
098: isOptional = value;
099: return this ;
100: }
101:
102: /**
103: * @see org.java.plugin.registry.PluginPrerequisite#isReverseLookup()
104: */
105: public boolean isReverseLookup() {
106: return isReverseLookup;
107: }
108:
109: /**
110: * @param value the reverse look-up flag to set
111: * @return this instance
112: */
113: public MockPluginPrerequisite setReverseLookup(final boolean value) {
114: isReverseLookup = value;
115: return this ;
116: }
117:
118: /**
119: * @see org.java.plugin.registry.PluginPrerequisite#matches()
120: */
121: public boolean matches() {
122: return matches;
123: }
124:
125: /**
126: * @param value the matches flag to set
127: * @return this instance
128: */
129: public MockPluginPrerequisite setMatches(final boolean value) {
130: matches = value;
131: return this ;
132: }
133:
134: /**
135: * @see org.java.plugin.registry.PluginPrerequisite#getMatchingRule()
136: */
137: public MatchingRule getMatchingRule() {
138: return matchingRule;
139: }
140:
141: /**
142: * @param value the matchingRule to set
143: * @return this instance
144: */
145: public MockPluginPrerequisite setMatchingRule(
146: final MatchingRule value) {
147: matchingRule = value;
148: return this ;
149: }
150:
151: /**
152: * @see org.java.plugin.registry.UniqueIdentity#getUniqueId()
153: */
154: public String getUniqueId() {
155: return getDeclaringPluginDescriptor().getId() + '@' + getId();
156: }
157: }
|