Package com.adito.extensions

Examples of com.adito.extensions.ExtensionException


    try {
      app = new ServerApplicationLauncher(parameters, shortcut
          .getApplication(), launchSession.getSession(), shortcut);
      app.start();
    } catch (Exception e) {
      throw new ExtensionException(ExtensionException.FAILED_TO_LAUNCH, e);
    }

    return null;
  }
View Full Code Here


      if (e.getName().equalsIgnoreCase("jar")) {
        descriptor.processFile(e);
      } else if (e.getName().equals("if")) {
        verifyClasspath(e);
      } else {
        throw new ExtensionException(
            ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
            "Invalid element <" + e.getName()
                + "> found in <classpath>");
      }
    }
View Full Code Here

      Element e = (Element) it.next();
      if (e.getName().equalsIgnoreCase("if")) {
        verifyMain(e);
      } else if (!e.getName().equalsIgnoreCase("arg")
          && !e.getName().equalsIgnoreCase("jvm")) {
        throw new ExtensionException(
            ExtensionException.FAILED_TO_PROCESS_DESCRIPTOR,
            "Unexpected element <" + e.getName()
                + "> found in <main>");
      }
    }
View Full Code Here

    // Stop extensions in the reverse order they were started
    if(extensionBundlesList != null) {
        Collections.reverse(extensionBundlesList);
   
        ExtensionException ee = null;
        for (ExtensionBundle bundle : extensionBundlesList) {
          try {
            bundle.stop();
          } catch (ExtensionException e) {
            if (ee == null) {
View Full Code Here

    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 {
      ExtensionBundleStatus extensionStatus = ExtensionStoreStatusManager.getExtensionStatus(bundle.getId());
      bundle.setStatus(extensionStatus);
    } catch (IOException ioe) {
      throw new ExtensionException(ExtensionException.INTERNAL_ERROR, ioe, "Failed to add bundle.");
    }

    for (ExtensionDescriptor descriptor : bundle) {
      if (log.isInfoEnabled())
        log.info("Extension " + descriptor.getName() + " has been loaded");
View Full Code Here

   * @return extension bundle
   * @throws ExtensionException if bundle could not be located ({@link ExtensionException#INVALID_EXTENSION}).
   */
  public ExtensionBundle getExtensionBundle(String id) throws ExtensionException {
    if (!extensionBundles.containsKey(id)) {
      throw new ExtensionException(ExtensionException.INVALID_EXTENSION, id);
    }
    return (ExtensionBundle) extensionBundles.get(id);
  }
View Full Code Here

    ExtensionStoreDescriptor store;
    try {
      // Get the application store descriptor
      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())
                log.info("Found a dependency (" + dep + "), that is not installed. Installing now");
              installExtensionFromStore(dep, store.getApplicationBundle(dep).getVersion().toString(), request);
            } catch (Exception e) {
              throw new ExtensionException(ExtensionException.INTERNAL_ERROR, "Failed to install dependency " + dep);
            }
          }
        }
      }

            // This action may be wrapped in a task progress monitor
            Task task = (Task)request.getAttribute(TaskHttpServletRequest.ATTR_TASK);
            if(task != null && request.getAttribute(TaskHttpServletRequest.ATTR_TASK_PROGRESS_HANDLED_EXTERNALLY) == null) {
                TaskProgressBar bar = new TaskProgressBar("installExtension", 0, (int)contentLength, 0); // TODO should accept longs
                task.clearProgressBars();
                task.addProgressBar(bar);
                in = new TaskInputStream(bar, in);
                ((TaskInputStream)in).getProgressBar().setNote(new BundleActionMessage("extensions", "taskProgress.downloadExtension.note", id));
                if(!task.isConfigured())
                    task.configured();
            }         

      return installExtension(id, in);
    } catch (IOException jde) {
      throw new ExtensionException(ExtensionException.INTERNAL_ERROR, "Failed to load descriptor.");
    } catch (JDOMException jde) {
      throw new ExtensionException(ExtensionException.FAILED_TO_PARSE_DESCRIPTOR);
    }
  }
View Full Code Here

            task.configured();
        }           

    ExtensionBundle currentBundle = getExtensionBundle(id);
    if (currentBundle == null) {
      throw new ExtensionException(ExtensionException.INVALID_EXTENSION, id);
    }

    try {
      return updateExtension(currentBundle, in, request);
    } catch (ExtensionException ee) {
View Full Code Here

                      HttpServletRequest request) throws Exception {

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

    boolean containsPlugin = currentBundle.isContainsPlugin();
View Full Code Here

       */
          UserDatabaseDefinition databaseDefinition = new UserDatabaseDefinition(PAMUserDatabase.class, "pam", "pam", 2010);
          UserDatabaseManager.getInstance().registerDatabase(databaseDefinition);
   
    } else {
      throw new ExtensionException(ExtensionException.FAILED_TO_LAUNCH,"PAM not currently supported on this platform or PAM not installed");
    }
   
    }
View Full Code Here

TOP

Related Classes of com.adito.extensions.ExtensionException

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.