org.netbeans.modules.project.libraries/1 1.29.1

org.netbeans.spi.project.libraries
Interface ArealLibraryProvider<A extends LibraryStorageArea,L extends LibraryImplementation2>


public interface ArealLibraryProvider<A extends LibraryStorageArea,L extends LibraryImplementation2>

Library provider which can define libraries in particular areas. There is no explicit method to save a library; setters on LibraryImplementation should do this.

Since:
org.netbeans.modules.project.libraries/1 1.15

Field Summary
static String PROP_OPEN_AREAS
          Property to fire when getOpenAreas() might have changed.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a listener to PROP_OPEN_AREAS.
 Class<A> areaType()
          Gets the runtime type of the area used by this provider.
 A createArea()
          Creates or otherwise picks a storage area interactively.
 L createLibrary(String type, String name, A area, Map<String,List<URI>> contents)
          Creates a new library.
 LibraryProvider<L> getLibraries(A area)
          Gets all libraries defined in a given area.
 Set<A> getOpenAreas()
          Looks for areas which should be somehow listed as open.
 Class<L> libraryType()
          Gets the runtime type of the libraries created by this provider.
 A loadArea(URL location)
          Loads a storage area (which may or may exist yet).
 void remove(L library)
          Deletes an existing library.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a listener to PROP_OPEN_AREAS.
 

Field Detail

PROP_OPEN_AREAS

static final String PROP_OPEN_AREAS
Property to fire when getOpenAreas() might have changed.

See Also:
Constant Field Values
Method Detail

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener to PROP_OPEN_AREAS.

Parameters:
listener - a listener to add

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener to PROP_OPEN_AREAS.

Parameters:
listener - a listener to remove

areaType

Class<A> areaType()
Gets the runtime type of the area used by this provider.

Returns:
the area type

libraryType

Class<L> libraryType()
Gets the runtime type of the libraries created by this provider.

Returns:
the library type

createArea

A createArea()
Creates or otherwise picks a storage area interactively. This might actually create a fresh area, or just load an existing one, or even do nothing (and return null). The implementor is free to show a dialog here.

Returns:
a new or existing storage area, or null

loadArea

A loadArea(URL location)
Loads a storage area (which may or may exist yet).

Parameters:
location - an abstract storage location which may or may not be recognized by this provider
Returns:
an area whose LibraryStorageArea.getLocation() matches the provided location, or null if this type of location is not recognized by this provider

getOpenAreas

Set<A> getOpenAreas()
Looks for areas which should be somehow listed as open. For example, a provider which refers to library areas from project metadata could list all areas referred to from currently open projects. It is not necessary to include areas recently mentioned e.g. by createArea().

Returns:
a (possibly empty) collection of areas

getLibraries

LibraryProvider<L> getLibraries(A area)
Gets all libraries defined in a given area. No two libraries in this area may share a given name (as in LibraryImplementation.getName(), though it is permitted for libraries from different areas to have the same name. Changes in the set of libraries defined in this area should be fired through LibraryProvider.PROP_LIBRARIES. Since IOException is not thrown either from this method or from LibraryProvider.getLibraries(), it is expected that any problems loading library definitions will be logged and that those libraries will be skipped.

Parameters:
area - some storage area (which might not even exist yet, in which case the set of libraries will initially be empty)
Returns:
a listenable set of libraries in this area (it is permitted to return distinct objects from call to call on the same area, i.e. no caching by the implementation is necessary)

createLibrary

L createLibrary(String type,
                String name,
                A area,
                Map<String,List<URI>> contents)
                                               throws IOException
Creates a new library.

Parameters:
type - the kind of library to make, as in LibraryTypeProvider.getLibraryType() or LibraryImplementation.getType()
name - the library name, as in LibraryImplementation.getName()
area - the location to define the library
contents - initial volume contents (keys must be contained in the appropriate LibraryTypeProvider.getSupportedVolumeTypes())
Returns:
a new library with matching type, name, area, and contents
Throws:
IOException - if an error occurs creating the library definition

remove

void remove(L library)
            throws IOException
Deletes an existing library.

Parameters:
library - a library produced by this provider
Throws:
IOException - if a problem can encountered deleting the library definition

org.netbeans.modules.project.libraries/1 1.29.1

Built on December 5 2011.  |  Portions Copyright 1997-2011 Sun Microsystems, Inc. All rights reserved.