X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.init%2Fsrc%2Forg%2Fargeo%2Finit%2Fa2%2FFsA2Source.java;h=d4aa863869aa682f3aec5c92e80e8212d8042f2c;hb=c66685995c1bf2c59bdf6d68753470c85828310a;hp=5099eed15be9509ec516a44223dc095b07114025;hpb=0a0a90e832a2fe24dc55d1cf67d75e276ad61b2c;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.init/src/org/argeo/init/a2/FsA2Source.java b/org.argeo.init/src/org/argeo/init/a2/FsA2Source.java index 5099eed15..d4aa86386 100644 --- a/org.argeo.init/src/org/argeo/init/a2/FsA2Source.java +++ b/org.argeo.init/src/org/argeo/init/a2/FsA2Source.java @@ -6,7 +6,6 @@ import java.net.URISyntaxException; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.HashMap; import java.util.Map; import java.util.SortedMap; @@ -18,15 +17,16 @@ import org.osgi.framework.Version; /** A file system {@link AbstractProvisioningSource} in A2 format. */ public class FsA2Source extends AbstractProvisioningSource implements A2Source { private final Path base; - private Map xOr; + private final Map xOr; - public FsA2Source(Path base) { - this(base, new HashMap<>()); - } +// public FsA2Source(Path base) { +// this(base, new HashMap<>()); +// } - public FsA2Source(Path base, Map xOr) { + public FsA2Source(Path base, Map xOr, boolean useReference) { + super(useReference); this.base = base; - this.xOr = xOr; + this.xOr = new HashMap<>(xOr); } void load() throws IOException { @@ -92,19 +92,8 @@ public class FsA2Source extends AbstractProvisioningSource implements A2Source { String ext = moduleFileName.substring(lastDot + 1); if (!"jar".equals(ext)) continue modules; -// String moduleName = moduleFileName.substring(0, lastDot); -// if (moduleName.endsWith("-SNAPSHOT")) -// moduleName = moduleName.substring(0, moduleName.length() - "-SNAPSHOT".length()); -// int lastDash = moduleName.lastIndexOf('-'); -// String versionStr = moduleName.substring(lastDash + 1); -// String componentName = moduleName.substring(0, lastDash); - // if(versionStr.endsWith("-SNAPSHOT")) { - // versionStr = readVersionFromModule(modulePath); - // } Version version; -// try { -// version = new Version(versionStr); -// } catch (Exception e) { + // TODO optimise? check attributes? String[] nameVersion = readNameVersionFromModule(modulePath); String componentName = nameVersion[0]; String versionStr = nameVersion[1]; @@ -139,19 +128,19 @@ public class FsA2Source extends AbstractProvisioningSource implements A2Source { } } - public static void main(String[] args) { - if (args.length == 0) - throw new IllegalArgumentException("Usage: "); - try { - Map xOr = new HashMap<>(); - xOr.put("osgi", "equinox"); - xOr.put("swt", "rap"); - FsA2Source context = new FsA2Source(Paths.get(args[0]), xOr); - context.load(); - context.asTree(); - } catch (Exception e) { - e.printStackTrace(); - } - } +// public static void main(String[] args) { +// if (args.length == 0) +// throw new IllegalArgumentException("Usage: "); +// try { +// Map xOr = new HashMap<>(); +// xOr.put("osgi", "equinox"); +// xOr.put("swt", "rap"); +// FsA2Source context = new FsA2Source(Paths.get(args[0]), xOr); +// context.load(); +// context.asTree(); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } }