}
String domainName = domainProps.getProperty("domainName", directory.getName());
String domainURI = domainProps.getProperty("domainURI", domainName);
DomainRegistry domainRegistry = domainRegistryFactory.getEndpointRegistry(domainURI, domainName);
Node node = new NodeImpl(deployer, compositeActivator, domainRegistry, extensionPointRegistry, null);
List<String> installed = new ArrayList<String>();
for (File f : directory.listFiles()) {
if (f.getName().endsWith(".jar") || f.getName().endsWith(".zip") || (f.isDirectory() && !f.getName().startsWith("."))) {
String fn = f.getName().lastIndexOf('.') == -1 ? f.getName() : f.getName().substring(0, f.getName().lastIndexOf('.'));
// ignore the contribution if it has an associated exploded folder version
if (!f.isDirectory() && new File(f.getParent(), fn).isDirectory()) {
continue;
}
String metaData = null;
for (File f2 : directory.listFiles()) {
if (f2.getName().startsWith(fn) && f2.getName().endsWith(".xml")) {
metaData = f2.getPath();
break;
}
}
List<String> dependencyURIs = new ArrayList<String>();
File dependencyFile = new File(directory, fn + ".dependencies");
if (dependencyFile.exists()) {
BufferedReader br = new BufferedReader(new FileReader(dependencyFile));
String s;
while ((s = br.readLine()) != null) {
if (!s.startsWith("#") && s.trim().length() > 0) {
dependencyURIs.addAll(Arrays.asList(s.trim().split("[ ,]+")));
}
}
br.close();
}
String curi = node.installContribution(null, f.getPath(), metaData, dependencyURIs);
installed.add(curi);
for (File f2 : directory.listFiles()) {
if (f2.getName().startsWith(fn) && f2.getName().endsWith(".composite")) {
node.addDeploymentComposite(curi, new FileReader(f2));
}
}
}
}
for (String curi : installed) {
node.startDeployables(curi);
}
return node;
}