import java.util.Map;
import java.util.Set;
-import org.argeo.osgi.boot.OsgiBootException;
import org.argeo.osgi.boot.OsgiBootUtils;
import org.eclipse.osgi.launch.EquinoxFactory;
import org.osgi.framework.Bundle;
osgiContext.load();
}
- void addSource(ProvisioningSource context) {
- sources.add(context);
+ protected void addSource(ProvisioningSource source) {
+ sources.add(source);
}
- void installWholeSource(ProvisioningSource context) {
+ void installWholeSource(ProvisioningSource source) {
Set<Bundle> updatedBundles = new HashSet<>();
- for (A2Contribution contribution : context.contributions.values()) {
+ for (A2Contribution contribution : source.listContributions(null)) {
for (A2Component component : contribution.components.values()) {
A2Module module = component.last().last();
Bundle bundle = installOrUpdate(module);
public void registerSource(String uri) {
try {
URI u = new URI(uri);
- if ("a2".equals(u.getScheme())) {
+ if (A2Source.SCHEME_A2.equals(u.getScheme())) {
if (u.getHost() == null || "".equals(u.getHost())) {
String baseStr = u.getPath();
if (File.separatorChar == '\\') {// MS Windows
}
}
} catch (Exception e) {
- throw new OsgiBootException("Cannot add source " + uri, e);
+ throw new A2Exception("Cannot add source " + uri, e);
}
}
String baseStr = base.toString();
if (File.separatorChar == '\\')// MS Windows
baseStr = '/' + baseStr.replace(File.separatorChar, '/');
- URI baseUri = new URI("a2", null, null, 0, baseStr, null, null);
+ URI baseUri = new URI(A2Source.SCHEME_A2, null, null, 0, baseStr, null, null);
registerSource(baseUri.toString());
OsgiBootUtils.info("Registered " + baseUri + " as default source");
return true;
}
}
- /** @return the new/updated bundle, or null if nothign was done. */
- Bundle installOrUpdate(A2Module module) {
+ /** @return the new/updated bundle, or null if nothing was done. */
+ protected Bundle installOrUpdate(A2Module module) {
try {
ProvisioningSource moduleSource = module.getBranch().getComponent().getContribution().getSource();
Version moduleVersion = module.getVersion();