View Javadoc
1   /*
2    * Copyright (C) 2007-2012 Argeo GmbH
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  package org.argeo.slc.core.deploy;
17  
18  import java.io.File;
19  import java.util.Map;
20  import java.util.TreeMap;
21  
22  import org.apache.commons.logging.Log;
23  import org.apache.commons.logging.LogFactory;
24  import org.argeo.slc.build.Distribution;
25  import org.argeo.slc.deploy.DeploymentData;
26  import org.argeo.slc.deploy.InstalledExecutables;
27  import org.argeo.slc.deploy.TargetData;
28  
29  public class SimpleExecutables implements InstalledExecutables {
30  	private final static Log log = LogFactory.getLog(SimpleExecutables.class);
31  
32  	private String baseDir;
33  	private Map<String, String> paths = new TreeMap<String, String>();
34  
35  	private Distribution distribution;
36  
37  	public String getExecutablePath(String key) {
38  		String path = paths.get(key);
39  		if (path == null) {
40  			if (log.isDebugEnabled())
41  				log.debug("No executable path found for key " + key
42  						+ ", using the key as executable name.");
43  			path = key;
44  		}
45  
46  		if (baseDir != null)
47  			path = baseDir + File.separator + path;
48  		return path;
49  	}
50  
51  	public String getDeployedSystemId() {
52  		// TODO Auto-generated method stub
53  		return null;
54  	}
55  
56  	public DeploymentData getDeploymentData() {
57  		// TODO Auto-generated method stub
58  		return null;
59  	}
60  
61  	public Distribution getDistribution() {
62  		return distribution;
63  	}
64  
65  	public TargetData getTargetData() {
66  		// TODO Auto-generated method stub
67  		return null;
68  	}
69  
70  	public String getBaseDir() {
71  		return baseDir;
72  	}
73  
74  	public void setBaseDir(String baseDir) {
75  		this.baseDir = baseDir;
76  	}
77  
78  	public Map<String, String> getPaths() {
79  		return paths;
80  	}
81  
82  	public void setPaths(Map<String, String> paths) {
83  		this.paths = paths;
84  	}
85  
86  	public void setDistribution(Distribution distribution) {
87  		this.distribution = distribution;
88  	}
89  
90  }