m.c.m.proxyma.resource
Class ProxymaResource

java.lang.Object
  extended by m.c.m.proxyma.resource.ProxymaResource

public class ProxymaResource
extends java.lang.Object

This class rappresents a resource managed by the proxy.
It countains a request and a response and it has all the attributes required by the proxyma-core to manage a client request/response.
In other words, this is the object that will be managed by all the plugins.

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

Version:
$Id: ProxymaResource.java 176 2010-07-03 09:02:14Z marcolinuz $
Author:
Marco Casavecchia Morganti (marcolinuz) [marcolinuz-at-gmail.com]

Constructor Summary
ProxymaResource(ProxymaRequest request, ProxymaResponse response, ProxymaContext context)
          Default constructor for this class
 
Method Summary
 void addAttibute(java.lang.String attributeName, java.lang.Object attributeValue)
          Add a new Attribute to the resource.
 void deleteAttribute(java.lang.String anAttributeName)
          Remove an attribute from the resource
 java.lang.Object getAttribute(java.lang.String anAttributeName)
          Get an attribute (if exists) from the resource using its name
 java.util.Collection<java.lang.String> getAttributeNames()
          Returns a collection of attribute names stored into the resource
 ProxymaContext getContext()
          Returns the contex where this resource was generated.
 java.lang.String getDestinationSubPath()
          Returns the subpath relative to the destination of the proxy folder
 ProxyFolderBean getProxyFolder()
          Returns the proxy foder that matched the requested URI.
 java.net.URL getProxymaRootURL()
          Returns the URI where proxyma is deployed
 java.lang.String getProxymaRootURLAsString()
          Returns the complete URI where proxyma is deployed
 ProxymaRequest getRequest()
          Returns the request generated from the factory method.
 ProxymaResponse getResponse()
          Returns the response generated from the factory method This the response that will be sent back to the client
 void setDestinationSubPath(java.lang.String destinationSubPath)
          Sets the subpath relative to the destination of the proxy folder
 void setProxyFolder(ProxyFolderBean theFolder)
          Set the proxy foder that matched the requested URI.
 void setProxymaRootURI(java.lang.String uri)
          Sets the complete URI where proxyma is deployed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxymaResource

public ProxymaResource(ProxymaRequest request,
                       ProxymaResponse response,
                       ProxymaContext context)
                throws org.apache.commons.lang.NullArgumentException
Default constructor for this class

Parameters:
context - the context where the Resource will live.
Throws:
org.apache.commons.lang.NullArgumentException - if any of the passed parameters is null
Method Detail

getContext

public ProxymaContext getContext()
Returns the contex where this resource was generated.

Returns:
the current context for this resource.

getRequest

public ProxymaRequest getRequest()
Returns the request generated from the factory method. It countains the client request.

Returns:
the client request

getResponse

public ProxymaResponse getResponse()
Returns the response generated from the factory method This the response that will be sent back to the client

Returns:
the response for the client.

getProxyFolder

public ProxyFolderBean getProxyFolder()
Returns the proxy foder that matched the requested URI.

Returns:
the response for the client.

getDestinationSubPath

public java.lang.String getDestinationSubPath()
Returns the subpath relative to the destination of the proxy folder

Returns:
the subpath of the proxy folder

setDestinationSubPath

public void setDestinationSubPath(java.lang.String destinationSubPath)
Sets the subpath relative to the destination of the proxy folder


getProxymaRootURLAsString

public java.lang.String getProxymaRootURLAsString()
Returns the complete URI where proxyma is deployed

Returns:
http://host[:port]/

getProxymaRootURL

public java.net.URL getProxymaRootURL()
Returns the URI where proxyma is deployed

Returns:
the URI where proxyma is deployed

setProxymaRootURI

public void setProxymaRootURI(java.lang.String uri)
Sets the complete URI where proxyma is deployed


setProxyFolder

public void setProxyFolder(ProxyFolderBean theFolder)
Set the proxy foder that matched the requested URI.


getAttribute

public java.lang.Object getAttribute(java.lang.String anAttributeName)
Get an attribute (if exists) from the resource using its name

Parameters:
anAttributeName - the wanted Resource Attribute
Returns:
null if the attribute doesn't exists.

addAttibute

public void addAttibute(java.lang.String attributeName,
                        java.lang.Object attributeValue)
                 throws org.apache.commons.lang.NullArgumentException
Add a new Attribute to the resource. Note: any duplicated entry will be overwritten. Use the containsAttribute() method to check if you care about to not overwrite anything.

Parameters:
attributeName - the name of the attribute to add.
attributeValue - the value of the attribute, it can be any kind of object so it's a responsability of the reader to do the upper-cast to the proper class.
Throws:
org.apache.commons.lang.NullArgumentException - if the attribute name is null

deleteAttribute

public void deleteAttribute(java.lang.String anAttributeName)
                     throws org.apache.commons.lang.NullArgumentException
Remove an attribute from the resource

Parameters:
attributeName - the attribute to remove.
Throws:
org.apache.commons.lang.NullArgumentException - if the argument is null

getAttributeNames

public java.util.Collection<java.lang.String> getAttributeNames()
Returns a collection of attribute names stored into the resource

Returns:
the attribute names


Copyright © 2010. All Rights Reserved.