Interface IApplicationBehaviourDelegate
- All Known Implementing Classes:
InfobaseApplicationBehaviourDelegate
,ServerApplicationBehaviourDelegate
public interface IApplicationBehaviourDelegate
Application type specific implementation of application operations.
Usually, application code should use
IApplicationManager
which could then delegate to instances of IApplicationBehaviourDelegate
for application type specific behaviour.-
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.default ExecutionContext
launch
(IApplication application, String launchMode, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) Deprecated, for removal: This API element is subject to removal in a future version.void
onStateChanged
(IApplication application, LifecycleState state) Called when application state has been changed.void
prepare
(IApplication application, String launchMode, 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.default ExecutionContext
stop
(IApplication application, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Details
-
initialize
void initialize(IApplicationProvisionNotifier notifier, IApplicationType type) throws ApplicationException Initializes the application behaviour delegate with the registered application type and provision notifier.- Parameters:
notifier
- the application provision notifier, cannot benull
type
- the application type, cannot benull
- Throws:
ApplicationException
- if method call failed with some reason
-
publish
PublishState publish(IApplication application, PublishKind kind, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) throws ApplicationException Publishes the application with the provided publish kind.- 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
org.eclipse.core.runtime.IStatus check(IApplication application, ApplicationCheckUnknownStateTreatment whenUnknown, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws ApplicationException 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.- 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
void prepare(IApplication application, String launchMode, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) throws ApplicationException 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 bepublish(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 withcleanup(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.- Parameters:
application
- the application to prepare, cannot benull
launchMode
- 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
-
launch
@Deprecated(forRemoval=true) default ExecutionContext launch(IApplication application, String launchMode, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) throws ApplicationException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
ApplicationException
-
cleanup
void cleanup(IApplication application, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) throws ApplicationException 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 byprepare(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 byprepare(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 asdelete(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.- 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
-
stop
@Deprecated(forRemoval=true) default ExecutionContext stop(IApplication application, ExecutionContext context, org.eclipse.core.runtime.SubMonitor monitor) throws ApplicationException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
ApplicationException
-
delete
Deletes the specified application.- 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
Called when application state has been changed.- Parameters:
application
- Application whose state has changed. Nevernull
.state
- State in which application has been transitioned. Nevernull
.
-
prepare(IApplication,String,ExecutionContext,SubMonitor)
instead