com.sourceforge.jpatterns.core
Class JPEngineImpl

java.lang.Object
  extended by com.sourceforge.jpatterns.core.JPEngineImpl
All Implemented Interfaces:
IJPEngine

public class JPEngineImpl
extends Object
implements IJPEngine

The concrete, JPatterns "default" implementation.

$Author:: zmicer $
$Rev:: 67 $
* $Date:: 2007-08-28 21:37:07 #$
$Date:: 2007-08-28 21:37:07 #$


Field Summary
static org.apache.log4j.Logger LOG
          Logger instance.
 
Constructor Summary
JPEngineImpl()
          Default public constructor.
 
Method Summary
protected  void checkIsInitialized()
          Check if the instance of initialized.
protected  com.sourceforge.jpatterns.schema.CastorSectionType getCastorSectionType(String name, String scope)
          Get the castor section type using the provided input data
 JPConstants.EngineConfigCaregory getCategory()
           
protected  JPatternsConfigsBean getCategoryJPatternsConfigsBean()
           
 IJPConfig getConfig(String configName, String scope)
          Get the config pattern
 IJPFactory getFactory(String factoryName, String scope)
          Get the IJPFactory using the provided name and the scope.
 IJPattern getPattern(String patternName, String scope)
          Get the IJPattern using the provided name and the scope.
protected  IJPFactory getPluginFactory()
          Get factory is used for the retriving the plugin configurations
 void init(JPConstants.EngineConfigCaregory category)
          Set the JPatterns engine category type - it could be consumer, framework related etc.
 boolean isInitialized()
           
protected  void logAndThrow(String message)
          Log the message and then throw it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.log4j.Logger LOG
Logger instance.

Constructor Detail

JPEngineImpl

public JPEngineImpl()
Default public constructor.

Method Detail

init

public void init(JPConstants.EngineConfigCaregory category)
Description copied from interface: IJPEngine
Set the JPatterns engine category type - it could be consumer, framework related etc. It defines the purposes it would be used.

Specified by:
init in interface IJPEngine
Parameters:
category - instance of JPConstants.EngineConfigCaregory, Can not be null (otherwise IllegalArgumentException would appear).
See Also:
IJPEngine.init(com.sourceforge.jpatterns.core.JPConstants.EngineConfigCaregory)

getCategory

public JPConstants.EngineConfigCaregory getCategory()
Specified by:
getCategory in interface IJPEngine
Returns:
the JPatterns engine category. In the case it is not initialized - null would be returned
See Also:
IJPEngine.init(com.sourceforge.jpatterns.core.JPConstants.EngineConfigCaregory)

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface IJPEngine
Returns:
true if the instance is initialized, false otherwise. For now the presence of the category set only influence on this, but in the future it could be changed
See Also:
IJPEngine.isInitialized()

getFactory

public IJPFactory getFactory(String factoryName,
                             String scope)
Description copied from interface: IJPEngine
Get the IJPFactory using the provided name and the scope. Please be noticed in the case the scope is not specified the following constant is used as the scope id: (com.sourceforge.jpatterns.core.JPConstants.DEFAULT_SCOPE_NAME)
Please be noticed that the factory returned using the provided scope name, may contains the items(implementation mappings) different then this scope provided. It takes place in the case when the factory has the default scope, and has the items with different scopes - all of them would be accesible through this factory (having the different scope).
Throws JPInitializationException in the case it is not initialized

Specified by:
getFactory in interface IJPEngine
Parameters:
factoryName - the name of the factory to be retrieved. Can not be null (otherwise IllegalArgumentException would appear).
scope - scope name to be used for the retrieving of the appropriate factory. Could be null, in the case the default scope would be used.
Returns:
the IJPFactory instance to be used later.
See Also:
IJPEngine.getFactory(java.lang.String,java.lang.String)

getPattern

public IJPattern getPattern(String patternName,
                            String scope)
Description copied from interface: IJPEngine
Get the IJPattern using the provided name and the scope. Please be noticed in the case the scope is not specified the following constant is used as the scope id: (com.sourceforge.jpatterns.core.JPConstants.DEFAULT_SCOPE_NAME)
Be noticed that the pattern returned using the provided scope name, may contains the items(implementation mappings) different then this scope provided.
Throws JPInitializationException in the case it is not initialized

Specified by:
getPattern in interface IJPEngine
Parameters:
patternName - the name of the pattern to be retrieved. Can not be null (otherwise IllegalArgumentException would appear).
scope - scope name to be used for the retrieving of the appropriate pattern. Could be null, in the case the default scope would be used.
Returns:
the IJPattern instance to be used later.
See Also:
IJPEngine.getPattern(String,String)

getConfig

public IJPConfig getConfig(String configName,
                           String scope)
Description copied from interface: IJPEngine
Get the config pattern

Specified by:
getConfig in interface IJPEngine
Parameters:
configName - the name of the config pattern, Can not be null (otherwise IllegalArgumentException would appear).
scope - the name of the config scope, Can not be null (otherwise IllegalArgumentException would appear).
Returns:
the IJPConfig instance.
See Also:
IJPEngine.getConfig(java.lang.String, java.lang.String)

getCastorSectionType

protected com.sourceforge.jpatterns.schema.CastorSectionType getCastorSectionType(String name,
                                                                                  String scope)
Get the castor section type using the provided input data

Parameters:
name - the name of the section to be retrived, Can not be null (otherwise IllegalArgumentException would appear).
scope - the name of the scope to be retrived, Can not be null (otherwise IllegalArgumentException would appear).
Returns:
the castor section type to be used.

getPluginFactory

protected IJPFactory getPluginFactory()
Get factory is used for the retriving the plugin configurations

Returns:
the instance of IJPFactory.

getCategoryJPatternsConfigsBean

protected JPatternsConfigsBean getCategoryJPatternsConfigsBean()
Returns:
the specific for the pointed category

checkIsInitialized

protected void checkIsInitialized()
Check if the instance of initialized.


logAndThrow

protected void logAndThrow(String message)
                    throws JPConfigException
Log the message and then throw it.

Parameters:
message - the not emopty message to be thrown and logged
Throws:
JPConfigException - always, using message


Copyright © 2007 jzmicer.team. All Rights Reserved.