org.apache.cocoon.framework
Class Factory

java.lang.Object
  |
  +--org.apache.cocoon.framework.Factory

public class Factory
extends java.lang.Object

The factory used by Cocoon to create needed classes. This class is used instead of direct creation to allow the behavior to be configurable without requiring recompilation or any direct code modifications.

Version:
$Revision: 1.1 $ $Date: 1999/03/22 23:50:06 $
Author:
Stefano Mazzocchi

Field Summary
private static Configurations configurations
           
 
Constructor Summary
Factory()
           
 
Method Summary
static java.lang.Object create(java.lang.String type)
          This method returns a class which implements the org.apache.[type].[Type] where [type] is the type string passed and [Type] is the same string with first letter uppercase.
static java.lang.Object create(java.lang.String type, Configurations conf)
          This method acts like create(String type) but initializes the created class with the give Configurations rather than with those used by the factory.
static void init(Configurations conf)
          Set the configurations for this factory.
private static java.lang.Object instantiate(java.lang.String name, java.lang.String type, Configurations conf)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

configurations

private static Configurations configurations
Constructor Detail

Factory

public Factory()
Method Detail

init

public static void init(Configurations conf)
Set the configurations for this factory.

create

public static java.lang.Object create(java.lang.String type)
                               throws java.lang.RuntimeException
This method returns a class which implements the org.apache.[type].[Type] where [type] is the type string passed and [Type] is the same string with first letter uppercase.

The actual implementation is mapped by the "type" configuration of this factory.

For example, the method create("parser") looks for the parser configuration and returns a class of type org.apache.parser.Parser.


create

public static java.lang.Object create(java.lang.String type,
                                      Configurations conf)
                               throws java.lang.RuntimeException
This method acts like create(String type) but initializes the created class with the give Configurations rather than with those used by the factory.

instantiate

private static java.lang.Object instantiate(java.lang.String name,
                                            java.lang.String type,
                                            Configurations conf)
                                     throws java.lang.RuntimeException

Copyright (c) 1998 The Java Apache Project