org.springframework.extensions.surf.resource
Class ResourceService

java.lang.Object
  extended by org.springframework.extensions.surf.resource.ResourceService
All Implemented Interfaces:
EventListener, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener

public class ResourceService
extends Object
implements org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener

Resource service for web framework

Author:
muzquiano

Constructor Summary
ResourceService()
           
 
Method Summary
 Resource getResource(String resourceId)
          Gets the resource for the given resource id
 Resource getResource(String protocolId, String endpointId, String objectId)
          Gets a resource for the given protocol, endpoint and object id
 ResourceContent getResourceContent(String resourceId)
          Retrieves the content payload for the described resource
 ResourceContent getResourceContent(String protocolId, String endpointId, String objectId)
          Retrieves the content payload for the described resource
 String[] getResourceDescriptorIds(String resourceId)
          Returns an array of the constituent parts of a resource id - the protocol id, the endpoint id and the object id.
 ResourceLoader getResourceLoader(String protocolId, String endpointId)
          Returns an appropriate resource loader for the given protocol and endpoint
 ResourceLoaderFactory getResourceLoaderFactory(String protocolId)
          Returns a resource loader factory for the given protocol
 ResourceContent getResourceMetadata(String resourceId)
          Retrieves the metadata payload for the described resource
 ResourceContent getResourceMetadata(String protocolId, String endpointId, String objectId)
           
 WebFrameworkServiceRegistry getServiceRegistry()
          Gets the service registry.
 WebFrameworkConfigElement getWebFrameworkConfiguration()
          Gets the web framework configuration.
 void onApplicationEvent(org.springframework.context.ApplicationEvent event)
           
protected  void onBootstrap()
          Initialization of Resource Service
 void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
           
 void setServiceRegistry(WebFrameworkServiceRegistry webFrameworkServiceRegistry)
          Sets the service registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceService

public ResourceService()
Method Detail

setApplicationContext

public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
                           throws org.springframework.beans.BeansException
Specified by:
setApplicationContext in interface org.springframework.context.ApplicationContextAware
Throws:
org.springframework.beans.BeansException

setServiceRegistry

public void setServiceRegistry(WebFrameworkServiceRegistry webFrameworkServiceRegistry)
Sets the service registry.

Parameters:
webFrameworkServiceRegistry - the new service registry

getServiceRegistry

public WebFrameworkServiceRegistry getServiceRegistry()
Gets the service registry.

Returns:
the service registry

getWebFrameworkConfiguration

public WebFrameworkConfigElement getWebFrameworkConfiguration()
Gets the web framework configuration.

Returns:
the web framework configuration

onApplicationEvent

public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener

onBootstrap

protected void onBootstrap()
Initialization of Resource Service


getResource

public Resource getResource(String resourceId)
                     throws ResourceLoaderException
Gets the resource for the given resource id

Parameters:
resourceId - the resource id
Returns:
the resource
Throws:
ResourceLoaderException - the resource loader exception

getResource

public Resource getResource(String protocolId,
                            String endpointId,
                            String objectId)
                     throws ResourceLoaderException
Gets a resource for the given protocol, endpoint and object id

Parameters:
protocolId -
endpointId -
objectId -
Returns:
the resource
Throws:
ResourceLoaderException

getResourceLoader

public ResourceLoader getResourceLoader(String protocolId,
                                        String endpointId)
Returns an appropriate resource loader for the given protocol and endpoint

Parameters:
protocolId -
endpointId -
Returns:

getResourceLoaderFactory

public ResourceLoaderFactory getResourceLoaderFactory(String protocolId)
Returns a resource loader factory for the given protocol

Parameters:
protocolId -
Returns:
resource loader factory

getResourceContent

public ResourceContent getResourceContent(String resourceId)
                                   throws IOException,
                                          ResourceLoaderException
Retrieves the content payload for the described resource

Parameters:
resourceId -
Returns:
Throws:
ResourceLoaderException
ContentLoaderException
IOException

getResourceContent

public ResourceContent getResourceContent(String protocolId,
                                          String endpointId,
                                          String objectId)
                                   throws IOException,
                                          ResourceLoaderException
Retrieves the content payload for the described resource

Parameters:
protocolId -
objectId -
endpointId -
Returns:
Throws:
ResourceLoaderException
ContentLoaderException
IOException

getResourceMetadata

public ResourceContent getResourceMetadata(String resourceId)
                                    throws IOException,
                                           ResourceLoaderException
Retrieves the metadata payload for the described resource

Parameters:
resourceId -
Returns:
Throws:
ResourceLoaderException
ContentLoaderException
IOException

getResourceMetadata

public ResourceContent getResourceMetadata(String protocolId,
                                           String endpointId,
                                           String objectId)
                                    throws IOException,
                                           ResourceLoaderException
Throws:
IOException
ResourceLoaderException

getResourceDescriptorIds

public String[] getResourceDescriptorIds(String resourceId)
Returns an array of the constituent parts of a resource id - the protocol id, the endpoint id and the object id.

Parameters:
resourceId - the resource id
Returns:
the resource ids


Copyright © 2009 SpringSource, Inc. All Rights Reserved.