@Override public String toString() { return super.toString()+"[own="+Entities.sanitize(ownConfig)+"]"; }
protected static String getDeprecatedProperty(ConfigBag conf, String key) { if (conf.containsKey(key)) { LOG.warn("Jclouds using deprecated brooklyn-jclouds property "+key+": "+Entities.sanitize(conf.getAllConfig())); return (String) conf.getStringKey(key); } else { return null; } }
@Override public void reconstruct(RebindContext rebindContext, PolicyMemento memento) { if (LOG.isTraceEnabled()) LOG.trace("Reconstructing policy {}({}): displayName={}; flags={}; " + "customProperties={}", new Object[] {memento.getType(), memento.getId(), memento.getDisplayName(), sanitize(memento.getFlags()), sanitize(memento.getCustomFields())}); // Note that the flags have been set in the constructor policy.setName(memento.getDisplayName()); doReconsruct(rebindContext, memento); }
protected PolicyMemento getMementoWithProperties(Map<String,?> props) { PolicyMemento memento = MementosGenerators.newPolicyMementoBuilder(policy).customFields(props).build(); if (LOG.isTraceEnabled()) LOG.trace("Creating memento for policy {}({}): displayName={}; flags={}; " + "customProperties={}; ", new Object[] {memento.getType(), memento.getId(), memento.getDisplayName(), sanitize(memento.getFlags()), sanitize(memento.getCustomFields())}); return memento; }
protected EntityMemento getMementoWithProperties(Map<String,?> props) { EntityMemento memento = MementosGenerators.newEntityMementoBuilder(entity).customFields(props).build(); if (LOG.isTraceEnabled()) LOG.trace("Creating memento for entity {}({}): parent={}; children={}; locations={}; "+ "policies={}; members={}; config={}; attributes={}; entityReferenceConfigs={}; " + "entityReferenceAttributes={}; customProperties={}", new Object[] {memento.getType(), memento.getId(), memento.getParent(), memento.getChildren(), memento.getLocations(), memento.getPolicies(), memento.getMembers(), sanitize(memento.getConfig()), sanitize(memento.getAttributes()), memento.getEntityReferenceConfigs(), memento.getEntityReferenceAttributes(), sanitize(memento.getCustomFields())}); return memento; }
protected LocationMemento getMementoWithProperties(Map<String,?> props) { LocationMemento memento = MementosGenerators.newLocationMementoBuilder(location).customFields(props).build(); if (LOG.isTraceEnabled()) LOG.trace("Creating memento for location {}({}): displayName={}; parent={}; children={}; "+ "locationConfig={}; locationConfigDescription={}; customProperties={}; ", new Object[] {memento.getType(), memento.getId(), memento.getDisplayName(), memento.getParent(), memento.getChildren(), sanitize(memento.getLocationConfig()), memento.getLocationConfigDescription(), sanitize(memento.getCustomFields())}); return memento; }
protected void startInLocation(final MachineProvisioningLocation<?> location) { final Map<String,Object> flags = obtainProvisioningFlags(location); if (!(location instanceof LocalhostMachineProvisioningLocation)) log.info("Starting {}, obtaining a new location instance in {} with ports {}", new Object[] {this, location, flags.get("inboundPorts")}); setAttribute(PROVISIONING_LOCATION, location); MachineLocation machine; try { machine = Tasks.withBlockingDetails("Provisioning machine in "+location, new Callable<MachineLocation>() { public MachineLocation call() throws NoMachinesAvailableException { return location.obtain(flags); }}); if (machine == null) throw new NoMachinesAvailableException("Failed to obtain machine in "+location.toString()); } catch (Exception e) { throw Exceptions.propagate(e); } if (log.isDebugEnabled()) log.debug("While starting {}, obtained new location instance {}", this, (machine instanceof SshMachineLocation ? machine+", details "+((SshMachineLocation)machine).getUser()+":"+Entities.sanitize(((SshMachineLocation)machine).getAllConfig()) : machine)); if (!(location instanceof LocalhostMachineProvisioningLocation)) log.info("While starting {}, obtained a new location instance {}, now preparing process there", this, machine); startInLocation(machine); }
public MachineLocation call() throws Exception { final Map<String,Object> flags = obtainProvisioningFlags(location); if (!(location instanceof LocalhostMachineProvisioningLocation)) log.info("Starting {}, obtaining a new location instance in {} with ports {}", new Object[] {entity(), location, flags.get("inboundPorts")}); entity().setAttribute(SoftwareProcess.PROVISIONING_LOCATION, location); MachineLocation machine; try { machine = Tasks.withBlockingDetails("Provisioning machine in "+location, new Callable<MachineLocation>() { public MachineLocation call() throws NoMachinesAvailableException { return location.obtain(flags); }}); if (machine == null) throw new NoMachinesAvailableException("Failed to obtain machine in "+location.toString()); } catch (Exception e) { throw Exceptions.propagate(e); } if (log.isDebugEnabled()) log.debug("While starting {}, obtained new location instance {}", entity(), (machine instanceof SshMachineLocation ? machine+", details "+((SshMachineLocation)machine).getUser()+":"+Entities.sanitize(((SshMachineLocation)machine).getAllConfig(false)) : machine)); return machine; } }).build());
ComputeService result = cachedComputeServices.get(cacheKey); if (result!=null) { LOG.debug("jclouds ComputeService cache hit for compute service, for "+Entities.sanitize(properties)); return result; LOG.debug("jclouds ComputeService cache miss for compute service, creating, for "+Entities.sanitize(properties)); ComputeService result = cachedComputeServices.get(cacheKey); if (result != null) { LOG.debug("jclouds ComputeService cache recovery for compute service, for "+Entities.sanitize(cacheKey)); LOG.debug("jclouds ComputeService created "+computeService+", adding to cache, for "+Entities.sanitize(properties)); cachedComputeServices.put(cacheKey, computeService);
"entityReferenceAttributes={}; customProperties={}", new Object[] {memento.getType(), memento.getId(), memento.getParent(), memento.getChildren(), memento.getLocations(), memento.getPolicies(), memento.getMembers(), sanitize(memento.getConfig()), sanitize(memento.getAttributes()), memento.getEntityReferenceConfigs(), memento.getEntityReferenceAttributes(), sanitize(memento.getCustomFields())});
@Override public void reconstruct(RebindContext rebindContext, LocationMemento memento) { if (LOG.isTraceEnabled()) LOG.trace("Reconstructing location {}({}): displayName={}; parent={}; children={}; " + "locationConfig={}; locationConfigDescription={}; customProperties={}", new Object[] {memento.getType(), memento.getId(), memento.getDisplayName(), memento.getParent(), memento.getChildren(), sanitize(memento.getLocationConfig()), memento.getLocationConfigDescription(), sanitize(memento.getCustomFields())}); // Note that the flags have been set in the constructor location.setName(memento.getDisplayName()); location.getConfigBag().putAll(memento.getLocationConfig()).markAll( Sets.difference(memento.getLocationConfig().keySet(), memento.getLocationConfigUnused())). setDescription(memento.getLocationConfigDescription()); // Do late-binding of config that are references to other locations for (String flagName : memento.getLocationConfigReferenceKeys()) { Field field = FlagUtils.findFieldForFlag(flagName, location); Class<?> fieldType = field.getType(); Object transformedValue = memento.getLocationConfig().get(flagName); Object restoredValue = MementoTransformer.transformIdsToLocations(rebindContext, transformedValue, fieldType, true); location.getConfigBag().putStringKey(flagName, restoredValue); FlagUtils.setFieldFromFlag(location, flagName, restoredValue); } setParent(rebindContext, memento); addChildren(rebindContext, memento); doReconsruct(rebindContext, memento); }
vmHostname, setup.getDescription(), Entities.sanitize(sshConfig) });