8026c47d309e48bf4105c88118028de4789e752d
[idea/community.git] / platform / external-system-impl / src / com / intellij / openapi / externalSystem / service / remote / RemoteExternalSystemProjectResolverImpl.java
1 package com.intellij.openapi.externalSystem.service.remote;
2
3 import com.intellij.openapi.externalSystem.model.DataNode;
4 import com.intellij.openapi.externalSystem.model.ExternalSystemException;
5 import com.intellij.openapi.externalSystem.model.project.ProjectData;
6 import com.intellij.openapi.externalSystem.model.settings.ExternalSystemExecutionSettings;
7 import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId;
8 import com.intellij.openapi.externalSystem.service.project.ExternalSystemProjectResolver;
9 import com.intellij.util.Producer;
10 import org.jetbrains.annotations.NotNull;
11 import org.jetbrains.annotations.Nullable;
12
13 /**
14  * Defines common interface for resolving gradle project, i.e. building object-level representation of <code>'build.gradle'</code>.
15  * 
16  * @author Denis Zhdanov
17  * @since 8/8/11 10:58 AM
18  */
19 public class RemoteExternalSystemProjectResolverImpl<S extends ExternalSystemExecutionSettings>
20   extends AbstractRemoteExternalSystemService<S> implements RemoteExternalSystemProjectResolver<S>
21 {
22
23   private final ExternalSystemProjectResolver<S> myDelegate;
24
25   public RemoteExternalSystemProjectResolverImpl(@NotNull ExternalSystemProjectResolver<S> delegate) {
26     myDelegate = delegate;
27   }
28
29   @Nullable
30   @Override
31   public DataNode<ProjectData> resolveProjectInfo(@NotNull final ExternalSystemTaskId id,
32                                                   @NotNull final String projectPath,
33                                                   final boolean isPreviewMode,
34                                                   final S settings)
35     throws ExternalSystemException, IllegalArgumentException, IllegalStateException
36   {
37     return execute(id, () -> myDelegate.resolveProjectInfo(id, projectPath, isPreviewMode, settings, getNotificationListener()));
38   }
39
40   @Override
41   public boolean cancelTask(@NotNull final ExternalSystemTaskId id)
42     throws ExternalSystemException, IllegalArgumentException, IllegalStateException {
43     return myDelegate.cancelTask(id, getNotificationListener());
44   }
45 }