BundleDestinationDefinition.class) || expectedClass.equals(BundleDestinationSpecification.class))) { BundleDestinationDefinition.Builder bld = BundleDestinationDefinition.builder().withName(name) .withConnectionString(connection).withDescription(description).withAcceptedBundleTypes(accepts);
/** * Creates a new destination definition builder initialized with the provided name that will add * the built destination definition into this bundle configuration instance automatically. * * @param name the name of this bundle destination location (must not be <code>null</code>) * @since 4.13 */ public BundleDestinationDefinition.Builder createDestinationDefinitionBuilder(String name) { if (name == null) { throw new IllegalArgumentException("name == null"); } return BundleDestinationDefinition.builderAddingTo(this).withName(name); }
private String getConnectionString(BundleResourceDeployment resourceDeployment) { ResourceContainer rc = inventoryManager.getResourceContainer(resourceDeployment.getResource()); BundleDestination dest = resourceDeployment.getBundleDeployment().getDestination(); ResourceType type = rc.getResource().getResourceType(); String specName = dest.getDestinationSpecificationName(); String relativeDeployDir = dest.getDeployDir(); Configuration config = new Configuration(); config.put(new PropertySimple("deployDir", relativeDeployDir)); ConnectionStringAvailableProperties props = new ConnectionStringAvailableProperties(rc, measurementManager, config); for (ResourceTypeBundleConfiguration.BundleDestinationSpecification spec : type .getResourceTypeBundleConfiguration().getBundleDestinationSpecifications()) { if (specName.equals(spec.getName())) { ResourceTypeBundleConfiguration.BundleDestinationDefinition def = (ResourceTypeBundleConfiguration.BundleDestinationDefinition) spec; String rawConnectionString = def.getConnectionString(); if (rawConnectionString == null) { return null; } TokenReplacingReader trr = new TokenReplacingReader(new StringReader(rawConnectionString), props); try { return StreamUtil.slurp(trr); } finally { StreamUtil.safeClose(trr); } } } return null; }
@Override public String toString() { return "BundleDestinationLocation[name=" + getName() + ", conn=" + connectionString + ", refs=" + referencedConfiguration + ", description=" + getDescription(); }
public BundleDestinationDefinition build() { BundleDestinationDefinition ret = new BundleDestinationDefinition(name, connString, description, refs, acceptedBundleTypes); if (targetConfig != null) { targetConfig.addBundleDestinationSpecification(ret); } return ret; } }