org.apache.turbine.services.assemblerbroker
Class TurbineAssemblerBrokerService

java.lang.Object
  |
  +--org.apache.turbine.services.BaseInitable
        |
        +--org.apache.turbine.services.BaseService
              |
              +--org.apache.turbine.services.TurbineBaseService
                    |
                    +--org.apache.turbine.services.assemblerbroker.TurbineAssemblerBrokerService
All Implemented Interfaces:
AssemblerBrokerService, Initable, Service

public class TurbineAssemblerBrokerService
extends TurbineBaseService
implements AssemblerBrokerService

TurbineAssemblerBrokerService allows assemblers (like screens, actions and layouts) to be loaded from one or more AssemblerFactory classes. AssemblerFactory classes are registered with this broker by adding them to the TurbineResources.properties file.

Author:
Leon Messerschmidt

Field Summary
private  java.util.Hashtable factories
          A structure that holds the registered AssemblerFactories
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.turbine.services.assemblerbroker.AssemblerBrokerService
ACTION_TYPE, LAYOUT_TYPE, NAVIGATION_TYPE, PAGE_TYPE, SCHEDULEDJOB_TYPE, SCREEN_TYPE, SERVICE_NAME
 
Constructor Summary
TurbineAssemblerBrokerService()
           
 
Method Summary
 Assembler getAssembler(java.lang.String type, java.lang.String name)
          Attempt to retrieve an Assembler of a given type with a name.
private  java.util.Vector getFactoryGroup(java.lang.String type)
          Get a list of AssemblerFactories of a certain type
 void init()
          Initializes the AssemblerBroker and loads the AssemblerFactory classes registerd in TurbineResources.Properties.
private  void registerFactories(java.lang.String type)
          Utiltiy method to register all factories for a given type.
 void registerFactory(java.lang.String type, AssemblerFactory factory)
          Register a new AssemblerFactory under a certain type
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init, shutdown
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker, shutdown
 

Field Detail

factories

private java.util.Hashtable factories
A structure that holds the registered AssemblerFactories
Constructor Detail

TurbineAssemblerBrokerService

public TurbineAssemblerBrokerService()
Method Detail

getFactoryGroup

private java.util.Vector getFactoryGroup(java.lang.String type)
Get a list of AssemblerFactories of a certain type

registerFactories

private void registerFactories(java.lang.String type)
                        throws TurbineException
Utiltiy method to register all factories for a given type.

init

public void init()
          throws InitializationException
Initializes the AssemblerBroker and loads the AssemblerFactory classes registerd in TurbineResources.Properties.
Specified by:
init in interface Initable
Overrides:
init in class TurbineBaseService
Following copied from interface: org.apache.turbine.services.Initable
Throws:
InitializationException, - if initialization of this class was not successful.

registerFactory

public void registerFactory(java.lang.String type,
                            AssemblerFactory factory)
Register a new AssemblerFactory under a certain type
Specified by:
registerFactory in interface AssemblerBrokerService

getAssembler

public Assembler getAssembler(java.lang.String type,
                              java.lang.String name)
                       throws TurbineException
Attempt to retrieve an Assembler of a given type with a name. Cycle through all the registered AssemblerFactory classes of type and retrun the first non-null assembly found. If an assembly was not found return null.
Specified by:
getAssembler in interface AssemblerBrokerService


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.