/**
   * Install provided extension.
   *
   * @param extensionId the identifier of the extension to install
   * @param dependency indicate if the extension is installed as a dependency
   * @param namespace the namespace where to install the extension
   * @param parentBranch the children of the parent {@link DefaultExtensionPlanNode}
   * @throws InstallException error when trying to install provided extension
   * @throws ResolveException unexpected exception has been raised
   */
  protected void installExtension(
      ExtensionId extensionId,
      boolean dependency,
      String namespace,
      ModifableExtensionPlanTree parentBranch)
      throws InstallException, ResolveException {
    if (getRequest().isVerbose()) {
      if (namespace != null) {
        this.logger.info(
            LOG_RESOLVE_NAMESPACE,
            "Resolving extension [{}] on namespace [{}]",
            extensionId,
            namespace);
      } else {
        this.logger.info(LOG_RESOLVE, "Resolving extension [{}] on all namespaces", extensionId);
      }
    }

    // Make sure the extension is not already a core extension
    if (this.coreExtensionRepository.exists(extensionId.getId())) {
      throw new InstallException(
          String.format("There is already a core extension with the id [%s]", extensionId.getId()));
    }

    InstalledExtension previousExtension =
        checkAlreadyInstalledExtension(extensionId.getId(), extensionId.getVersion(), namespace);

    ModifableExtensionPlanNode node =
        installExtension(previousExtension, extensionId, dependency, namespace);

    addExtensionNode(node);
    parentBranch.add(node);
  }
Пример #2
0
  @Override
  public boolean equals(Object obj) {
    if (obj instanceof ExtensionId) {
      ExtensionId extensionId = (ExtensionId) obj;

      return getId().equals(extensionId.getId()) && getVersion().equals(extensionId.getVersion());
    }

    return false;
  }
 String getPathSuffix(ExtensionId extensionId, String type) {
   return extensionId.getId() + '-' + extensionId.getVersion().getValue() + '.' + type;
 }