m.c.m.proxyma.core
Class ProxyEngine

java.lang.Object
  extended by m.c.m.proxyma.core.ProxyEngine

public class ProxyEngine
extends java.lang.Object

This class is the main skeleton of this whole project and is a mixture of many design patterns.

Its purpose is to manage a ProximaResource (that has a request inside) in order to fill the response with the requested data using the provided plugins.
IMPORTANT: The engine guarantees that the preprocessors and the transformer are executed respecting the "executiPriority" defined into the proxyma-config.xml. Plugins with a lower priority are execute first and plugins with an higher priority are executed lastly (BTW: plugins with the same priority are executed in random order).

NOTE: this software is released under GPL License. See the LICENSE of this distribution for more informations.

Version:
$Id: ProxyEngine.java 179 2010-07-03 11:49:04Z marcolinuz $
Author:
Marco Casavecchia Morganti (marcolinuz) [marcolinuz-at-gmail.com]

Constructor Summary
ProxyEngine(ProxymaContext context)
          The constructor for this class.
 
Method Summary
 int doProxy(ProxymaResource aResource)
          This is the core method of this project.
 java.util.Collection<CacheProvider> getRegisteredCachePlugins()
          Get a Collection of CacheProviders registered into the Engine.
 java.util.Collection<ResourceHandler> getRegisteredPluginsByType(ProxymaTags.HandlerType type)
          Get a collection of the registered plugins by type.
protected  boolean isEnableShowFoldersListOnRootURI()
          Get the new value for the flag
If true, proxyma will show the list of the registered folders if the client access to the root uri of the proxy.
protected  void setAvailableCacheProviders(java.util.HashMap<java.lang.String,CacheProvider> availableCacheProviders)
          Protected method to set the available cache providers.
protected  void setAvailablePreprocessors(java.util.HashMap<java.lang.String,ResourceHandler> availablePreprocessors)
          Protected method to set the available preprocessor plugins.
protected  void setAvailableRetrivers(java.util.HashMap<java.lang.String,ResourceHandler> availableRetrivers)
          Protected method to set the available retriver plugins.
protected  void setAvailableSerializers(java.util.HashMap<java.lang.String,ResourceHandler> availableSerializers)
          Protected method to set the available serializer plugins.
protected  void setAvailableTransformers(java.util.HashMap<java.lang.String,ResourceHandler> availableTransformers)
          Protected method to set the available transformer plugins.
protected  void setEnableShowFoldersListOnRootURI(boolean showFoldersListOnRootURI)
          Sets the new value for the flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyEngine

public ProxyEngine(ProxymaContext context)
The constructor for this class.

Parameters:
context - the context to use to retrive configuration data
Method Detail

doProxy

public int doProxy(ProxymaResource aResource)
            throws java.io.IOException,
                   java.lang.Exception
This is the core method of this project. It applies to the passed resource all the configured plugins defined into the ProxyFolder that is responsible of its creation.

Parameters:
aResource - a resource to masquerade by the proxy.
Throws:
java.io.IOException
java.lang.Exception

getRegisteredCachePlugins

public java.util.Collection<CacheProvider> getRegisteredCachePlugins()
Get a Collection of CacheProviders registered into the Engine.

Returns:
the mentioned collection.

getRegisteredPluginsByType

public java.util.Collection<ResourceHandler> getRegisteredPluginsByType(ProxymaTags.HandlerType type)
Get a collection of the registered plugins by type.

Parameters:
type - the type of the plugins that have to be returned
Returns:
The collection of registered resource handlers

setAvailableCacheProviders

protected void setAvailableCacheProviders(java.util.HashMap<java.lang.String,CacheProvider> availableCacheProviders)
Protected method to set the available cache providers.
It's used by the ProxyEngineFactory to create an instance of this class.

Parameters:
availableCacheProviders - the new Map of availeble cache providers.
See Also:
ProxyEngineFactory

setAvailablePreprocessors

protected void setAvailablePreprocessors(java.util.HashMap<java.lang.String,ResourceHandler> availablePreprocessors)
Protected method to set the available preprocessor plugins.
It's used by the ProxyEngineFactory to create an instance of this class.

Parameters:
availableCacheProviders - the new Map of availeble preprocessors.
See Also:
ProxyEngineFactory

setAvailableRetrivers

protected void setAvailableRetrivers(java.util.HashMap<java.lang.String,ResourceHandler> availableRetrivers)
Protected method to set the available retriver plugins.
It's used by the ProxyEngineFactory to create an instance of this class.

Parameters:
availableCacheProviders - the new Map of availeble retrivers.
See Also:
ProxyEngineFactory

setAvailableSerializers

protected void setAvailableSerializers(java.util.HashMap<java.lang.String,ResourceHandler> availableSerializers)
Protected method to set the available serializer plugins.
It's used by the ProxyEngineFactory to create an instance of this class.

Parameters:
availableCacheProviders - the new Map of availeble serializers.
See Also:
ProxyEngineFactory

setAvailableTransformers

protected void setAvailableTransformers(java.util.HashMap<java.lang.String,ResourceHandler> availableTransformers)
Protected method to set the available transformer plugins.
It's used by the ProxyEngineFactory to create an instance of this class.

Parameters:
availableCacheProviders - the new Map of availeble transformers.
See Also:
ProxyEngineFactory

isEnableShowFoldersListOnRootURI

protected boolean isEnableShowFoldersListOnRootURI()
Get the new value for the flag
If true, proxyma will show the list of the registered folders if the client access to the root uri of the proxy.

Returns:
true or false

setEnableShowFoldersListOnRootURI

protected void setEnableShowFoldersListOnRootURI(boolean showFoldersListOnRootURI)
Sets the new value for the flag.

Parameters:
enableShowFoldersListOnRootURI -
See Also:
isShowFoldersListOnRootURI


Copyright © 2010. All Rights Reserved.