Class ServerApplicationBehaviourDelegate
java.lang.Object
com.e1c.g5.dt.internal.applications.wst.ui.ServerApplicationBehaviourDelegate
- All Implemented Interfaces:
IApplicationBehaviourDelegate
public class ServerApplicationBehaviourDelegate
extends Object
implements IApplicationBehaviourDelegate
Behavior implementation for applications which are hosted on a standalone server.
Since standalone server applications require connection with standalone server to perform most
operations,
preparing
application automatically
establishes
connection with its infobase.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.core.runtime.IStatus
check
(IApplication application, ApplicationCheckUnknownStateTreatment whenUnknown, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) Checks whether the application is ready to start.void
cleanup
(IApplication application, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) Cleans up resources associated with the application.void
delete
(IApplication application, boolean unsynchronize) Deletes the specified application.void
initialize
(IApplicationProvisionNotifier notifier, IApplicationType type) Initializes the application behaviour delegate with the registered application type and provision notifier.void
onStateChanged
(IApplication application, LifecycleState state) Called when application state has been changed.void
prepare
(IApplication application, String requestedLaunchMode, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) Prepares underlying infrastructure to be ready for interaction.publish
(IApplication application, PublishKind kind, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) Publishes the application with the provided publish kind.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.e1c.g5.dt.applications.contributors.IApplicationBehaviourDelegate
launch, stop
-
Constructor Details
-
ServerApplicationBehaviourDelegate
public ServerApplicationBehaviourDelegate()
-
-
Method Details
-
initialize
Description copied from interface:IApplicationBehaviourDelegate
Initializes the application behaviour delegate with the registered application type and provision notifier.- Specified by:
initialize
in interfaceIApplicationBehaviourDelegate
- Parameters:
notifier
- the application provision notifier, cannot benull
type
- the application type, cannot benull
-
publish
public PublishState publish(IApplication application, PublishKind kind, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) throws ApplicationException Description copied from interface:IApplicationBehaviourDelegate
Publishes the application with the provided publish kind.- Specified by:
publish
in interfaceIApplicationBehaviourDelegate
- Parameters:
application
- the application to publish, cannot benull
kind
- the publish kind to use, cannot benull
context
- the execution context, cannot benull
monitor
- the progress monitor to report progress to, cannot benull
- Returns:
- the publication state after execution, never
null
- Throws:
ApplicationException
- if method call failed with some reason
-
check
public org.eclipse.core.runtime.IStatus check(IApplication application, ApplicationCheckUnknownStateTreatment whenUnknown, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws ApplicationException Description copied from interface:IApplicationBehaviourDelegate
Checks whether the application is ready to start. Such readiness check might include checking that related infobase configuration has not been changed outside of EDT. If application's project has extensions then those extensions are checked as well.- Specified by:
check
in interfaceIApplicationBehaviourDelegate
- Parameters:
application
- the application to check, cannot benull
whenUnknown
- Indicates how to treat situation when previous infobase state is not known and so cannot determine if there are changes in infobase. Must not benull
.context
- Context with start parameters. It must containExecutionContext.ACTIVE_SHELL_NAME
with the shell to be used for interaction with a user. Must not benull
.monitor
- the progress monitor to report progress to, cannot benull
- Returns:
IStatus.OK
if application is ready to be started,IStatus.CANCEL
if user cancells operation,IStatus.ERROR
if application is not ready to be started.- Throws:
ApplicationException
- if thecontext
does not specifyExecutionContext.ACTIVE_SHELL_NAME
or pulling changes from the associated infobase fails.
-
prepare
public void prepare(IApplication application, String requestedLaunchMode, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) throws ApplicationException Description copied from interface:IApplicationBehaviourDelegate
Prepares underlying infrastructure to be ready for interaction. Some applications might consist in more than just a client. Those type of applications might require additional set up for the interaction with them to function properly. For example, a server application might require a server to be started before a client application can beIApplicationBehaviourDelegate.publish(com.e1c.g5.dt.applications.IApplication, com.e1c.g5.dt.applications.PublishKind, com.e1c.g5.dt.applications.ExecutionContext, org.eclipse.core.runtime.SubMonitor)
-ed or client started. Such preparation work is performed by the method. The opposite work of undoing such preparation should be done withIApplicationBehaviourDelegate.cleanup(com.e1c.g5.dt.applications.IApplication, com.e1c.g5.dt.applications.ExecutionContext, org.eclipse.core.runtime.SubMonitor)
. The application preparation for regular run and for debug run might be significatly different. The caller must specify launch mode to be the same as it will specify when actually starting application in the future. However, it is up to the application if it will honor or ignore the mode and if it will re-prepare if it is already prepared for another mode or the current application state is good enough for the desired launch mode. The current thread is blocked until preparation is complete (for example, server start finishes). Since this is a long running operation, it might be inappripriate to run it from UI thread. Consider usingorg.eclipse.jface.dialogs.ProgressMonitorDialog
with fork mode enabled.- Specified by:
prepare
in interfaceIApplicationBehaviourDelegate
- Parameters:
application
- the application to prepare, cannot benull
requestedLaunchMode
- Desired future application start mode. See org.eclipse.debug.core.ILaunchManager.RUN_MODE and org.eclipse.debug.core.ILaunchManager.DEBUG_MODE. Must not benull
.context
- Context containing parameters affecting application preparation. The context could be modified as a result of the call and should be used when starting clients. For example,ExecutionContext.DEBUG_TARGET
andExecutionContext.DEBUG_URL
might be added/updated to reflect application settings when preparing for debug mode. Must not benull
.monitor
- the progress monitor to report progress to ornull
if report is not desired- Throws:
ApplicationException
- if method call failed with some reason
-
cleanup
public void cleanup(IApplication application, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) throws ApplicationException Description copied from interface:IApplicationBehaviourDelegate
Cleans up resources associated with the application. The method does not stop client application being developed. Instead, it undoes preparation work that has been previously done byIApplicationBehaviourDelegate.prepare(com.e1c.g5.dt.applications.IApplication, java.lang.String, com.e1c.g5.dt.applications.ExecutionContext, org.eclipse.core.runtime.SubMonitor)
. For example, if for a server application a server itself has been started byIApplicationBehaviourDelegate.prepare(com.e1c.g5.dt.applications.IApplication, java.lang.String, com.e1c.g5.dt.applications.ExecutionContext, org.eclipse.core.runtime.SubMonitor)
and then a client application has been started then the method might stop that previously started server once it is not needed anymore. This can change lifecycle state of the application but should have no effect on application synchronization/equality/publish state. Cleanup is a temporary action and should not be as desctructive asIApplicationBehaviourDelegate.delete(com.e1c.g5.dt.applications.IApplication, boolean)
. The current thread is blocked until operation is finished. Since this is a long running operation, it might be inappripriate to run it from UI thread. Consider usingorg.eclipse.jface.dialogs.ProgressMonitorDialog
with fork mode enabled.- Specified by:
cleanup
in interfaceIApplicationBehaviourDelegate
- Parameters:
application
- the application to stop, cannot benull
context
- the execution context, cannot benull
monitor
- the progress monitor to report progress to, cannot benull
- Throws:
ApplicationException
- if method call failed with some reason
-
delete
Description copied from interface:IApplicationBehaviourDelegate
Deletes the specified application.- Specified by:
delete
in interfaceIApplicationBehaviourDelegate
- Parameters:
application
- Application to be deleted. Must not benull
.unsynchronize
-true
if synchronization state is to be deleted orfalse
is to keep synchronization state.- Throws:
ApplicationException
- If the specified application could not be deleted for whatever reason.
-
onStateChanged
Description copied from interface:IApplicationBehaviourDelegate
Called when application state has been changed.- Specified by:
onStateChanged
in interfaceIApplicationBehaviourDelegate
- Parameters:
application
- Application whose state has changed. Nevernull
.state
- State in which application has been transitioned. Nevernull
.
-