org.nuxeo.core.resources.model
Interface ISiteController

All Known Implementing Classes:
AbstractSiteController, NullSiteController

public interface ISiteController

A site controller operation execution and notification on a specific site
There are a small set of required operations for any type of site. This set includes only read only operations. Any other operation is optional and can be customized by each site type by registering operation handlers

Clients may be notified on the performed operations by registering as a ISiteOperationListener listener
This type of listener supports operation cancelation

Author:
Bogdan Stefanescu

Method Summary
 void addOperationListener(ISiteOperationListener listener)
          Add a listener to be notified of site operations
 void execute(ISiteOperation operation)
          Execute the given operation on the given target resource The operation result status can be retrieved from the operation after the execution finished by calling ISiteOperation.getStatus() If the operation is asynchronously executed then you may regsiter a listener to be notified when the operation completes to be able to retrieve the operation result status
 boolean exists(ISiteResource resource)
          Check whether the given resource exists
 ISiteResource getChild(ISiteFolder container, java.lang.String path)
          Get the child resource having the given path relative to the container resource
 ISiteResource[] getChildren(ISiteFolder resource, org.eclipse.core.runtime.IProgressMonitor monitor)
          Get the children for the given resource if any
 IResourceMetadata getMetadata(ISiteResource resource)
          Get the metadata for the given resource
 ISiteOperationHandler getOperationHandler(java.lang.String opType)
          Get the registered handler for the given operation type or null if none was registered
 ISite getSite()
          Get the controlled site
 boolean isOperationEnabled(java.lang.String operationType)
          Tests whether or not the controller is able to handle the given type of operation.
 void login(java.util.Map credentials)
          Open a new session using given credentials
 void logout()
          End current session
 void registerOperationHandler(java.lang.String opType, ISiteOperationHandler handler)
          Register a handler for the given operation type
 void removeOperationListener(ISiteOperationListener listener)
          Remove the given listener if already registered or do nothing otherwise
 void setSite(ISite site)
          Set the site to be controlled.
 void unregisterOperationHandler(java.lang.String opType)
          Unregister the handler for the given operation if any
 

Method Detail

getSite

ISite getSite()
Get the controlled site

Returns:
the controlled site

setSite

void setSite(ISite site)
Set the site to be controlled. If the controller was already associated to a site the system resources allocated for this association must be freed and the association removed

Parameters:
site - the site to be controlled

addOperationListener

void addOperationListener(ISiteOperationListener listener)
Add a listener to be notified of site operations

Parameters:
listener - the listener to register

removeOperationListener

void removeOperationListener(ISiteOperationListener listener)
Remove the given listener if already registered or do nothing otherwise

Parameters:
listener - the listener to remove

registerOperationHandler

void registerOperationHandler(java.lang.String opType,
                              ISiteOperationHandler handler)
Register a handler for the given operation type

Parameters:
opType - the operation type
handler - the handler to register with the given operation type

unregisterOperationHandler

void unregisterOperationHandler(java.lang.String opType)
Unregister the handler for the given operation if any

Parameters:
opType - the operation type

getOperationHandler

ISiteOperationHandler getOperationHandler(java.lang.String opType)
Get the registered handler for the given operation type or null if none was registered

Parameters:
opType - the operation type
Returns:
the registered handler for this type of operation or null if none was registered

isOperationEnabled

boolean isOperationEnabled(java.lang.String operationType)
Tests whether or not the controller is able to handle the given type of operation.

Parameters:
operationType - the operation type
Returns:
true if the operation is handled by the controller, false otherwise

login

void login(java.util.Map credentials)
           throws org.eclipse.core.runtime.CoreException
Open a new session using given credentials

Parameters:
credentials - the credetials to use to login
Throws:
org.eclipse.core.runtime.CoreException - if an errormoccurs or login failed

logout

void logout()
            throws org.eclipse.core.runtime.CoreException
End current session

Throws:
CoreExceptionif - amn error occurs
org.eclipse.core.runtime.CoreException

getChild

ISiteResource getChild(ISiteFolder container,
                       java.lang.String path)
                       throws org.eclipse.core.runtime.CoreException
Get the child resource having the given path relative to the container resource

Parameters:
container - the container resource from where to find the child
path - the relative path of the resource to find
Returns:
the resource or null if not found
Throws:
org.eclipse.core.runtime.CoreException

getChildren

ISiteResource[] getChildren(ISiteFolder resource,
                            org.eclipse.core.runtime.IProgressMonitor monitor)
                            throws org.eclipse.core.runtime.CoreException
Get the children for the given resource if any

Parameters:
resource - the resource to query for children
monitor - the monitor if progress monitorinf is required otherwise null
Returns:
an array with children site resource or an empty array if no children exists
Throws:
org.eclipse.core.runtime.CoreException - if an error occurs or resource is not existing

getMetadata

IResourceMetadata getMetadata(ISiteResource resource)
                              throws org.eclipse.core.runtime.CoreException
Get the metadata for the given resource

Parameters:
resource - the resource
Returns:
the resource metadata or an exception if an error occured or the resource is not existing
Throws:
org.eclipse.core.runtime.CoreException - if an error occurs or resource is not existing

exists

boolean exists(ISiteResource resource)
               throws org.eclipse.core.runtime.CoreException
Check whether the given resource exists

Parameters:
resource - the resource to test
Returns:
true if the resource exists, false otherwise
Throws:
org.eclipse.core.runtime.CoreException - if an error occurs or resource is not existing

execute

void execute(ISiteOperation operation)
             throws org.eclipse.core.runtime.CoreException
Execute the given operation on the given target resource The operation result status can be retrieved from the operation after the execution finished by calling ISiteOperation.getStatus() If the operation is asynchronously executed then you may regsiter a listener to be notified when the operation completes to be able to retrieve the operation result status

Parameters:
operation - the operation to execute
Throws:
org.eclipse.core.runtime.CoreException - if an error occurs or resource is not existing