com.ibm.workplace.wcm.api
Interface Repository


public interface Repository

The entry point into the WCM repository.

This interface provides methods for obtaining a Workspace. A Workspace represents a view of the repository for the specified user.


Method Summary
 void endWorkspace()
          Performs a logout from the currently associated Workspace and unregisters the current thread from its session.
 void executeInVP(VirtualPortalContext vpContext, VirtualPortalScopedAction vpScopedAction)
          Execute the VirtualPortalScopedAction within the scope of the Virtual Portal defined by the VirtualPortalContext.
 VirtualPortalContext generateVPContextFromContextPath(java.lang.String contextPath)
          Generate a VirtualPortalContext derived from the Virtual Portal context path value.
 VirtualPortalContext generateVPContextFromHostname(java.lang.String hostname)
          Generate a VirtualPortalContext derived from the Virtual Portal host name.
 VirtualPortalContext generateVPContextFromObjectId(ObjectID objectId)
          Generate a VirtualPortalContext derived from the Virtual Portal Object ID If Object ID is null, return base portal by default
 java.util.List<VirtualPortalContext> getAllVirtualPortalContexts()
          Return a list of all Virtual Portal contexts available on the current system
 Workspace getAnonymousWorkspace()
          Returns a Workspace object representing a view of the repository for the Anonymous user.
 java.lang.String getClusterName()
          Returns the cluster name of the current repository
 VirtualPortalContext getCurrentVirtualPortalContext()
          Retrieve the current Virtual Portal context or the Base Portal if called outside of a Virtual Portal
 java.lang.String getHostName()
          Returns the host name of the current repository
 java.lang.String getNodeName()
          Returns the name of the current node
 Workspace getSystemWorkspace()
          Returns a Workspace object representing a system view of the repository.
 Workspace getWorkspace()
          Returns a Workspace object representing a view of the repository for the current User accessing the system.
 Workspace getWorkspace(java.security.Principal principal)
          Returns a Workspace object representing a view of the repository for the specified Principal.
 Workspace getWorkspace(java.lang.String username, java.lang.String password)
          Returns a Workspace object that represents a view of the repository for a user with the specified credentials.
 Workspace getWorkspace(com.ibm.portal.um.User user)
          Returns a Workspace object representing a view of the repository for the specified User.
 boolean isVirtualPortalScoped()
          Determine whether the current system has Virtual Portal Web Content Library scoping enabled as used with Managed Pages
 

Method Detail

getWorkspace

Workspace getWorkspace(java.lang.String username,
                       java.lang.String password)
                       throws com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException,
                              com.ibm.workplace.wcm.api.exceptions.OperationFailedException
Returns a Workspace object that represents a view of the repository for a user with the specified credentials.

Parameters:
username - the username of the user to get a Workspace for
password - the user's password
Returns:
a Workspace for the specified user; returns an Anonymous Workspace if the user could not be authenticated.
Throws:
com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException - if the WCM service is not available
com.ibm.workplace.wcm.api.exceptions.OperationFailedException - if a Workspace could not be created for this user
java.lang.NullPointerException - if either of the arguments to this method is null

getAnonymousWorkspace

Workspace getAnonymousWorkspace()
                                throws com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException,
                                       com.ibm.workplace.wcm.api.exceptions.OperationFailedException
Returns a Workspace object representing a view of the repository for the Anonymous user.

Returns:
Workspace for the Anonymous user
Throws:
com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException - if the WCM service is not available
com.ibm.workplace.wcm.api.exceptions.OperationFailedException - if a workspace could not be created for this user

getWorkspace

Workspace getWorkspace(java.security.Principal principal)
                       throws com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException,
                              com.ibm.workplace.wcm.api.exceptions.OperationFailedException
Returns a Workspace object representing a view of the repository for the specified Principal.

Parameters:
principal - The java.security.Principal to retrieve a Workspace for.
Returns:
Workspace for the specified Principal
Throws:
com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException - if the WCM service is not available
com.ibm.workplace.wcm.api.exceptions.OperationFailedException - if a workspace could not be created for the specified Principal
java.lang.NullPointerException - if the argument to this method is null

getWorkspace

Workspace getWorkspace(com.ibm.portal.um.User user)
                       throws com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException,
                              com.ibm.workplace.wcm.api.exceptions.OperationFailedException
Returns a Workspace object representing a view of the repository for the specified User.

Parameters:
user - The com.ibm.portal.um.User to retrieve a Workspace for.
Returns:
Workspace for the specified User
Throws:
com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException - if the WCM service is not available
com.ibm.workplace.wcm.api.exceptions.OperationFailedException - if a workspace could not be created for the specified Principal
java.lang.NullPointerException - if the argument to this method is null

getWorkspace

Workspace getWorkspace()
                       throws com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException,
                              com.ibm.workplace.wcm.api.exceptions.OperationFailedException
Returns a Workspace object representing a view of the repository for the current User accessing the system. If no user is currently logged into the system an anonymous Workspace will be returned

Returns:
Workspace for the current User
Throws:
com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException - if the WCM service is not available
com.ibm.workplace.wcm.api.exceptions.OperationFailedException - if a workspace could not be created for the current User
java.lang.NullPointerException - if the argument to this method is null

getSystemWorkspace

Workspace getSystemWorkspace()
                             throws com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException,
                                    com.ibm.workplace.wcm.api.exceptions.OperationFailedException
Returns a Workspace object representing a system view of the repository.

Returns:
a Workspace object representing a system view of the repository.
Throws:
com.ibm.workplace.wcm.api.exceptions.ServiceNotAvailableException - if the WCM service is not available
com.ibm.workplace.wcm.api.exceptions.OperationFailedException - if a workspace could not be created for the specified Principal
java.lang.NullPointerException - if the argument to this method is null

endWorkspace

void endWorkspace()
Performs a logout from the currently associated Workspace and unregisters the current thread from its session. N.B. You don't need to call endWorkspace() when using a JSP component as rendering and session management is handled by Web Content Manager.


getNodeName

java.lang.String getNodeName()
Returns the name of the current node

Returns:
the name of the current node

getHostName

java.lang.String getHostName()
Returns the host name of the current repository

Returns:
the host name of the current repository

getClusterName

java.lang.String getClusterName()
Returns the cluster name of the current repository

Returns:
the cluster name of the current repository

executeInVP

void executeInVP(VirtualPortalContext vpContext,
                 VirtualPortalScopedAction vpScopedAction)
                 throws WCMException
Execute the VirtualPortalScopedAction within the scope of the Virtual Portal defined by the VirtualPortalContext. This will allow WCM API code to access all WCM assets located within the target Virtual Portal.

The access rights used for accessing artifacts in the target Virtual Portal will be based on the security configuration of the Virtual Portal. It is possible to configure a Virtual Portal to use a completely separate LDAP and this makes it necessary within the scope of the Virtual Portal to use the Repository.getWorkspace with credentials for a valid user of the Virtual Portal.

Note that it is not allow to stack multiple calls to execute within different Virtual Portals.

Objects that are taken out of this Virtual Portal scope will no longer be able to access their repository and all actions will be performed as if the item belonged to the base portal workspace.

Parameters:
vpContext - the Virtual Portal to target.
vpScopedAction - the action to perform within the scope of the target Virtual Portal
Throws:
WCMException - if an exception is thrown by the VirtualPortalScopedAction or if the target Virtual Portal defined by VirtualPortalContext could not be found
Since:
8.0.0.1

generateVPContextFromHostname

VirtualPortalContext generateVPContextFromHostname(java.lang.String hostname)
                                                   throws VirtualPortalNotFoundException
Generate a VirtualPortalContext derived from the Virtual Portal host name. Only use this if the host name uniquely identifies the target Virtual Portal. If the target virtual portal and the base portal share the same host name then the base portal will be returned as the context. If hostname is null, return base portal by default

Parameters:
hostname - the host name of the target Virtual Portal
Returns:
VirtualPortalContext to Virtual Portal identified by the specified host name.
Throws:
VirtualPortalNotFoundException - if a Virtual Portal with the target host name could not be found
Since:
8.0.0.1

generateVPContextFromContextPath

VirtualPortalContext generateVPContextFromContextPath(java.lang.String contextPath)
                                                      throws VirtualPortalNotFoundException
Generate a VirtualPortalContext derived from the Virtual Portal context path value. If contextPath is null, return base portal by default

Parameters:
contextPath - the context path of the target Virtual Portal
Returns:
VirtualPortalContext to Virtual Portal identified by the specified context path.
Throws:
VirtualPortalNotFoundException - if a Virtual Portal with the specified context path could not be found
Since:
8.0.0.1

getAllVirtualPortalContexts

java.util.List<VirtualPortalContext> getAllVirtualPortalContexts()
Return a list of all Virtual Portal contexts available on the current system

Returns:
List of all Virtual Portal contexts
Since:
8.0.0.1 CF13

generateVPContextFromObjectId

VirtualPortalContext generateVPContextFromObjectId(ObjectID objectId)
Generate a VirtualPortalContext derived from the Virtual Portal Object ID If Object ID is null, return base portal by default

Parameters:
objectId - the ObjectID for the target Virtual Portal
Returns:
VirtualPortalContext to Virtual Portal identified by the specified context path.
Since:
8.0.0.1 CF13

getCurrentVirtualPortalContext

VirtualPortalContext getCurrentVirtualPortalContext()
Retrieve the current Virtual Portal context or the Base Portal if called outside of a Virtual Portal

Returns:
VirtualPortalContext the context of the current virtual portal
Since:
8.0.0.1 CF13

isVirtualPortalScoped

boolean isVirtualPortalScoped()
Determine whether the current system has Virtual Portal Web Content Library scoping enabled as used with Managed Pages

Returns:
true if Virtual Portal scoping is enabled, false otherwise
Since:
8.0.0.1 CF13