private Thread thread;
@Override
public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException
{
Deployment deployment = deploymentInstance.get();
final AddonId addonToDeploy = getAddonEntry(deployment);
File destDir = repository.getAddonBaseDir(addonToDeploy);
destDir.mkdirs();
if (archive instanceof ForgeArchive)
{
ShrinkWrapUtil.toFile(new File(destDir.getAbsolutePath() + "/" + archive.getName()), archive);
ShrinkWrapUtil.unzip(destDir, archive);
repository.deploy(addonToDeploy, ((ForgeArchive) archive).getAddonDependencies(), new ArrayList<File>());
repository.enable(addonToDeploy);
}
else if (archive instanceof ForgeRemoteAddon)
{
ForgeRemoteAddon remoteAddon = (ForgeRemoteAddon) archive;
AddonManager addonManager = new AddonManagerImpl(runnable.forge, new MavenDependencyResolver(
new FileResourceFactory(), new MavenContainer()));
InstallRequest request = addonManager.install(remoteAddon.getAddonId());
request.perform();
}
else
{
throw new IllegalArgumentException(
"Invalid Archive type. Ensure that your @Deployment method returns type 'ForgeArchive'.");
}
AddonRegistry registry = runnable.getForge().getAddonRegistry();
try
{
Future<Void> future = registry.start(addonToDeploy);
future.get();
Addon addon = registry.getAddon(addonToDeploy);
if (addon.getStatus().isFailed())
{
ContainerException e = new ContainerException("Addon " + addonToDeploy + " failed to deploy.");
deployment.deployedWithError(e);
throw e;
}
}
catch (Exception e)
{