@Override public void destroy() { destroy(false); }
@Override public String getProvisionResult() { String status = getOptionalAttribute(DataStore.ContainerAttribute.ProvisionStatus, ""); if (status.equals(PROVISION_SUCCESS)) { return getExtenderStatus(); } else { return status; } }
/** * Returns the resolved address of the {@link io.fabric8.api.Container}. * * @return the resolved address for this container */ @Override public String getIp() { return getMandatorySubstitutedAttribute(DataStore.ContainerAttribute.Ip); }
public Map<String, String> getProvisionStatusMap() { Map<String, String> answer = new HashMap<String, String>(); answer.put(DataStore.ContainerAttribute.ProvisionStatus.name(), getProvisionStatus()); answer.put(DataStore.ContainerAttribute.BlueprintStatus.name(), getBlueprintStatus().name()); answer.put(DataStore.ContainerAttribute.SpringStatus.name(), getSpringStatus().name()); return answer; }
private String getExtenderStatus() { ModuleStatus blueprintStatus = getBlueprintStatus(); ModuleStatus springStatus = getSpringStatus(); if (blueprintStatus != ModuleStatus.STARTED) { return blueprintStatus.name().toLowerCase(); } else if (springStatus != ModuleStatus.STARTED) { return springStatus.name().toLowerCase(); } else { return PROVISION_SUCCESS; } }
private Profile getContainerProfile() { Version version = getVersion(); String profileId = CONTAINER_PROFILE_PREFIX + getId(); ProfileBuilder builder = ProfileBuilder.Factory.create(profileId).version(version.getId()); ContainerProfileOptions optionsProvider = new ContainerProfileOptions(getId(), version, dataStore); return builder.addOptions(optionsProvider).getProfile(); }
@Override public String getLocalIp() { return getNullableSubstitutedAttribute(DataStore.ContainerAttribute.LocalIp); }
@Override public Container[] getContainers() { assertValid(); Map<String, Container> containers = new HashMap<String, Container>(); List<String> containerIds = dataStore.get().getContainers(); for (String containerId : containerIds) { String parentId = dataStore.get().getContainerParent(containerId); if (parentId.isEmpty()) { if (!containers.containsKey(containerId)) { Container container = new ContainerImpl(null, containerId, this); containers.put(containerId, container); } } else { Container parent = containers.get(parentId); if (parent == null) { parent = new ContainerImpl(null, parentId, this); containers.put(parentId, parent); } Container container = new ContainerImpl(parent, containerId, this); containers.put(containerId, container); } } return containers.values().toArray(new Container[containers.size()]); }
@Override public CreateContainerMetadata<?> getMetadata() { if (metadata == null) { metadata = getMetadata(getClass().getClassLoader()); if (metadata == null) { for (Class<?> type : fabricService.getSupportedCreateContainerMetadataTypes()) { metadata = getMetadata(type.getClassLoader()); if (metadata != null) { break; } } } } return metadata; }
/** * Checks if Container is root and has alive children. */ public boolean hasAliveChildren() { for (Container child : getChildren()) { if (child.isAlive()) { return true; } } return false; }
public Container[] getChildren() { List<Container> children = new ArrayList<Container>(); for (Container container : fabricService.getContainers()) { if (container.getParent() != null && getId().equals(container.getParent().getId())) { children.add(container); } } return children.toArray(new Container[children.size()]); }
public Profile getOverlayProfile() { ProfileService profileService = fabricService.adapt(ProfileService.class); return profileService.getOverlayProfile(getContainerProfile()); }
@Override public String getPublicIp() { return getNullableSubstitutedAttribute(DataStore.ContainerAttribute.PublicIp); }
@Override public Container getContainer(String name) { assertValid(); if (dataStore.get().hasContainer(name)) { Container parent = null; String parentId = dataStore.get().getContainerParent(name); if (parentId != null && !parentId.isEmpty()) { parent = getContainer(parentId); } return new ContainerImpl(parent, name, this); } throw new FabricException("Container '" + name + "' does not exist"); }
public String getType() { String answer = null; CreateContainerMetadata<?> containerMetadata = getMetadata(); if (containerMetadata != null) { answer = containerMetadata.getContainerType(); } if (Strings.isNullOrBlank(answer)) { answer = "karaf"; } return answer; }
/** * Returns the resolver of the {@link io.fabric8.api.Container}. * The resolver identifies which of the {@link io.fabric8.api.Container} address should be used for address resolution. * * @return One of the: localip, localhostname, publicip, publichostname, manualip. */ @Override public String getResolver() { return getMandatorySubstitutedAttribute(DataStore.ContainerAttribute.Resolver); }
@Override public String getLocalHostname() { return getNullableSubstitutedAttribute(DataStore.ContainerAttribute.LocalHostName); }
dataStore.get().createContainerConfig(metadata); ContainerImpl container = new ContainerImpl(parent, metadata.getContainerName(), FabricServiceImpl.this); metadata.setContainer(container); LOGGER.info("The container " + metadata.getContainerName() + " has been successfully created");
@Override public String getHttpUrl() { return getMandatorySubstitutedAttribute(DataStore.ContainerAttribute.HttpUrl); }
@Override public String getPublicHostname() { return getNullableSubstitutedAttribute(DataStore.ContainerAttribute.PublicHostName); }