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);
}
}
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();
}
Aggregations