Package org.osgi.framework

Examples of org.osgi.framework.BundleException


    try {
      in.close();
    } catch (IOException e) {
      // ignore
    }
    throw new BundleException("Cannot update composite bundles", BundleException.INVALID_OPERATION); //$NON-NLS-1$
  }
View Full Code Here


  public static Headers parseManifest(InputStream in) throws BundleException {
    Headers headers = new Headers(10);
    try {
      ManifestElement.parseBundleManifest(in, headers);
    } catch (IOException e) {
      throw new BundleException(Msg.MANIFEST_IOEXCEPTION, BundleException.MANIFEST_ERROR, e);
    }
    headers.setReadOnly();
    return headers;
  }
View Full Code Here

    ClassLoadingHook[] loaderHooks = sourcedata.getAdaptor().getHookRegistry().getClassLoadingHooks();
    boolean hookAdded = false;
    for (int i = 0; i < loaderHooks.length; i++)
      hookAdded |= loaderHooks[i].addClassPathEntry(result, cp, hostloader, sourcedata, sourcedomain);
    if (!addClassPathEntry(result, cp, hostloader, sourcedata, sourcedomain) && !hookAdded) {
      BundleException be = new BundleException(NLS.bind(AdaptorMsg.BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION, cp, sourcedata.getLocation()), BundleException.MANIFEST_ERROR);
      sourcedata.getAdaptor().getEventPublisher().publishFrameworkEvent(FrameworkEvent.INFO, sourcedata.getBundle(), be);
    }
  }
View Full Code Here

    if (Debug.DEBUG && Debug.DEBUG_GENERAL)
      if (in == null)
        Debug.println("Unable to find system bundle manifest " + Constants.OSGI_BUNDLE_MANIFEST); //$NON-NLS-1$

    if (in == null)
      throw new BundleException(AdaptorMsg.SYSTEMBUNDLE_MISSING_MANIFEST, BundleException.MANIFEST_ERROR);
    return Headers.parseManifest(in);
  }
View Full Code Here

        manifestTimeStamp = bundledata.getBundleFile().getEntry(Constants.OSGI_BUNDLE_MANIFEST).getTime();
      return builtIn;
    }
    Dictionary result = generateManifest(null);
    if (result == null)
      throw new BundleException(NLS.bind(EclipseAdaptorMsg.ECLIPSE_DATA_MANIFEST_NOT_FOUND, bundledata.getLocation()));
    return result;
  }
View Full Code Here

    Dictionary generatedManifest;
    try {
      generatedManifest = converter.convertManifest(bundledata.getBundleFile().getBaseFile(), true, null, true, null);
    } catch (PluginConversionException pce) {
      String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONVERTER_ERROR_CONVERTING, bundledata.getBundleFile().getBaseFile());
      throw new BundleException(message, BundleException.MANIFEST_ERROR, pce);
    }

    //Now we know the symbolicId and the version of the bundle, we check to see if don't have a manifest for it already
    Version version = Version.parseVersion((String) generatedManifest.get(Constants.BUNDLE_VERSION));
    String symbolicName = ManifestElement.parseHeader(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME, (String) generatedManifest.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME))[0].getValue();
View Full Code Here

    private Bundle installBundle(String groupId, String artifactId, String version, boolean startBundle) throws BundleException {
        String filespec = groupId + ":" + artifactId + ":jar:" + version;
        File[] resolved = Maven.resolver().resolve(filespec).withoutTransitivity().asFile();
        if (resolved == null || resolved.length == 0)
            throw new BundleException("Cannot obtain maven artifact: " + filespec);

        File bundleFile;
        if (resolved.length == 1) {
            bundleFile = resolved[0];
        } else if (version.endsWith("SNAPSHOT")) {
            // [TODO] process multiple snapshots
            throw new BundleException("Multiple maven artifacts for: " + filespec);
        } else {
            throw new BundleException("Multiple maven artifacts for: " + filespec);
        }

        String location = bundleFile.toURI().toString();
        log.info("Installing bundle: " + location);
        try {
View Full Code Here

        } catch (RuntimeException rte) {
            throw rte;
        } catch (BundleException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new BundleException(MESSAGES.cannotDeployBundle(dep), ex);
        }
    }
View Full Code Here

                Method method = runtimeClass.getMethod("getInstance");
                instance = (OSGiRuntime) method.invoke(null);
                return instance;
               
            } catch (Exception e) {
                throw new BundleException("Could not start OSGi runtime " + runtimeClassName, e);
            }
        }

        try {
           
            instance = EquinoxRuntime.getInstance();
            return instance;
           
        } catch (ClassNotFoundException e) {
            // Ignore
        } catch (Throwable e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
        }

        try {

            instance = FelixRuntime.getInstance();
            return instance;
        } catch (ClassNotFoundException e) {
            // Ignore
        } catch (Throwable e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
        }

        try {
      
            instance = KnopflerfishRuntime.getInstance();
            return instance;
           
        } catch (ClassNotFoundException e) {
            // Ignore
        } catch (Throwable e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
        }

        throw new BundleException("Could not start OSGi runtime from the classpath");
    }
View Full Code Here

                Method method = runtimeClass.getMethod("getInstance");
                instance = (OSGiTestRuntime) method.invoke(null);
                return instance;
               
            } catch (Exception e) {
                throw new BundleException("Could not start OSGi runtime " + runtimeClassName, e);
            }
        }

        instance = FelixTestRuntime.getInstance();
        return instance;
View Full Code Here

TOP

Related Classes of org.osgi.framework.BundleException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.