use of io.fabric8.runtime.container.LifecycleException in project fabric8 by jboss-fuse.
the class Fabric8Container method start.
@Override
public void start() throws LifecycleException {
// lets kill any containers that are running before we start
FabricAssertions.killJavaAndDockerProcesses();
fabricControllerManager = createFabricControllerManager();
Fabric8ContainerConfiguration config = configuration.get();
config.configure(fabricControllerManager);
try {
FabricController fabricController = FabricAssertions.assertFabricCreate(fabricControllerManager);
controller.set(fabricController);
} catch (Exception e) {
throw new LifecycleException("Failed to create fabric: " + e, e);
}
System.out.println("Created a controller " + controller.get());
}
use of io.fabric8.runtime.container.LifecycleException in project fabric8 by jboss-fuse.
the class AbstractManagedContainer method start.
@Override
public final synchronized void start() throws LifecycleException {
assertNotDestroyed();
try {
if (state == State.CREATED || state == State.STOPPED) {
doStart(configuration);
state = State.STARTED;
}
} catch (Exception ex) {
throw new LifecycleException("Cannot start container", ex);
}
}
use of io.fabric8.runtime.container.LifecycleException in project fabric8 by jboss-fuse.
the class AbstractManagedContainer method stop.
@Override
public final synchronized void stop() throws LifecycleException {
assertNotDestroyed();
try {
if (state == State.STARTED) {
doStop(configuration);
state = State.STOPPED;
}
} catch (Exception ex) {
throw new LifecycleException("Cannot stop container", ex);
}
}
use of io.fabric8.runtime.container.LifecycleException in project fabric8 by jboss-fuse.
the class AbstractManagedContainer method create.
@Override
public final synchronized void create(T configuration) throws LifecycleException {
if (state != null)
throw new IllegalStateException("Cannot create container in state: " + state);
this.configuration = configuration;
// [TODO] [FABRIC-929] No connector available to access repository jboss-public-repository-group
// Remove this hack. It shouldbe possible to use the shrinkwrap maven resolver
boolean useShrinkwrap = System.getProperty("shrinkwrap.resolver") != null;
for (MavenCoordinates artefact : configuration.getMavenCoordinates()) {
File zipfile = useShrinkwrap ? shrinkwrapResolve(artefact) : localResolve(artefact);
GenericArchive archive = ShrinkWrap.createFromZipFile(GenericArchive.class, zipfile);
ExplodedExporter exporter = archive.as(ExplodedExporter.class);
File targetdir = configuration.getTargetDirectory();
if (!targetdir.isDirectory() && !targetdir.mkdirs())
throw new IllegalStateException("Cannot create target dir: " + targetdir);
if (containerHome == null) {
exporter.exportExploded(targetdir, "");
File[] childDirs = targetdir.listFiles();
if (childDirs.length != 1)
throw new IllegalStateException("Expected one child directory, but was: " + Arrays.asList(childDirs));
containerHome = childDirs[0];
} else {
exporter.exportExploded(containerHome, "");
}
}
state = State.CREATED;
try {
doConfigure(configuration);
} catch (Exception ex) {
throw new LifecycleException("Cannot configure container", ex);
}
}
Aggregations