All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class uhr.core.dk.ParamStore

java.lang.Object
   |
   +----uhr.core.dk.ParamStore

public class ParamStore
extends Object
implements ServiceHost, UF_Object_String_String
This class handles storage of dk for parameter driven parts using a "Java class resource" storage mechanism.

DK is stored as XML and parsed into Flexitrons. Note we don't use the URL class to allows use in Java versions without is, such as embedded systems. The implementation, if it knows it will always have URL available, is welcome to use it.

DK URLs of a simple nature are used. The format is: jcresource://class name/file name. An example using this format is:

 jcresource://jcon.systems.AwardSystem/edit/docs/EditEmail.dk
 
The Java class name is used as a host via Class.forName(class name) and then Class.getResourceAsStream(file name). The file name is relative to the class location. For writes we determine where the class is on disk and then open and write to the file name.

We recreate the class name object from the class name, assuming this is compatable with the classloaders involved. If this is a problem, then we will have to modify this to support Class markers instead of Strings for the marker name.

DL URLs may also be relative. This allows container DK to be reused anywhere in a system and removes tight coupling. While this is not implemented here, we shall describe it here and move the doc to where it's eventually done.

The simplest url is none. For this case the part name, tree path and first upward marker define its url. This by far the most common case. The DK marker is defined as a class name in a cell, allowing the cell's branch to use the marker easily. This is a container DK XML entity named "dkmarker".

To refer to the dk marker but use a non-default dk file, the url may be "file name" with no protocol or marker. This is translated as using the upward marker, upward path, plus the file name. For example this allows two parts in a cell to use the same DK by merely use the same file name.

Note - Other and multiple protocols and storage mechanisms are possible. To mix protocols in container dk, different classes would be used. They would be in a registry for different protocol handlers, much like Java's handles URLs. The registry would be the ParamStore message service, and route different protocols to their handlers.


Constructor Index

 o ParamStore()

Method Index

 o get(String, String)
This uniface is redirected to readIntoFlexitron(...).
 o getServiceHostAide()
Returns the aide handling the ServiceHost's attractor work.
 o readIntoObject(String, String)
Reads the dk for the url, parses it into a data structure of the given type (such as a Flexitron) and returns the Object, which is intended to be given directly to a parameter driven part.
 o readIntoText(String)
Reads the dk for the url and returns it unmodified as raw text.
 o remove(String)
Removes the dk for the url from storage.
 o writeFromText(String, String)
Writes the dk for the url to storage.

Constructors

 o ParamStore
 public ParamStore()

Methods

 o getServiceHostAide
 public ServiceHostAide getServiceHostAide()
Returns the aide handling the ServiceHost's attractor work. My ServiceItems are:
   Type:      UF_Flexitron_String
   ServiceID: uhr.core.dk.ReadDKIntoFlexitron
 

Returns:
the aide.
 o get
 public Object get(String dk_url,
                   String type)
This uniface is redirected to readIntoFlexitron(...).

Parameters:
dk_url - the url for the dk.
type - the dk data structure type to use.
Returns:
the dk in a standard data structure.
 o readIntoObject
 public Object readIntoObject(String url,
                              String type)
Reads the dk for the url, parses it into a data structure of the given type (such as a Flexitron) and returns the Object, which is intended to be given directly to a parameter driven part.

Currrently the only type supported is uhr.core.tron.Flexitron.

Parameters:
url - the url for the dk.
type - the dk data structure type to use.
Returns:
the dk in a data structure of the type.
Throws: IllegalArgumentException
if the type is unsupported.
 o readIntoText
 public String readIntoText(String url)
Reads the dk for the url and returns it unmodified as raw text. This is intended for editing purposes. However please note that a sophisticated editor can edit a Flexitron.

Parameters:
url - the url for the dk.
Returns:
the dk as raw text.
 o writeFromText
 public void writeFromText(String url,
                           String text)
Writes the dk for the url to storage. This is intended to allow a DK Editor to save edits.

Parameters:
url - the url for the dk.
text - the dk in raw text.
 o remove
 public String remove(String url)
Removes the dk for the url from storage. This is intended to allow a DK Editor to delete the dk for a part.

Parameters:
url - the url in question.
Returns:
the text removed or null if none.

All Packages  Class Hierarchy  This Package  Previous  Next  Index