/** * Gets the component type. * * @return Component type. */ public ComponentType getComponentType() { return implementation != null ? getImplementation().getComponentType() : null; }
protected RingBufferChannelBuilder(String name) { definition = new Channel(name); data = new RingBufferData(); definition.setMetadata(data); }
/** * Constructor. * * @param uri the reference URI * @param definition the reference type definition * @param parent the parent component */ public LogicalReference(URI uri, Reference<ComponentType> definition, LogicalComponent<?> parent) { super(uri, definition != null ? definition.getServiceContract() : null, parent); this.definition = definition; }
/** * Includes the composite in the current composite. * * @param included the name of the composite to include * @return the builder */ public CompositeBuilder include(Composite included) { checkState(); Include include = new Include(); include.setIncluded(included); include.setName(included.getName()); composite.add(include); return this; }
/** * Adds a reference with the given name and target. * * @param name the reference name * @param target the target */ public T reference(String name, String target) { checkState(); Component<?> definition = getComponent(); Reference<Component> reference = new Reference<>(name, Multiplicity.ONE_ONE); reference.addTarget(new Target(target)); definition.add(reference); return builder(); }
/** * Returns true if the reference is not keyed, true if the reference is keyed and the target specifies a key, false if the reference is keyed and the target * does not specify a key. * * @param logicalReference the logical reference * @param target the target * @return true if the reference is not keyed, true if the reference is keyed and the target specifies a key, false if the reference is keyed and the target * does not specify a key */ private boolean validKey(LogicalReference logicalReference, LogicalComponent<?> target) { return !logicalReference.getDefinition().isKeyed() || target.getDefinition().getKey() != null || target.getDefinition().getComponentType().getKey() != null; } }
private void includeProperties(Composite composite, LogicalCompositeComponent domain, InstantiationContext context) { for (Property property : composite.getProperties().values()) { includeProperty(property, domain, context); } for (Include include : composite.getIncludes().values()) { for (Property property : include.getIncluded().getProperties().values()) { includeProperty(property, domain,context); } } }
/** * Returns the event type * * @return the event type */ public JavaType getType() { return (JavaType) super.getType(); } }
protected CompositeBuilder(QName name) { composite = new Composite(name); } }
/** * Adds a property value. * * @param name the property name * @param value the value * @return the builder */ public T property(String name, Object value) { checkState(); PropertyValue propertyValue = new PropertyValue(name, value); getComponent().add(propertyValue); return builder(); }
/** * Default constructor * * @param uri the service uri * @param definition the service definition * @param parent the service parent component */ @SuppressWarnings("unchecked") public LogicalService(URI uri, Service<ComponentType> definition, LogicalComponent<?> parent) { super(uri, definition != null ? definition.getServiceContract() : null, parent); this.definition = definition; }
public void introspect(Channel channel) { channel.getBindings().forEach(b -> { if (b instanceof NATSBinding) { b.setConnectionTypes(Nats.class, Subscription.class); } }); } }
private ServiceContract getServiceContract(BindableDefinition parent) throws GenerationException { ServiceContract serviceContract; if (parent instanceof AbstractService) { serviceContract = ((AbstractService) parent).getServiceContract(); } else if (parent instanceof AbstractReference) { serviceContract = ((AbstractReference) parent).getServiceContract(); } else { throw new GenerationException("Unsupported bindable type: " + parent); } return serviceContract; }
/** * Constructor. * * @param uri URI of the resource. * @param definition the resource reference definition. * @param parent the parent component */ public LogicalResourceReference(URI uri, RD definition, LogicalComponent<?> parent) { super(uri, definition != null ? definition.getServiceContract() : null, parent); this.definition = definition; }
private boolean noPolicy(LogicalComponent<?> component) { return component != null && (component.getDefinition().getImplementation().isType(IMPLEMENTATION_SYSTEM) || component.getDefinition().getImplementation().isType(IMPLEMENTATION_SINGLETON)); }
/** * Sets the component type. * * @param componentType the component type */ public void setComponentType(T componentType) { componentType.setParent(this); this.componentType = componentType; }
/** * Sets the component implementation. * * @param implementation the component implementation */ public void setImplementation(I implementation) { implementation.setParent(this); this.implementation = implementation; }
/** * Adds a reference with the given name and target. * * @param name the reference name * @param target the target * @param multiplicity the multiplicity */ public T reference(String name, String target, Multiplicity multiplicity) { checkState(); Component<?> definition = getComponent(); Reference<Component> reference = new Reference<>(name, multiplicity); reference.addTarget(new Target(target)); definition.add(reference); return builder(); }
/** * Returns the event type * * @return the event type */ public JavaType getType() { return (JavaType) super.getType(); } }
/** * Adds a reference with the given name and target. * * @param name the reference name * @param target the target */ public T reference(String name, String target, boolean required) { checkState(); Component<?> definition = getComponent(); Multiplicity multiplicity = required ? Multiplicity.ONE_ONE : Multiplicity.ZERO_ONE; Reference<Component> reference = new Reference<>(name, multiplicity); reference.addTarget(new Target(target)); definition.add(reference); return builder(); }