Search in sources :

Example 1 with StreamlineComponent

use of com.hortonworks.streamline.streams.layout.component.StreamlineComponent in project streamline by hortonworks.

the class CatalogToLayoutConverter method getComponentLayout.

public static com.hortonworks.streamline.streams.layout.component.Component getComponentLayout(TopologyComponent component) {
    StreamlineComponent componentLayout;
    if (component instanceof TopologySource) {
        componentLayout = new StreamlineSource() {

            @Override
            public void accept(TopologyDagVisitor visitor) {
                throw new UnsupportedOperationException("Not intended to be called here.");
            }
        };
    } else if (component instanceof TopologyProcessor) {
        componentLayout = new StreamlineProcessor() {

            @Override
            public void accept(TopologyDagVisitor visitor) {
                throw new UnsupportedOperationException("Not intended to be called here.");
            }
        };
    } else if (component instanceof TopologySink) {
        componentLayout = new StreamlineSink() {

            @Override
            public void accept(TopologyDagVisitor visitor) {
                throw new UnsupportedOperationException("Not intended to be called here.");
            }
        };
    } else {
        componentLayout = new StreamlineComponent() {

            @Override
            public void accept(TopologyDagVisitor visitor) {
                throw new UnsupportedOperationException("Not intended to be called here.");
            }
        };
    }
    componentLayout.setId(component.getId().toString());
    componentLayout.setName(component.getName());
    componentLayout.setConfig(component.getConfig());
    return componentLayout;
}
Also used : StreamlineProcessor(com.hortonworks.streamline.streams.layout.component.StreamlineProcessor) TopologyDagVisitor(com.hortonworks.streamline.streams.layout.component.TopologyDagVisitor) StreamlineComponent(com.hortonworks.streamline.streams.layout.component.StreamlineComponent) StreamlineSource(com.hortonworks.streamline.streams.layout.component.StreamlineSource) StreamlineSink(com.hortonworks.streamline.streams.layout.component.StreamlineSink)

Example 2 with StreamlineComponent

use of com.hortonworks.streamline.streams.layout.component.StreamlineComponent in project streamline by hortonworks.

the class TopologyComponentFactory method getStreamlineComponent.

private <T extends StreamlineComponent> T getStreamlineComponent(Class<T> clazz, TopologyComponent topologyComponent) {
    if (topologyComponent.getReconfigure()) {
        throw new IllegalStateException("Topology component " + topologyComponent + " must be reconfigured");
    }
    TopologyComponentBundle topologyComponentBundle = getTopologyComponentBundle(topologyComponent);
    StreamlineComponent component = getProvider(clazz, topologyComponentBundle.getSubType()).create(topologyComponent);
    component.setId(topologyComponent.getId().toString());
    component.setName(topologyComponent.getName());
    component.setConfig(topologyComponent.getConfig());
    component.setTopologyComponentBundleId(topologyComponentBundle.getId().toString());
    component.setTransformationClass(topologyComponentBundle.getTransformationClass());
    return clazz.cast(component);
}
Also used : StreamlineComponent(com.hortonworks.streamline.streams.layout.component.StreamlineComponent) TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)

Aggregations

StreamlineComponent (com.hortonworks.streamline.streams.layout.component.StreamlineComponent)2 TopologyComponentBundle (com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)1 StreamlineProcessor (com.hortonworks.streamline.streams.layout.component.StreamlineProcessor)1 StreamlineSink (com.hortonworks.streamline.streams.layout.component.StreamlineSink)1 StreamlineSource (com.hortonworks.streamline.streams.layout.component.StreamlineSource)1 TopologyDagVisitor (com.hortonworks.streamline.streams.layout.component.TopologyDagVisitor)1