org.milyn.cdr
Class SmooksResourceConfigurationStore

java.lang.Object
  extended by org.milyn.cdr.SmooksResourceConfigurationStore

public class SmooksResourceConfigurationStore
extends Object

SmooksResourceConfiguration context store.

Stores the SmooksResourceConfigurations for a given container context in the form of SmooksResourceConfigurationList entries. Also maintains a "default" config list for the context.

Author:
tfennelly

Constructor Summary
SmooksResourceConfigurationStore(ApplicationContext applicationContext)
          Public constructor.
 
Method Summary
 void close()
          Close this resource configuration store, uninitializing all ContentHandlers allocated from this store instance.
 List<ContentHandler> getAllocatedHandlers()
           
 ContentHandlerFactory getContentHandlerFactory(String type)
          Get the ContentHandlerFactory for a resource based on the supplied resource type.
 Object getObject(SmooksResourceConfiguration resourceConfig)
          Load a Java Object defined by the supplied SmooksResourceConfiguration instance.
 Iterator<SmooksResourceConfigurationList> getSmooksResourceConfigurationLists()
          Get all the added SmooksResourceConfigurationList instances added on this store.
 SmooksResourceConfiguration[] getSmooksResourceConfigurations(ProfileSet profileSet)
          Get all the SmooksResourceConfiguration entries registered on this context store for the specified profile set.
 void load(BufferedReader cdrlLoadList)
          Load all .cdrl files listed in the BufferedReader stream.
 void registerResource(SmooksResourceConfiguration resourceConfig)
          Register a SmooksResourceConfiguration on this context store.
 void registerResources(String baseURI, InputStream resourceConfigStream)
          Register the set of resources specified in the supplied XML configuration stream.
 void removeShutdownHook()
          Remove the shutdown hook associated with this store instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmooksResourceConfigurationStore

public SmooksResourceConfigurationStore(ApplicationContext applicationContext)
Public constructor.

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

removeShutdownHook

public void removeShutdownHook()
Remove the shutdown hook associated with this store instance.


load

public void load(BufferedReader cdrlLoadList)
          throws IOException
Load all .cdrl files listed in the BufferedReader stream.

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

Parameters:
cdrlLoadList - BufferedReader cdrl list - one cdrl def per line.
Throws:
IOException - Error reading list buffer.

registerResources

public void registerResources(String baseURI,
                              InputStream resourceConfigStream)
                       throws SAXException,
                              IOException,
                              URISyntaxException
Register the set of resources specified in the supplied XML configuration stream.

Parameters:
baseURI - The base URI to be associated with the configuration stream.
resourceConfigStream - XML resource configuration stream.
Throws:
SAXException - Error parsing the resource stream.
IOException - Error reading resource stream.
URISyntaxException
See Also:
SmooksResourceConfiguration

registerResource

public void registerResource(SmooksResourceConfiguration resourceConfig)
Register a SmooksResourceConfiguration on this context store.

The config gets added to the default resource list.

Parameters:
resourceConfig - The Content Delivery Resource definition to be registered.

getSmooksResourceConfigurationLists

public Iterator<SmooksResourceConfigurationList> getSmooksResourceConfigurationLists()
Get all the added SmooksResourceConfigurationList instances added on this store.

Returns:
All the SmooksResourceConfigurationList instances added on this store.

getSmooksResourceConfigurations

public SmooksResourceConfiguration[] getSmooksResourceConfigurations(ProfileSet profileSet)
Get all the SmooksResourceConfiguration entries registered on this context store for the specified profile set.

Parameters:
profileSet - The profile set against which to lookup.
Returns:
All SmooksResourceConfiguration entries targeted at the specified useragent.

getObject

public Object getObject(SmooksResourceConfiguration resourceConfig)
Load a Java Object defined by the supplied SmooksResourceConfiguration instance.

Parameters:
resourceConfig - SmooksResourceConfiguration instance.
Returns:
An Object instance from the SmooksResourceConfiguration.

getAllocatedHandlers

public List<ContentHandler> getAllocatedHandlers()

getContentHandlerFactory

public ContentHandlerFactory getContentHandlerFactory(String type)
                                               throws UnsupportedContentHandlerTypeException
Get the ContentHandlerFactory for a resource based on the supplied resource type.

Note that ContentHandlerFactory implementations must be configured under a selector value of "cdu-creator".

Parameters:
type - ContentHandlerFactory type e.g. "class", "xsl" etc.
Returns:
ContentHandlerFactory for the resource.
Throws:
UnsupportedContentHandlerTypeException - No ContentHandlerFactory registered for the specified resource type.

close

public void close()
Close this resource configuration store, uninitializing all ContentHandlers allocated from this store instance.



Copyright © 2008. All Rights Reserved.