001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.spi.project.libraries;
043:
044: import java.beans.PropertyChangeListener;
045: import java.net.URL;
046: import java.util.List;
047:
048: /**
049: * Base SPI interface for library. This SPI class is used as a model by the libraries framework.
050: * The {@link LibraryTypeProvider} implementor should rather use
051: * {@link org.netbeans.spi.project.libraries.support.LibrariesSupport#createLibraryImplementation}
052: * factory method to create default LibraryImplementation than to implement this interface.
053: */
054: public interface LibraryImplementation {
055:
056: String PROP_NAME = "name"; //NOI18N
057: String PROP_DESCRIPTION = "description"; //NOI18N
058: String PROP_CONTENT = "content"; //NOI18N
059:
060: /**
061: * Returns type of library, the LibraryTypeProvider creates libraries
062: * of given unique type.
063: * @return String unique identifier, never returns null.
064: */
065: String getType();
066:
067: /**
068: * Returns name of the library
069: * @return String unique name of the library, never returns null.
070: */
071: String getName();
072:
073: /**
074: * Get a description of the library.
075: * The description provides more detailed information about the library.
076: * @return String the description or null if the description is not available
077: */
078: String getDescription();
079:
080: /**
081: * Returns the resource name of the bundle which is used for localizing
082: * the name and description. The bundle is located using the system ClassLoader.
083: * @return String, the resource name of the bundle. If null in case when the
084: * name and description is not localized.
085: */
086: String getLocalizingBundle();
087:
088: /**
089: * Returns List of resources contained in the given volume.
090: * The returned list is unmodifiable. To change the content of
091: * the given volume use setContent method.
092: * @param volumeType the type of volume for which the content should be returned.
093: * @return list of resource URLs (never null)
094: * @throws IllegalArgumentException if the library does not support given type of volume
095: */
096: List<URL> getContent(String volumeType)
097: throws IllegalArgumentException;
098:
099: /**
100: * Sets the name of the library, called by LibrariesStorage while reading the library
101: * @param name - the unique name of the library, can't be null.
102: */
103: void setName(String name);
104:
105: /**
106: * Sets the description of the library, called by LibrariesStorage while reading the library
107: * The description is more detailed information about the library.
108: * @param text - the description of the library, may be null.
109: */
110: void setDescription(String text);
111:
112: /**
113: * Sets the localizing bundle. The bundle is used for localizing the name and description.
114: * The bundle is located using the system ClassLoader.
115: * Called by LibrariesStorage while reading the library.
116: * @param resourceName of the bundle without extension, may be null.
117: */
118: void setLocalizingBundle(String resourceName);
119:
120: /**
121: * Adds PropertyChangeListener
122: * @param l - the PropertyChangeListener
123: */
124: void addPropertyChangeListener(PropertyChangeListener l);
125:
126: /**
127: * Removes PropertyChangeListener
128: * @param l - - the PropertyChangeListener
129: */
130: void removePropertyChangeListener(PropertyChangeListener l);
131:
132: /**
133: * Sets content of given volume
134: * @param volumeType the type of volume for which the content should be set
135: * @param path the list of resource URLs
136: * @throws IllegalArgumentException if the library does not support given volumeType
137: */
138: void setContent(String volumeType, List<URL> path)
139: throws IllegalArgumentException;
140:
141: }
|