Package com.adito.extensions

Examples of com.adito.extensions.ExtensionBundle


    try {
      RepositoryStore repStore = RepositoryFactory.getRepository().getStore(ARCHIVE_STORE);
      ZipExtract.extractZipFile(getExtensionStoreDirectory(), repStore.getEntryInputStream(id + ".zip"));
      reload(id);
      ExtensionBundle newBundle = getExtensionBundle(id);
      installExtension(newBundle);
      fireBundleEvent(CoreEventConstants.INSTALL_EXTENSION, newBundle);
    } catch (IOException e) {
      CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this,
              CoreEventConstants.INSTALL_EXTENSION,
View Full Code Here


            in = new TaskInputStream(bar, in);
            ((TaskInputStream)in).getProgressBar().setNote(new BundleActionMessage("extensions", "taskProgress.downloadExtension.note", id));
            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) {
      CoreServlet.getServlet()
              .fireCoreEvent(new CoreEvent(this,
                      CoreEventConstants.UPDATE_EXTENSION,
                      null,
                      null,
                      CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_EXTENSION_ID,
                                                currentBundle.getId())
                      .addAttribute(CoreAttributeConstants.EVENT_ATTR_EXTENSION_NAME, currentBundle.getName())
                      .addAttribute(CoreAttributeConstants.EVENT_ATTR_EXTENSION_VERSION,
                                                currentBundle.getVersion().toString()));
      throw ee;
    }
  }
View Full Code Here

      currentBundle.setType(ExtensionBundle.TYPE_PENDING_UPDATE);
      fireBundleEvent(CoreEventConstants.UPDATE_EXTENSION, currentBundle);
      return currentBundle;
    } else {
      reload(currentBundle.getId());
      ExtensionBundle newBundle = getExtensionBundle(currentBundle.getId());
      installExtension(newBundle);
      postInstallExtension(newBundle, request);
      if (newBundle.getStatus().isStartedOrActivated()) {
        newBundle.stop();
        newBundle.start();
        newBundle.activate();
      }
      fireBundleEvent(CoreEventConstants.UPDATE_EXTENSION, newBundle);
      return newBundle;
    }
  }
View Full Code Here

       
        for (Iterator itr = document.getRootElement().getChildren().iterator(); itr.hasNext();) {
            Element element = (Element) itr.next();
            if (element.getName().equalsIgnoreCase("install") || element.getName().equalsIgnoreCase("configure")) {

                ExtensionBundle extensionBundle = buildExtensionBundle(element);
                if(applicationBundles.containsKey(extensionBundle.getId())) {
                    throw new JDOMException("Duplicate application bundle id.");
                }
               
                // If supported operating system
                if(extensionBundle.getPlatform()!=null && !extensionBundle.getPlatform().equals("")) {
                  StringTokenizer tokens = new StringTokenizer(extensionBundle.getPlatform(), ",");
                  while(tokens.hasMoreTokens()) {
                    String platform = tokens.nextToken();
                    if(Utils.isSupportedPlatform(platform) && Utils.isSupportedArch(extensionBundle.getArch())) {
                      applicationBundles.put(extensionBundle.getId(), extensionBundle);
                      applicationBundlesList.add(extensionBundle);
                      break;
                    }
                  }
                } else {
                  applicationBundles.put(extensionBundle.getId(), extensionBundle);
                  applicationBundlesList.add(extensionBundle);
                }
                // End if
            } else {
                throw new JDOMException("Unknown element '" + element.getName() + "'.");
View Full Code Here

        if(orderAttr == null) {
            log.warn("In extension store descriptor for " + id + ", <" + element.getName() + "> requires an 'order' attribute. Assuming '99999'");
       
        int type = element.getName().equalsIgnoreCase("install") ? ExtensionBundle.TYPE_INSTALLABLE : ExtensionBundle.TYPE_CONFIGUREABLE;
        try {
            return new ExtensionBundle(new VersionInfo.Version(version), type, id, name, description, license, productURL, instructionsURL, requiredHostVersion, dependencyNames, category, mandatoryUpdate, orderAttr == null ? 99999 : orderAttr.getIntValue(), changes, platform, arch);
        }
        catch(DataConversionException dce) {
            throw new IOException("Invalid order attribute. " + dce.getMessage());
        }
    }
View Full Code Here

    public void init(AbstractWizardSequence wizardSequence, HttpServletRequest request) throws Exception {
        super.init(wizardSequence, request);
        availableApplications = new ArrayList();
        selectedApplication = (String)wizardSequence.getAttribute(ATTR_SELECTED_APPLICATION, null);
        for (Iterator i = ExtensionStore.getInstance().getAllAvailableExtensionBundles().iterator(); i.hasNext();) {
            ExtensionBundle b = (ExtensionBundle)i.next();
            if(b.getStatus() == ExtensionBundleStatus.ACTIVATED) {
              for(Iterator j = b.iterator(); j.hasNext(); ) {
                  ExtensionDescriptor d = (ExtensionDescriptor)j.next();
                 
                  // Only show extensions if the type is not hidden and the extension itself is not hidden
                  if(!d.isHidden() && !d.getExtensionType().isHidden()) {
                      if (this.getFocussedField() == null){
View Full Code Here

    List<ExtensionBundle> all = new ArrayList<ExtensionBundle>(extensionBundlesList);
    try {
      ExtensionStoreDescriptor descriptor = getDownloadableExtensionStoreDescriptor(downloadableExtensions != null, getWorkingVersion());
      if (descriptor != null && descriptor.getExtensionBundles() != null) {
        for (Iterator itr = descriptor.getExtensionBundles().iterator(); itr.hasNext();) {
          ExtensionBundle bundle = (ExtensionBundle) itr.next();
          // If the app is already installed, remove dont include it
          // in the list
          if (!extensionBundles.containsKey(bundle.getId())) {
            all.add(bundle);
          }
        }
      }
    } catch (Exception e) {
View Full Code Here

       
      try {
          ExtensionStoreDescriptor descriptor = getDownloadableExtensionStoreDescriptor(downloadableExtensions != null, getWorkingVersion());
          if (descriptor != null && descriptor.getExtensionBundles() != null) {
              for (Iterator itr = descriptor.getExtensionBundles().iterator(); itr.hasNext();) {
                  ExtensionBundle bundle = (ExtensionBundle) itr.next();
                  // If the app is already installed, remove dont include it
                  // in the list
                  if (!extensionBundles.containsKey(bundle.getId()) && bundle.getCategory().equals(category)) {
                      all.add(bundle);
                  }
              }
          }
      } catch (Exception e) {
View Full Code Here

        downloadableExtensions = new ExtensionStoreDescriptor(storeURL);
        downloadableExtensionsLastUpdated = new GregorianCalendar();

        for (ExtensionBundle extensionBundle : downloadableExtensions.getExtensionBundles()) {
          try {
            ExtensionBundle installedApp = getExtensionBundle(extensionBundle.getId());
            if (!installedApp.isDevExtension() && installedApp.getVersion().compareTo(extensionBundle.getVersion()) < 0) {
              if (log.isInfoEnabled())
                log.info("Update found for extenions " + extensionBundle.getId());
              installedApp.setType(ExtensionBundle.TYPE_UPDATEABLE);
              installedApp.setUpdateVersion(extensionBundle.getVersion());
              installedApp.setChanges(extensionBundle.getChanges());
            }
          } catch (Exception e) {
                    if (log.isInfoEnabled())
                        log.info("Extension " + extensionBundle.getId() + " is not installed.");
          }
View Full Code Here

      // If there are any pending removals or installations, we cannot
      // reload
      boolean pending = false;
      for (Iterator i = currentlyLoadedExtensions.entrySet().iterator(); !pending && i.hasNext();) {
        Map.Entry ent = (Map.Entry) i.next();
        final ExtensionBundle bundle = (ExtensionBundle) ent.getValue();
        pending = bundle.getType() == ExtensionBundle.TYPE_PENDING_INSTALLATION || bundle.getType() == ExtensionBundle.TYPE_PENDING_REMOVAL
          || bundle.getType() == ExtensionBundle.TYPE_PENDING_UPDATE
          || bundle.getType() == ExtensionBundle.TYPE_PENDING_STATE_CHANGE;
      }
      if (pending) {
        throw new Exception("There are pending installations / removals / updates. You must restart the server.");
      }

      // Reload

      if (request.getParameter("id") == null) {
        ExtensionStore.getInstance().reload();
      } else {
        String application = request.getParameter("id");
        ExtensionStore.getInstance().reload(application);
      }

      /*
       * Build up an error message from any exceptions that may have
       * occured during reloading
       */
      if (errors != null && errors.size() > 0) {
        StringBuffer buf = new StringBuffer();
        for (ExtensionBundle bundle : ExtensionStore.getInstance().getExtensionBundles()) {
          if (bundle.getError() != null) {
            if (buf.length() > 0) {
              buf.append(". ");
            }
            buf.append(bundle.getError().getMessage());
          }
        }
        throw new Exception(buf.toString());
      }

      // Look for new plugins
      Map newLoadedPlugins = getLoadedPlugins();

      // Look for new plugins
      boolean newPluginsFound = false;
      for (Iterator i = newLoadedPlugins.entrySet().iterator(); i.hasNext();) {
        Map.Entry ent = (Map.Entry) i.next();
        if (!currentlyLoadedPlugins.containsKey(ent.getKey())) {
          ExtensionDescriptor des = (ExtensionDescriptor) newLoadedPlugins.get(ent.getKey());
          des.getApplicationBundle().setType(ExtensionBundle.TYPE_PENDING_INSTALLATION);
          newPluginsFound = true;
        }
      }
      if (newPluginsFound) {
        GlobalWarningManager.getInstance().addMultipleGlobalWarning(new GlobalWarning(GlobalWarning.MANAGEMENT_USERS, new BundleActionMessage("extensions",
                "extensionStore.message.pluginInstalledRestartRequired"), DismissType.DISMISS_FOR_USER));
      }

      // Look for new extensions
      Map newLoadedExtensions = getLoadedExtensions();

      // Look for extension updates
      File updatedExtensionsDir = ExtensionStore.getInstance().getUpdatedExtensionsDirectory();
      boolean updatesFound = false;
      for (Iterator i = newLoadedExtensions.entrySet().iterator(); i.hasNext();) {
        Map.Entry ent = (Map.Entry) i.next();
        if (new File(updatedExtensionsDir, (String) ent.getKey()).exists()) {
          final ExtensionBundle bundle = (ExtensionBundle) ent.getValue();
          for (Iterator j = bundle.iterator(); j.hasNext();) {
            ExtensionDescriptor des = (ExtensionDescriptor) j.next();
            des.getApplicationBundle().setType(ExtensionBundle.TYPE_PENDING_UPDATE);
          }
          updatesFound = true;
        }
      }
      if (updatesFound) {
        GlobalWarningManager.getInstance().addMultipleGlobalWarning(new GlobalWarning(GlobalWarning.MANAGEMENT_USERS, new BundleActionMessage("extensions",
                "extensionStore.message.extensionUpdatedRestartRequired"), DismissType.DISMISS_FOR_USER));
      }

      // Check for new extensions
      for (Iterator i = newLoadedExtensions.entrySet().iterator(); i.hasNext();) {
        Map.Entry ent = (Map.Entry) i.next();
        if (!currentlyLoadedExtensions.containsKey(ent.getKey())) {
          final ExtensionBundle bundle = (ExtensionBundle) ent.getValue();

          // If installing, there may be a license agreement to handle
          File licenseFile = bundle.getLicenseFile();
          if (licenseFile != null && licenseFile.exists()) {
            final boolean fNewPluginsFound = newPluginsFound;
            CoreUtil.requestLicenseAgreement(request.getSession(), new LicenseAgreement(bundle.getName(),
                    licenseFile,
                    new LicenseAgreementCallback() {
                      public void licenseAccepted(HttpServletRequest request) {
                        // Dont care
                      }
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.