public void install3rdPartyComponent(JOSSOArtifact artifact, boolean replace)
      throws InstallException {

    if (artifact.getBaseName().startsWith("log4j")
        || artifact.getBaseName().startsWith("spring-2.0")) return;

    if (artifact.getBaseName().startsWith("slf4j")) return;

    if (artifact.getBaseName().startsWith("jcl-over-slf4j")) return;

    if (artifact.getBaseName().startsWith("logback")) return;

    try {

      FileObject srcFile = getFileSystemManager().resolveFile(artifact.getLocation());

      // Some jars must be copied in special directories in Tomcat 5.5 / 5.0
      if (getTargetPlatform().getVersion().startsWith("5.")) {

        if (artifact.getBaseName().startsWith("commons-collections")) {
          removeOldJar(srcFile.getName().getBaseName(), this.targetEndorsedLibDir, true);
          installFile(srcFile, this.targetEndorsedLibDir, replace);
        } else {
          removeOldJar(srcFile.getName().getBaseName(), this.targetLibDir, true);
          installFile(srcFile, this.targetLibDir, replace);
        }

      } else if (getTargetPlatform().getVersion().startsWith("6.0")
          || getTargetPlatform().getVersion().startsWith("7.0")
          || getTargetPlatform().getVersion().startsWith("8.0")) {

        // Minmal set of dependencies for TC 6/7/8
        if (artifact.getBaseName().startsWith("spring-")) {
          removeOldJar(srcFile.getName().getBaseName(), this.targetLibDir, true);
          installFile(srcFile, this.targetLibDir, replace);
        } else if (artifact.getBaseName().startsWith("xbean-")) {
          removeOldJar(srcFile.getName().getBaseName(), this.targetLibDir, true);
          installFile(srcFile, this.targetLibDir, replace);
        } else if (artifact.getBaseName().startsWith("commons-")) {
          removeOldJar(srcFile.getName().getBaseName(), this.targetLibDir, true);
          installFile(srcFile, this.targetLibDir, replace);
        }

      } else {
        removeOldJar(srcFile.getName().getBaseName(), this.targetLibDir, true);
        installFile(srcFile, this.targetLibDir, replace);
      }

    } catch (IOException e) {
      throw new InstallException(e.getMessage(), e);
    }
  }
  @Override
  public void installComponent(JOSSOArtifact artifact, boolean replace) throws InstallException {
    try {

      FileObject srcFile = getFileSystemManager().resolveFile(artifact.getLocation());

      // Install only the proper artifact for the target platform ...
      if (artifact.getBaseName().startsWith("josso-liferay5-agent")) {
        installFile(srcFile, this.targetLibDir, replace);

      } else if (artifact.getBaseName().startsWith("josso-agent-shared")) {
        installFile(srcFile, this.targetLibDir, replace);

      } else if (artifact.getBaseName().startsWith("josso-agents-bin")
          && artifact.getClassifier() != null
          && artifact.getClassifier().equals("axis")) {
        installFile(srcFile, this.targetJOSSOLibDir, replace);
      } else {
        log.debug("Artifact is not valid for selected platform : " + artifact);
      }
    } catch (IOException e) {
      throw new InstallException(e.getMessage(), e);
    }
  }
  public void installApplication(JOSSOArtifact artifact, boolean replace) throws InstallException {

    try {

      if (!artifact.getType().equals("war")) {
        log.debug("Application type : " + artifact.getType() + " not supported.");
        return;
      }

      // If the war is already expanded, copy it with a new name.
      FileObject srcFile = getFileSystemManager().resolveFile(artifact.getLocation());

      // Is this the josso gateaway ?
      String name = artifact.getBaseName();
      boolean isFolder = srcFile.getType().equals(FileType.FOLDER);

      if (name.startsWith("josso-gateway-web")) {
        // INSTALL GWY
        // Do we have to explode the war ?
        if (getTargetPlatform().isJOSSOWarExploded() && !isFolder) {
          installJar(srcFile, this.targetDeployDir, "josso", true, replace);
        } else {
          installFile(srcFile, this.targetDeployDir, "josso.war", replace);
        }
        return;
      }

      if (artifact.getBaseName().startsWith("josso-partner-tomcat-web")) {
        installJar(srcFile, this.targetDeployDir, "partnerapp", true, replace);
        return;
      }

    } catch (IOException e) {
      throw new InstallException(e.getMessage(), e);
    }
  }
  @Override
  public void installConfiguration(JOSSOArtifact artifact, boolean replace)
      throws InstallException {
    try {
      FileObject srcFile = getFileSystemManager().resolveFile(artifact.getLocation());

      String name = srcFile.getName().getBaseName();

      if (name.startsWith("setenv")) {
        installFile(srcFile, this.targetBinDir, replace);
      } else if (name.equals("jaas.conf")) {
        installFile(srcFile, this.targetConfDir, replace);
      } else {
        installFile(srcFile, this.targetJOSSOConfDir, replace);
      }
    } catch (IOException e) {
      throw new InstallException(e.getMessage(), e);
    }
  }
  @Override
  public void installConfiguration(JOSSOArtifact artifact, boolean replace)
      throws InstallException {
    try {
      FileObject srcFile = getFileSystemManager().resolveFile(artifact.getLocation());

      String name = srcFile.getName().getBaseName();

      if (name.equals("portal-log4j-ext.xml") || name.equals("log4j.dtd")) {
        FileObject metaInfDir = targetConfDir.resolveFile("META-INF/");

        if (!metaInfDir.exists()) metaInfDir.createFolder();

        installFile(srcFile, metaInfDir, replace);
      } else {
        installFile(srcFile, this.targetConfDir, replace);
      }

    } catch (IOException e) {
      throw new InstallException(e.getMessage(), e);
    }
  }
  public void installComponent(JOSSOArtifact artifact, boolean replace) throws InstallException {
    try {

      // TODO : This should be part of the install command, maybe based on 'features' definitions.

      FileObject srcFile = getFileSystemManager().resolveFile(artifact.getLocation());

      // Install only the proper artifact for the target platform ...
      if (artifact.getBaseName().startsWith("josso-agent-shared")) {
        installFile(srcFile, this.targetJOSSOSharedLibDir, replace);

      } else if (artifact.getBaseName().startsWith("josso-agents-bin")) {

        // For Tomcat 6 and 7, jaxws is used now
        if (getTargetPlatform().getVersion().startsWith("6.0")
            || getTargetPlatform().getVersion().startsWith("7.0")
            || getTargetPlatform().getVersion().startsWith("8.0")) {

          if (artifact.getClassifier().equals("jaxws")) {
            installFile(srcFile, this.targetJOSSOLibDir, replace);
          }

        } else if (artifact.getClassifier() == null || artifact.getClassifier().equals("axis")) {
          // This is either Tomcat 5.0 or 5.5 ...
          installFile(srcFile, this.targetJOSSOLibDir, replace);
        }

      } else if (artifact.getBaseName().startsWith("josso-tomcat50-agent")
          && getTargetPlatform().getVersion().startsWith("5.0")) {
        installFile(srcFile, this.targetJOSSOLibDir, replace);

      } else if (artifact.getBaseName().startsWith("josso-tomcat55-agent")
          && getTargetPlatform().getVersion().startsWith("5.5")) {
        installFile(srcFile, this.targetJOSSOLibDir, replace);

      } else if (artifact.getBaseName().startsWith("josso-tomcat60-agent")
          && getTargetPlatform().getVersion().startsWith("6.0")) {
        installFile(srcFile, this.targetJOSSOLibDir, replace);

      } else if (artifact.getBaseName().startsWith("josso-tomcat70-agent")
          && getTargetPlatform().getVersion().startsWith("7.0")) {
        // We do not have TC8 specific files
        installFile(srcFile, this.targetJOSSOLibDir, replace);

      } else if (artifact.getBaseName().startsWith("josso-tomcat70-agent")
          && getTargetPlatform().getVersion().startsWith("8.0")) {
        installFile(srcFile, this.targetJOSSOLibDir, replace);

      } else {
        log.debug("Artifact is not valid for selected platform : " + artifact);
      }

    } catch (IOException e) {
      throw new InstallException(e.getMessage(), e);
    }
  }