Package com.e1c.g5.dt.applications
Interface IApplicationManager
- All Known Implementing Classes:
ApplicationManager
public interface IApplicationManager
Manages applications.
Allows
preparing, checking for changes,
updating and discovering applications.
Note that this manager does not allow creation of new applications.- Restriction:
- This interface is not intended to be extended by clients.
- Restriction:
- This interface is not intended to be implemented by clients.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAppllicationListener(IApplicationListener listener) Adds the application listener to listen to application events.org.eclipse.core.runtime.IStatuscheck(IApplication application, ApplicationCheckUnknownStateTreatment whenUnknown, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) Checks whether the application is ready to start.voidcleanup(IApplication application, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) Cleans up resources associated with the application.voiddelete(IApplication application, boolean unsynchronize) Deletes the specified application.findApplicationByInfobase(InfobaseReference infobase) Finds an application that uses specified infobase.findApplicationByInfobaseAndProject(InfobaseReference infobase, org.eclipse.core.resources.IProject project) Finds an application for the specified project that uses specified infobase.getApplication(org.eclipse.core.resources.IProject project, String id) Returns the project application with the provided id.getApplicationArtifacts(Object object) Returns a list of all found application artifacts for the provided application or application artifact.getApplications(org.eclipse.core.resources.IProject project) Returns a list of all registered project applications.Returns a list of all registered application types.getDefaultApplication(org.eclipse.core.resources.IProject project) Returns the default registered project application.Optional<org.eclipse.core.resources.IProject>Returns the default application owner project if there is any.getDefaultUrlAccess(IApplication application) Returns the default URL access instance for the provided application.getLifecycleState(ILifecycleAware object) Returns the application lifecycle state for the provided application or lifecycle aware artifact.getUpdateState(IApplication application) Gets status of application update.getUrlAccesses(IApplication application) Returns a list of all found URL access instances for the provided application.voidprepare(IApplication application, String launchMode, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) Prepares underlying infrastructure to be ready for interaction.voidRemoves the application listener.voidsetDefaultApplication(org.eclipse.core.resources.IProject project, IApplication application) Sets the default registered project application.voidsetDefaultUrlAccess(IApplication application, IUrlAccess urlAccess) Sets the default URL access instance for the provided application.start(IApplication application, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) Runs application being developed.update(IApplication application, ApplicationUpdateType updateType, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) Updates infobase configuration as per project state.
-
Method Details
-
getApplication
Optional<IApplication> getApplication(org.eclipse.core.resources.IProject project, String id) throws ApplicationException Returns the project application with the provided id.- Parameters:
project- the project to get application for, cannot benullid- the id of the application, cannot benull- Returns:
- the optional found application
- Throws:
ApplicationException- if method call failed with some reason
-
getApplications
List<IApplication> getApplications(org.eclipse.core.resources.IProject project) throws ApplicationException Returns a list of all registered project applications.- Parameters:
project- the project to get applications for, cannot benull- Returns:
- a list of all registered project applications, never
null - Throws:
ApplicationException- if method call failed with some reason
-
getDefaultProject
Returns the default application owner project if there is any.- Returns:
- the default application owner project if there is any
- Throws:
ApplicationException- if method call failed with some reason
-
getDefaultApplication
Optional<IApplication> getDefaultApplication(org.eclipse.core.resources.IProject project) throws ApplicationException Returns the default registered project application.- Parameters:
project- the project to get default application for, cannot benull- Returns:
- the optional default registered project application
- Throws:
ApplicationException- if method call failed with some reason
-
getDefaultUrlAccess
Returns the default URL access instance for the provided application.- Parameters:
application- the application, cannot benull- Returns:
- the optional default URL access instance for the provided application
- Throws:
ApplicationException- if method call failed with some reason
-
getUpdateState
Gets status of application update. This shows whether infobase configuration has been updated and if any changes were made in project since then. This does not show if any changes has been made in infobase configuration via designer. Usecheck(com.e1c.g5.dt.applications.IApplication, com.e1c.g5.dt.applications.ApplicationCheckUnknownStateTreatment, com.e1c.g5.dt.applications.ExecutionContext, org.eclipse.core.runtime.IProgressMonitor)to detect such changes.- Parameters:
application- Application which state to get. Must not be null.- Returns:
- Update status of the application. Never null.
- Throws:
ApplicationException- if method call failed with some reason
-
getLifecycleState
Returns the application lifecycle state for the provided application or lifecycle aware artifact. May be unkown.- Parameters:
object- the object to get state for, cannot benull- Returns:
- the application lifecycle state, never
null - Throws:
ApplicationException- if method call failed with some reason
-
getApplicationTypes
Returns a list of all registered application types.- Returns:
- a list of all registered application types, never
null - Throws:
ApplicationException- if method call failed with some reason
-
getApplicationArtifacts
Returns a list of all found application artifacts for the provided application or application artifact.- Parameters:
object- the object to get application artifacts for, cannot benull- Returns:
- a list of all found application artifacts, never
null - Throws:
ApplicationException- if method call failed with some reason
-
getUrlAccesses
Returns a list of all found URL access instances for the provided application. May return the application itself if it is an instance ofIUrlAccess.- Parameters:
object- the object to get URL access instances for, cannot benull- Returns:
- a list of all found URL access instances, never
null - Throws:
ApplicationException- if method call failed with some reason
-
setDefaultApplication
void setDefaultApplication(org.eclipse.core.resources.IProject project, IApplication application) throws ApplicationException Sets the default registered project application.- Parameters:
project- the project to get application for, cannot benullapplication- the default project application to register for the project ornullto reset- Throws:
ApplicationException- if method call failed with some reason
-
setDefaultUrlAccess
void setDefaultUrlAccess(IApplication application, IUrlAccess urlAccess) throws ApplicationException Sets the default URL access instance for the provided application.- Parameters:
application- the application, cannot benullthe- default URL access instance to register for the provided application ornullto reset- 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 benullwhenUnknown- 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_NAMEwith 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.OKif application is ready to be started,IStatus.CANCELif user cancels operation,IStatus.ERRORif application is not ready to be started.- Throws:
ApplicationException- if thecontextdoes not specifyExecutionContext.ACTIVE_SHELL_NAMEor pulling changes from the associated infobase fails.
-
update
ApplicationUpdateState update(IApplication application, ApplicationUpdateType updateType, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws ApplicationException Updates infobase configuration as per project state. Project and infobase are determined by the application.- Parameters:
application- Application determining project and infobase to update. Must not be null.updateType- Determines if just changes in the project should be loaded into the infobasecontext- the execution context, cannot benullmonitor- the progress monitor to report progress to ornullif report is not desired- Returns:
- New state of the application. Never null.
- Throws:
ApplicationException- if method call failed with some reason
-
prepare
void prepare(IApplication application, String launchMode, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws ApplicationException Prepares underlying infrastructure to be ready for interaction. Some applications might consist in more than just a client (which can bestart(com.e1c.g5.dt.applications.IApplication, com.e1c.g5.dt.applications.ExecutionContext, org.eclipse.core.runtime.IProgressMonitor)-ed). 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 be#publish-ed or clientstart(com.e1c.g5.dt.applications.IApplication, com.e1c.g5.dt.applications.ExecutionContext, org.eclipse.core.runtime.IProgressMonitor)-ed. 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.IProgressMonitor). The application preparation for regular run and for debug run might be significantly 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 inappropriate to run it from UI thread. Consider usingorg.eclipse.jface.dialogs.ProgressMonitorDialogwith fork mode enabled.- Parameters:
application- the application to prepare, cannot benulllaunchMode- 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_TARGETandExecutionContext.DEBUG_URLmight be added/updated to reflect application settings when preparing for debug mode. Must not benull.monitor- the progress monitor to report progress to ornullif report is not desired- Throws:
ApplicationException- if method call failed with some reason
-
cleanup
void cleanup(IApplication application, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor 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.IProgressMonitor). 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.IProgressMonitor)and then a client application has been started bystart(com.e1c.g5.dt.applications.IApplication, com.e1c.g5.dt.applications.ExecutionContext, org.eclipse.core.runtime.IProgressMonitor)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). If the application has not been previouslyprepare(com.e1c.g5.dt.applications.IApplication, java.lang.String, com.e1c.g5.dt.applications.ExecutionContext, org.eclipse.core.runtime.IProgressMonitor)d then it still can be cleaned up without generating an error. 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.ProgressMonitorDialogwith fork mode enabled.- Parameters:
application- the application to stop, cannot benullcontext- the execution context, cannot benullmonitor- the progress monitor to report progress to ornullif report is not desired- Throws:
ApplicationException- if method call failed with some reason
-
start
Optional<Process> start(IApplication application, ExecutionContext context, org.eclipse.core.runtime.IProgressMonitor monitor) throws ApplicationException Runs application being developed. The method runs client application being developed and represented by the specifiedIApplication. Some application types (for example, server applications) require that preliminary preparation is performed before application being developed can be run. For this purpose,prepare(IApplication, String, ExecutionContext, IProgressMonitor)should be used beforehand.- Parameters:
application- the application to start, cannot benullcontext- the execution context, cannot benullmonitor- the progress monitor to report progress to, cannot benull- Returns:
- the optional application client system process, may be empty if application is web for example
- Throws:
ApplicationException- if method call failed with some reason
-
addAppllicationListener
Adds the application listener to listen to application events.- Parameters:
listener- the application listener, cannot benull
-
removeAppllicationListener
Removes the application listener.- Parameters:
listener- the application listener, cannot benull
-
delete
Deletes the specified application.- Parameters:
application- Application to be deleted. Must not benull.unsynchronize-trueif synchronization state is to be deleted orfalseis to keep synchronization state.- Throws:
ApplicationException- If the specified application could not be deleted for whatever reason.
-
findApplicationByInfobase
Optional<IApplication> findApplicationByInfobase(InfobaseReference infobase) throws ApplicationException Finds an application that uses specified infobase. If project is known then consider usingfindApplicationByInfobaseAndProject(com._1c.g5.v8.dt.platform.services.model.InfobaseReference, org.eclipse.core.resources.IProject)which could much faster.- Parameters:
infobase- Infobase for which to find application. Must not benull.- Returns:
- Application that uses specified infobase or an empty value if infobase is not used by any application.
Never
null. - Throws:
ApplicationException- If an error occurred while searching for matching application.
-
findApplicationByInfobaseAndProject
Optional<IApplication> findApplicationByInfobaseAndProject(InfobaseReference infobase, org.eclipse.core.resources.IProject project) throws ApplicationException Finds an application for the specified project that uses specified infobase. The method is similar tofindApplicationByInfobase(com._1c.g5.v8.dt.platform.services.model.InfobaseReference)but could be much faster.- Parameters:
infobase- Infobase for which to search application. Must not benull.project- Project for which to search application. Must not benull.- Returns:
- Application that uses specified infobase and project
or an empty value if infobase is not used by any application in the specified project.
Never
null. - Throws:
ApplicationException- If an error occurred while searching for matching application.
-