|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gvsig.tools.library.AbstractLibrary
public abstract class AbstractLibrary
Base Library implementation, checking that a Library is initialized and postInitialized only once. Also adds initialization logging.
Nested Class Summary | |
---|---|
static class |
AbstractLibrary.Required
Association between a library class and its type. |
Nested classes/interfaces inherited from interface org.gvsig.tools.library.Library |
---|
Library.TYPE |
Constructor Summary | |
---|---|
protected |
AbstractLibrary()
Empty constructor. |
protected |
AbstractLibrary(Class library,
int priority)
Deprecated. to be removed in the 4.x version. Use the AbstractLibrary() empty constructor and override the
doRegistration() method instead. |
protected |
AbstractLibrary(Class library,
String type)
Deprecated. to be removed in the 4.x version. Use the AbstractLibrary() empty constructor and override the
doRegistration() method instead. |
Method Summary | |
---|---|
protected abstract void |
doInitialize()
Performs all the initializations of the library, only related to himself: register implementation classes through the Locator, start services, etc. |
protected abstract void |
doPostInitialize()
Performs all the initializations or validations related to the library dependencies, as getting references to objects through other libraries Locators. |
void |
doRegistration()
|
boolean |
equals(Object obj)
|
Class |
getLibrary()
Returns the name of the current Library |
int |
getPriority()
Returns a priority number to range this implementation in case multiple ones are within the libraries initialization. |
Set |
getRequireds()
Returns a Set of required libraries and their types. |
String |
getType()
Returns the type of the Library. |
int |
hashCode()
|
void |
initialize()
Performs all the initializations of the library, only related to himself: register implementation classes through the Locator, start services, etc. |
boolean |
isRequired(Class libClass)
Returns if a given library class is required. |
boolean |
isRequired(Library lib)
Returns if a given library is required. |
void |
postInitialize()
Performs all the initializations or validations related to the library dependencies, as getting references to objects through other libraries Locators. |
protected void |
registerAs(Class library,
String type)
Registers the library with type of library it is: API or implementation of a library. |
protected void |
registerAsAPI(Class library)
Registers the library as an API one. |
protected void |
registerAsImplementationOf(Class library)
Registers the library as an implementation of an API library, with the default priority. |
protected void |
registerAsImplementationOf(Class library,
int priority)
Registers the library as an implementation of an API library. |
protected void |
registerAsServiceOf(Class library)
Registers the library as a service or provider of an API library. |
void |
require(Class library)
Adds a required library, so it is initialized before the current one. |
void |
require(Class library,
String type)
Deprecated. use the require(Class) method instead, as you may
have problems if the type specified is not correct. Moreover,
this is not needed. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractLibrary()
protected AbstractLibrary(Class library, String type)
AbstractLibrary()
empty constructor and override the
doRegistration()
method instead.
When it is an API library, the class will be itself.
library
- the library class we relate totype
- the library type. See TYPE
.AbstractLibrary()
protected AbstractLibrary(Class library, int priority)
AbstractLibrary()
empty constructor and override the
doRegistration()
method instead.
library
- the library class we relate topriority
- the priority of the library against other implementations
of the same libraryAbstractLibrary()
Method Detail |
---|
public Set getRequireds()
Library
getRequireds
in interface Library
public Class getLibrary()
getLibrary
in interface Library
Library
class this library is related topublic String getType()
Library
getType
in interface Library
TYPE.
public int getPriority()
Library
getPriority
in interface Library
public final void require(Class library, String type)
require(Class)
method instead, as you may
have problems if the type specified is not correct. Moreover,
this is not needed.
library
- the required librarytype
- the type of the required librarypublic final void require(Class library)
library
- the required libraryprotected final void registerAs(Class library, String type)
When it is an API library, the class will be itself.
library
- the library class we relate totype
- the library type. See TYPE
.protected final void registerAsAPI(Class library)
library
- the library class we relate toprotected final void registerAsImplementationOf(Class library)
library
- the library class we relate toprotected final void registerAsImplementationOf(Class library, int priority)
library
- the library class we relate topriority
- the priority of the library against other implementations
of the same libraryprotected final void registerAsServiceOf(Class library)
library
- the library class we relate topublic final void initialize() throws LibraryException
Library
initialize
in interface Library
LibraryException
- if there is an error while performing the initialization of
the librarypublic final void postInitialize() throws LibraryException
Library
postInitialize
in interface Library
LibraryException
- if there is an error while loading an implementation of the
librarypublic void doRegistration()
doRegistration
in interface Library
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public boolean isRequired(Library lib)
Library
isRequired
in interface Library
lib
- the library to check if it is required
public boolean isRequired(Class libClass)
Library
isRequired
in interface Library
libClass
- the library Class to check if it is required
protected abstract void doInitialize() throws LibraryException
LibraryException
- if there is an error while performing the initialization of
the libraryprotected abstract void doPostInitialize() throws LibraryException
LibraryException
- if there is an error while loading an implementation of the
library
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |