diff --git a/project.libraries/apichanges.xml b/project.libraries/apichanges.xml --- a/project.libraries/apichanges.xml +++ b/project.libraries/apichanges.xml @@ -107,6 +107,20 @@ + + + Allow Library to provide properties + + + + + + Allow Library to provide properties. + + + + + Allow user created library to provide display name diff --git a/project.libraries/manifest.mf b/project.libraries/manifest.mf --- a/project.libraries/manifest.mf +++ b/project.libraries/manifest.mf @@ -2,7 +2,7 @@ OpenIDE-Module: org.netbeans.modules.project.libraries/1 OpenIDE-Module-Install: org/netbeans/modules/project/libraries/LibrariesModule.class OpenIDE-Module-Layer: org/netbeans/modules/project/libraries/resources/mf-layer.xml -OpenIDE-Module-Specification-Version: 1.33 +OpenIDE-Module-Specification-Version: 1.34 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/project/libraries/resources/Bundle.properties AutoUpdate-Show-In-Client: false diff --git a/project.libraries/src/org/netbeans/api/project/libraries/Library.java b/project.libraries/src/org/netbeans/api/project/libraries/Library.java --- a/project.libraries/src/org/netbeans/api/project/libraries/Library.java +++ b/project.libraries/src/org/netbeans/api/project/libraries/Library.java @@ -51,13 +51,16 @@ import java.util.ArrayList; import java.util.List; import java.util.MissingResourceException; +import java.util.Properties; import java.util.ResourceBundle; import java.util.logging.Logger; +import org.netbeans.api.annotations.common.NonNull; import org.netbeans.modules.project.libraries.LibraryAccessor; import org.netbeans.modules.project.libraries.Util; import org.netbeans.modules.project.libraries.ui.LibrariesModel; import org.netbeans.spi.project.libraries.LibraryImplementation; import org.netbeans.spi.project.libraries.LibraryImplementation2; +import org.netbeans.spi.project.libraries.LibraryImplementation3; import org.openide.util.NbBundle; import org.openide.util.WeakListeners; @@ -147,6 +150,22 @@ } } // end getContent + /** + * Returns properties associated with this library. Returned properties + * object should be considered readonly and any changes to it will not be + * propagated back to the library itself. + * @return never null but can be empty if library does not have any properties + * or does not support concept of properties + * @since 1.34 + */ + @NonNull + public Properties getProperties() { + if (impl instanceof LibraryImplementation3) { + return new Properties(((LibraryImplementation3)impl).getProperties()); + } else { + return new Properties(); + } + } /** * Get library binding name. The name identifies library diff --git a/project.libraries/src/org/netbeans/modules/project/libraries/DefaultLibraryImplementation.java b/project.libraries/src/org/netbeans/modules/project/libraries/DefaultLibraryImplementation.java --- a/project.libraries/src/org/netbeans/modules/project/libraries/DefaultLibraryImplementation.java +++ b/project.libraries/src/org/netbeans/modules/project/libraries/DefaultLibraryImplementation.java @@ -50,9 +50,9 @@ import java.beans.PropertyChangeEvent; import org.netbeans.api.annotations.common.CheckForNull; import org.netbeans.api.annotations.common.NullAllowed; -import org.netbeans.spi.project.libraries.NamedLibraryImplementation; +import org.netbeans.spi.project.libraries.LibraryImplementation3; -public final class DefaultLibraryImplementation implements NamedLibraryImplementation { +public final class DefaultLibraryImplementation implements LibraryImplementation3 { private String description; @@ -68,6 +68,8 @@ private String displayName; private List listeners; + + private volatile Properties properties; /** * Create new LibraryImplementation supporting given library. @@ -201,4 +203,13 @@ l.propertyChange(event); } } + + @Override + public Properties getProperties() { + return properties; + } + + public void setProperties(Properties props) { + properties = props; + } } diff --git a/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationHandler.java b/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationHandler.java --- a/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationHandler.java +++ b/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationHandler.java @@ -119,5 +119,14 @@ public void handle_displayName (String data, Attributes meta) throws SAXException; + public void start_properties(final Attributes meta) throws SAXException;; + + public void end_properties() throws SAXException; + + public void start_property(final Attributes meta) throws SAXException;; + + public void end_property() throws SAXException; + + public void handle_value (String data, Attributes meta) throws SAXException; } diff --git a/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationHandlerImpl.java b/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationHandlerImpl.java --- a/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationHandlerImpl.java +++ b/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationHandlerImpl.java @@ -51,9 +51,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Properties; import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; -import java.util.regex.Pattern; import org.netbeans.spi.project.libraries.LibraryImplementation; import org.netbeans.spi.project.libraries.LibraryTypeProvider; import org.openide.util.Utilities; @@ -75,16 +75,22 @@ private String libraryName; private String localizingBundle; private String displayName; - private Map> contentTypes = new HashMap>(); + private final Map> contentTypes = new HashMap>(); + private final Properties properties = new Properties(); // last volume private List cpEntries; //last volume type private String contentType; //parsing volume? - private boolean inVolume = false; + private State state = State.LIB; //Used flag preventing from being reused private final AtomicBoolean used = new AtomicBoolean(); + + //Propery name - valid in State.PROPERTY + private String propName; + //Propery value - valid in State.PROPERTY + private String propValue; @Override public void startDocument() { @@ -100,13 +106,13 @@ @Override public void start_volume(final Attributes meta) throws SAXException { cpEntries = new ArrayList(); - this.inVolume = true; + this.state = State.VOLUME; } @Override public void end_volume() throws SAXException { contentTypes.put (contentType, cpEntries); - this.inVolume = false; + this.state = State.LIB; this.contentType = null; } @@ -115,7 +121,7 @@ if (data == null || data.length () == 0) { throw new SAXException ("Empty value of type element"); //NOI18N } - if (this.inVolume) { + if (this.state == State.VOLUME) { this.contentType = data; } else { @@ -129,7 +135,9 @@ if (LibraryDeclarationParser.VER_1.equals(version)) { return ""; //NOI18N } else if (LibraryDeclarationParser.VER_2.equals(version)) { - return LibraryDeclarationParser.LIBRARY_NS; + return LibraryDeclarationParser.LIBRARY_NS2; + } else if (LibraryDeclarationParser.VER_3.equals(version)) { + return LibraryDeclarationParser.LIBRARY_NS3; } else { throw new SAXException("Invalid librray descriptor version"); // NOI18N } @@ -168,6 +176,9 @@ if (!update || !Utilities.compareObjects(this.library.getLocalizingBundle(), displayName)) { Util.setDisplayName(this.library,displayName); } + if (!update || !Utilities.compareObjects(this.library.getLocalizingBundle(), displayName)) { + Util.setProperties(this.library, properties); + } for (Map.Entry> entry : contentTypes.entrySet()) { String contentType = entry.getKey(); List cp = entry.getValue(); @@ -190,7 +201,11 @@ @Override public void handle_name(final String data, final Attributes meta) throws SAXException { - this.libraryName = data; + if (state == State.PROPERTY) { + this.propName = data; + } else { + this.libraryName = data; + } } @Override @@ -216,6 +231,37 @@ return this.library; } + @Override + public void start_properties(Attributes meta) throws SAXException { + state = State.PROPERTIES; + properties.clear(); + } + + @Override + public void end_properties() throws SAXException { + state = State.LIB; + } + + @Override + public void start_property(Attributes meta) throws SAXException { + this.propName = null; + this.propValue = null; + state = State.PROPERTY; + } + + @Override + public void end_property() throws SAXException { + state = State.PROPERTIES; + assert propName != null; + assert propValue != null; + properties.setProperty(propName, propValue); + } + + @Override + public void handle_value(String data, Attributes meta) throws SAXException { + this.propValue = data; + } + public static class UnknownLibraryTypeException extends SAXException { private UnknownLibraryTypeException( final String libraryName, @@ -223,6 +269,8 @@ super ("Cannot create library: "+libraryName+" of unknown type: " +libraryType,null); } } + + private static enum State {LIB, VOLUME, PROPERTIES, PROPERTY}; private static boolean urlsEqual (final Collection first, final Collection second) { diff --git a/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationParser.java b/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationParser.java --- a/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationParser.java +++ b/project.libraries/src/org/netbeans/modules/project/libraries/LibraryDeclarationParser.java @@ -50,13 +50,15 @@ import java.io.OutputStream; import java.net.URL; import java.util.List; +import java.util.Map; +import java.util.Properties; import java.util.Stack; import java.util.concurrent.atomic.AtomicBoolean; import javax.xml.parsers.ParserConfigurationException; import org.netbeans.api.annotations.common.NonNull; +import org.netbeans.api.annotations.common.NullAllowed; import org.netbeans.spi.project.libraries.LibraryImplementation; import org.netbeans.spi.project.libraries.LibraryTypeProvider; -import org.netbeans.spi.project.libraries.NamedLibraryImplementation; import org.openide.filesystems.FileObject; import org.openide.xml.XMLUtil; import org.w3c.dom.Document; @@ -87,9 +89,11 @@ private static final String LIBRARY_DEF_1 = "-//NetBeans//DTD Library Declaration 1.0//EN"; //NOI18N private static final String LIBRARY_DTD_1 = "http://www.netbeans.org/dtds/library-declaration-1_0.dtd"; //NOI18N - static final String LIBRARY_NS = "http://www.netbeans.org/ns/library-declaration/2"; //NOI18N + static final String LIBRARY_NS2 = "http://www.netbeans.org/ns/library-declaration/2"; //NOI18N + static final String LIBRARY_NS3 = "http://www.netbeans.org/ns/library-declaration/3"; //NOI18N static final String VER_1 = "1.0"; //NOI18N static final String VER_2 = "2.0"; //NOI18N + static final String VER_3 = "3.0"; //NOI18N private static final String LIBRARY = "library"; //NOI18N private static final String VERSION = "version"; //NOI18N private static final String VOLUME = "volume"; //NOI18N @@ -99,6 +103,9 @@ private static final String NAME = "name"; //NOI18N private static final String BUNDLE = "localizing-bundle"; //NOI18N private static final String DISPLAY_NAME = "display-name"; //NOI18N + private static final String PROPERTIES = "properties"; //NOI18N + private static final String PROPERTY = "property"; //NOI18N + private static final String VALUE = "value"; //NOI18N private StringBuffer buffer; private final LibraryDeclarationConvertor parslet; @@ -158,6 +165,10 @@ handler.start_volume(attrs); } else if (LIBRARY.equals(qname)) { expectedNS = handler.start_library(ns, attrs); + } else if (PROPERTIES.equals(qname) && supportsProperties(ns)) { + handler.start_properties(attrs); + } else if (PROPERTY.equals(qname) && supportsProperties(ns)) { + handler.start_property(attrs); } } @@ -173,6 +184,10 @@ handler.end_volume(); } else if (LIBRARY.equals(qname)) { handler.end_library(); + } else if (PROPERTIES.equals(qname) && supportsProperties(ns)) { + handler.end_properties(); + } else if (PROPERTY.equals(qname) && supportsProperties(ns)) { + handler.end_property(); } } @@ -250,9 +265,12 @@ } else if (BUNDLE.equals(here)) { if (fireOnlyIfMixed) throw new IllegalStateException("Unexpected characters() event! (Missing DTD?)"); handler.handle_localizingBundle(buffer.length() == 0 ? null : buffer.toString(), attrs); - } else if (DISPLAY_NAME.equals(here) && LIBRARY_NS.equals(ns)) { + } else if (DISPLAY_NAME.equals(here) && supportsDisplayName(ns)) { if (fireOnlyIfMixed) throw new IllegalStateException("Unexpected characters() event! (Missing DTD?)"); handler.handle_displayName(buffer.length() == 0 ? null : buffer.toString(), attrs); + } else if (VALUE.equals(here) && supportsProperties(ns)) { + if (fireOnlyIfMixed) throw new IllegalStateException("Unexpected characters() event! (Missing DTD?)"); + handler.handle_value(buffer.length() == 0 ? null : buffer.toString(), attrs); } else { //do not care } @@ -332,7 +350,9 @@ final @NonNull LibraryImplementation library, final @NonNull LibraryTypeProvider libraryTypeProvider) throws IOException { final Document doc = Util.supportsDisplayName(library) ? - createLibraryDefinition2(library, libraryTypeProvider) : + (Util.supportsProperties(library) ? + createLibraryDefinition3(library, libraryTypeProvider) : + createLibraryDefinition2(library, libraryTypeProvider)) : createLibraryDefinition1(library, libraryTypeProvider); final OutputStream os = definitionFile.getOutputStream(); try { @@ -381,34 +401,82 @@ private static Document createLibraryDefinition2( final @NonNull LibraryImplementation library, final @NonNull LibraryTypeProvider libraryTypeProvider) { - final Document doc = XMLUtil.createDocument(LIBRARY, LIBRARY_NS, null, null); + final Document doc = XMLUtil.createDocument(LIBRARY, LIBRARY_NS2, null, null); final Element libraryE = doc.getDocumentElement(); libraryE.setAttribute(VERSION, VER_2); // NOI18N - libraryE.appendChild(doc.createElementNS(LIBRARY_NS, NAME)).appendChild(doc.createTextNode(library.getName())); // NOI18N - libraryE.appendChild(doc.createElementNS(LIBRARY_NS, TYPE)).appendChild(doc.createTextNode(library.getType())); // NOI18N + libraryE.appendChild(doc.createElementNS(LIBRARY_NS2, NAME)).appendChild(doc.createTextNode(library.getName())); // NOI18N + libraryE.appendChild(doc.createElementNS(LIBRARY_NS2, TYPE)).appendChild(doc.createTextNode(library.getType())); // NOI18N String description = library.getDescription(); if (description != null && description.length() > 0) { - libraryE.appendChild(doc.createElementNS(LIBRARY_NS, DESCRIPTION)).appendChild(doc.createTextNode(description)); // NOI18N + libraryE.appendChild(doc.createElementNS(LIBRARY_NS2, DESCRIPTION)).appendChild(doc.createTextNode(description)); // NOI18N } String localizingBundle = library.getLocalizingBundle(); if (localizingBundle != null && localizingBundle.length() > 0) { - libraryE.appendChild(doc.createElementNS(LIBRARY_NS, BUNDLE)).appendChild(doc.createTextNode(localizingBundle)); // NOI18N + libraryE.appendChild(doc.createElementNS(LIBRARY_NS2, BUNDLE)).appendChild(doc.createTextNode(localizingBundle)); // NOI18N } String displayname = Util.getDisplayName(library); if (displayname != null) { - libraryE.appendChild(doc.createElementNS(LIBRARY_NS, DISPLAY_NAME)).appendChild(doc.createTextNode(displayname)); // NOI18N + libraryE.appendChild(doc.createElementNS(LIBRARY_NS2, DISPLAY_NAME)).appendChild(doc.createTextNode(displayname)); // NOI18N } for (String vtype : libraryTypeProvider.getSupportedVolumeTypes()) { - Element volumeE = (Element) libraryE.appendChild(doc.createElementNS(LIBRARY_NS,VOLUME)); // NOI18N - volumeE.appendChild(doc.createElementNS(LIBRARY_NS, TYPE)).appendChild(doc.createTextNode(vtype)); // NOI18N + Element volumeE = (Element) libraryE.appendChild(doc.createElementNS(LIBRARY_NS2,VOLUME)); // NOI18N + volumeE.appendChild(doc.createElementNS(LIBRARY_NS2, TYPE)).appendChild(doc.createTextNode(vtype)); // NOI18N List volume = library.getContent(vtype); if (volume != null) { for (URL url : volume) { - volumeE.appendChild(doc.createElementNS(LIBRARY_NS, RESOURCE)).appendChild(doc.createTextNode(url.toString())); // NOI18N + volumeE.appendChild(doc.createElementNS(LIBRARY_NS2, RESOURCE)).appendChild(doc.createTextNode(url.toString())); // NOI18N } } } return doc; } + + private static Document createLibraryDefinition3( + final @NonNull LibraryImplementation library, + final @NonNull LibraryTypeProvider libraryTypeProvider) { + final Document doc = XMLUtil.createDocument(LIBRARY, LIBRARY_NS3, null, null); + final Element libraryE = doc.getDocumentElement(); + libraryE.setAttribute(VERSION, VER_3); // NOI18N + libraryE.appendChild(doc.createElementNS(LIBRARY_NS3, NAME)).appendChild(doc.createTextNode(library.getName())); // NOI18N + libraryE.appendChild(doc.createElementNS(LIBRARY_NS3, TYPE)).appendChild(doc.createTextNode(library.getType())); // NOI18N + String description = library.getDescription(); + if (description != null && description.length() > 0) { + libraryE.appendChild(doc.createElementNS(LIBRARY_NS3, DESCRIPTION)).appendChild(doc.createTextNode(description)); // NOI18N + } + String localizingBundle = library.getLocalizingBundle(); + if (localizingBundle != null && localizingBundle.length() > 0) { + libraryE.appendChild(doc.createElementNS(LIBRARY_NS3, BUNDLE)).appendChild(doc.createTextNode(localizingBundle)); // NOI18N + } + String displayname = Util.getDisplayName(library); + if (displayname != null) { + libraryE.appendChild(doc.createElementNS(LIBRARY_NS3, DISPLAY_NAME)).appendChild(doc.createTextNode(displayname)); // NOI18N + } + for (String vtype : libraryTypeProvider.getSupportedVolumeTypes()) { + Element volumeE = (Element) libraryE.appendChild(doc.createElementNS(LIBRARY_NS3,VOLUME)); // NOI18N + volumeE.appendChild(doc.createElementNS(LIBRARY_NS3, TYPE)).appendChild(doc.createTextNode(vtype)); // NOI18N + List volume = library.getContent(vtype); + if (volume != null) { + for (URL url : volume) { + volumeE.appendChild(doc.createElementNS(LIBRARY_NS3, RESOURCE)).appendChild(doc.createTextNode(url.toString())); // NOI18N + } + } + } + final Properties properties = Util.getProperties(library); + final Element propertiesNode = (Element) libraryE.appendChild(doc.createElementNS(LIBRARY_NS3, PROPERTIES)); + for (Map.Entry e : properties.entrySet()) { + final Element propertyNode = (Element)propertiesNode.appendChild(doc.createElementNS(LIBRARY_NS3, PROPERTY)); + propertyNode.appendChild(doc.createElementNS(LIBRARY_NS3, NAME)).appendChild(doc.createTextNode((String)e.getKey())); // NOI18N + propertyNode.appendChild(doc.createElementNS(LIBRARY_NS3, VALUE)).appendChild(doc.createTextNode((String)e.getValue())); // NOI18N + } + return doc; + } + + private static boolean supportsDisplayName(@NullAllowed final String ns) { + return LIBRARY_NS2.equals(ns) || LIBRARY_NS3.equals(ns); + } + + private static boolean supportsProperties(@NullAllowed final String ns) { + return LIBRARY_NS3.equals(ns); + } } diff --git a/project.libraries/src/org/netbeans/modules/project/libraries/Util.java b/project.libraries/src/org/netbeans/modules/project/libraries/Util.java --- a/project.libraries/src/org/netbeans/modules/project/libraries/Util.java +++ b/project.libraries/src/org/netbeans/modules/project/libraries/Util.java @@ -41,8 +41,10 @@ */ package org.netbeans.modules.project.libraries; +import com.sun.istack.internal.NotNull; import java.util.Map; import java.util.MissingResourceException; +import java.util.Properties; import java.util.ResourceBundle; import java.util.WeakHashMap; import java.util.logging.Level; @@ -52,6 +54,7 @@ import org.netbeans.api.annotations.common.NullAllowed; import org.netbeans.modules.project.libraries.ui.ProxyLibraryImplementation; import org.netbeans.spi.project.libraries.LibraryImplementation; +import org.netbeans.spi.project.libraries.LibraryImplementation3; import org.netbeans.spi.project.libraries.NamedLibraryImplementation; import org.openide.filesystems.FileObject; import org.openide.util.NbBundle; @@ -113,6 +116,33 @@ return false; } } + + public static boolean supportsProperties(final @NonNull LibraryImplementation impl) { + assert impl != null; + if (impl instanceof ProxyLibraryImplementation) { + return supportsDisplayName(((ProxyLibraryImplementation)impl).getOriginal()); + } + return impl instanceof LibraryImplementation3; + } + + @NotNull + public static Properties getProperties (final @NonNull LibraryImplementation impl) { + return supportsProperties(impl) ? + ((LibraryImplementation3)impl).getProperties() : + new Properties(); + } + + public static boolean setProperties( + final @NonNull LibraryImplementation impl, + final @NonNull Properties props) { + if (supportsProperties(impl)) { + ((LibraryImplementation3)impl).setProperties(props); + return true; + + } else { + return false; + } + } public static void registerSource( final @NonNull LibraryImplementation impl, diff --git a/project.libraries/src/org/netbeans/modules/project/libraries/resources/library-declaration-3_0.xsd b/project.libraries/src/org/netbeans/modules/project/libraries/resources/library-declaration-3_0.xsd new file mode 100644 --- /dev/null +++ b/project.libraries/src/org/netbeans/modules/project/libraries/resources/library-declaration-3_0.xsd @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/project.libraries/src/org/netbeans/modules/project/libraries/resources/mf-layer.xml b/project.libraries/src/org/netbeans/modules/project/libraries/resources/mf-layer.xml --- a/project.libraries/src/org/netbeans/modules/project/libraries/resources/mf-layer.xml +++ b/project.libraries/src/org/netbeans/modules/project/libraries/resources/mf-layer.xml @@ -59,6 +59,7 @@ + diff --git a/project.libraries/src/org/netbeans/modules/project/libraries/ui/ProxyLibraryImplementation.java b/project.libraries/src/org/netbeans/modules/project/libraries/ui/ProxyLibraryImplementation.java --- a/project.libraries/src/org/netbeans/modules/project/libraries/ui/ProxyLibraryImplementation.java +++ b/project.libraries/src/org/netbeans/modules/project/libraries/ui/ProxyLibraryImplementation.java @@ -52,11 +52,13 @@ import java.beans.PropertyChangeSupport; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeEvent; +import java.util.Properties; import org.netbeans.api.annotations.common.NullAllowed; import org.netbeans.modules.project.libraries.Util; import org.netbeans.spi.project.libraries.LibraryImplementation; import org.netbeans.spi.project.libraries.LibraryImplementation2; +import org.netbeans.spi.project.libraries.LibraryImplementation3; import org.netbeans.spi.project.libraries.NamedLibraryImplementation; import org.openide.util.WeakListeners; @@ -64,7 +66,7 @@ * * @author tom */ -public class ProxyLibraryImplementation implements NamedLibraryImplementation, PropertyChangeListener { +public class ProxyLibraryImplementation implements LibraryImplementation3, PropertyChangeListener { private final LibraryImplementation original; private final LibrariesModel model; @@ -233,7 +235,20 @@ return "Proxy[" + original + "]"; // NOI18N } - static class ProxyLibraryImplementation2 extends ProxyLibraryImplementation implements LibraryImplementation2, NamedLibraryImplementation { + @Override + public Properties getProperties() { + if (!Util.supportsProperties(original)) { + throw new IllegalStateException("Original does not support displayName"); //NOI18N + } + return Util.getProperties(original); + } + + @Override + public void setProperties(Properties properties) { + //For now no UI to set properties + } + + static class ProxyLibraryImplementation2 extends ProxyLibraryImplementation implements LibraryImplementation2, LibraryImplementation3 { Map> newURIContents; diff --git a/project.libraries/src/org/netbeans/spi/project/libraries/LibraryImplementation3.java b/project.libraries/src/org/netbeans/spi/project/libraries/LibraryImplementation3.java new file mode 100644 --- /dev/null +++ b/project.libraries/src/org/netbeans/spi/project/libraries/LibraryImplementation3.java @@ -0,0 +1,68 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2012 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + * + * Contributor(s): + * + * Portions Copyrighted 2012 Sun Microsystems, Inc. + */ +package org.netbeans.spi.project.libraries; + +import java.util.Properties; +import org.netbeans.api.annotations.common.NonNull; + +/** + * LibraryImplementation extension allowing library to expose additional + * properties. + * + * @author David Konecny + * @since 1.34 + */ +public interface LibraryImplementation3 extends NamedLibraryImplementation { + + /** + * Returns library properties + * @return the {@link Properties} + */ + @NonNull + Properties getProperties(); + + /** + * Sets the library properties + * @param properties the properties to be set + */ + void setProperties(@NonNull Properties properties); +}