org.nuxeo.core.resources.model
Class NullSiteController

java.lang.Object
  extended by org.nuxeo.core.resources.model.NullSiteController
All Implemented Interfaces:
ISiteController

public class NullSiteController
extends java.lang.Object
implements ISiteController

A controller that is doing nothing

Author:
Bogdan Stefanescu

Constructor Summary
NullSiteController()
           
 
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
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullSiteController

public NullSiteController()
Method Detail

login

public void login(java.util.Map credentials)
           throws org.eclipse.core.runtime.CoreException
Description copied from interface: ISiteController
Open a new session using given credentials

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

logout

public void logout()
            throws org.eclipse.core.runtime.CoreException
Description copied from interface: ISiteController
End current session

Specified by:
logout in interface ISiteController
Throws:
org.eclipse.core.runtime.CoreException

addOperationListener

public void addOperationListener(ISiteOperationListener listener)
Description copied from interface: ISiteController
Add a listener to be notified of site operations

Specified by:
addOperationListener in interface ISiteController
Parameters:
listener - the listener to register

execute

public void execute(ISiteOperation operation)
             throws org.eclipse.core.runtime.CoreException
Description copied from interface: ISiteController
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

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

exists

public boolean exists(ISiteResource resource)
               throws org.eclipse.core.runtime.CoreException
Description copied from interface: ISiteController
Check whether the given resource exists

Specified by:
exists in interface ISiteController
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

getChild

public ISiteResource getChild(ISiteFolder container,
                              java.lang.String path)
                       throws org.eclipse.core.runtime.CoreException
Description copied from interface: ISiteController
Get the child resource having the given path relative to the container resource

Specified by:
getChild in interface ISiteController
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

public ISiteResource[] getChildren(ISiteFolder resource,
                                   org.eclipse.core.runtime.IProgressMonitor monitor)
                            throws org.eclipse.core.runtime.CoreException
Description copied from interface: ISiteController
Get the children for the given resource if any

Specified by:
getChildren in interface ISiteController
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

public IResourceMetadata getMetadata(ISiteResource resource)
                              throws org.eclipse.core.runtime.CoreException
Description copied from interface: ISiteController
Get the metadata for the given resource

Specified by:
getMetadata in interface ISiteController
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

getOperationHandler

public ISiteOperationHandler getOperationHandler(java.lang.String opType)
Description copied from interface: ISiteController
Get the registered handler for the given operation type or null if none was registered

Specified by:
getOperationHandler in interface ISiteController
Parameters:
opType - the operation type
Returns:
the registered handler for this type of operation or null if none was registered

isOperationEnabled

public boolean isOperationEnabled(java.lang.String operationType)
Description copied from interface: ISiteController
Tests whether or not the controller is able to handle the given type of operation.

Specified by:
isOperationEnabled in interface ISiteController
Parameters:
operationType - the operation type
Returns:
true if the operation is handled by the controller, false otherwise

getSite

public ISite getSite()
Description copied from interface: ISiteController
Get the controlled site

Specified by:
getSite in interface ISiteController
Returns:
the controlled site

setSite

public void setSite(ISite site)
Description copied from interface: ISiteController
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

Specified by:
setSite in interface ISiteController
Parameters:
site - the site to be controlled

registerOperationHandler

public void registerOperationHandler(java.lang.String opType,
                                     ISiteOperationHandler handler)
Description copied from interface: ISiteController
Register a handler for the given operation type

Specified by:
registerOperationHandler in interface ISiteController
Parameters:
opType - the operation type
handler - the handler to register with the given operation type

removeOperationListener

public void removeOperationListener(ISiteOperationListener listener)
Description copied from interface: ISiteController
Remove the given listener if already registered or do nothing otherwise

Specified by:
removeOperationListener in interface ISiteController
Parameters:
listener - the listener to remove

unregisterOperationHandler

public void unregisterOperationHandler(java.lang.String opType)
Description copied from interface: ISiteController
Unregister the handler for the given operation if any

Specified by:
unregisterOperationHandler in interface ISiteController
Parameters:
opType - the operation type