com.sapportals.wcm.repository
Interface IResourceFactory


public interface IResourceFactory

The resource factory has methods to create resource objects (IResource) and to access the manager and service factories.

Version:
$Id: //javabas/com.sapportals.wcm/dev/src/java/repository/framework/api/com/sapportals/wcm/repository/ResourceFactory.java#24 $
See Also:
IManagerFactory,

Copyright (c) SAP Portals Europe GmbH 2001


Method Summary
 boolean checkExistence(com.sapportals.wcm.util.uri.RID rid, IResourceContext context)
          Returns true if a resource exists for the given resource identifier.
 com.sapportals.wcm.repository.filter.IFilterFactory getFilterFactory()
          Returns a instance of the FilterFactory
 com.sapportals.wcm.repository.manager.IManagerFactory getManagerFactory()
          Returns a instance of the ManagerFactory
 java.lang.Object getObject(com.sapportals.wcm.util.uri.RID rid, IResourceContext context, java.lang.Class asClass)
          Returns a resource object converted into a semantic object for the given resource identifier and context.
 IResource getResource(com.sapportals.wcm.util.uri.RID rid, boolean resolveInternalLinks, IResourceContext context)
          Returns a resource object instance for the given RID and context.
 IResource getResource(com.sapportals.wcm.util.uri.RID rid, IResourceContext context)
          Returns a resource object instance for the given resource identifier and context.
 IResource getResource(com.sapportals.wcm.util.uri.RID rid, IResourceContext context, boolean createCollections)
          Returns a resource object instance for the given RID and context.
 IResourceList getResources(com.sapportals.wcm.util.uri.IRidList ridList, java.util.Map propertyMaps, com.sapportals.wcm.repository.ResourceErrors errors, IResourceContext context)
          Returns a list of resource instances for a list of resource identifiers and possible {@IPropertyMap}s for the resources.
 IResourceList getResources(com.sapportals.wcm.util.uri.IRidList ridList, java.util.Map propertyMaps, com.sapportals.wcm.repository.ResourceErrors errors, java.lang.String[] permissionNames, IResourceContext context)
          Returns a list of resource instances for a list of resource identifiers and possible {@IPropertyMap}s for the resources.
 IResourceList getResources(com.sapportals.wcm.util.uri.IRidList ridList, com.sapportals.wcm.repository.ResourceErrors errors, IResourceContext context)
          Returns a list of resource instances for an array of resource identifiers.
 IResourceList getResources(com.sapportals.wcm.util.uri.IRidList ridList, com.sapportals.wcm.repository.ResourceErrors errors, java.lang.String[] permissionNames, IResourceContext context)
          Returns a list of resource instances for an array of resource identifiers and removes resources without the specified permission(s) from the result list.
 IResourceContext getServiceContext()
          Returns a new resource context for services with an anonymous user
 IResourceContext getServiceContext(java.lang.String userID)
          Returns a new resource context for services with an anonymous user
 IRepositoryServiceFactory getServiceFactory()
          Returns a instance of the ServiceFactory
 

Method Detail

checkExistence

public boolean checkExistence(com.sapportals.wcm.util.uri.RID rid,
                              IResourceContext context)
                       throws com.sapportals.wcm.repository.ResourceException,
                              com.sapportals.wcm.repository.AuthorizationRequiredException
Returns true if a resource exists for the given resource identifier.
Parameters:
rid - The RID to check
context - The resource context
Returns:
True if the resource exists
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation
com.sapportals.wcm.repository.AuthorizationRequiredException - Exception raised in failure situation

getFilterFactory

public com.sapportals.wcm.repository.filter.IFilterFactory getFilterFactory()
                                                                     throws com.sapportals.wcm.repository.ResourceException
Returns a instance of the FilterFactory
Returns:
The service factory
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation

getManagerFactory

public com.sapportals.wcm.repository.manager.IManagerFactory getManagerFactory()
                                                                        throws com.sapportals.wcm.repository.ResourceException
Returns a instance of the ManagerFactory
Returns:
The service factory
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation

getObject

public java.lang.Object getObject(com.sapportals.wcm.util.uri.RID rid,
                                  IResourceContext context,
                                  java.lang.Class asClass)
                           throws com.sapportals.wcm.repository.ResourceException
Returns a resource object converted into a semantic object for the given resource identifier and context.
Parameters:
rid - TBD: Description of the incoming method parameter
context - TBD: Description of the incoming method parameter
asClass - TBD: Description of the incoming method parameter
Returns:
object
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation

getResource

public IResource getResource(com.sapportals.wcm.util.uri.RID rid,
                             boolean resolveInternalLinks,
                             IResourceContext context)
                      throws com.sapportals.wcm.repository.ResourceException
Returns a resource object instance for the given RID and context.
Parameters:
rid - The RID of the resource
resolveInternalLinks - true : If the RID contains internal links to collections the framework will find and return the target resource. In this case the RID of the returned resource will not be equal to the specified RID parameter. false : If the RID contains internal links to collections a InternalLinkException exception is thrown.
context - The resource context object
Returns:
The resource object instance
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation
See Also:
IResource.getRID(), IResource.getAccessRID()

getResource

public IResource getResource(com.sapportals.wcm.util.uri.RID rid,
                             IResourceContext context)
                      throws com.sapportals.wcm.repository.ResourceException
Returns a resource object instance for the given resource identifier and context. This method is a shortcut for getResource(rid, true, context) . Returns null if the resource does not exist.
Parameters:
rid - The resource identifier of the resource.
context - The resource context.
Returns:
resource The resource instance. null is returned only if the resource definitively does not exist. If it can not be created by the repositoy for some other reason (e.g. internal error) an appropriate exception such as ServiceUnavailableException will be thrown
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation

getResource

public IResource getResource(com.sapportals.wcm.util.uri.RID rid,
                             IResourceContext context,
                             boolean createCollections)
                      throws com.sapportals.wcm.repository.ResourceException
Returns a resource object instance for the given RID and context. Internal links to collections are resolved.
Parameters:
rid - The RID of the resource
createCollections - If the resource does not exists create a new collection with that name. All collections in the path will be created.
context - The resource context object
Returns:
The resource object instance
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation

getResources

public IResourceList getResources(com.sapportals.wcm.util.uri.IRidList ridList,
                                  java.util.Map propertyMaps,
                                  com.sapportals.wcm.repository.ResourceErrors errors,
                                  IResourceContext context)
                           throws com.sapportals.wcm.repository.ResourceException
Returns a list of resource instances for a list of resource identifiers and possible {@IPropertyMap}s for the resources. The property maps need not be present for each and every resource identifier. If a property map is given for a resource, the caller indicates that he is content to see those properties on the returned resource object. If these properties are visible on the returned resource or if the repository will return the actual, current properties is up to the repository.

Repositories are however encouraged to sacrifice exactness for speed, e.g. prefer the client supplied properties compared to (maybe costly) resource lookups and validations.

Parameters:
ridList - A list of resource identifiers. The list can contain RIDs from different managers.
propertyMaps - a map holding an IPropertyMap with the resource identifier {@RID} as key.
errors - A reference to a ResourceErrors instance. If this is null all exceptions will be ignored.
context - The resource context
Returns:
A list of resources
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation

getResources

public IResourceList getResources(com.sapportals.wcm.util.uri.IRidList ridList,
                                  java.util.Map propertyMaps,
                                  com.sapportals.wcm.repository.ResourceErrors errors,
                                  java.lang.String[] permissionNames,
                                  IResourceContext context)
                           throws com.sapportals.wcm.repository.ResourceException
Returns a list of resource instances for a list of resource identifiers and possible {@IPropertyMap}s for the resources. The property maps need not be present for each and every resource identifier. If a property map is given for a resource, the caller indicates that he is content to see those properties on the returned resource object. If these properties are visible on the returned resource or if the repository will return the actual, current properties is up to the repository.

Repositories are however encouraged to sacrifice exactness for speed, e.g. prefer the client supplied properties compared to (maybe costly) resource lookups and validations.

Parameters:
ridList - A list of resource identifiers. The list can contain RIDs from different managers.
propertyMaps - a map holding an IPropertyMap with the resource identifier {@RID} as key.
errors - A reference to a ResourceErrors instance. If this is null all exceptions will be ignored.
permissionNames - An array of permission names. Permission name constants are defined in IPermission.
context - The resource context
Returns:
A list of resources
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation

getResources

public IResourceList getResources(com.sapportals.wcm.util.uri.IRidList ridList,
                                  com.sapportals.wcm.repository.ResourceErrors errors,
                                  IResourceContext context)
                           throws com.sapportals.wcm.repository.ResourceException
Returns a list of resource instances for an array of resource identifiers. The resulting list will not have the same size as list of RIDs if some resources do not exist or ResourceExceptions occured for some resources. Exceptions are collected in an ResourceErrors instance.
Parameters:
ridList - A list of resource identifiers. The list can contain RIDs from different managers.
errors - A reference to a ResourceErrors instance. If this is null all exceptions will be ignored.
context - The resource context
Returns:
A list of resources
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation

getResources

public IResourceList getResources(com.sapportals.wcm.util.uri.IRidList ridList,
                                  com.sapportals.wcm.repository.ResourceErrors errors,
                                  java.lang.String[] permissionNames,
                                  IResourceContext context)
                           throws com.sapportals.wcm.repository.ResourceException
Returns a list of resource instances for an array of resource identifiers and removes resources without the specified permission(s) from the result list.
Parameters:
ridList - A list of resource identifiers. The list can contain RIDs from different managers.
errors - A reference to a ResourceErrors instance. If this is null all exceptions will be ignored.
permissionNames - An array of permission names. Permission name constants are defined in IPermission.
context - The resource context
Returns:
A list of resources
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation

getServiceContext

public IResourceContext getServiceContext()
                                   throws com.sapportals.wcm.repository.ResourceException
Returns a new resource context for services with an anonymous user
Returns:
a new resource context for services with an anonymous user
Throws:
com.sapportals.wcm.repository.ResourceException - on error

getServiceContext

public IResourceContext getServiceContext(java.lang.String userID)
                                   throws com.sapportals.wcm.repository.ResourceException
Returns a new resource context for services with an anonymous user
Parameters:
userID - the ID of the service user account
Returns:
a new resource context for services with an anonymous user
Throws:
com.sapportals.wcm.repository.ResourceException - on error

getServiceFactory

public IRepositoryServiceFactory getServiceFactory()
                                            throws com.sapportals.wcm.repository.ResourceException
Returns a instance of the ServiceFactory
Returns:
The service factory
Throws:
com.sapportals.wcm.repository.ResourceException - Exception raised in failure situation