.withConfig(topologyConfig) .withDescription(description) .withVersion(version) .withSpecExecutor(specExecutor); topologySpecs.add(topologySpecBuilder.build());
/** Creates a builder for the TopologySpec based on values in a topology properties config. */ public static TopologySpec.Builder builder(URI catalogURI, Properties topologyProps) { String name = topologyProps.getProperty(ConfigurationKeys.TOPOLOGY_NAME_KEY); String group = topologyProps.getProperty(ConfigurationKeys.TOPOLOGY_GROUP_KEY, "default"); try { URI topologyURI = new URI(catalogURI.getScheme(), catalogURI.getAuthority(), "/" + group + "/" + name, null); TopologySpec.Builder builder = new TopologySpec.Builder(topologyURI).withConfigAsProperties(topologyProps); String descr = topologyProps.getProperty(ConfigurationKeys.TOPOLOGY_DESCRIPTION_KEY, null); if (null != descr) { builder = builder.withDescription(descr); } return builder; } catch (URISyntaxException e) { throw new RuntimeException("Unable to create a TopologySpec URI: " + e, e); } }
public URI getDefaultURI() { URI topologyCatalogURI = getTopologyCatalogURI(); Config topologyCfg = getConfig(); String name = topologyCfg.hasPath(ConfigurationKeys.TOPOLOGY_NAME_KEY) ? topologyCfg.getString(ConfigurationKeys.TOPOLOGY_NAME_KEY) : "default"; String group = topologyCfg.hasPath(ConfigurationKeys.TOPOLOGY_GROUP_KEY) ? topologyCfg.getString(ConfigurationKeys.TOPOLOGY_GROUP_KEY) : "default"; try { return new URI(topologyCatalogURI.getScheme(), topologyCatalogURI.getAuthority(), "/" + group + "/" + name, null, null); } catch (URISyntaxException e) { throw new RuntimeException("Unable to create default TopologySpec URI:" + e, e); } }
.withConfig(topologyConfig) .withDescription(description) .withVersion(version) .withSpecExecutor(specExecutor); topologySpecs.add(topologySpecBuilder.build());
/** Creates a builder for the TopologySpec based on values in a topology properties config. */ public static TopologySpec.Builder builder(URI catalogURI, Properties topologyProps) { String name = topologyProps.getProperty(ConfigurationKeys.TOPOLOGY_NAME_KEY); String group = topologyProps.getProperty(ConfigurationKeys.TOPOLOGY_GROUP_KEY, "default"); try { URI topologyURI = new URI(catalogURI.getScheme(), catalogURI.getAuthority(), "/" + group + "/" + name, null); TopologySpec.Builder builder = new TopologySpec.Builder(topologyURI).withConfigAsProperties(topologyProps); String descr = topologyProps.getProperty(ConfigurationKeys.TOPOLOGY_DESCRIPTION_KEY, null); if (null != descr) { builder = builder.withDescription(descr); } return builder; } catch (URISyntaxException e) { throw new RuntimeException("Unable to create a TopologySpec URI: " + e, e); } }
public URI getDefaultURI() { URI topologyCatalogURI = getTopologyCatalogURI(); Config topologyCfg = getConfig(); String name = topologyCfg.hasPath(ConfigurationKeys.TOPOLOGY_NAME_KEY) ? topologyCfg.getString(ConfigurationKeys.TOPOLOGY_NAME_KEY) : "default"; String group = topologyCfg.hasPath(ConfigurationKeys.TOPOLOGY_GROUP_KEY) ? topologyCfg.getString(ConfigurationKeys.TOPOLOGY_GROUP_KEY) : "default"; try { return new URI(topologyCatalogURI.getScheme(), topologyCatalogURI.getAuthority(), "/" + group + "/" + name, null, null); } catch (URISyntaxException e) { throw new RuntimeException("Unable to create default TopologySpec URI:" + e, e); } }
public static TopologySpec.Builder builder() { return new TopologySpec.Builder(); }
public static TopologySpec.Builder builder(URI topologySpecUri) { return new TopologySpec.Builder(topologySpecUri); }
public static TopologySpec.Builder builder(String topologySpecUri) { return new TopologySpec.Builder(topologySpecUri); }
public TopologySpec build() { Preconditions.checkNotNull(this.uri); Preconditions.checkNotNull(this.version); return new TopologySpec(getURI(), getVersion(), getDescription(), getConfig(), getConfigAsProperties(), getSpecExceutorInstance()); }
public Config getConfig() { if (!this.config.isPresent()) { this.config = this.configAsProperties.isPresent() ? Optional.of(ConfigUtils.propertiesToTypedConfig(this.configAsProperties.get(), Optional.<String>absent())) : Optional.of(getDefaultConfig()); } return this.config.get(); }
.withConfig(topologyConfig) .withDescription("") .withVersion("1") .withSpecExecutor(specExecutor); TopologySpec topologySpec = topologySpecBuilder.build(); topologySpecMap.put(topologySpecUri, topologySpec);
private TopologySpec initTopologySpec(String storeDir, String ... args) { Properties properties = new Properties(); properties.put("specStore.fs.dir", storeDir); String capabilitiesString = ""; for(int i =0 ; i < args.length - 1 ; i ++ ) { capabilitiesString = capabilitiesString + ( args[i] + ":" + args[i+1] + ","); } Assert.assertEquals(capabilitiesString.charAt(capabilitiesString.length() - 1) , ','); capabilitiesString = capabilitiesString.substring(0, capabilitiesString.length() - 1 ); properties.put("specExecInstance.capabilities", capabilitiesString); properties.put("executorAttrs", new Properties()); Config config = ConfigUtils.propertiesToConfig(properties); SpecExecutor specExecutorInstance = new InMemorySpecExecutor(config); TopologySpec.Builder topologySpecBuilder = TopologySpec.builder( IdentityFlowToJobSpecCompilerTest.computeTopologySpecURI(SPEC_STORE_PARENT_DIR, storeDir)) .withConfig(config) .withDescription(SPEC_DESCRIPTION) .withVersion(SPEC_VERSION) .withSpecExecutor(specExecutorInstance); return topologySpecBuilder.build(); }
public static TopologySpec.Builder builder() { return new TopologySpec.Builder(); }
public static TopologySpec.Builder builder(String topologySpecUri) { return new TopologySpec.Builder(topologySpecUri); }
private TopologySpec initTopologySpec() { Properties properties = new Properties(); properties.put("specStore.fs.dir", TOPOLOGY_SPEC_STORE_DIR); properties.put("specExecInstance.capabilities", TEST_SOURCE_NAME + ":" + TEST_SINK_NAME); Config config = ConfigUtils.propertiesToConfig(properties); SpecExecutor specExecutorInstance = new InMemorySpecExecutor(config); TopologySpec.Builder topologySpecBuilder = TopologySpec.builder(computeTopologySpecURI(SPEC_STORE_PARENT_DIR, TOPOLOGY_SPEC_STORE_DIR)) .withConfig(config) .withDescription(SPEC_DESCRIPTION) .withVersion(SPEC_VERSION) .withSpecExecutor(specExecutorInstance); return topologySpecBuilder.build(); }
public static TopologySpec.Builder builder(URI topologySpecUri) { return new TopologySpec.Builder(topologySpecUri); }
private TopologySpec initTopologySpec() { Properties properties = new Properties(); properties.put("specStore.fs.dir", SPEC_STORE_DIR); properties.put("specExecInstance.capabilities", "source:destination"); Config config = ConfigUtils.propertiesToConfig(properties); SpecExecutor specExecutorInstanceProducer = new InMemorySpecExecutor(config); TopologySpec.Builder topologySpecBuilder = TopologySpec.builder(computeTopologySpecURI()) .withConfig(config) .withDescription(SPEC_DESCRIPTION) .withVersion(SPEC_VERSION) .withSpecExecutor(specExecutorInstanceProducer); return topologySpecBuilder.build(); }
public Config getConfig() { if (!this.config.isPresent()) { this.config = this.configAsProperties.isPresent() ? Optional.of(ConfigUtils.propertiesToTypedConfig(this.configAsProperties.get(), Optional.<String>absent())) : Optional.of(getDefaultConfig()); } return this.config.get(); }