1 package org
.argeo
.init
.a2
;
4 import java
.io
.IOException
;
5 import java
.nio
.file
.Path
;
6 import java
.nio
.file
.Paths
;
7 import java
.util
.Arrays
;
10 import org
.argeo
.init
.osgi
.OsgiBootUtils
;
11 import org
.osgi
.framework
.Version
;
14 * A provisioning source based on the linear classpath with which the JVM has
17 public class ClasspathSource
extends AbstractProvisioningSource
{
19 public ClasspathSource() {
23 void load() throws IOException
{
24 A2Contribution classpathContribution
= getOrAddContribution( A2Contribution
.CLASSPATH
);
25 List
<String
> classpath
= Arrays
.asList(System
.getProperty("java.class.path").split(File
.pathSeparator
));
26 parts
: for (String part
: classpath
) {
27 Path file
= Paths
.get(part
);
30 version
= new Version(readVersionFromModule(file
));
31 } catch (Exception e
) {
35 String moduleName
= readSymbolicNameFromModule(file
);
36 A2Component component
= classpathContribution
.getOrAddComponent(moduleName
);
37 A2Module module
= component
.getOrAddModule(version
, file
);
38 if (OsgiBootUtils
.isDebug())
39 OsgiBootUtils
.debug("Registered " + module
);