Mercurial > hg > tc-symbol-server
comparison agent/src/jetbrains/buildServer/symbols/SrcSrvStreamBuilder.java @ 25:f4e0050e2a2f
resolve server url from config parameter
author | Evgeniy.Koshkin |
---|---|
date | Tue, 06 Aug 2013 14:18:09 +0400 |
parents | agent/src/jetbrains/buildServer/symbols/SrcSrvStreamProvider.java@9cbdbfed44f4 |
children | 6ac3c2491e1a |
comparison
equal
deleted
inserted
replaced
24:9cbdbfed44f4 | 25:f4e0050e2a2f |
---|---|
1 /* | |
2 * Copyright 2000-2013 JetBrains s.r.o. | |
3 * | |
4 * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 * you may not use this file except in compliance with the License. | |
6 * You may obtain a copy of the License at | |
7 * | |
8 * http://www.apache.org/licenses/LICENSE-2.0 | |
9 * | |
10 * Unless required by applicable law or agreed to in writing, software | |
11 * distributed under the License is distributed on an "AS IS" BASIS, | |
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 * See the License for the specific language governing permissions and | |
14 * limitations under the License. | |
15 */ | |
16 | |
17 package jetbrains.buildServer.symbols; | |
18 | |
19 import java.io.File; | |
20 import java.io.FileWriter; | |
21 import java.io.IOException; | |
22 import java.util.Collection; | |
23 | |
24 /** | |
25 * @author Evgeniy.Koshkin | |
26 */ | |
27 public class SrcSrvStreamBuilder { | |
28 | |
29 private final FileUrlProvider myUrlProvider; | |
30 | |
31 public SrcSrvStreamBuilder(final FileUrlProvider urlProvider) { | |
32 myUrlProvider = urlProvider; | |
33 } | |
34 | |
35 public void dumpStreamToFile(File targetFile, Collection<File> sourceFiles) throws IOException { | |
36 final FileWriter fileWriter = new FileWriter(targetFile.getPath(), true); | |
37 | |
38 try { | |
39 fileWriter.write("SRCSRV: ini ------------------------------------------------\r\n"); | |
40 fileWriter.write("VERSION=3\r\n"); | |
41 fileWriter.write("INDEXVERSION=2\r\n"); | |
42 fileWriter.write("VERCTRL=http\r\n"); | |
43 fileWriter.write("SRCSRV: variables ------------------------------------------\r\n"); | |
44 fileWriter.write("SRCSRVVERCTRL=http\r\n"); | |
45 fileWriter.write(String.format("HTTP_ALIAS=%s\r\n", myUrlProvider.getHttpAlias())); | |
46 fileWriter.write("HTTP_EXTRACT_TARGET=%HTTP_ALIAS%/%var2%\r\n"); | |
47 fileWriter.write("SRCSRVTRG=%HTTP_EXTRACT_TARGET%\r\n"); | |
48 fileWriter.write("SRCSRVCMD=\r\n"); | |
49 fileWriter.write("SRCSRV: source files ------------------------------------------\r\n"); | |
50 for(File sourceFile : sourceFiles){ | |
51 final String sourceFileCanonical = sourceFile.getCanonicalPath(); | |
52 fileWriter.write(String.format("%s*%s\r\n", sourceFileCanonical, myUrlProvider.getFileUrl(sourceFileCanonical))); | |
53 } | |
54 fileWriter.write("SRCSRV: end ------------------------------------------------"); | |
55 } | |
56 finally { | |
57 fileWriter.close(); | |
58 } | |
59 } | |
60 } |