Package com.adito.extensions

Examples of com.adito.extensions.ExtensionBundle


  public Collection<String> getMountNames() throws Exception {
    Iterator itr = ExtensionStore.getInstance().getExtensionBundles().iterator();
    List<String> l = new ArrayList<String>();
    while (itr.hasNext()) {
      ExtensionBundle b = (ExtensionBundle) itr.next();
      l.add(b.getId());
    }
    return l;
  }
View Full Code Here


      loadBundle(descriptors[0], false);
    }
  }

  private void loadBundle(File descriptor, boolean devExtension) throws ExtensionException {
    ExtensionBundle bundle = new ExtensionBundle(descriptor, devExtension);
    loadBundle(bundle);
  }
View Full Code Here

  }

  private void loadBundle(ExtensionBundle bundle) throws ExtensionException {

    bundle.load();
    ExtensionBundle oldBundle = (ExtensionBundle) extensionBundles.get(bundle.getId());

    if (oldBundle != null && oldBundle.isDevExtension()) {
      throw new ExtensionException(ExtensionException.CANNOT_REPLACE_DEV_EXTENSION, bundle.getId());
    }

    bundle.setCategory(ExtensionStore.INSTALLED_CATEGORY);
    try {
View Full Code Here

   * @param bundleId
   * @throws ExtensionException
   * @throws IOException
   */
  public void systemDisableExtension(String bundleId) throws ExtensionException, IOException {
    ExtensionBundle extensionBundle = getExtensionBundle(bundleId);
    extensionBundle.setStatus(ExtensionBundle.ExtensionBundleStatus.SYSTEM_DISABLED);
    ExtensionStoreStatusManager.systemDisableExtension(bundleId);
  }
View Full Code Here

  /**
   * @param bundleId
   * @throws Exception
   */
  public void disableExtension(String bundleId) throws Exception {
    ExtensionBundle extensionBundle = getExtensionBundle(bundleId);
    extensionBundle.setStatus(ExtensionBundle.ExtensionBundleStatus.DISABLED);
    ExtensionStoreStatusManager.disableExtension(bundleId);
    if(extensionBundle.isContainsPlugin()) {
      extensionBundle.setType(ExtensionBundle.TYPE_PENDING_STATE_CHANGE);
    }
  }
View Full Code Here

  /**
   * @param bundleId
   * @throws Exception
   */
  public void enableExtension(String bundleId) throws Exception {
    ExtensionBundle extensionBundle = getExtensionBundle(bundleId);
    extensionBundle.setStatus(ExtensionBundle.ExtensionBundleStatus.ENABLED);
    ExtensionStoreStatusManager.enableExtension(bundleId);
    if(extensionBundle.isContainsPlugin()) {
      extensionBundle.setType(ExtensionBundle.TYPE_PENDING_STATE_CHANGE);
    }
  }
View Full Code Here

  /**
   * @return ExtensionDescriptor
   */
  public ExtensionDescriptor getAgentApplication() {
    try {
      ExtensionBundle bundle = getExtensionBundle(AGENT_EXTENSION_BUNDLE_ID);
      return bundle != null ? (ExtensionDescriptor) bundle.getApplicationDescriptor(AGENT_EXTENSION_BUNDLE_ID) : null;
    } catch (Exception e) {
      log.error("Failed to get agent descriptor. Loaded?", e);
      return null;
    }
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public void reload(String id) throws ExtensionException {
    if (log.isInfoEnabled())
      log.info("Reloading application bundle " + id);
    if (isExtensionLoaded(id)) {
      ExtensionBundle bundle = getExtensionBundle(id);
      try {
        bundle.load();
      } catch (ExtensionException ee) {
        log.warn("Failed to reload extension descriptor.", ee);
        extensionBundles.remove(id);
        extensionBundlesList.remove(bundle);
        throw ee;
View Full Code Here

   * @param id extension bundle id
   * @return true if the extension has been loaded
   */
  public boolean isExtensionLoaded(String id) {
    for (Iterator i = extensionBundlesList.iterator(); i.hasNext();) {
      ExtensionBundle bundle = (ExtensionBundle) i.next();
      if (bundle.containsApplication(id)) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

      store = getDownloadableExtensionStoreDescriptor(true);
      if (store == null) {
        throw new ExtensionException(ExtensionException.INTERNAL_ERROR, "No downloadable applications.");
      }

      ExtensionBundle bundle = store.getApplicationBundle(id);
      if (bundle == null) {
        throw new ExtensionException(ExtensionException.INVALID_EXTENSION, id);
      }

      // Check host version
      Context context = ContextHolder.getContext();
      if (bundle.getRequiredHostVersion() != null && bundle.getRequiredHostVersion().compareTo(context.getVersion()) > 0) {
        throw new ExtensionException(ExtensionException.INSUFFICIENT_ADITO_HOST_VERSION,
                bundle.getId(),
                bundle.getRequiredHostVersion().toString());
     

      // Install all dependencies
      if (bundle.getDependencies() != null) {
        for (String dep : bundle.getDependencies()) {
          if (isExtensionBundleLoaded(dep)) {
            ExtensionBundle current = getExtensionBundle(dep);
            ExtensionBundle available = store.getApplicationBundle(dep);
            if(available != null) {
              if (!current.isDevExtension() && isNewerVersionAvailable(available, current)) {
                if (log.isInfoEnabled())
                  log.info("Found a dependency (" + dep + "), that needs upgrading. " + current.getVersion().toString() + " is the current version, " +  available.getVersion().toString() + " is available. Installing now");
                installExtensionFromStore(current.getId(), available.getVersion().toString(), request);
              }
            }
          } else {
            try {
              if (log.isInfoEnabled())
View Full Code Here

TOP

Related Classes of com.adito.extensions.ExtensionBundle

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.