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
30 * Created by Eugene Petrenko (eugene.petrenko@gmail.com)
\r
31 * Date: 21.07.11 16:07
\r
33 public interface CommandFactory {
\r
36 <T> T createInstall(@NotNull PackagesInstallParameters params,
\r
37 @NotNull File packagesConfig,
\r
38 @NotNull File targetFolder,
\r
39 @NotNull Callback<T> factory) throws RunBuildException;
\r
42 <T> T createUpdate(@NotNull PackagesUpdateParameters params,
\r
43 @NotNull File packagesConfig,
\r
44 @NotNull File targetFolder,
\r
45 @NotNull Callback<T> factory) throws RunBuildException;
\r
48 <T> T createPush(@NotNull NuGetPublishParameters params,
\r
49 @NotNull File packagePath,
\r
50 @NotNull Callback<T> factory) throws RunBuildException;
\r
52 <T> T createPack(@NotNull NuGetPackParameters params,
\r
53 @NotNull File workdir,
\r
54 @NotNull Callback<T> factory) throws RunBuildException;
\r
56 public interface Callback<T> {
\r
58 * Called with generated arguments to crate execurable instance or run command
\r
59 * @param program program to run
\r
60 * @param workingDir working firectory of program
\r
61 * @param argz arguments array
\r
62 * @return some result object depending of caller's desire
\r
63 * @throws RunBuildException if failed to create/execure command
\r
66 T createCommand(@NotNull File program,
\r
67 @NotNull final File workingDir,
\r
68 @NotNull Collection<String> argz) throws RunBuildException;
\r