]> git.argeo.org Git - gpl/argeo-slc.git/blob - ide/plugins/org.argeo.slc.ide.ui/src/org/argeo/slc/ide/ui/DeployedSlcSystem.java
Merge branch 'master' of https://github.com/argeo/argeo-slc.git
[gpl/argeo-slc.git] / ide / plugins / org.argeo.slc.ide.ui / src / org / argeo / slc / ide / ui / DeployedSlcSystem.java
1 package org.argeo.slc.ide.ui;
2
3 import java.io.File;
4 import java.io.IOException;
5 import java.util.List;
6 import java.util.Vector;
7
8 import org.eclipse.core.runtime.CoreException;
9 import org.eclipse.jdt.launching.IVMInstall;
10 import org.eclipse.jdt.launching.JavaRuntime;
11
12 public class DeployedSlcSystem implements SlcSystem {
13 private File baseDir;
14 private String relLibDir = "lib";
15
16 public DeployedSlcSystem(String baseDirPath) {
17 try {
18 this.baseDir = new File(baseDirPath).getCanonicalFile();
19 } catch (IOException e) {
20 throw new RuntimeException("Cannot get path for " + baseDirPath, e);
21 }
22 }
23
24 public String[] getClasspath() throws CoreException {
25 List<String> classpath = new Vector<String>();
26 File libDir = new File(baseDir.getPath() + File.separator + relLibDir);
27 File[] files = libDir.listFiles();
28 for (File file : files) {
29 try {
30 classpath.add(file.getCanonicalPath());
31 } catch (IOException e) {
32 throw new RuntimeException("Cannot get path for " + file, e);
33 }
34 }
35 return classpath.toArray(new String[classpath.size()]);
36 }
37
38 public IVMInstall getVmInstall() throws CoreException {
39 return JavaRuntime.getDefaultVMInstall();
40 }
41
42 public String getAntHome() {
43 return baseDir.getPath();
44 }
45
46 public String getJavaLibraryPath() {
47 return baseDir.getPath() + File.separator + "bin";
48 }
49
50 }