Commit 6d9a9b8edc541b072bd5734a6eb2e7b4db2b8ea5

  • avatar
  • tomson
  • Thu May 14 21:14:48 CEST 2009
Special loading when running in an OSGi-Env
  
153153 public int load;
154154 public DeploymentSpec spec;
155155 public boolean loaded;
156 public boolean isOsgi;
156157 }
157158
158159 private static class DeploymentSpec {
393393 unpackDeploymentSpec(url, jarName);
394394 ++count;
395395 }
396 } else if( url.getProtocol().equals("bundleresource") ) {
397 String eform = url.toExternalForm();
398
399 // Try to decide the name of the .jar file to have a
400 // reference point for later..
401 int end = eform.length() - DEPLOY_DESCRIPTOR_NAME.length() - 2;
402 int start = eform.lastIndexOf('/', end - 1) + 1;
403
404 if (start > 0 && start < end) {
405 String jarName = eform.substring(start, end);
406 if (VERBOSE_LOADING)
407 reporter.report("Loading ", jarName, " from ", eform);
408
409 unpackDeploymentSpecOSGi(url,jarName);
410 ++count;
411 }
412
396413 }
397414 }
398415
472472 }
473473
474474 reporter.report(" - using deployment spec");
475 File libFile = new File(jambiTempDirBase(e.spec.key), e.name);
476 Runtime.getRuntime().load(libFile.getAbsolutePath());
475 if( ! e.isOsgi ) {
476 File libFile = new File(jambiTempDirBase(e.spec.key), e.name);
477 Runtime.getRuntime().load(libFile.getAbsolutePath());
478 } else {
479 System.loadLibrary(new File(e.name).getName());
480 }
477481 reporter.report(" - ok!");
478482 e.loaded = true;
479483
539539 }
540540 }
541541
542
542 private static void unpackDeploymentSpecOSGi(URL deploymentSpec, String jarName) throws Exception {
543 DeploymentSpec spec = readDeploySpec(deploymentSpec, jarName);
544
545 if( spec == null )
546 return;
547
548 for (LibraryEntry e : spec.libraries) {
549 e.isOsgi=true;
550 }
551 }
552
543553 private static void unpackDeploymentSpec(URL deploymentSpec, String jarName) throws Exception {
544554 reporter.report("Unpacking .jar file: '", jarName, "'");
545555