Libraries API
Representation of a library, and the ability to find the installed libraries.
Contents
Libraries API
The libraries API provides a client API of the Libraries framework. The Library itself is a typed set of
volumes. The volume is a ordered list of resources. The type of library implies the volumes contained
in it. For example the Java SE library contains three volumes (sources, classpath and javadoc). The resource is a
valid URL of the physical resource.
To obtain a list of installed libraries you want to call
{@link org.netbeans.api.project.libraries.LibraryManager#getLibraries}
as in the following example for listing the names of installed libraries.
Library[] libraries = LibraryManager.getDefault().getLibraries ();
for (int i = 0; i< libraries.length; i++) {
System.out.println(libraries[i].getName()+" : "+libraries[i].getType());
}
To obtain a library with a given name you want to call
{@link org.netbeans.api.project.libraries.LibraryManager#getLibrary} method as in the following example.
Library library = LibraryManager.getDefault().getLibrary ("Ant");
if (library != null) {
System.out.println(library.getName()+" : "+libraries[i].getType());
}
Libraries module provides graphical manager of libraries. The manager allows you to create a new library
of a given type, to delete existing library or to change content of volumes. It is not possible to create
or delete a volume in the library since the volumes are implied by the library type.
To open the graphical libraries manager you need to call
{@link org.netbeans.api.project.libraries.LibrariesCustomizer#showCustomizer} method.
A module is able to register the predefined library. For example the junit module installs
the junit library. The library definition is placed in the org-netbeans-api-project-libraries/Libraries folder
on the system filesystem.
The library format is given by the following DTD.
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT library (name, type, description?, localizing-bundle?, volume*) >
<!ATTLIST library version CDATA #FIXED "1.0" >
<!ELEMENT name (#PCDATA) >
<!ELEMENT description (#PCDATA) >
<!ELEMENT localizing-bundle (#PCDATA)>
<!ELEMENT volume (type, resource*) >
<!ELEMENT type (#PCDATA) >
<!ELEMENT resource (#PCDATA) >
|