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 JCM has
17 public class ClasspathSource
extends AbstractProvisioningSource
{
18 void load() throws IOException
{
19 A2Contribution classpathContribution
= getOrAddContribution( A2Contribution
.CLASSPATH
);
20 List
<String
> classpath
= Arrays
.asList(System
.getProperty("java.class.path").split(File
.pathSeparator
));
21 parts
: for (String part
: classpath
) {
22 Path file
= Paths
.get(part
);
25 version
= new Version(readVersionFromModule(file
));
26 } catch (Exception e
) {
30 String moduleName
= readSymbolicNameFromModule(file
);
31 A2Component component
= classpathContribution
.getOrAddComponent(moduleName
);
32 A2Module module
= component
.getOrAddModule(version
, file
);
33 if (OsgiBootUtils
.isDebug())
34 OsgiBootUtils
.debug("Registered " + module
);