Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.jdeveloper.webapp.libraries
Class TagLibraryManager<T extends TagLibrary>

java.lang.Object
  extended by oracle.jdeveloper.webapp.libraries.TagLibraryManager<T>
Type Parameters:
T - concrete tag library implementation
Direct Known Subclasses:
JspLibraryManager

public abstract class TagLibraryManager<T extends TagLibrary>
extends java.lang.Object

Common abstract library manager refactored from JspLibraryManager for sharing with the facelet library manager.
Restrictions imposed by the library manager:

  1. TagLibrary can not be added to the manager if there is a library with the same name and same version.
  2. TagLibrary can not be added to the manager if there is already a library with the same URI but different name. All libraries with the same URI must have same name.
  3. TagLibrary URI has to be the same as the one specified in the Taglib file, if it exists. This rule is not inforced at the library registration time but all clients of this class has to obey it.
  4. If Taglib file does not contain URI, tag library URI has to be the same as the one Taglib's resource path when it is deployed, i.e. of the form /WEB-INF/lib/<name>.jar or /WEB-INF/lib/<name>.tld.
  5. Exact taglib validation is done by the concrete implementations.


Nested Class Summary
static class TagLibraryManager.RegistrationInfo
          Structure to store registration info about tag libraries
 
Field Summary
protected  java.util.Map<java.lang.String,oracle.jdevimpl.webapp.taglib.libraries.model.TagLibraryHistoryItem<T>> history
           
 
Constructor Summary
TagLibraryManager()
           
 
Method Summary
static void activateLibraries(TagLibrary[] libraries)
          Activates extensions for all the libraries specified.
static void activateLibrary(TagLibrary library)
          Activate library extension and extension dependencies
static TagLibraryManager.RegistrationInfo addActivatableLibrary(TagLibrary library, java.lang.String extensionId)
          Add an activatable library entry.
static TagLibraryManager.RegistrationInfo addActivatableLibrary(java.net.URL taglibUrl, java.lang.String extensionId)
          Add an activatable library entry.
 T addLibrary(T library)
          Add a T to the current model.
 T addLibrary(T library, boolean isUserLibrary)
          Adds library and marks it (non)editable for user via GUI.
protected  T addLibrary(T library, boolean isEditable, boolean notifyListeners)
           
static void addRegistrationInfo(java.util.Collection<TagLibrary> libList, java.lang.String extensionId, oracle.jdeveloper.webapp.libraries.TagLibraryManager.RegistrationInfo.Type regInfoType)
          Add registration info for the list of libraries specified.
 void addTagLibraryListener(TagLibraryListener listener)
          Add a listener to the library manager.
 void addTagLibraryURLClassesProvider(TagLibraryURLClassesProvider<T> urlProvider)
           
 boolean containsLibrary(T library)
          Checks if library instance is already added to the manager.
 void copyTo(TagLibraryManager<T> target)
           
 java.util.Collection<T> getAllLibraries()
          Return all installed Tag Libraries.
 TagLibraryManager<T> getCopy()
           
 T getFirstLibraryFromPrefix(java.lang.String prefix)
          Finds a T that has preffered prefix equal to the given prefix.
protected  oracle.jdevimpl.webapp.taglib.libraries.model.TagLibraryHistoryItem<T>[] getHistory()
           
 java.util.Collection<T> getLatestLibraryVersions()
          Return latest versions of all installed Tag Libraries.
 java.util.Collection<T> getLibraries(java.lang.String libraryName)
          Return all versions of the installed Tag Libraries with a given name.
 java.util.Collection<T> getLibrariesFromPrefix(java.lang.String prefix)
          Returns all libraries that have given preffered prefix.
 java.util.Collection<T> getLibrariesFromURI(java.lang.String uri)
          Finds all versions of the library with the given URI.
protected  java.util.Collection<T> getLibrariesToSave()
           
 T getLibrary(java.lang.String libraryName)
          Return latest versions of the installed Tag Libraries with a given name.
 T getLibrary(java.lang.String libraryName, java.lang.String version)
          Finds specified version of the installed Tag Library with a given name.
protected abstract  java.net.URL getLibraryFileLocation()
           
 T getLibraryFromURI(java.lang.String uri)
          Finds a latest version of the library with the given URI.
 T getLibraryFromURI(java.lang.String uri, java.lang.String version)
          Finds a given version of the library with the given URI.
static java.lang.String getOwnerExtensionId(TagLibrary tagLibrary)
          Returns owning extension id of the tag library
 java.util.Collection<T> getPackagedLibraries(java.net.URL archiveURL)
          Returns all tag libraries registered with the manager that are packaged in the given archive.
 java.lang.String getPrefixFromURI(java.lang.String uri)
          Given a tag library URI returns preffered prefix for its latest version.
static TagLibraryManager.RegistrationInfo getRegistrationInfo(TagLibrary tagLibrary)
          Returns RegistrationInfo structure that contains info about the extensions that registered various aspects of the tag library.
protected abstract  TagLibraryManager<T> getSingletonInstance()
           
 java.util.Collection<TagLibraryURLClassesProvider<T>> getTagLibraryURLClassesProviders()
           
 T getUnpackagedLibrary(java.net.URL taglibURL)
           
 MutableLibraryList getUserLibraries()
           
protected abstract  void initFromHistoryFile()
          Loads from history file in the extension System Directory
protected  void initLibrariesHistory()
           
 boolean isEditable(T library)
           
protected  void loadAllLibraries()
          Fire lazy loading.
protected abstract  void loadExtensionLibraries()
           
protected abstract  void loadExtensionLibrariesExtraInfo()
           
protected abstract  void loadMigratedLibraries()
           
protected abstract  void loadTagLibraryURLClassesProviders()
          Do whatever is necessary to load the URL providers.
protected abstract  TagLibraryManager<T> newInstance()
           
protected abstract  T newTagLibrary(T library)
           
protected abstract  TagLibraryChangeEvent<T> newTagLibraryChangeEvent(java.lang.Object source, T library, int event)
           
protected abstract  TagLibraryChangeEvent<T> newTagLibraryChangeEvent(java.lang.Object source, T library, java.util.List events)
           
protected abstract  java.util.Comparator<T> newTagLibraryNameComparator()
           
protected abstract  java.util.Comparator<T> newTagLibraryUriComparator()
           
 void notifyObservers(T library, java.util.List changes)
          If library is changed in a way that it colides with others it will be removed.
 void notifyObservers(T library, oracle.bali.xml.share.PropertyChange change)
          If library is changed in a way that it colides with others it will be removed.
 void removeLibrary(java.lang.String uri)
          Remove a latest version of the tag library with giver URI.
 boolean removeLibrary(T library)
          Remove a T from the current model.
 void removeTagLibraryListener(TagLibraryListener listener)
          Remove a listener from the library manager.
 void removeTagLibraryURLClassesProvider(TagLibraryURLClassesProvider<T> urlProvider)
           
protected abstract  void saveToFile()
           
protected abstract  void saveToHistory(T library)
           
 void setUserLibraries(MutableLibraryList userLibs)
           
protected abstract  boolean validateTaglibURL(T library)
          Checks that taglibURL points to the taglib file located or packaged in a way that it can work with the JSP/Facelet version library says it is compatible with.
protected abstract  boolean validateURI(T library)
          Checks that if libraries URI is already mapped the library name is same, and that if the URI is a resource path to the Taglib file (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

history

protected java.util.Map<java.lang.String,oracle.jdevimpl.webapp.taglib.libraries.model.TagLibraryHistoryItem<T extends TagLibrary>> history
Constructor Detail

TagLibraryManager

public TagLibraryManager()
Method Detail

getTagLibraryURLClassesProviders

public java.util.Collection<TagLibraryURLClassesProvider<T>> getTagLibraryURLClassesProviders()

addTagLibraryURLClassesProvider

public void addTagLibraryURLClassesProvider(TagLibraryURLClassesProvider<T> urlProvider)

removeTagLibraryURLClassesProvider

public void removeTagLibraryURLClassesProvider(TagLibraryURLClassesProvider<T> urlProvider)

getAllLibraries

public java.util.Collection<T> getAllLibraries()
Return all installed Tag Libraries.

Returns:
list containing T objects

getLibrariesFromURI

public java.util.Collection<T> getLibrariesFromURI(java.lang.String uri)
Finds all versions of the library with the given URI.

Parameters:
uri -
Returns:

containsLibrary

public boolean containsLibrary(T library)
Checks if library instance is already added to the manager.


getLibrariesFromPrefix

public java.util.Collection<T> getLibrariesFromPrefix(java.lang.String prefix)
Returns all libraries that have given preffered prefix.

Parameters:
prefix - Prefix of tag library.

getPrefixFromURI

public java.lang.String getPrefixFromURI(java.lang.String uri)
Given a tag library URI returns preffered prefix for its latest version.

Parameters:
uri -
Returns:
null if there is not tag library registered for the given uri

setUserLibraries

public void setUserLibraries(MutableLibraryList userLibs)

addTagLibraryListener

public void addTagLibraryListener(TagLibraryListener listener)
Add a listener to the library manager.

Parameters:
listener - the listener to add.

getPackagedLibraries

public java.util.Collection<T> getPackagedLibraries(java.net.URL archiveURL)
Returns all tag libraries registered with the manager that are packaged in the given archive.

Parameters:
archiveURL - URL of the archive file

getLibraryFromURI

public T getLibraryFromURI(java.lang.String uri)
Finds a latest version of the library with the given URI.

Parameters:
uri -
Returns:

getCopy

public TagLibraryManager<T> getCopy()

getLibraries

public java.util.Collection<T> getLibraries(java.lang.String libraryName)
Return all versions of the installed Tag Libraries with a given name.

Returns:
collection containing T objects

getLatestLibraryVersions

public java.util.Collection<T> getLatestLibraryVersions()
Return latest versions of all installed Tag Libraries.

Returns:
list containing T objects

removeLibrary

public void removeLibrary(java.lang.String uri)
Remove a latest version of the tag library with giver URI.

Parameters:
uri - URI of the tag library.

removeLibrary

public boolean removeLibrary(T library)
Remove a T from the current model.

Parameters:
library - T to remove.
Returns:
true if library successfully removed

getLibraryFromURI

public T getLibraryFromURI(java.lang.String uri,
                           java.lang.String version)
Finds a given version of the library with the given URI.

Parameters:
uri -
Returns:

getUnpackagedLibrary

public T getUnpackagedLibrary(java.net.URL taglibURL)

getUserLibraries

public MutableLibraryList getUserLibraries()

addLibrary

public T addLibrary(T library,
                    boolean isUserLibrary)
Adds library and marks it (non)editable for user via GUI.

Parameters:
isUserLibrary - false is library is added by an extension
See Also:
#addLibrary(T)

getFirstLibraryFromPrefix

public T getFirstLibraryFromPrefix(java.lang.String prefix)
Finds a T that has preffered prefix equal to the given prefix. Returns that latest version of the library.

Parameters:
prefix - Prefix of tag library.

isEditable

public boolean isEditable(T library)

notifyObservers

public void notifyObservers(T library,
                            java.util.List changes)
If library is changed in a way that it colides with others it will be removed.


getLibrary

public T getLibrary(java.lang.String libraryName)
Return latest versions of the installed Tag Libraries with a given name.

Parameters:
libraryName -

addLibrary

public T addLibrary(T library)
Add a T to the current model.

Parameters:
library - T to add.
Returns:
library being added. Returns null if adding fails.

removeTagLibraryListener

public void removeTagLibraryListener(TagLibraryListener listener)
Remove a listener from the library manager.

Parameters:
listener - the listener to remove.

copyTo

public void copyTo(TagLibraryManager<T> target)

activateLibraries

public static void activateLibraries(TagLibrary[] libraries)
Activates extensions for all the libraries specified.

Parameters:
libraries - list of libraries added

activateLibrary

public static void activateLibrary(TagLibrary library)
Activate library extension and extension dependencies

Parameters:
library - The library whose corresponding extension needs to be activated.

getOwnerExtensionId

public static java.lang.String getOwnerExtensionId(TagLibrary tagLibrary)
Returns owning extension id of the tag library

Parameters:
tagLibrary - the tag library cannot be null
Returns:
Id of the extension where the library was defined, or null if registered by user.

getRegistrationInfo

public static TagLibraryManager.RegistrationInfo getRegistrationInfo(TagLibrary tagLibrary)
Returns RegistrationInfo structure that contains info about the extensions that registered various aspects of the tag library.

Parameters:
tagLibrary - tag library
Returns:
registration info structure

addActivatableLibrary

public static TagLibraryManager.RegistrationInfo addActivatableLibrary(TagLibrary library,
                                                                       java.lang.String extensionId)
Add an activatable library entry.

Parameters:
library - library
extensionId - lib's corresponding extension

addActivatableLibrary

public static TagLibraryManager.RegistrationInfo addActivatableLibrary(java.net.URL taglibUrl,
                                                                       java.lang.String extensionId)
Add an activatable library entry.

Parameters:
taglibUrl - library url
extensionId - lib's corresponding extension
Returns:
New registration info existing on file/created for this taglibUrl

addRegistrationInfo

public static void addRegistrationInfo(java.util.Collection<TagLibrary> libList,
                                       java.lang.String extensionId,
                                       oracle.jdeveloper.webapp.libraries.TagLibraryManager.RegistrationInfo.Type regInfoType)
Add registration info for the list of libraries specified.

Parameters:
libList - list of libraries
extensionId - module extension id
regInfoType - Info type, one of the constants in RegistrationInfo

getLibrary

public T getLibrary(java.lang.String libraryName,
                    java.lang.String version)
Finds specified version of the installed Tag Library with a given name.


notifyObservers

public void notifyObservers(T library,
                            oracle.bali.xml.share.PropertyChange change)
If library is changed in a way that it colides with others it will be removed.


getHistory

protected oracle.jdevimpl.webapp.taglib.libraries.model.TagLibraryHistoryItem<T>[] getHistory()

getLibrariesToSave

protected java.util.Collection<T> getLibrariesToSave()

addLibrary

protected T addLibrary(T library,
                       boolean isEditable,
                       boolean notifyListeners)

initFromHistoryFile

protected abstract void initFromHistoryFile()
Loads from history file in the extension System Directory


loadMigratedLibraries

protected abstract void loadMigratedLibraries()

loadExtensionLibraries

protected abstract void loadExtensionLibraries()

loadExtensionLibrariesExtraInfo

protected abstract void loadExtensionLibrariesExtraInfo()

validateTaglibURL

protected abstract boolean validateTaglibURL(T library)
Checks that taglibURL points to the taglib file located or packaged in a way that it can work with the JSP/Facelet version library says it is compatible with.


newInstance

protected abstract TagLibraryManager<T> newInstance()

getSingletonInstance

protected abstract TagLibraryManager<T> getSingletonInstance()

getLibraryFileLocation

protected abstract java.net.URL getLibraryFileLocation()

newTagLibraryChangeEvent

protected abstract TagLibraryChangeEvent<T> newTagLibraryChangeEvent(java.lang.Object source,
                                                                     T library,
                                                                     java.util.List events)

validateURI

protected abstract boolean validateURI(T library)
Checks that if libraries URI is already mapped the library name is same, and that if the URI is a resource path to the Taglib file (i.e. /WEB-INF/foo.tld or /WEB-INF/bar.jar) it matches the resource name and ....


newTagLibraryChangeEvent

protected abstract TagLibraryChangeEvent<T> newTagLibraryChangeEvent(java.lang.Object source,
                                                                     T library,
                                                                     int event)

newTagLibrary

protected abstract T newTagLibrary(T library)

saveToFile

protected abstract void saveToFile()
                            throws java.io.IOException
Throws:
java.io.IOException

saveToHistory

protected abstract void saveToHistory(T library)

loadAllLibraries

protected void loadAllLibraries()
Fire lazy loading.


initLibrariesHistory

protected void initLibrariesHistory()

loadTagLibraryURLClassesProviders

protected abstract void loadTagLibraryURLClassesProviders()
Do whatever is necessary to load the URL providers. This function is called only once per instance.


newTagLibraryUriComparator

protected abstract java.util.Comparator<T> newTagLibraryUriComparator()

newTagLibraryNameComparator

protected abstract java.util.Comparator<T> newTagLibraryNameComparator()

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

Copyright © 1997, 2011, Oracle. All rights reserved.