public Map<String, List<CompensatableCommand>> generate(List<LogicalComponent<?>> components) throws GenerationException { Map<String, List<CompensatableCommand>> commands = new HashMap<String, List<CompensatableCommand>>(); for (LogicalComponent<?> component : components) { if (component.getState() == LogicalState.MARKED) { List<CompensatableCommand> list = getCommands(component.getZone(), commands); QName deployable = component.getDeployable(); // only log application composite deployments boolean log = !component.getUri().toString().startsWith(Names.RUNTIME_NAME); StopContextCommand command = new StopContextCommand(deployable, log); if (!list.contains(command)) { list.add(command); } } } return commands; }
public Map<String, List<CompensatableCommand>> generate(List<LogicalComponent<?>> components, boolean incremental) throws GenerationException { Map<String, List<CompensatableCommand>> commands = new HashMap<String, List<CompensatableCommand>>(); for (LogicalComponent<?> component : components) { if (component.getState() == LogicalState.NEW || !incremental) { QName deployable = component.getDeployable(); // only log application composite deployments boolean log = !component.getUri().toString().startsWith(Names.RUNTIME_NAME); StartContextCommand command = new StartContextCommand(deployable, log); String zone = component.getZone(); List<CompensatableCommand> list = getCommands(zone, commands); if (!list.contains(command)) { list.add(command); } } } return commands; }
/** * Maps a component to a zone based on a collection of deployment plans. * * @param component the component to map * @param plan the deployment plans to use for mapping * @throws AllocationException if an error occurs mapping */ private void selectZone(LogicalComponent<?> component, DeploymentPlan plan) throws AllocationException { QName deployable = component.getDeployable(); if (deployable == null) { // programming error throw new AssertionError("Deployable not found for " + component.getUri()); } String zoneName = plan.getDeployableMappings().get(deployable); if (zoneName == null) { throw new DeployableMappingNotFoundException("Zone mapping not found for deployable: " + deployable); } component.setZone(zoneName); }
public void bind(LogicalChannel channel) { QName deployable = channel.getParent().getDeployable(); String topic = channel.getUri().toString(); JmsBindingDefinition channelDefinition = createTopicBindingDefinition(topic); LogicalBinding<JmsBindingDefinition> channelBinding = new LogicalBinding<JmsBindingDefinition>(channelDefinition, channel, deployable); channelBinding.setAssigned(true); channel.addBinding(channelBinding); }
URI uri = component.getUri(); URI contributionUri = component.getDefinition().getContributionUri(); QName deployable = component.getDeployable(); String zone = component.getZone(); ComponentInfo info = new ComponentInfo(uri, contributionUri, deployable, zone);
/** * Creates a wire by resolving a Target. * * @param target the target * @param reference the source reference * @param bindingName the binding name or null * @param parent the parent component * @param context the instantiation context * @return the wire or null if it could not be created */ private LogicalWire createWire(Target target, LogicalReference reference, String bindingName, LogicalCompositeComponent parent, InstantiationContext context) { LogicalService service = resolveService(reference, target, parent, context); if (service == null) { return null; } QName deployable = service.getParent().getDeployable(); LogicalWire wire = new LogicalWire(parent, reference, service, deployable, true); String serviceBindingName = target.getBinding(); resolveBindings(reference, bindingName, service, wire, serviceBindingName, context); return wire; }
@SuppressWarnings("unchecked") protected PhysicalComponentDefinition generateDefinition(LogicalComponent<?> component) throws GenerationException { Implementation<?> implementation = component.getDefinition().getImplementation(); Class<? extends Implementation> type = implementation.getClass(); ComponentGenerator generator = generatorRegistry.getComponentGenerator(type); if (generator == null) { throw new GeneratorNotFoundException(type); } PhysicalComponentDefinition definition = generator.generate(component); URI uri = component.getUri(); definition.setComponentUri(uri); definition.setClassLoaderId(component.getDefinition().getContributionUri()); QName deployable = component.getDeployable(); definition.setDeployable(deployable); return definition; }
private void generateCommand(LogicalProducer producer, ChannelConnectionCommand command, boolean incremental) throws GenerationException { LogicalComponent<?> component = producer.getParent(); QName deployable = producer.getParent().getDeployable(); if (LogicalState.MARKED == component.getState()) { Map<LogicalChannel, ChannelDeliveryType> channels = new HashMap<LogicalChannel, ChannelDeliveryType>();
private void generateCommand(LogicalConsumer consumer, ChannelConnectionCommand command, boolean incremental) throws GenerationException { LogicalComponent<?> component = consumer.getParent(); QName deployable = consumer.getParent().getDeployable(); if (LogicalState.MARKED == component.getState()) { Map<LogicalChannel, ChannelDeliveryType> channels = new HashMap<LogicalChannel, ChannelDeliveryType>();
public void markForCollection(QName deployable, LogicalCompositeComponent composite) { for (LogicalComponent<?> component : composite.getComponents()) { if (deployable.equals(component.getDeployable())) { if (component instanceof LogicalCompositeComponent) { markForCollection(deployable, (LogicalCompositeComponent) component);
QName deployable = target.getParent().getDeployable();
QName sourceDeployable = source.getDeployable(); QName targetDeployable = target.getDeployable();
QName sourceDeployable = source.getDeployable(); QName targetDeployable = target.getDeployable();
public void bind(LogicalWire wire) throws BindingSelectionException { LogicalReference source = wire.getSource().getLeafReference(); LogicalService target = wire.getTarget().getLeafService(); QName deployable = source.getParent().getDeployable();
public void bind(LogicalWire wire) throws BindingSelectionException { LogicalReference source = wire.getSource().getLeafReference(); LogicalService target = wire.getTarget().getLeafService(); QName deployable = source.getParent().getDeployable();