net.wimpi.text
Class ProcessingKernel

java.lang.Object
  |
  +--net.wimpi.text.ProcessingKernel

public class ProcessingKernel
extends java.lang.Object

Class that implements a kernel for handling the main tasks of the processing framework. It represents a singleton, and can be used to retrieve or add named Processor or ProcessingPipe instances, the same as named ResourcePool instances. There are also utility methods for bootstrapping from a Properties instance, and returning the current state as Properties instance.

Version:
0.2 19/11/2002
Author:
Dieter Wimberger
See Also:
Processor, ProcessingPipe

Method Summary
 void addProcessingPipe(ProcessingPipe pipe)
          Adds a processing pipe to this kernel.
 void addProcessor(Processor processor)
          Adds a processor to this kernel.
 void addResourcePool(java.lang.String name, ResourcePool pool)
          Adds a resource pool with the given name to this kernel.
static ProcessingKernel createProcessingKernel(java.util.Properties props)
          Creates a Kernel from a given Properties instance.
 java.util.Properties dumpKernel()
          Returns a Properties instance that reflects the actual state of the Kernel.
 ProcessingPipe getProcessingPipe(java.lang.String name)
          Returns a reference to a ProcessingPipe instance if available for the given name.
 Processor getProcessor(java.lang.String name)
          Returns a reference to a Processor instance if available for the given name.
static ProcessingKernel getReference()
          Returns the singleton reference of the unique Kernel instance.
 ResourcePool getResourcePool(java.lang.String name)
          Returns a reference to a ResourcePool instance if available for the given name.
 java.lang.String[] listProcessingPipes()
          Lists the available processing pipes with their respective name.
 java.lang.String[] listProcessors()
          Lists the available processors with their respective name.
 java.lang.String[] listResourcePools()
          Lists the available resource pools with their respective name.
 void reloadKernel(java.util.Properties props)
          Reloads the Kernel from a Properties instance.
 void removeProcessingPipe(ProcessingPipe pipe)
          Removes the given ProcessingPipe from the kernel.
 void removeProcessor(Processor processor)
          Removes the given Processor from the kernel.
 void removeResourcePool(java.lang.String name)
          Removes the ResourcePool with the given name from the kernel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

listProcessingPipes

public java.lang.String[] listProcessingPipes()
Lists the available processing pipes with their respective name.
Returns:
a String[] containing a list of processing pipe names.

getProcessingPipe

public ProcessingPipe getProcessingPipe(java.lang.String name)
Returns a reference to a ProcessingPipe instance if available for the given name.
Parameters:
name - the name of the pipe to be retrieved.
Returns:
the reference to the ProcessingPipe instance.

addProcessingPipe

public void addProcessingPipe(ProcessingPipe pipe)
Adds a processing pipe to this kernel.
Parameters:
pipe - the ProcessingPipe to be added.

removeProcessingPipe

public void removeProcessingPipe(ProcessingPipe pipe)
Removes the given ProcessingPipe from the kernel.
Parameters:
pipe - the ProcessingPipe instance to be removed.

listResourcePools

public java.lang.String[] listResourcePools()
Lists the available resource pools with their respective name.
Returns:
a String[] containing a list of resource pool names.

getResourcePool

public ResourcePool getResourcePool(java.lang.String name)
Returns a reference to a ResourcePool instance if available for the given name.
Parameters:
name - the name of the pool to be retrieved.
Returns:
the reference to the ResourcePool instance.

addResourcePool

public void addResourcePool(java.lang.String name,
                            ResourcePool pool)
Adds a resource pool with the given name to this kernel.
Parameters:
name - the name of the pool.
pool - the ResourcePool to be added.

removeResourcePool

public void removeResourcePool(java.lang.String name)
Removes the ResourcePool with the given name from the kernel.
Parameters:
name - the name of the ResourcePool to be removed.

listProcessors

public java.lang.String[] listProcessors()
Lists the available processors with their respective name.
Returns:
a String[] containing a list of processor names.

getProcessor

public Processor getProcessor(java.lang.String name)
Returns a reference to a Processor instance if available for the given name.
Parameters:
name - the name of the processor to be retrieved.
Returns:
the reference to the Processor instance.

addProcessor

public void addProcessor(Processor processor)
Adds a processor to this kernel.
Parameters:
processor - the Processor to be added.

removeProcessor

public void removeProcessor(Processor processor)
Removes the given Processor from the kernel.
Parameters:
processor - the Processor instance to be removed.

dumpKernel

public java.util.Properties dumpKernel()
Returns a Properties instance that reflects the actual state of the Kernel.
Returns:
the reference to the created Properties instance.

reloadKernel

public void reloadKernel(java.util.Properties props)
                  throws java.lang.Exception
Reloads the Kernel from a Properties instance.
Parameters:
props - a reference to a Properties instance describing a kernel state.

getReference

public static final ProcessingKernel getReference()
Returns the singleton reference of the unique Kernel instance.
Returns:
the singleton instance reference.

createProcessingKernel

public static final ProcessingKernel createProcessingKernel(java.util.Properties props)
                                                     throws java.lang.Exception
Creates a Kernel from a given Properties instance. Note that this can only be use once without running into troubles.


Copyright 2001,2002 Dieter Wimberger. All Rights Reserved.