com.ibm.portal.resolver.helper
Class EarlyBindingDataSource

java.lang.Object
  extended by com.ibm.portal.resolver.helper.DefaultDataSource
      extended by com.ibm.portal.resolver.helper.EarlyBindingDataSource
All Implemented Interfaces:
Disposable, Addressable, CacheControlDataSource, DataSource, DataSourceFragment, ProjectContextDataSource, UserContextDataSource, VaryDataSource, VirtualPortalContextDataSource, TimeStamped
Direct Known Subclasses:
AbstractStaticDataSource

public class EarlyBindingDataSource
extends DefaultDataSource
implements UserContextDataSource, CacheControlDataSource, VaryDataSource, ProjectContextDataSource, VirtualPortalContextDataSource

Implementation of a DataSource designed to be used in conjunction with the PocURLFactory.newURL(DataSource) method. Per default - after initialization or after calling clear() - the data source assumes that it is privately cacheable and that the content depends on all relevant vary headers.

This DataSource can also be used to return a header-only data source for the lookup usecase of the DataSourceFactoryEx.newSource(URI, String, Map, Context). If Constants.VALUE_LOOKUP is passed as a parameter, the caller is only interested in the meta information (headers) for the data source, not the actual data. The EarlyBindingDataSource can be used to represent these metadata in an efficient way.

Since:
7.0
Note:
This interface is designed to be implemented by clients.

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ibm.portal.resolver.data.CacheControlDataSource
CacheControlDataSource.CACHE_POLICY, CacheControlDataSource.CACHE_SCOPE
 
Field Summary
 
Fields inherited from interface com.ibm.portal.resolver.data.UserContextDataSource
USER_CONTEXT_UNKNOWN
 
Fields inherited from interface com.ibm.portal.resolver.data.CacheControlDataSource
CACHE_CONTROL_EXTENSIONS_UNDEFINED
 
Fields inherited from interface com.ibm.portal.resolver.data.VaryDataSource
NO_VARY_HEADERS, VARY_HEADERS_UNKNOWN
 
Fields inherited from interface com.ibm.portal.resolver.data.ProjectContextDataSource
PROJECT_CONTEXT_UNKNOWN
 
Fields inherited from interface com.ibm.portal.resolver.data.VirtualPortalContextDataSource
VIRTUAL_PORTAL_CONTEXT_UNKNOWN
 
Fields inherited from interface com.ibm.portal.resolver.data.DataSource
CONTENT_TYPE_UNKNOWN, CREATION_UNKNOWN, EXPIRATION_UNKNOWN, LAST_MODIFICATION_UNKNOWN, MAX_AGE_INFINITE, MAX_AGE_NONE, ROOT_DATE
 
Fields inherited from interface com.ibm.portal.resolver.data.Addressable
EMPTY_PARAMETERS
 
Constructor Summary
EarlyBindingDataSource()
          Initializes the object
 
Method Summary
 void clear()
          Reset the object
 void dispose()
          Indicate that the object will no longer be accessed
 java.util.Map<java.lang.String,java.lang.String> getCacheControlExtensions()
          Returns a map of cache control extensions that get added to the cache control header, as defined in ://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.6
 CacheControlDataSource.CACHE_POLICY getCachePolicy()
          Returns the caching policy for the data
 CacheControlDataSource.CACHE_SCOPE getCacheScope()
          Returns the cache scope for the data
 java.util.Map<java.lang.String,java.lang.String[]> getParameters()
           Returns an potentially unmodifiable version of the parameters used to address the object, never null, but potentially the empty map.
 java.lang.String[] getVaryHeaders()
          Returns a list of HTTP request headers that the content of the data source depends on.
 java.lang.Boolean isPrivate()
          Indicates if the data source depends on the user context (if any).
 java.lang.Boolean isProjectDependent()
          Indicates if the data source depends on the project context (if any).
 java.lang.Boolean isVirtualPortalDependent()
          Indicates if the data source depends on the virtual portal context (if any).
 void setCacheControlExtensions(java.util.Map<java.lang.String,java.lang.String> cacheControlExtensions)
          Assigns a new map of cache control extensions.
 void setCachePolicy(CacheControlDataSource.CACHE_POLICY cachePolicy)
          Assigns a new cache policy
 void setCacheScope(CacheControlDataSource.CACHE_SCOPE aScope)
          Overrides the cache scope
 void setCreated(java.util.Date created)
           
 void setExpires(java.util.Date expires)
           
protected  void setLastMod(java.util.Date lastMod)
          Deprecated. use setLastModified(Date) instead
 void setLastModified(java.util.Date lastMod)
          Sets the last modified timestamp
protected  void setParameters(java.util.Map<java.lang.String,java.lang.String[]> aParams)
           
 void setPrivate(java.lang.Boolean aFlag)
          Sets if this DataSource represents private data
 void setProjectDependent(java.lang.Boolean aFlag)
          Sets if this DataSource depends on a project
 void setUri(java.net.URI uri)
          Deprecated. 
 void setURI(java.net.URI uri)
           
 void setVaryHeaders(java.lang.String[] aHeaders)
          Assigns the vary headers that the data source depends on.
 void setVirtualPortalDependent(java.lang.Boolean aFlag)
          Sets if this DataSource depends on the virtual portal
 
Methods inherited from class com.ibm.portal.resolver.helper.DefaultDataSource
createParameters, getCachePolicy, getCachePolicy, getCachePolicy, getCachePolicy, getCachePolicy, getCacheScope, getCacheScope, getCacheScope, getCacheScope, getCacheScope, getContentType, getContentType, getContentType, getContentType, getContentType, getCreated, getExpiration, getExpiration, getExpiration, getExpiration, getExpiration, getExpiration, getExpiration, getExpiration, getExpiration, getExpiration, getExpiration, getExpiration, getExpiration, getLastModified, getParameter, getParameter, getParameter, getParameter, getParameter, getParameter, getParameters, getParameters, getProjectContext, getProjectContext, getProjectContext, getProjectContext, getURI, getUserContext, getUserContext, getUserContext, getUserContext, getVaryHeaders, getVaryHeaders, getVaryHeaders, getVirtualPortalContext, getVirtualPortalContext, getVirtualPortalContext, getVirtualPortalContext, setAddressable, setCachePolicy, setCachePolicy, setCachePolicy, setCachePolicy, setCacheScope, setCacheScope, setCacheScope, setCacheScope, setContentType, setContentType, setContentType, setDataSource, setExpiration, setExpiration, setExpiration, setExpiration, setExpiration, setExpiration, setExpiration, setExpiration, setProjectContext, setProjectContext, setProjectContext, setProjectContext, setProjectContext, setProjectContext, setUserContext, setUserContext, setUserContext, setUserContext, setUserContext, setUserContext, setVaryHeaders, setVaryHeaders, setVaryHeaders, setVaryHeaders, setVirtualPortalContext, setVirtualPortalContext, setVirtualPortalContext, setVirtualPortalContext, setVirtualPortalContext, setVirtualPortalContext, valueOf, valueOf, valueOf, valueOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.portal.resolver.data.CacheControlDataSource
getExpiration
 
Methods inherited from interface com.ibm.portal.resolver.data.DataSource
getContentType, getCreated, getLastModified
 
Methods inherited from interface com.ibm.portal.resolver.data.Addressable
getURI
 

Constructor Detail

EarlyBindingDataSource

public EarlyBindingDataSource()
Initializes the object

Method Detail

clear

public void clear()
Reset the object

Overrides:
clear in class DefaultDataSource

dispose

public void dispose()
Description copied from interface: Disposable
Indicate that the object will no longer be accessed

Specified by:
dispose in interface Disposable
Overrides:
dispose in class DefaultDataSource

getCacheControlExtensions

public java.util.Map<java.lang.String,java.lang.String> getCacheControlExtensions()
Description copied from class: DefaultDataSource
Returns a map of cache control extensions that get added to the cache control header, as defined in ://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.6

Specified by:
getCacheControlExtensions in interface CacheControlDataSource
Overrides:
getCacheControlExtensions in class DefaultDataSource
Returns:
the extensions or null

getCachePolicy

public CacheControlDataSource.CACHE_POLICY getCachePolicy()
Description copied from class: DefaultDataSource
Returns the caching policy for the data

Specified by:
getCachePolicy in interface CacheControlDataSource
Overrides:
getCachePolicy in class DefaultDataSource
Returns:
cache policy or null

getCacheScope

public CacheControlDataSource.CACHE_SCOPE getCacheScope()
Description copied from class: DefaultDataSource
Returns the cache scope for the data

Specified by:
getCacheScope in interface CacheControlDataSource
Overrides:
getCacheScope in class DefaultDataSource
Returns:
cache scope or null

getParameters

public java.util.Map<java.lang.String,java.lang.String[]> getParameters()
Description copied from interface: Addressable

Returns an potentially unmodifiable version of the parameters used to address the object, never null, but potentially the empty map.

The key is of type String, the values of type String[]

Specified by:
getParameters in interface Addressable
Overrides:
getParameters in class DefaultDataSource
Returns:
parameter map

getVaryHeaders

public java.lang.String[] getVaryHeaders()
Description copied from class: DefaultDataSource
Returns a list of HTTP request headers that the content of the data source depends on. An empty list indicates that the result is independent on the request headers. A null return value indicates that the data source does not know its vary headers and relies on the framework to assign any.

Specified by:
getVaryHeaders in interface VaryDataSource
Overrides:
getVaryHeaders in class DefaultDataSource
Returns:
the list of headers or null

isPrivate

public java.lang.Boolean isPrivate()
Description copied from class: DefaultDataSource
Indicates if the data source depends on the user context (if any).

Specified by:
isPrivate in interface UserContextDataSource
Overrides:
isPrivate in class DefaultDataSource
Returns:
Boolean.TRUE if the data source depends on the user context, Boolean.FALSE if the data source does not depend on the user context of #USER_CONTEXT_UNKNOWN to leave the decision to the framework.

isProjectDependent

public java.lang.Boolean isProjectDependent()
Description copied from interface: ProjectContextDataSource
Indicates if the data source depends on the project context (if any).

Specified by:
isProjectDependent in interface ProjectContextDataSource
Overrides:
isProjectDependent in class DefaultDataSource
Returns:
Boolean.TRUE if the data source depends on the project context, Boolean.FALSE if the data source does not depend on the project context of ProjectContextDataSource.PROJECT_CONTEXT_UNKNOWN to leave the decision to the framework.
See Also:
ProjectContextDataSource.isProjectDependent()

isVirtualPortalDependent

public java.lang.Boolean isVirtualPortalDependent()
Description copied from interface: VirtualPortalContextDataSource
Indicates if the data source depends on the virtual portal context (if any).

Specified by:
isVirtualPortalDependent in interface VirtualPortalContextDataSource
Overrides:
isVirtualPortalDependent in class DefaultDataSource
Returns:
Boolean.TRUE if the data source depends on the virtual portal context, Boolean.FALSE if the data source does not depend on the virtual portal context of VirtualPortalContextDataSource.VIRTUAL_PORTAL_CONTEXT_UNKNOWN to leave the decision to the framework.
See Also:
VirtualPortalContextDataSource.isVirtualPortalDependent()

setCacheControlExtensions

public void setCacheControlExtensions(java.util.Map<java.lang.String,java.lang.String> cacheControlExtensions)
Assigns a new map of cache control extensions. The map will be referenced, not copied

Parameters:
cacheControlExtensions - The cacheControlExtensions to set.

setCachePolicy

public void setCachePolicy(CacheControlDataSource.CACHE_POLICY cachePolicy)
Assigns a new cache policy

Parameters:
cachePolicy - The cachePolicy to set.

setCacheScope

public void setCacheScope(CacheControlDataSource.CACHE_SCOPE aScope)
Overrides the cache scope

Parameters:
aScope - the new scope

setCreated

public void setCreated(java.util.Date created)
Overrides:
setCreated in class DefaultDataSource
Parameters:
created - the created to set

setExpires

public void setExpires(java.util.Date expires)
Overrides:
setExpires in class DefaultDataSource
Parameters:
expires - the expires to set

setLastMod

@Deprecated
protected void setLastMod(java.util.Date lastMod)
Deprecated. use setLastModified(Date) instead

Overrides:
setLastMod in class DefaultDataSource
Parameters:
lastMod - the lastMod to set

setLastModified

public void setLastModified(java.util.Date lastMod)
Sets the last modified timestamp

Parameters:
lastMod - the new time
Since:
8.0

setParameters

protected void setParameters(java.util.Map<java.lang.String,java.lang.String[]> aParams)
Overrides:
setParameters in class DefaultDataSource
Parameters:
aParams - the parameters to set

setPrivate

public void setPrivate(java.lang.Boolean aFlag)
Sets if this DataSource represents private data

Parameters:
aFlag - true if the data source is private, else false

setProjectDependent

public void setProjectDependent(java.lang.Boolean aFlag)
Sets if this DataSource depends on a project

Parameters:
aFlag - true if the data source depends on a project, else false
Since:
8.0

setUri

@Deprecated
public void setUri(java.net.URI uri)
Deprecated. 

Overrides:
setUri in class DefaultDataSource
Parameters:
uri - the uri to set

setURI

public void setURI(java.net.URI uri)
Overrides:
setURI in class DefaultDataSource
Parameters:
uri - the uri to set

setVaryHeaders

public void setVaryHeaders(java.lang.String[] aHeaders)
Assigns the vary headers that the data source depends on.

Parameters:
aHeaders - the headers

setVirtualPortalDependent

public void setVirtualPortalDependent(java.lang.Boolean aFlag)
Sets if this DataSource depends on the virtual portal

Parameters:
aFlag - true if the data source depends on the virtual portal, else false
Since:
8.0