[git] Restore double-dot as prohibited combination, and substitute to underscore
[idea/community.git] / platform / external-system-impl / src / com / intellij / openapi / externalSystem / service / RemoteExternalSystemFacade.java
1 package com.intellij.openapi.externalSystem.service;
2
3 import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
4 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
5 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskType;
6 import com.intellij.openapi.externalSystem.service.internal.ExternalSystemTaskAware;
7 import com.intellij.openapi.externalSystem.service.remote.RawExternalSystemProjectResolver;
8 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProgressNotificationManager;
9 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemProjectResolver;
10 import com.intellij.openapi.externalSystem.service.remote.RemoteExternalSystemTaskManager;
11 import org.jetbrains.annotations.NotNull;
12
13 import java.rmi.Remote;
14 import java.rmi.RemoteException;
15 import java.util.Collections;
16 import java.util.Map;
17 import java.util.Set;
18
19 /**
20  * Serves as a facade for working with external system which might be located at an external (non-ide) process.
21  * <p/>
22  * The main idea is that we don't want to use it directly from an ide process (to avoid unnecessary heap/perm gen pollution, 
23  * memory leaks etc). So, we use it at external process and current class works as a facade to it from ide process.
24  * 
25  * @author Denis Zhdanov
26  */
27 public interface RemoteExternalSystemFacade<S extends ExternalSystemExecutionSettings> extends Remote, ExternalSystemTaskAware {
28
29   /** <a href="http://en.wikipedia.org/wiki/Null_Object_pattern">Null object</a> for {@link RemoteExternalSystemFacade}. */
30   RemoteExternalSystemFacade<?> NULL_OBJECT = new RemoteExternalSystemFacade<ExternalSystemExecutionSettings>() {
31     @NotNull
32     @Override
33     public RemoteExternalSystemProjectResolver<ExternalSystemExecutionSettings> getResolver()
34       throws IllegalStateException
35     {
36       return RemoteExternalSystemProjectResolver.NULL_OBJECT;
37     }
38
39
40     @NotNull
41     @Override
42     public RemoteExternalSystemTaskManager<ExternalSystemExecutionSettings> getTaskManager() {
43       return RemoteExternalSystemTaskManager.NULL_OBJECT;
44     }
45
46     @Override
47     public void applySettings(@NotNull ExternalSystemExecutionSettings settings) {
48     }
49
50     @Override
51     public void applyProgressManager(@NotNull RemoteExternalSystemProgressNotificationManager progressManager) {
52     }
53
54     @NotNull
55     @Override
56     public RawExternalSystemProjectResolver<ExternalSystemExecutionSettings> getRawProjectResolver() {
57       return RawExternalSystemProjectResolver.Companion.getNULL_OBJECT();
58     }
59
60     @Override
61     public boolean isTaskInProgress(@NotNull ExternalSystemTaskId id) {
62       return false;
63     }
64
65     @Override
66     public boolean cancelTask(@NotNull ExternalSystemTaskId id) {
67       return false;
68     }
69
70     @NotNull
71     @Override
72     public Map<ExternalSystemTaskType, Set<ExternalSystemTaskId>> getTasksInProgress() {
73       return Collections.emptyMap();
74     }
75   };
76
77   /**
78    * Exposes {@code 'resolve external system project'} service that works at another process.
79    *
80    * @return                        {@code 'resolve external system project'} service
81    * @throws RemoteException        in case of unexpected I/O exception during processing
82    * @throws IllegalStateException  in case of inability to create the service
83    */
84   @NotNull
85   RemoteExternalSystemProjectResolver<S> getResolver() throws RemoteException, IllegalStateException;
86
87   /**
88    * Exposes {@code 'run external system task'} service which works at another process.
89    *
90    * @return external system build manager
91    * @throws RemoteException  in case of inability to create the service
92    */
93   @NotNull
94   RemoteExternalSystemTaskManager<S> getTaskManager() throws RemoteException;
95
96   /**
97    * Asks remote external system process to apply given settings.
98    *
99    * @param settings            settings to apply
100    * @throws RemoteException    in case of unexpected I/O exception during processing
101    */
102   void applySettings(@NotNull S settings) throws RemoteException;
103
104   /**
105    * Asks remote external system process to use given progress manager.
106    *
107    * @param progressManager  progress manager to use
108    * @throws RemoteException    in case of unexpected I/O exception during processing
109    */
110   void applyProgressManager(@NotNull RemoteExternalSystemProgressNotificationManager progressManager) throws RemoteException;
111
112   /**
113    * Same as {@link #getResolver()}, but operating on raw result
114    * @return
115    */
116   @NotNull
117   RawExternalSystemProjectResolver<S> getRawProjectResolver() throws RemoteException;
118 }