component.branches.put(id, this);
}
+ public Iterable<A2Module> listModules(Object filter) {
+ return modules.values();
+ }
+
A2Module getOrAddModule(Version version, Object locator) {
if (modules.containsKey(version)) {
A2Module res = modules.get(version);
return new A2Module(this, version, locator);
}
- A2Module last() {
+ public A2Module last() {
return modules.get(modules.lastKey());
}
- A2Module first() {
+ public A2Module first() {
return modules.get(modules.firstKey());
}
- A2Component getComponent() {
+ public A2Component getComponent() {
return component;
}
- String getId() {
+ public String getId() {
return id;
}
contribution.components.put(id, this);
}
+ public Iterable<A2Branch> listBranches(Object filter) {
+ return branches.values();
+ }
+
A2Branch getOrAddBranch(String branchId) {
if (branches.containsKey(branchId))
return branches.get(branchId);
return module;
}
- A2Branch last() {
+ public A2Branch last() {
return branches.get(branches.lastKey());
}
- A2Contribution getContribution() {
+ public A2Contribution getContribution() {
return contribution;
}
- String getId() {
+ public String getId() {
return id;
}
// context.contributions.put(id, this);
}
+ public Iterable<A2Component> listComponents(Object filter) {
+ return components.values();
+ }
+
A2Component getOrAddComponent(String componentId) {
if (components.containsKey(componentId))
return components.get(componentId);
* <code>Bundle-SymbolicName</code> and <code>Bundle-version</code>. This is the
* equivalent of the full coordinates of a Maven artifact version.
*/
-class A2Module implements Comparable<A2Module> {
+public class A2Module implements Comparable<A2Module> {
private final A2Branch branch;
private final Version version;
private final Object locator;
branch.modules.put(version, this);
}
- A2Branch getBranch() {
+ public A2Branch getBranch() {
return branch;
}
- Version getVersion() {
+ public Version getVersion() {
return version;
}
package org.argeo.init.a2;
+import java.net.URI;
+
/** A provisioning source in A2 format. */
public interface A2Source extends ProvisioningSource {
final static String SCHEME_A2 = "a2";
final static String DEFAULT_A2_URI = SCHEME_A2 + ":///";
+
+ URI getUri();
}
package org.argeo.init.a2;
import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
private final Path base;
public FsA2Source(Path base) {
- super();
this.base = base;
}
}
+ @Override
+ public URI getUri() {
+ URI baseUri = base.toUri();
+ try {
+ if (baseUri.getScheme().equals("file")) {
+ return new URI(SCHEME_A2, null, base.toString(), null);
+ } else {
+ throw new UnsupportedOperationException("Unsupported scheme " + baseUri.getScheme());
+ }
+ } catch (URISyntaxException e) {
+ throw new IllegalStateException("Cannot build URI from " + baseUri, e);
+ }
+ }
+
public static void main(String[] args) {
try {
FsA2Source context = new FsA2Source(Paths.get(