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

java.lang.Object
  extended byorg.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 EventFactory resolution, persistence of retrieved EventFactory instances, possible configuration updates based on a specific type of configuration template for the EventFactory instance and releasing EventFactory instances.

Concrete implementations of this abstract class implement the createContentHandler(String factoryName) and resolveContentHandler() APIs to typically provide a ContentHandler implementation tightly coupled to the type of the concrete implementation of this abstract class. 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 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 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()

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.

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)

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.

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.

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