Search in sources :

Example 1 with UniverseFeaturePackInstaller

use of org.jboss.galleon.universe.UniverseFeaturePackInstaller in project galleon by wildfly.

the class FeaturePackCreator method install.

void install(FeaturePackLocation.FPID fpid, Path fpContentDir) throws ProvisioningException {
    Universe<?> universe = null;
    UniverseFeaturePackInstaller ufpInstaller = null;
    if (universeResolution) {
        universe = universeResolver.getUniverse(fpid.getLocation().getUniverse());
        ufpInstaller = ufpInstallers.get(universe.getFactoryId());
        if (ufpInstaller == null) {
            throw new ProvisioningException(Errors.featurePackInstallerNotFound(universe.getFactoryId(), ufpInstallers.keySet()));
        }
    }
    final Path fpZip = getBuildDir().resolve(LayoutUtils.ensureValidFileName(fpid.toString()));
    try {
        ZipUtils.zip(fpContentDir, fpZip);
    } catch (IOException e) {
        throw new ProvisioningException("Failed to create feature-pack archive", e);
    }
    if (ufpInstaller != null) {
        ufpInstaller.install(universe, fpid, fpZip);
    }
}
Also used : Path(java.nio.file.Path) UniverseFeaturePackInstaller(org.jboss.galleon.universe.UniverseFeaturePackInstaller) ProvisioningException(org.jboss.galleon.ProvisioningException) IOException(java.io.IOException)

Example 2 with UniverseFeaturePackInstaller

use of org.jboss.galleon.universe.UniverseFeaturePackInstaller in project galleon by wildfly.

the class ProvisioningLayoutFactory method addLocal.

/**
 * Adds feature-pack archive to the local provisioning feature-pack cache.
 * Optionally, installs the feature-pack archive to the universe repository.
 *
 * @param featurePack  feature-pack archive
 * @param installInUniverse  whether to install the feature-pack into the universe repository
 * @return  feature-pack location which was added to the local cache
 * @throws ProvisioningException  in case of a failure
 */
public synchronized FeaturePackLocation addLocal(Path featurePack, boolean installInUniverse) throws ProvisioningException {
    final FPID fpid = FeaturePackDescriber.readSpec(featurePack).getFPID();
    put(featurePack, fpid);
    if (!installInUniverse) {
        return fpid.getLocation();
    }
    if (universeInstallers == null) {
        universeInstallers = UniverseFeaturePackInstaller.load();
    }
    final Universe<?> universe = universeResolver.getUniverse(fpid.getUniverse());
    final UniverseFeaturePackInstaller fpInstaller = universeInstallers.get(universe.getFactoryId());
    if (fpInstaller == null) {
        throw new ProvisioningException(Errors.featurePackInstallerNotFound(universe.getFactoryId(), universeInstallers.keySet()));
    }
    fpInstaller.install(universe, fpid, featurePack);
    return fpid.getLocation();
}
Also used : UniverseFeaturePackInstaller(org.jboss.galleon.universe.UniverseFeaturePackInstaller) FPID(org.jboss.galleon.universe.FeaturePackLocation.FPID) ProvisioningException(org.jboss.galleon.ProvisioningException)

Aggregations

ProvisioningException (org.jboss.galleon.ProvisioningException)2 UniverseFeaturePackInstaller (org.jboss.galleon.universe.UniverseFeaturePackInstaller)2 IOException (java.io.IOException)1 Path (java.nio.file.Path)1 FPID (org.jboss.galleon.universe.FeaturePackLocation.FPID)1