Package helma.framework.core
Class Prototype
java.lang.Object
helma.framework.core.Prototype
The Prototype class represents Script prototypes/type defined in a Helma
application. This class manages a prototypes templates, functions and actions
as well as optional information about the mapping of this type to a
relational database table.
-
Constructor Summary
ConstructorsConstructorDescriptionPrototype
(String name, Repository repository, Application app, Map typeProps) Creates a new Prototype object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRepository
(Repository repository, boolean update) Adds an repository to the list of repositoriesvoid
Check a prototype for new or updated resources.Return the application this prototype is a part ofReturn an iterator over this prototype's code resoruces.Get the DbMapping associated with this prototypeReturn this prototype's name in lower case lettersgetName()
Return this prototype's nameGet the parent prototype from which we inherit, or null if we are top of the line.Returns an array of repositories containing code for this prototype.Resource[]
Returns the list of resources in this prototype's repositories.Get a map containing this prototype's skins as stringsgetScriptableSkinMap
(Object[] skinpath) Get a map containing this prototype's skins as strings, overloaded by the skins found in the given skinpath.Get a skin for this prototype.Return an iterator over this prototype's skin resoruces.Get the prototype's aggregated type.propertiesfinal boolean
isInstanceOf
(String pname) Check if the given prototype is within this prototype's parent chain.long
Get the last time any script has been re-read for this prototype.void
Signal that some script in this prototype has been re-read from disk and needs to be re-compiled by the evaluators.final void
registerParents
(Map handlers, Object obj) Register an object as handler for all our parent prototypes, but only if a handler by that prototype name isn't registered yet.void
setParentPrototype
(Prototype parent) Set the parent prototype of this prototype, i.e.void
setTypeProperties
(Map map) Set the custom type properties for this prototype and update the database mapping.toString()
Return a string representing this prototype.
-
Constructor Details
-
Prototype
Creates a new Prototype object.- Parameters:
name
- the prototype's namerepository
- the first prototype's repositoryapp
- the application this prototype is a part oftypeProps
- custom type mapping properties
-
-
Method Details
-
getApplication
Return the application this prototype is a part of -
addRepository
Adds an repository to the list of repositories- Parameters:
repository
- repository to addupdate
- indicates whether to immediately update the prototype with the new code- Throws:
IOException
- if reading/updating from the repository fails
-
checkForUpdates
public void checkForUpdates()Check a prototype for new or updated resources. After this has been called the code and skins collections of this prototype should be up-to-date and the lastCodeUpdate be set if there has been any changes. -
getResources
Returns the list of resources in this prototype's repositories. Used by checkForUpdates() to see whether there is anything new. -
getRepositories
Returns an array of repositories containing code for this prototype. -
setParentPrototype
Set the parent prototype of this prototype, i.e. the prototype this prototype inherits from. -
getParentPrototype
Get the parent prototype from which we inherit, or null if we are top of the line. -
isInstanceOf
Check if the given prototype is within this prototype's parent chain. -
registerParents
Register an object as handler for all our parent prototypes, but only if a handler by that prototype name isn't registered yet. This is used to implement direct over indirect prototype precedence and child over parent precedence. -
getDbMapping
Get the DbMapping associated with this prototype -
getSkin
public Skin getSkin(Prototype proto, String skinname, String subskin, Object[] skinpath) throws IOException Get a skin for this prototype. This only works for skins residing in the prototype directory, not for skins files in other locations or database stored skins. If parentName and subName are defined, the skin may be a subskin of another skin.- Throws:
IOException
-
getName
Return this prototype's name- Returns:
- ...
-
getLowerCaseName
Return this prototype's name in lower case letters- Returns:
- ...
-
lastCodeUpdate
public long lastCodeUpdate()Get the last time any script has been re-read for this prototype. -
markUpdated
public void markUpdated()Signal that some script in this prototype has been re-read from disk and needs to be re-compiled by the evaluators. -
setTypeProperties
Set the custom type properties for this prototype and update the database mapping.- Parameters:
map
- the custom type mapping properties.
-
getTypeProperties
Get the prototype's aggregated type.properties- Returns:
- type.properties
-
getCodeResources
Return an iterator over this prototype's code resoruces. Synchronized to not return a collection in a transient state where it is just being updated by the type manager.- Returns:
- an iterator of this prototype's code resources
-
getSkinResources
Return an iterator over this prototype's skin resoruces. Synchronized to not return a collection in a transient state where it is just being updated by the type manager.- Returns:
- an iterator over this prototype's skin resources
-
toString
Return a string representing this prototype. -
getScriptableSkinMap
Get a map containing this prototype's skins as strings- Returns:
- a scriptable skin map
-
getScriptableSkinMap
Get a map containing this prototype's skins as strings, overloaded by the skins found in the given skinpath.- Returns:
- a scriptable skin map
-