org.eclipse.hyades.logging.events.cbe.impl
Class AbstractEventFactoryHome

java.lang.Object
  |
  +--org.eclipse.hyades.logging.events.cbe.impl.AbstractEventFactoryHome
All Implemented Interfaces:
EventFactoryHome
Direct Known Subclasses:
EventXMLFileEventFactoryHomeImpl, SimpleEventFactoryHomeImpl

public abstract class AbstractEventFactoryHome
extends java.lang.Object
implements EventFactoryHome

An abstract event factory home implementation for working with event factories.

This abstract class provides resolution of named EventFactory instances, persistence of retrieved EventFactory instances, configuration updates based on a specific type of configuration template for the EventFactory instances and releasing cached named EventFactory instances.

This abstract class also provides an anonymous EventFactory for retrieving an unnamed EventFactory for component independent event creation. The anonymous EventFactory may be retrieved and potentially updated based on a specific type of configuration template for the EventFactory instances, if one exists for unnamed EventFactory instances. Note, the anonymous EventFactory instance cannot be released once created.

Concrete implementations of this abstract class implement the createContentHandler(String factoryName) and resolveContentHandler() APIs to provide a ContentHandler implementation tightly coupled to the type of concrete implementation of this abstract class. The resolveContentHandler() API permits an alternative ContentHandler to be associated with an instance of a concrete implementation of this abstract class. This is achieved by extending the concrete implementation of this abstract class and extend the resolveContentHandler() API. Concrete implementations that do not require a ContentHandler nor configuration template, simply return null for each API.

For example, a concrete implementation of this abstract class may provide the an implementation of the createContentHandler(String factoryName) API that creates a specialized ContentHandler pre-configured with an event template resolved from a local event property file. The concrete implementation of this abstract class would also provide an implementation of the resolveContentHandler() API that retrieves a new instance of the specialized ContentHandler used in the implementation of the createContentHandler(String factoryName) API.

It is assumed that implementations of the createContentHandler(String factoryName) API would reference the implementation of the resolveContentHandler() API in the same concrete implementation of this abstract class when creating the returned ContentHandler.

Since:
1.0.1
Version:
1.0.1
Author:
Paul E Slauenwhite
See Also:
EventFactoryHome, EventPermission

Constructor Summary
AbstractEventFactoryHome()
           
 
Method Summary
 void checkAccess()
          Checks the system's SecurityManager for the context of the currently executing thread to see if the caller has permission to create, retrieve, update and release Event Factory instances from the Event Factory Home.
abstract  ContentHandler createContentHandler(java.lang.String factoryName)
          Creates an instance of the ContentHandler implementation which is tightly coupled to the type of the concrete implementation of this abstract class.
 EventFactory getAnonymousEventFactory()
          Retrieves an instance of the anonymous EventFactory.
 EventFactory getEventFactory(java.lang.String factoryName)
          Retrieves an instance of the named EventFactory.
 void releaseEventFactory(java.lang.String factoryName)
          Releases the reference to the instance of the named EventFactory.
abstract  ContentHandler resolveContentHandler()
          Resolves an instance of the ContentHandler implementation which is tightly coupled to the type of the concrete implementation of this abstract class.
 void updateAnonymousEventFactory()
          Updates the configuration on the instance of the anonymous EventFactory.
 void updateEventFactory(java.lang.String factoryName)
          Updates the configuration on the instance of the named EventFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEventFactoryHome

public AbstractEventFactoryHome()
Method Detail

createContentHandler

public abstract ContentHandler createContentHandler(java.lang.String factoryName)
Creates an instance of the ContentHandler implementation which is tightly coupled to the type of the concrete implementation of this abstract class.

The returned instance of the ContentHandler implementation is pre-configured with a event properties resolved from a source tightly coupled to the type of the concrete implementation of this abstract class.

It is assumed that implementations of this method would reference the implementation of the resolveContentHandler() method in the same concrete implementation of this abstract class when creating the returned ContentHandler.

Parameters:
factoryName - The name of the event factory associated with the returned ContentHandler implementation.
Returns:
An instance of the ContentHandler pre-configured with a event properties.

resolveContentHandler

public abstract ContentHandler resolveContentHandler()
Resolves an instance of the ContentHandler implementation which is tightly coupled to the type of the concrete implementation of this abstract class.

It is assumed that implementations of the createContentHandler(String factoryName) method would reference the implementation of this method in the same concrete implementation of this abstract class when creating the returned ContentHandler.

Returns:
An instance of the ContentHandler tightly coupled with this type of this event factory home implementation.

checkAccess

public void checkAccess()
                 throws java.lang.SecurityException
Deprecated. As of Hyades M10, Java permission-based security is no longer supported. This method will never throw a SecurityException.

Description copied from interface: EventFactoryHome
Checks the system's SecurityManager for the context of the currently executing thread to see if the caller has permission to create, retrieve, update and release Event Factory instances from the Event Factory Home. The caller has permission if the EventPermission("factory") permission has been explicitly granted to the caller.

If the caller has been granted permission the method quietly returns. Otherwise, the method throws a SecurityException.

Specified by:
checkAccess in interface EventFactoryHome
Throws:
java.lang.SecurityException - If the SecurityManager exists and if the caller does not have permission (e.g. EventPermission("factory")).
See Also:
EventFactoryHome.checkAccess()

getAnonymousEventFactory

public EventFactory getAnonymousEventFactory()
Description copied from interface: EventFactoryHome
Retrieves an instance of the anonymous EventFactory.

An instance of the anonymous EventFactory is created if the anonymous EventFactory instance currently does not exist.

Once the anonymous EventFactory is created, the instance is cached for future calls to retrieve the same anonymous EventFactory.

The anonymous EventFactory is used to for component independent event creation and is unnamed. The anonymous EventFactory may be assigned a ContentHandler for configuration updates based on a specific type of configuration template for the EventFactory instances, if one exists for unnamed EventFactory instances.

Specified by:
getAnonymousEventFactory in interface EventFactoryHome
Returns:
The retrieved or newly created anonymous EventFactory.
See Also:
EventFactoryHome.getAnonymousEventFactory()

getEventFactory

public EventFactory getEventFactory(java.lang.String factoryName)
Description copied from interface: EventFactoryHome
Retrieves an instance of the named EventFactory.

An instance of a named EventFactory is created if no named instance current exists or a named instance is released.

Once a named EventFactory is created, the instance is cached for future calls to retrieve the same named EventFactory.

The name of the EventFactory uniquely identifies an instance of an EventFactory. All subsequent calls will return the same instance of the named EventFactory.

EventFactory names are hierarchal represented using the standard Java dot-delimited name-space naming conventions.

Passing a null EventFactory name parameter in will be equivalent to calling the EventFactoryHome.getAnonymousEventFactory() API.

Specified by:
getEventFactory in interface EventFactoryHome
Parameters:
factoryName - The name of the EventFactory.
Returns:
The retrieved or newly created EventFactory.
See Also:
EventFactoryHome.getEventFactory(java.lang.String)

updateAnonymousEventFactory

public void updateAnonymousEventFactory()
Description copied from interface: EventFactoryHome
Updates the configuration on the instance of the anonymous EventFactory.

If the EventFactoryHome instance does not support ContentHandler s for unnamed EventFactory instances, no update occurs.

The anonymous EventFactory is used to for component independent event creation and is unnamed. The anonymous EventFactory may be assigned a ContentHandler for configuration updates based on a specific type of configuration template for the EventFactory instances, if one exists for unnamed EventFactory instances.

Specified by:
updateAnonymousEventFactory in interface EventFactoryHome
See Also:
EventFactoryHome.updateAnonymousEventFactory()

updateEventFactory

public void updateEventFactory(java.lang.String factoryName)
Description copied from interface: EventFactoryHome
Updates the configuration on the instance of the named EventFactory.

If no named EventFactory instance exists, no update occurs.

The name of the EventFactory uniquely identifies an instance of an EventFactory. All calls will update the configuration on the same named instance of the EventFactory.

EventFactory names are hierarchal represented using the standard Java dot-delimited name-space naming conventions.

Passing a null EventFactory name parameter in will be equivalent to calling the EventFactoryHome.updateAnonymousEventFactory() API.

Passing an empty string (e.g. "") with or without white space or a single asterisk (e.g. *) as the name parameter updates the configuration on all cached EventFactory instances.

Specified by:
updateEventFactory in interface EventFactoryHome
Parameters:
factoryName - The name of the EventFactory.
See Also:
EventFactoryHome.updateEventFactory(java.lang.String)

releaseEventFactory

public void releaseEventFactory(java.lang.String factoryName)
Description copied from interface: EventFactoryHome
Releases the reference to the instance of the named EventFactory.

If no named EventFactory instance exists, no release occurs.

The name of the EventFactory uniquely identifies an instance of an EventFactory.

EventFactory names are hierarchal represented using the standard Java dot-delimited name-space naming conventions.

Passing an empty string (e.g. "") with or without white space or a single asterisk (e.g. *) as the name parameter releases all cached EventFactory instances.

Specified by:
releaseEventFactory in interface EventFactoryHome
Parameters:
factoryName - The name of the EventFactory.
See Also:
EventFactoryHome.releaseEventFactory(java.lang.String)