2 * Copyright 2000-2011 JetBrains s.r.o.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 package jetbrains.buildServer.nuget.agent.commands;
\r
19 import jetbrains.buildServer.RunBuildException;
\r
20 import jetbrains.buildServer.nuget.agent.parameters.NuGetPackParameters;
\r
21 import jetbrains.buildServer.nuget.agent.parameters.NuGetPublishParameters;
\r
22 import jetbrains.buildServer.nuget.agent.parameters.PackagesInstallParameters;
\r
23 import jetbrains.buildServer.nuget.agent.parameters.PackagesUpdateParameters;
\r
24 import org.jetbrains.annotations.NotNull;
\r
26 import java.io.File;
\r
27 import java.util.Collection;
\r
28 import java.util.Map;
\r
31 * Created by Eugene Petrenko (eugene.petrenko@gmail.com)
\r
32 * Date: 21.07.11 16:07
\r
34 public interface CommandFactory {
\r
37 <T> T createInstall(@NotNull PackagesInstallParameters params,
\r
38 @NotNull File packagesConfig,
\r
39 @NotNull File targetFolder,
\r
40 @NotNull Callback<T> factory) throws RunBuildException;
\r
43 <T> T createUpdate(@NotNull PackagesUpdateParameters params,
\r
44 @NotNull File packagesConfig,
\r
45 @NotNull File targetFolder,
\r
46 @NotNull Callback<T> factory) throws RunBuildException;
\r
49 <T> T createPush(@NotNull NuGetPublishParameters params,
\r
50 @NotNull File packagePath,
\r
51 @NotNull Callback<T> factory) throws RunBuildException;
\r
53 <T> T createPack(@NotNull NuGetPackParameters params,
\r
54 @NotNull File workdir,
\r
55 @NotNull Callback<T> factory) throws RunBuildException;
\r
57 public interface Callback<T> {
\r
59 * Called with generated arguments to crate execurable instance or run command
\r
60 * @param program program to run
\r
61 * @param workingDir working firectory of program
\r
62 * @param argz arguments array
\r
63 * @param additionalEnvironment environment variables that has to be added
\r
64 * @return some result object depending of caller's desire
\r
65 * @throws RunBuildException if failed to create/execure command
\r
68 T createCommand(@NotNull File program,
\r
69 @NotNull File workingDir,
\r
70 @NotNull Collection<String> argz,
\r
71 @NotNull Map<String, String> additionalEnvironment) throws RunBuildException;
\r