org.eclipse.stp.core.saf.handler
Interface IEntryPointHandler

All Superinterfaces:
IHandler
All Known Implementing Classes:
AbstractEntryPointHandler

public interface IEntryPointHandler
extends IHandler

This interface must be implemented by all entry point handlers. Most handlers should extend the abstract class AbstractEntryPointHandler which provides certain convenient methods.


Method Summary
 boolean canCreateEntryPointBinding()
          Queries if the entry point handler provides support for creating an entry point binding using the method createEntryPointBindingFor().
 boolean canCreateEntryPointFor(java.lang.Object service)
          Queries if an entry point of the kind supported by this handler can be created for the specified model object.
 boolean canCreateManyEntryPointBindings()
          Queries if the entry point handler provides support for creating more than one binding instance for an entry point.
 org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation createEntryPointBindingFor(org.eclipse.stp.core.sca.EntryPoint theEntryPoint, IUIContext callback)
          Adds a binding of the kind supported by this handler to the specified EntryPoint object, based on the specified target and interfaces in the entry point definition.
 org.eclipse.stp.core.sca.SCAObject[] createEntryPointFor(java.lang.Object service, org.eclipse.core.resources.IContainer container, IUIContext callback)
          Creates an entry point with a binding of the kind supported by this handler for the specified service.
 boolean isInterfaceKindSupported(IInterfaceHandler interfaceHandler)
          Queries if an entry point of the kind supported by this handler supports interfaces of the kind specified by the given interface handler in its interface set.
 org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation removeKind(org.eclipse.stp.core.sca.EntryPoint theEntryPoint)
          Removes a given binding kind from the entry point.
 
Methods inherited from interface org.eclipse.stp.core.saf.handler.IHandler
getDescription, getDescriptiveKindName, getKind, getLargeIcon, getName, getSmallIcon
 

Method Detail

canCreateEntryPointFor

public boolean canCreateEntryPointFor(java.lang.Object service)
Queries if an entry point of the kind supported by this handler can be created for the specified model object. If this method returns true, the handler's createEntryPointFor(Object, IContainer, IUIContext) method may be called to create an entry point for the component or external service.

This method should be quick to execute, because it may be called to populate a context menu or a user dialog.

Parameters:
service - an object representing the service to be exposed
Returns:
true if the handler can create an EntryPoint object from the specified model object; false otherwise

createEntryPointFor

public org.eclipse.stp.core.sca.SCAObject[] createEntryPointFor(java.lang.Object service,
                                                                org.eclipse.core.resources.IContainer container,
                                                                IUIContext callback)
                                                         throws SAFException,
                                                                java.lang.InterruptedException,
                                                                InvalidOperationException
Creates an entry point with a binding of the kind supported by this handler for the specified service. All interfaces of the target are exposed. To expose specific interfaces, call createEntryPointBindingFor(EntryPoint, IUIContext) instead. Optionally, this method may create other objects required to support the new entry point (such as a component). This method is not expected to associate a resource with the returned EntryPoint or supporting object.

Parameters:
service - an object representing the service being exposed
container - the container that holds the module, subsystem, composite, etc. that will use the entry point object returned by this method. The handler could use its location as a base to place any binding-related files that need to be generated.
callback - callback object that the handler can use to obtain additional information needed to create the entry point. Callers may pass in a null value.
Returns:
an array of SCAObject containing the new entry point and any other SCA objects generated by the handler to support the new entry point
Throws:
SAFException - An unexpected exception occurred.
InvalidOperationException - An entry point cannot be created from the given service object.
java.lang.InterruptedException - The caller did not provide a callback object needed by the handler, or the callback request was canceled or aborted.

canCreateEntryPointBinding

public boolean canCreateEntryPointBinding()
Queries if the entry point handler provides support for creating an entry point binding using the method createEntryPointBindingFor().

Returns:
true if support is provided for creating a binding; false otherwise

canCreateManyEntryPointBindings

public boolean canCreateManyEntryPointBindings()
Queries if the entry point handler provides support for creating more than one binding instance for an entry point.

Returns:
true if support is provided for creating more than one binding of the supported kind; false otherwise

createEntryPointBindingFor

public org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation createEntryPointBindingFor(org.eclipse.stp.core.sca.EntryPoint theEntryPoint,
                                                                                                  IUIContext callback)
                                                                                           throws SAFException,
                                                                                                  java.lang.InterruptedException,
                                                                                                  InvalidOperationException
Adds a binding of the kind supported by this handler to the specified EntryPoint object, based on the specified target and interfaces in the entry point definition. The handler is expected to update the entry point definition, if necessary. If the entry point has an existing binding, the handler can add to or replace the binding. The handler can use the callback to query for more information from the user. If the binding requires associated files, this method should generate those files. In this case, this method should be aware that the files it generates may replace some already being managed in a team environment. The EntryPoint object should have a resource associated with it. The handler can use this location to generate relative file references if needed or use the location for storing binding-related files that need to be generated. The resource can be retrieved by casting the EntryPoint object to an EObject and calling EObject.eResource().

Parameters:
theEntryPoint - an existing entry point definition, which may contain interfaces and a binding
callback - callback object that the handler can use to obtain additional information needed to create the binding. Callers may pass in a null value.
Returns:
an IDataModelOperation instance that, once executed by the caller, creates the entry point binding
Throws:
SAFException - An unexpected exception occurred.
InvalidOperationException - A binding cannot be created for the given entry point.
java.lang.InterruptedException - The caller did not provide a callback object needed by the handler, or the callback request was canceled or aborted.

isInterfaceKindSupported

public boolean isInterfaceKindSupported(IInterfaceHandler interfaceHandler)
                                 throws SAFException
Queries if an entry point of the kind supported by this handler supports interfaces of the kind specified by the given interface handler in its interface set.

Parameters:
interfaceHandler - the interface handler that will be used to manipulate the interface. The implementation of this method can obtain the interface kind by invoking IHandler.getKind() when performing the evaluation.
Returns:
true if the entry point supports interfaces of the specified interface kind; false otherwise
Throws:
SAFException - An unexpected exception occurred in the handler.

removeKind

public org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation removeKind(org.eclipse.stp.core.sca.EntryPoint theEntryPoint)
                                                                           throws SAFException,
                                                                                  InvalidOperationException
Removes a given binding kind from the entry point. Generally, existing interfaces will be preserved. No clean-up is done on existing binding-related files. If the entry point does not contain the given binding type, this method performs no work.

Parameters:
theEntryPoint - the entry point being modified
Returns:
an IDataModelOperation instance that, once executed by the caller, resets the entry point kind
Throws:
SAFException - No handler for the specified kind is found, or the handler throws an exception.
InvalidOperationException - The entry point kind cannot be removed.