|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimple.template.Environment
public class Environment
The Delegate
provides a full implementation of an
environment. This enables the template engine to provide its
mapping scheme to the object transparently and decouples both
the controller objects and the templating system from the
mapping scheme used. The resolve
method provided
by this will use the mapping scheme to locate the required
templates, all completly transparent to the controllers.
Constructor Summary | |
---|---|
Environment(Container system,
Context context)
Constructor for the Delegate object. |
Method Summary | |
---|---|
boolean |
contains(java.lang.String name)
The contains method is used to determine if
a mapping exists for the given name. |
boolean |
exists(java.lang.String path)
Determines whether the named template exists. |
java.lang.Object |
get(java.lang.String name)
The get method is used to retrieve the value
mapped to the specified name. |
java.util.Set |
keySet()
To ascertain what mappings exist, the names of all values previously put into thhis database can be retrieved with this method. |
Document |
lookup(java.lang.String path)
Looks for the named template and wraps the template within a new Document instance. |
void |
put(java.lang.String name,
java.lang.Object value)
The put method is used to insert a mapping in
the environment that pairs the issued name with the issued
value. |
void |
remove(java.lang.String name)
The remove method is used to remove the
mapping from the environment. |
Document |
resolve(java.lang.String target)
Looks for the named template and wraps the template within a new Document instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Environment(Container system, Context context)
Delegate
object. In order
to incorporate the template engines mapping scheme into
this environment, this requires that the engines context
is provided, the templating system is also required to
produce documents that can be configured for rendering.
system
- this represents the templating system usedcontext
- this is the context of the template engineMethod Detail |
---|
public void put(java.lang.String name, java.lang.Object value)
put
method is used to insert a mapping in
the environment that pairs the issued name with the issued
value. The value can be referenced in future by its name.
Properties set with this method will be set within the
container, and will thus be available to all documents.
put
in interface Database
name
- this is the name of the value being insertedvalue
- this is the named value that is insertedpublic java.lang.Object get(java.lang.String name)
get
method is used to retrieve the value
mapped to the specified name. If a value does not exist
matching the given name, then this returns null. All the
property values retrieved by this method are obtained
from the container, and are retrievable from documents.
get
in interface Database
name
- this is the name of the value to be retrieved
public void remove(java.lang.String name)
remove
method is used to remove the
mapping from the environment. This method either removes
the value or returns silently if the name does not exits.
Once removed, all documents with access to the property
can no longer reference it, nor can the container.
remove
in interface Database
name
- this is the name of the value to be removedpublic java.util.Set keySet()
Set
that
contains the names of all the mappings added to this.
keySet
in interface Database
public boolean contains(java.lang.String name)
contains
method is used to determine if
a mapping exists for the given name. This returns true if
the mapping exists or false otherwise. This delegates to
the internal container object that contains all mappings.
contains
in interface Database
name
- this is the name of the mapping to determine
public boolean exists(java.lang.String path)
lookup
method will locate
a template given the specified path. If the template is
accessable this returns true, otherwise false is returned.
exists
in interface Container
path
- this is the path used to locate the template
public Document lookup(java.lang.String path) throws java.lang.Exception
Document
instance. Resolving the location
of the template is left up the templating system, typically
this requires a file path reference to locate the template.
The document created by this method is transient, that is, it is a unique instance. This means that changes to the properties of any created document object affect only that instance. All documents retrieved use the UTF-8 encoding.
lookup
in interface Container
path
- this is the path used to locate the template
java.lang.Exception
- this is thrown if the is a problem with
locating or rendering the specified templatepublic Document resolve(java.lang.String target) throws java.lang.Exception
Document
instance. Resolving the location
of the template is done using the internal mapping scheme
employed by the template engine. This will extract the path
from the HTTP URI and delegate to the lookup
method, which will use the templating system to locate the
template. This is used to hide all mapping details.
The document created by this method is transient, that is, it is a unique instance. This means that changes to the properties of any created document object affect only that instance. All documents retrieved use the UTF-8 encoding.
target
- the unmodified URI to resolve to a template
java.lang.Exception
- this is thrown if ther is a problem with
locating or rendering the resolved template
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |