Milyn-Smooks Version 0.4

org.milyn.cdr
Class CDRStore

java.lang.Object
  extended byorg.milyn.cdr.CDRStore

public class CDRStore
extends java.lang.Object

Content Delivery Resource (CDR) store object.

This class is used to load CDRs.

Author:
tfennelly

Constructor Summary
CDRStore(ContainerContext containerContext)
          Public constructor.
 
Method Summary
 CDRClassLoader getCdrarClassLoader()
          Get the CDRClassLoader to be used loading java class instances from this CDRStore instance.
 CDRArchive[] getCdrars()
          Get an array of the loaded CDRArchive instances.
 CDRDef[] getCDRDefs(UAContext deviceContext)
          Get all CDRDef entries for the specified device from all loaded CDRArchive archives.
 CDRArchiveEntry getEntry(CDRDef unitDef)
          Get the CDRArchiveEntry for the specificd CDRDef instance.
 CDRArchiveEntry getEntry(java.lang.String name)
          Get the CDRArchiveEntry matching the name specified.
 java.lang.Object getObject(CDRDef unitDef)
          Load a Java Object defined by the supplied CDRDef instance.
 void load(java.io.BufferedReader cdrarLoadList)
          Load all .cdrar files listed in the BufferedReader stream.
 void load(CDRArchive cdrar)
          Load a preconstructed CDRArchive instance.
 void load(java.io.File cdrarDir)
          Load all .cdrar files in the specified folder.
 void load(java.lang.String name, java.util.jar.JarInputStream cdrarStream)
          Load an cdrar archive.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDRStore

public CDRStore(ContainerContext containerContext)
Public constructor.

Parameters:
containerContext - Container context in which this store lives.
Method Detail

load

public void load(CDRArchive cdrar)
Load a preconstructed CDRArchive instance.

Parameters:
cdrar - CDRArchive instance to load.

load

public void load(java.lang.String name,
                 java.util.jar.JarInputStream cdrarStream)
          throws CDRArchiveAlreadyLoadedException,
                 InvalidCDRArchiveException,
                 java.io.IOException
Load an cdrar archive.

Parameters:
name - The archive name.
cdrarStream - The JarInputStream of the associated CDRArchive JAR.
Throws:
CDRArchiveAlreadyLoadedException - A cdrar by the supplied name has already been loaded.
InvalidCDRArchiveException - The cdrar is invalid e.g. no archive definition file.
java.io.IOException - Error reading the JarInputStream.

load

public void load(java.io.BufferedReader cdrarLoadList)
          throws java.io.IOException
Load all .cdrar files listed in the BufferedReader stream.

Because this method uses the ContainerResourceLocator it may be possible to load external cdrar files. If the ContainerResourceLocator is a ServletResourceLocator the lines in the BufferedReader param can contain external URLs.

Parameters:
cdrarLoadList - BufferedReader cdrar list - one cdrar def per line.
Throws:
java.io.IOException

load

public void load(java.io.File cdrarDir)
          throws java.io.IOException
Load all .cdrar files in the specified folder.

Parameters:
cdrarDir - Folder from which to load.
Throws:
java.io.IOException

getCdrars

public CDRArchive[] getCdrars()
Get an array of the loaded CDRArchive instances.

Each CDRArchive instance provides access to an enumeration of all it's CDRArchiveEntrys.

The order is equal to the order in which they were loaded.

Returns:
An array of the loaded CDRArchive instances.

getEntry

public CDRArchiveEntry getEntry(java.lang.String name)
                         throws CDRArchiveEntryNotFoundException
Get the CDRArchiveEntry matching the name specified.

Parameters:
name - The Jar name of the entry.
Returns:
The CDRArchiveEntry for the specified name.
Throws:
CDRArchiveEntryNotFoundException - When the requested CDRArchiveEntry has not been loaded and is therefore unknown.

getEntry

public CDRArchiveEntry getEntry(CDRDef unitDef)
                         throws CDRArchiveEntryNotFoundException
Get the CDRArchiveEntry for the specificd CDRDef instance.

Parameters:
unitDef - The CDRDef whose CDRArchiveEntry is being requested.
Returns:
The CDRArchiveEntry for the specified CDRDef.
Throws:
CDRArchiveEntryNotFoundException - When the requested CDRArchiveEntry has not been loaded and is therefore unknown.

getCDRDefs

public CDRDef[] getCDRDefs(UAContext deviceContext)
Get all CDRDef entries for the specified device from all loaded CDRArchive archives.

Parameters:
deviceContext - The device.
Returns:
All CDRDef entries for the specified device.

getCdrarClassLoader

public CDRClassLoader getCdrarClassLoader()
Get the CDRClassLoader to be used loading java class instances from this CDRStore instance.

Returns:
Returns the cdrarClassLoader.

getObject

public java.lang.Object getObject(CDRDef unitDef)
Load a Java Object defined by the supplied CDRDef instance.

The class implementation must contain a public constructor that takes a CDRDef parameter.

Parameters:
unitDef - CDRDef instance.
Returns:
An Object instance from the CDRDef.

Milyn-Smooks Version 0.4