use of io.fabric8.maven.core.config.Profile in project fabric8 by jboss-fuse.
the class AbstractChildContainerCreateAction method preCreateContainer.
/**
* Pre validates input before creating the container(s)
*
* @param name the name of the container to create
* @throws IllegalArgumentException is thrown if input is invalid
*/
protected void preCreateContainer(String name) throws IllegalArgumentException {
FabricValidations.validateContainerName(name);
if (clusterService.getEnsembleContainers().isEmpty()) {
return;
}
if (FabricCommand.doesContainerExist(fabricService, name)) {
throw new IllegalArgumentException("A container with name " + name + " already exists.");
}
// get the profiles for the given version
Version ver = version != null ? profileService.getRequiredVersion(version) : fabricService.getRequiredDefaultVersion();
List<Profile> profiles = ver.getProfiles();
// validate profiles exists before creating a new container
Set<String> names = getProfileNames();
for (String profile : names) {
Profile prof = getProfile(profiles, profile, ver);
if (prof == null) {
throw new IllegalArgumentException("Profile " + profile + " with version " + ver.getId() + " does not exist.");
}
if (prof.isAbstract()) {
throw new IllegalArgumentException("Profile " + profile + " with version " + ver.getId() + " is abstract and can not be associated to containers.");
}
}
if (fabricService.getZookeeperUrl() == null) {
throw new IllegalArgumentException("should start a zookeeper ensemble first.");
}
}
use of io.fabric8.maven.core.config.Profile in project fabric8 by jboss-fuse.
the class AutoScaleStatusListAction method printStatus.
protected void printStatus(PrintStream out, AutoScaleStatus status) {
TablePrinter table = new TablePrinter();
table.columns("auto scale profile", "status", "message");
List<AutoScaleProfileStatus> profileStatuses = status.getProfileStatuses();
for (AutoScaleProfileStatus profile : profileStatuses) {
table.row(getStringOrBlank(profile.getProfile()), getStringOrBlank(profile.getStatus()), getStringOrBlank(profile.getMessage()));
}
table.print();
}
use of io.fabric8.maven.core.config.Profile in project fabric8 by jboss-fuse.
the class ProfileFacade method setParents.
public Profile setParents(Profile[] profiles) {
List<String> parentIds = new ArrayList<String>();
for (Profile profile : profiles) {
parentIds.add(profile.getId());
}
Helpers.exec(j4p, "changeProfileParents(java.lang.String, java.lang.String, java.util.List)", versionId, id, parentIds);
return null;
}
use of io.fabric8.maven.core.config.Profile in project fabric8 by jboss-fuse.
the class VersionFacade method getProfiles.
@Override
public List<Profile> getProfiles() {
List<Profile> rc = new ArrayList<Profile>();
JSONArray array = getFieldValue("profiles");
if (array == null || array.size() == 0) {
return Collections.emptyList();
}
for (Object profile : array) {
rc.add(new ProfileFacade(j4p, id, (String) profile));
}
return rc;
}
use of io.fabric8.maven.core.config.Profile in project fabric8 by jboss-fuse.
the class AbstractContainerCreateAction method preCreateContainer.
/**
* Pre validates input before creating the container(s)
*
* @param name the name of the container to create
* @throws IllegalArgumentException is thrown if input is invalid
*/
protected void preCreateContainer(String name) throws IllegalArgumentException {
FabricValidations.validateContainerName(name);
if (!isEnsembleServer) {
if (clusterService.getEnsembleContainers().isEmpty()) {
if (!isEnsembleServer) {
throw new IllegalStateException("The use of the --ensemble-server option is mandatory when creating an initial container");
}
return;
}
if (FabricCommand.doesContainerExist(fabricService, name)) {
throw new IllegalArgumentException("A container with name " + name + " already exists.");
}
// get the profiles for the given version
Version ver = version != null ? profileService.getRequiredVersion(version) : fabricService.getRequiredDefaultVersion();
List<Profile> profiles = ver.getProfiles();
// validate profiles exists before creating a new container
Set<String> names = getProfileNames();
for (String profile : names) {
Profile prof = getProfile(profiles, profile, ver);
if (prof == null) {
throw new IllegalArgumentException("Profile " + profile + " with version " + ver.getId() + " does not exist.");
}
if (prof.isAbstract()) {
throw new IllegalArgumentException("Profile " + profile + " with version " + ver.getId() + " is abstract and can not be associated to containers.");
}
}
}
if (!isEnsembleServer && fabricService.getZookeeperUrl() == null) {
throw new IllegalArgumentException("Either start a zookeeper ensemble or use --ensemble-server.");
}
}
Aggregations