## helma.framework.core
Class Prototype

    java.lang.Object
      helma.framework.core.Prototype

    public final class Prototype

extends java.lang.Object

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
`Prototype(java.lang.String name, Repository repository, Application app)` Creates a new Prototype object.

Method Summary
`void` `addRepository(Repository repository, boolean update)` Adds an repository to the list of repositories
`void` `checkForUpdates()` Check a prototype for new or updated resources.
`Application` `getApplication()` Return the application this prototype is a part of
`java.util.Iterator` `getCodeResources()` Return an iterator over this prototype's code resoruces.
`DbMapping` `getDbMapping()` Get the DbMapping associated with this prototype
`java.lang.String` `getLowerCaseName()` Return this prototype's name in lower case letters
`java.lang.String` `getName()` Return this prototype's name
`Prototype` `getParentPrototype()` Get the parent prototype from which we inherit, or null if we are top of the line.
`Repository[]` `getRepositories()` Returns an array of repositories containing code for this prototype.
`Resource[]` `getResources()` Returns the list of resources in this prototype's repositories.
`java.util.Map` `getScriptableSkinMap()` Get a map containing this prototype's skins as strings
`java.util.Map` `getScriptableSkinMap(java.lang.Object[] skinpath)` Get a map containing this prototype's skins as strings, overloaded by the skins found in the given skinpath.
`Skin` `getSkin(java.lang.String skinName, java.lang.String parentName, java.lang.String subName)` Get a skin for this prototype.
`java.util.Iterator` `getSkinResources()` Return an iterator over this prototype's skin resoruces.
`ResourceProperties` `getTypeProperties()` Get the prototype's aggregated type.properties
`boolean` `isInstanceOf(java.lang.String pname)` Check if the given prototype is within this prototype's parent chain.
`long` `lastCodeUpdate()` Get the last time any script has been re-read for this prototype.
`void` `markUpdated()` Signal that some script in this prototype has been re-read from disk and needs to be re-compiled by the evaluators.
`void` `registerParents(java.util.Map handlers, java.lang.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.
`java.lang.String` `toString()` Return a string representing this prototype.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Prototype

    public Prototype(java.lang.String name,
                     Repository repository,
                     Application app)

  Creates a new Prototype object.

  Parameters:
    `name` - the prototype's name
    `repository` - the first prototype's repository
    `app` - the application this prototype is a part of

Method Detail

### getApplication

    public Application getApplication()

  Return the application this prototype is a part of

### addRepository

    public void addRepository(Repository repository,
                              boolean update)
                       throws java.io.IOException

  Adds an repository to the list of repositories

  Parameters:
    `repository` - repository to add
    `update` - indicates whether to immediately update the prototype with the new code
  Throws:
    `java.io.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

    public Resource[] getResources()

  Returns the list of resources in this prototype's repositories. Used by checkForUpdates() to see whether there is anything new.

### getRepositories

    public Repository[] getRepositories()

  Returns an array of repositories containing code for this prototype.

### setParentPrototype

    public void setParentPrototype(Prototype parent)

  Set the parent prototype of this prototype, i.e. the prototype this prototype inherits from.

### getParentPrototype

    public Prototype getParentPrototype()

  Get the parent prototype from which we inherit, or null if we are top of the line.

### isInstanceOf

    public final boolean isInstanceOf(java.lang.String pname)

  Check if the given prototype is within this prototype's parent chain.

### registerParents

    public final void registerParents(java.util.Map handlers,
                                      java.lang.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. This is used to implement direct over indirect prototype precedence and child over parent precedence.

### getDbMapping

    public DbMapping getDbMapping()

  Get the DbMapping associated with this prototype

### getSkin

    public Skin getSkin(java.lang.String skinName,
                        java.lang.String parentName,
                        java.lang.String subName)
                 throws java.io.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:
    `java.io.IOException`

### getName

    public java.lang.String getName()

  Return this prototype's name

  Returns:
    ...

### getLowerCaseName

    public java.lang.String 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.

### getTypeProperties

    public ResourceProperties getTypeProperties()

  Get the prototype's aggregated type.properties

  Returns:
    type.properties

### getCodeResources

    public java.util.Iterator 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

    public java.util.Iterator 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

    public java.lang.String toString()

  Return a string representing this prototype.

  Overrides:
    `toString` in class `java.lang.Object`

### getScriptableSkinMap

    public java.util.Map getScriptableSkinMap()

  Get a map containing this prototype's skins as strings

  Returns:
    a scriptable skin map

### getScriptableSkinMap

    public java.util.Map getScriptableSkinMap(java.lang.Object[] skinpath)

  Get a map containing this prototype's skins as strings, overloaded by the skins found in the given skinpath.

  Returns:
    a scriptable skin map

Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.