SAP NetWeaver '04

com.sapportals.wcm.repository
Interface IResourceFactory

[contained in: com.sap.netweaver.bc.rf.par - bc.rf.framework_api.jar]
public interface IResourceFactory

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

Copyright (c) SAP AG 2001-2004

See Also:
IManagerFactory

Method Summary
 boolean checkExistence(RID rid, IResourceContext context)
          Returns true if a resource exists for the given resource identifier.
 boolean checkExistence(URI uri, IResourceContext context)
          Deprecated. As of EP 5.0 SP3, replaced by method with RID parameter.
 IFilterFactory getFilterFactory()
          Returns a instance of the FilterFactory
 IManagerFactory getManagerFactory()
          Returns a instance of the ManagerFactory
 java.lang.Object getObject(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(RID rid, boolean resolveInternalLinks, IResourceContext context)
          Returns a resource object instance for the given RID and context.
 IResource getResource(RID rid, IResourceContext context)
          Returns a resource object instance for the given resource identifier and context.
 IResource getResource(RID rid, IResourceContext context, boolean createCollections)
          Returns a resource object instance for the given RID and context.
 IResource getResource(URI uri, IResourceContext context)
          Deprecated. As of EP 5.0 SP3, replaced by getResource() method with RID parameter.
 IResource getResource(URI uri, IResourceContext context, boolean createCollections)
          Deprecated. As of EP 5.0 SP3, replaced by getResource() method with RID parameter.
 IResourceList getResources(IRidList ridList, java.util.Map propertyMaps, 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(IRidList ridList, java.util.Map propertyMaps, 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(IRidList ridList, ResourceErrors errors, IResourceContext context)
          Returns a list of resource instances for an array of resource identifiers.
 IResourceList getResources(IRidList ridList, 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.
 IResourceList getResources(IUriList uriList, ResourceErrors errors, IResourceContext context)
          Deprecated. As of EP 5.0 SP3, replaced by getResources() method with IRidList parameter.
 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

getResource

public IResource getResource(URI uri,
                             IResourceContext context)
                      throws ResourceException,
                             AuthorizationRequiredException
Deprecated. As of EP 5.0 SP3, replaced by getResource() method with RID parameter.

Parameters:
uri - TBD: Description of the incoming method parameter
context - TBD: Description of the incoming method parameter
Returns:
resource
Throws:
ResourceException - Exception raised in failure situation
AuthorizationRequiredException - Exception raised in failure situation

getResource

public IResource getResource(URI uri,
                             IResourceContext context,
                             boolean createCollections)
                      throws ResourceException,
                             AuthorizationRequiredException
Deprecated. As of EP 5.0 SP3, replaced by getResource() method with RID parameter.

Parameters:
uri - TBD: Description of the incoming method parameter
context - TBD: Description of the incoming method parameter
createCollections - TBD: Description of the incoming method parameter
Returns:
resource
Throws:
ResourceException - Exception raised in failure situation
AuthorizationRequiredException - Exception raised in failure situation

getResource

public IResource getResource(RID rid,
                             IResourceContext context)
                      throws 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:
ResourceException - Exception raised in failure situation

getObject

public java.lang.Object getObject(RID rid,
                                  IResourceContext context,
                                  java.lang.Class asClass)
                           throws 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:
ResourceException - Exception raised in failure situation

getResource

public IResource getResource(RID rid,
                             IResourceContext context,
                             boolean createCollections)
                      throws 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:
ResourceException - Exception raised in failure situation

getResource

public IResource getResource(RID rid,
                             boolean resolveInternalLinks,
                             IResourceContext context)
                      throws 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:
ResourceException - Exception raised in failure situation
See Also:
IResource.getRID(), IResource.getAccessRID()

getResources

public IResourceList getResources(IUriList uriList,
                                  ResourceErrors errors,
                                  IResourceContext context)
                           throws ResourceException
Deprecated. As of EP 5.0 SP3, replaced by getResources() method with IRidList parameter.

Parameters:
uriList - TBD: Description of the incoming method parameter
errors - TBD: Description of the incoming method parameter
context - TBD: Description of the incoming method parameter
Returns:
resources
Throws:
ResourceException - Exception raised in failure situation

getResources

public IResourceList getResources(IRidList ridList,
                                  ResourceErrors errors,
                                  IResourceContext context)
                           throws 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:
ResourceException - Exception raised in failure situation

getResources

public IResourceList getResources(IRidList ridList,
                                  ResourceErrors errors,
                                  java.lang.String[] permissionNames,
                                  IResourceContext context)
                           throws 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:
ResourceException - Exception raised in failure situation

getResources

public IResourceList getResources(IRidList ridList,
                                  java.util.Map propertyMaps,
                                  ResourceErrors errors,
                                  IResourceContext context)
                           throws 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:
ResourceException - Exception raised in failure situation

getResources

public IResourceList getResources(IRidList ridList,
                                  java.util.Map propertyMaps,
                                  ResourceErrors errors,
                                  java.lang.String[] permissionNames,
                                  IResourceContext context)
                           throws 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:
ResourceException - Exception raised in failure situation

checkExistence

public boolean checkExistence(URI uri,
                              IResourceContext context)
                       throws ResourceException,
                              AuthorizationRequiredException
Deprecated. As of EP 5.0 SP3, replaced by method with RID parameter.


checkExistence

public boolean checkExistence(RID rid,
                              IResourceContext context)
                       throws ResourceException,
                              AuthorizationRequiredException
Returns true if a resource exists for the given resource identifier.

Note that this method should only be used if the caller really only requires this piece of information. Using the return value to decide whether it makes sense to call getResource(RID, IResourceContext), or to detect whether a particular RID isn't in use yet DOES NOT WORK due to possible race conditions. Instead, just do the respective method calls and properly check results/exceptions.

Parameters:
rid - The RID to check
context - The resource context
Returns:
True if the resource exists
Throws:
ResourceException - Exception raised in failure situation
AuthorizationRequiredException - Exception raised in failure situation

getServiceFactory

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

getManagerFactory

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

getFilterFactory

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

getServiceContext

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

getServiceContext

public IResourceContext getServiceContext(java.lang.String userID)
                                   throws 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:
ResourceException - on error

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.