org.apache.jetspeed.capabilities.impl
Class JetspeedCapabilities

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
          extended by org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
              extended by org.apache.jetspeed.capabilities.impl.JetspeedCapabilities
All Implemented Interfaces:
Capabilities, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean

public class JetspeedCapabilities
extends InitablePersistenceBrokerDaoSupport
implements Capabilities, org.springframework.beans.factory.BeanFactoryAware

Jetspeed Capabilities

Version:
$Id: JetspeedCapabilities.java 517124 2007-03-12 08:10:25Z ate $
Author:
David Sean Taylor, Roger Ruttimann

Field Summary
static java.lang.String AGENT_XML
           
static java.lang.String DEFAULT_AGENT
           
 
Fields inherited from class org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
repositoryPath
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
JetspeedCapabilities(java.lang.String repositoryPath, java.util.Properties properties)
          Deprecated. As of release 2.1, property-based class references replaced by container managed bean factory
JetspeedCapabilities(java.lang.String repositoryPath, java.lang.String clientBeanName, java.lang.String mediaTypeBeanName, java.lang.String mimeTypeBeanName, java.lang.String capabilityBeanName)
           
 
Method Summary
 Capability createCapability(java.lang.String capabilityName)
          Create a new capability in the system or return the existing one if already exists
 Client createClient(java.lang.String clientName)
          Create a new client in the system or return the existing one if already exists
 MediaType createMediaType(java.lang.String mediaTypeName)
          Create a new mediaType in the system or return the existing one if already exists
 MimeType createMimeType(java.lang.String mimeType)
          Create a new mimetype in the system or return the existing one if already exists
 void deleteCapability(Capability capability)
          delete existing capability from backend storage
 void deleteCapabilityMapCache()
          Clears CapabilityMap cache TODO: Roger, why is this on the public interface.
 void deleteClient(Client client)
          delete existing client from backend storage
 void deleteMediaType(MediaType mediaType)
          delete existing media type from backend storage
 void deleteMimeType(MimeType mimeType)
          delete existing mime type from backend storage
 Client findClient(java.lang.String userAgent)
          Returns the client which matches the given useragent string.
 java.util.Iterator getCapabilities()
          Obtain an iterator of all existing capabilities.
 Capability getCapability(java.lang.String capability)
          Given a capability string, look up the corresponding capability object.
 java.lang.String getCapabilityBeanName()
          Obtain the name of the CapabilityBean reference
 CapabilityMap getCapabilityMap(java.lang.String userAgent)
          Creates a Capability Map with Capabilities, Mimetypes and mediaTypes for the given UserAgentPattern
 Client getClient(java.lang.String clientName)
          Given a client name, look up the corresponding client object.
 java.lang.String getClientBeanName()
          Obtain the name of the ClientBean reference
 java.util.Iterator getClients()
          Obtain an iterator of all existing clients.
 MediaType getMediaType(java.lang.String mediaType)
          Given a media type string, look up the corresponding media type object.
 java.lang.String getMediaTypeBeanName()
          Obtain the name of the Media Type reference
 MediaType getMediaTypeForMimeType(java.lang.String mimeTypeName)
          getMediaTypeForMimeType
 java.util.Iterator getMediaTypes()
          Obtain an iterator of all existing media types.
 java.util.Collection getMediaTypesForMimeTypes(java.util.Iterator mimetypes)
          Returns a collection of MediaTypes that matches the MimeTypes defined in the mimetype parameter
 MimeType getMimeType(java.lang.String mimeType)
          Given a mime type string, look up the corresponding mime type object.
 java.lang.String getMimeTypeBeanName()
          Obtain the name of the Mime Type reference
 java.util.Iterator getMimeTypes()
          Obtain an iterator of all existing mime types.
 void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
           
 void setCapabilityBeanName(java.lang.String capabilityBeanName)
          Set the name of the CapabilityBean reference - used exclusively in IoC
 void setClientBeanName(java.lang.String clientBeanName)
          Set the name of the ClientBean reference - used exclusively in IoC
 void setMediaTypeBeanName(java.lang.String mediaTypeBeanName)
          Set the name of the MediaType bean reference - used exclusively in IoC
 void setMimeTypeBeanName(java.lang.String mimeTypeBeanName)
          Set the name of the MimeType bean reference - used exclusively in IoC
 void storeCapability(Capability capability)
          Save capability to backend storage
 void storeClient(Client client)
          Save client to backend storage
 void storeMediaType(MediaType mediaType)
          Save media type to backend storage
 void storeMimeType(MimeType mimeType)
          Save mime type to backend storage
 
Methods inherited from class org.apache.jetspeed.components.dao.InitablePersistenceBrokerDaoSupport
init
 
Methods inherited from class org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
checkDaoConfig, closePersistenceBrokerIfNecessary, convertOjbAccessException, createPersistenceBrokerTemplate, getJcdAlias, getPersistenceBroker, getPersistenceBrokerTemplate, releasePersistenceBroker, setJcdAlias, setPersistenceBrokerTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_AGENT

public static final java.lang.String DEFAULT_AGENT
See Also:
Constant Field Values

AGENT_XML

public static final java.lang.String AGENT_XML
See Also:
Constant Field Values
Constructor Detail

JetspeedCapabilities

public JetspeedCapabilities(java.lang.String repositoryPath,
                            java.lang.String clientBeanName,
                            java.lang.String mediaTypeBeanName,
                            java.lang.String mimeTypeBeanName,
                            java.lang.String capabilityBeanName)

JetspeedCapabilities

public JetspeedCapabilities(java.lang.String repositoryPath,
                            java.util.Properties properties)
Deprecated. As of release 2.1, property-based class references replaced by container managed bean factory

Create a JetspeedProfiler with properties. Expected properties are: defaultRule = the default profiling rule anonymousUser = the name of the anonymous user persistenceStoreName = The name of the persistence persistenceStore component to connect to services.profiler.locator.impl = the pluggable Profile Locator impl services.profiler.principalRule.impl = the pluggable Principal Rule impl services.profiler.profilingRule.impl = the pluggable Profiling Rule impl

Parameters:
persistenceStore - The persistence persistenceStore
properties - Properties for this component described above
Method Detail

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
                    throws org.springframework.beans.BeansException
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Throws:
org.springframework.beans.BeansException

getCapabilityMap

public CapabilityMap getCapabilityMap(java.lang.String userAgent)
                               throws UnableToBuildCapabilityMapException
Description copied from interface: Capabilities
Creates a Capability Map with Capabilities, Mimetypes and mediaTypes for the given UserAgentPattern

Specified by:
getCapabilityMap in interface Capabilities
Parameters:
userAgent - Agent from the request
Returns:
CapabilityMap populated with Capabilities, Mimetypes and Mediatype that match the userAgent. Never returns null
Throws:
UnableToBuildCapabilityMapException
See Also:
org.apache.jetspeed.services.capability.CapabilityService#getCapabilityMap(java.lang.String)

findClient

public Client findClient(java.lang.String userAgent)
Returns the client which matches the given useragent string.

Specified by:
findClient in interface Capabilities
Parameters:
useragent - the useragent to match
Returns:
the found client or null if the user-agent does not match any defined client
See Also:
org.apache.jetspeed.capabilities.CapabilityService#findClient(java.lang.String)

getClients

public java.util.Iterator getClients()
Description copied from interface: Capabilities
Obtain an iterator of all existing clients.

Specified by:
getClients in interface Capabilities
Returns:
Returns an iterator for all existing Clients

getMediaTypesForMimeTypes

public java.util.Collection getMediaTypesForMimeTypes(java.util.Iterator mimetypes)
Description copied from interface: Capabilities
Returns a collection of MediaTypes that matches the MimeTypes defined in the mimetype parameter

Specified by:
getMediaTypesForMimeTypes in interface Capabilities
Returns:
Collection of Mediatypes that matches the mimetypes

deleteCapabilityMapCache

public void deleteCapabilityMapCache()
Description copied from interface: Capabilities
Clears CapabilityMap cache TODO: Roger, why is this on the public interface. It seems to be impl specific

Specified by:
deleteCapabilityMapCache in interface Capabilities

getMediaType

public MediaType getMediaType(java.lang.String mediaType)
Description copied from interface: Capabilities
Given a media type string, look up the corresponding media type object.

Specified by:
getMediaType in interface Capabilities
Parameters:
mediaType - The string representation of a media type.
Returns:
The found media type object or if not found, null.

getMediaTypeForMimeType

public MediaType getMediaTypeForMimeType(java.lang.String mimeTypeName)
getMediaTypeForMimeType

Specified by:
getMediaTypeForMimeType in interface Capabilities
Parameters:
mimeType - to use for lookup
Returns:
MediaTypeEntry that matches the lookup in the MEDIATYPE_TO_MIMETYPE table

getCapabilities

public java.util.Iterator getCapabilities()
Obtain an iterator of all existing capabilities.

Specified by:
getCapabilities in interface Capabilities
Returns:
Returns an iterator for all existing Capabilities of type Capability

getMimeTypes

public java.util.Iterator getMimeTypes()
Obtain an iterator of all existing mime types.

Specified by:
getMimeTypes in interface Capabilities
Returns:
Returns an iterator for all existing Mime Types of type MimeType

getMediaTypes

public java.util.Iterator getMediaTypes()
Obtain an iterator of all existing media types.

Specified by:
getMediaTypes in interface Capabilities
Returns:
Returns an iterator for all existing media types of type MediaType

getMimeTypeBeanName

public java.lang.String getMimeTypeBeanName()
Description copied from interface: Capabilities
Obtain the name of the Mime Type reference

Specified by:
getMimeTypeBeanName in interface Capabilities
Returns:
ref-id of the mime type bean

setMimeTypeBeanName

public void setMimeTypeBeanName(java.lang.String mimeTypeBeanName)
Description copied from interface: Capabilities
Set the name of the MimeType bean reference - used exclusively in IoC

Specified by:
setMimeTypeBeanName in interface Capabilities
Parameters:
mimeTypeBeanName - The ref-id of the mimeType bean.

getClientBeanName

public java.lang.String getClientBeanName()
Description copied from interface: Capabilities
Obtain the name of the ClientBean reference

Specified by:
getClientBeanName in interface Capabilities
Returns:
ref-id of the client bean

setClientBeanName

public void setClientBeanName(java.lang.String clientBeanName)
Description copied from interface: Capabilities
Set the name of the ClientBean reference - used exclusively in IoC

Specified by:
setClientBeanName in interface Capabilities
Parameters:
clientBeanName - The ref-id of the client bean.

getMediaTypeBeanName

public java.lang.String getMediaTypeBeanName()
Description copied from interface: Capabilities
Obtain the name of the Media Type reference

Specified by:
getMediaTypeBeanName in interface Capabilities
Returns:
ref-id of the media type bean

setMediaTypeBeanName

public void setMediaTypeBeanName(java.lang.String mediaTypeBeanName)
Description copied from interface: Capabilities
Set the name of the MediaType bean reference - used exclusively in IoC

Specified by:
setMediaTypeBeanName in interface Capabilities
Parameters:
mediaTypeBeanName - The ref-id of the mediaType bean.

getCapabilityBeanName

public java.lang.String getCapabilityBeanName()
Description copied from interface: Capabilities
Obtain the name of the CapabilityBean reference

Specified by:
getCapabilityBeanName in interface Capabilities
Returns:
ref-id of the capability bean

setCapabilityBeanName

public void setCapabilityBeanName(java.lang.String capabilityBeanName)
Description copied from interface: Capabilities
Set the name of the CapabilityBean reference - used exclusively in IoC

Specified by:
setCapabilityBeanName in interface Capabilities
Parameters:
capabilityBeanName - The ref-id of the capability bean.

createMimeType

public MimeType createMimeType(java.lang.String mimeType)
                        throws java.lang.ClassNotFoundException
Description copied from interface: Capabilities
Create a new mimetype in the system or return the existing one if already exists

Specified by:
createMimeType in interface Capabilities
Parameters:
mimeType - The string describing the mimeType
Returns:
A new (or existing) MimeType
Throws:
java.lang.ClassNotFoundException

createCapability

public Capability createCapability(java.lang.String capabilityName)
                            throws java.lang.ClassNotFoundException
Description copied from interface: Capabilities
Create a new capability in the system or return the existing one if already exists

Specified by:
createCapability in interface Capabilities
Parameters:
capabilityName - The string describing the capability
Returns:
A new (or existing) capability
Throws:
java.lang.ClassNotFoundException

createMediaType

public MediaType createMediaType(java.lang.String mediaTypeName)
                          throws java.lang.ClassNotFoundException
Description copied from interface: Capabilities
Create a new mediaType in the system or return the existing one if already exists

Specified by:
createMediaType in interface Capabilities
Parameters:
mediaTypeName - The string describing the mediaType
Returns:
A new (or existing) MediaType
Throws:
java.lang.ClassNotFoundException

createClient

public Client createClient(java.lang.String clientName)
                    throws java.lang.ClassNotFoundException
Description copied from interface: Capabilities
Create a new client in the system or return the existing one if already exists

Specified by:
createClient in interface Capabilities
Parameters:
clientName - The string describing the client
Returns:
A new (or existing) client
Throws:
java.lang.ClassNotFoundException

getMimeType

public MimeType getMimeType(java.lang.String mimeType)
Description copied from interface: Capabilities
Given a mime type string, look up the corresponding mime type object.

Specified by:
getMimeType in interface Capabilities
Parameters:
mimeType - The string representation of a mime type.
Returns:
The found mime type object or if not found, null.

getClient

public Client getClient(java.lang.String clientName)
Description copied from interface: Capabilities
Given a client name, look up the corresponding client object.

Specified by:
getClient in interface Capabilities
Parameters:
clientName - The name of the client.
Returns:
The found client object or if not found, null.

getCapability

public Capability getCapability(java.lang.String capability)
Description copied from interface: Capabilities
Given a capability string, look up the corresponding capability object.

Specified by:
getCapability in interface Capabilities
Parameters:
capability - The string representation of a capability.
Returns:
The found capability object or if not found, null.

storeMediaType

public void storeMediaType(MediaType mediaType)
                    throws CapabilitiesException
Description copied from interface: Capabilities
Save media type to backend storage

Specified by:
storeMediaType in interface Capabilities
Parameters:
mediaType - valid mediatype object
Throws:
CapabilitiesException

deleteMediaType

public void deleteMediaType(MediaType mediaType)
                     throws CapabilitiesException
Description copied from interface: Capabilities
delete existing media type from backend storage

Specified by:
deleteMediaType in interface Capabilities
Parameters:
mediaType - valid mediatype object
Throws:
CapabilitiesException

storeCapability

public void storeCapability(Capability capability)
                     throws CapabilitiesException
Description copied from interface: Capabilities
Save capability to backend storage

Specified by:
storeCapability in interface Capabilities
Parameters:
capability - valid capability object
Throws:
CapabilitiesException

deleteCapability

public void deleteCapability(Capability capability)
                      throws CapabilitiesException
Description copied from interface: Capabilities
delete existing capability from backend storage

Specified by:
deleteCapability in interface Capabilities
Parameters:
capability - valid capability object
Throws:
CapabilitiesException

storeMimeType

public void storeMimeType(MimeType mimeType)
                   throws CapabilitiesException
Description copied from interface: Capabilities
Save mime type to backend storage

Specified by:
storeMimeType in interface Capabilities
Parameters:
mimeType - valid mimetype object
Throws:
CapabilitiesException

deleteMimeType

public void deleteMimeType(MimeType mimeType)
                    throws CapabilitiesException
Description copied from interface: Capabilities
delete existing mime type from backend storage

Specified by:
deleteMimeType in interface Capabilities
Parameters:
mimeType - valid mimetype object
Throws:
CapabilitiesException

storeClient

public void storeClient(Client client)
                 throws CapabilitiesException
Description copied from interface: Capabilities
Save client to backend storage

Specified by:
storeClient in interface Capabilities
Parameters:
client - valid Client object
Throws:
CapabilitiesException

deleteClient

public void deleteClient(Client client)
                  throws CapabilitiesException
Description copied from interface: Capabilities
delete existing client from backend storage

Specified by:
deleteClient in interface Capabilities
Parameters:
client - valid client object
Throws:
CapabilitiesException


Copyright © 1999-2009 Apache Software Foundation. All Rights Reserved.