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.util.Collection;
021: import java.util.Collections;
022: import java.util.LinkedList;
023:
024: import org.java.plugin.registry.Library;
025: import org.java.plugin.registry.Version;
026:
027: /**
028: * @version $Id$
029: */
030: public class MockLibrary extends MockPluginElement<Library> implements
031: Library {
032: private boolean isCodeLibrary;
033: private String path;
034: private Version version;
035: private LinkedList<String> exports = new LinkedList<String>();
036:
037: /**
038: * @see org.java.plugin.registry.Library#getExports()
039: */
040: public Collection<String> getExports() {
041: return Collections.unmodifiableCollection(exports);
042: }
043:
044: /**
045: * @param exportPrefix export prefix to add
046: * @return this instance
047: */
048: public MockLibrary addExport(final String exportPrefix) {
049: exports.add(exportPrefix);
050: return this ;
051: }
052:
053: /**
054: * @see org.java.plugin.registry.Library#getPath()
055: */
056: public String getPath() {
057: return path;
058: }
059:
060: /**
061: * @param value the path to set
062: * @return this instance
063: */
064: public MockLibrary setPath(final String value) {
065: path = value;
066: return this ;
067: }
068:
069: /**
070: * @see org.java.plugin.registry.Library#getVersion()
071: */
072: public Version getVersion() {
073: return version;
074: }
075:
076: /**
077: * @param value the version to set
078: * @return this instance
079: */
080: public MockLibrary setVersion(final Version value) {
081: version = value;
082: return this ;
083: }
084:
085: /**
086: * @see org.java.plugin.registry.Library#isCodeLibrary()
087: */
088: public boolean isCodeLibrary() {
089: return isCodeLibrary;
090: }
091:
092: /**
093: * @param value the code library flag to set
094: * @return this instance
095: */
096: public MockLibrary setCodeLibrary(final boolean value) {
097: isCodeLibrary = value;
098: return this ;
099: }
100:
101: /**
102: * @see org.java.plugin.registry.UniqueIdentity#getUniqueId()
103: */
104: public String getUniqueId() {
105: return getDeclaringPluginDescriptor().getId() + '@' + getId();
106: }
107: }
|