本文整理了Java中azkaban.utils.Props.setSource()
方法的一些代码示例,展示了Props.setSource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Props.setSource()
方法的具体详情如下:
包路径:azkaban.utils.Props
类名称:Props
方法名:setSource
[英]Sets source.
[中]设置源。
代码示例来源:origin: azkaban/azkaban
/**
* Load props from a file.
*/
public Props(final Props parent, final File file) throws IOException {
this(parent);
setSource(file.getPath());
final InputStream input = new BufferedInputStream(new FileInputStream(file));
try {
loadFrom(input);
} catch (final IOException e) {
throw e;
} finally {
input.close();
}
}
代码示例来源:origin: azkaban/azkaban
public static Props fromHierarchicalMap(final Map<String, Object> propsMap) {
if (propsMap == null) {
return null;
}
final String source = (String) propsMap.get("source");
final Map<String, String> propsParams =
(Map<String, String>) propsMap.get("props");
final Map<String, Object> parent = (Map<String, Object>) propsMap.get("parent");
final Props parentProps = fromHierarchicalMap(parent);
final Props props = new Props(parentProps, propsParams);
props.setSource(source);
return props;
}
代码示例来源:origin: azkaban/azkaban
@Override
public List<Pair<String, Props>> handle(final ResultSet rs) throws SQLException {
if (!rs.next()) {
return Collections.emptyList();
}
final List<Pair<String, Props>> properties = new ArrayList<>();
do {
final String name = rs.getString(3);
final int eventType = rs.getInt(5);
final byte[] dataBytes = rs.getBytes(6);
final EncodingType encType = EncodingType.fromInteger(eventType);
String propertyString = null;
try {
if (encType == EncodingType.GZIP) {
// Decompress the sucker.
propertyString = GZIPUtils.unGzipString(dataBytes, "UTF-8");
} else {
propertyString = new String(dataBytes, "UTF-8");
}
final Props props = PropsUtils.fromJSONString(propertyString);
props.setSource(name);
properties.add(new Pair<>(name, props));
} catch (final IOException e) {
throw new SQLException(e);
}
} while (rs.next());
return properties;
}
}
代码示例来源:origin: azkaban/azkaban
try {
parent = new Props(parent, file);
parent.setSource(relative);
final Props prop = new Props(parent, file);
final String relative = getRelativeFilePath(base, file.getPath());
prop.setSource(relative);
代码示例来源:origin: azkaban/azkaban
private Flow convertAzkabanFlowToFlow(final AzkabanFlow azkabanFlow, final String flowName,
final File flowFile) {
final Flow flow = new Flow(flowName);
flow.setAzkabanFlowVersion(Constants.AZKABAN_FLOW_VERSION_2_0);
final Props props = azkabanFlow.getProps();
FlowLoaderUtils.addEmailPropsToFlow(flow, props);
props.setSource(flowFile.getName());
flow.addAllFlowProperties(ImmutableList.of(new FlowProps(props)));
// Convert azkabanNodes to nodes inside the flow.
azkabanFlow.getNodes().values().stream()
.map(n -> convertAzkabanNodeToNode(n, flowName, flowFile, azkabanFlow))
.forEach(n -> flow.addNode(n));
// Add edges for the flow.
buildFlowEdges(azkabanFlow, flowName);
if (this.edgeMap.containsKey(flowName)) {
flow.addAllEdges(this.edgeMap.get(flowName));
}
// Todo jamiesjc: deprecate startNodes, endNodes and numLevels, and remove below method finally.
// Blow method will construct startNodes, endNodes and numLevels for the flow.
flow.initialize();
return flow;
}
代码示例来源:origin: azkaban/azkaban
@Test
public void testFetchProjectProperties() throws Exception {
final Props props1 = new Props();
props1.setSource("source1");
props1.put("key1", "value1");
props1.put("key2", "value2");
final Props props2 = new Props();
props2.setSource("source2");
props2.put("keykey", "valuevalue1");
props2.put("keyaaa", "valueaaa");
final List<Props> list = Arrays.asList(props1, props2);
createThreeProjects();
final Project project = this.loader.fetchProjectByName("mytestProject");
this.loader.uploadProjectProperties(project, list);
final Map<String, Props> propsMap = this.loader
.fetchProjectProperties(project.getId(), project.getVersion());
Assert.assertEquals(propsMap.get("source1").get("key2"), "value2");
Assert.assertEquals(propsMap.get("source2").get("keyaaa"), "valueaaa");
}
代码示例来源:origin: azkaban/azkaban
prop.setSource(jobName + Constants.JOB_OVERRIDE_SUFFIX);
oldProps = this.projectLoader.fetchProjectProperty(project, prop.getSource());
代码示例来源:origin: azkaban/azkaban
@Test
public void testUploadOrUpdateProjectProperty() throws Exception {
final Props props = new Props();
props.setSource("source1");
props.put("key1", "value1");
props.put("key2", "value2");
createThreeProjects();
final Project project = this.loader.fetchProjectByName("mytestProject");
this.loader.uploadProjectProperty(project, props);
final Props sameProps = this.loader.fetchProjectProperty(project, props.getSource());
Assert.assertEquals(sameProps.get("key1"), "value1");
Assert.assertEquals(sameProps.get("key2"), "value2");
props.put("key2", "value9");
this.loader.updateProjectProperty(project, props);
final Props sameProps2 = this.loader.fetchProjectProperty(project, props.getSource());
Assert.assertEquals(sameProps2.get("key2"), "value9");
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
/**
* Load props from a file.
*
* @param parent
* @param file
* @throws IOException
*/
public Props(Props parent, File file) throws IOException {
this(parent);
setSource(file.getPath());
InputStream input = new BufferedInputStream(new FileInputStream(file));
try {
loadFrom(input);
} catch (IOException e) {
input.close();
throw e;
}
input.close();
}
代码示例来源:origin: com.linkedin.azkaban/az-core
/**
* Load props from a file.
*
* @param parent the parent
* @param file the file
* @throws IOException the io exception
*/
public Props(final Props parent, final File file) throws IOException {
this(parent);
setSource(file.getPath());
final InputStream input = new BufferedInputStream(new FileInputStream(file));
try {
loadFrom(input);
} catch (final IOException e) {
throw e;
} finally {
input.close();
}
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
@SuppressWarnings("unchecked")
public static Props fromHierarchicalMap(Map<String, Object> propsMap) {
if (propsMap == null) {
return null;
}
String source = (String)propsMap.get("source");
Map<String, String> propsParams = (Map<String,String>)propsMap.get("props");
Map<String,Object> parent = (Map<String,Object>)propsMap.get("parent");
Props parentProps = fromHierarchicalMap(parent);
Props props = new Props(parentProps, propsParams);
props.setSource(source);
return props;
}
代码示例来源:origin: com.linkedin.azkaban/az-core
/**
* From hierarchical map props.
*
* @param propsMap the props map
* @return the props
*/
public static Props fromHierarchicalMap(final Map<String, Object> propsMap) {
if (propsMap == null) {
return null;
}
final String source = (String) propsMap.get("source");
final Map<String, String> propsParams =
(Map<String, String>) propsMap.get("props");
final Map<String, Object> parent = (Map<String, Object>) propsMap.get("parent");
final Props parentProps = fromHierarchicalMap(parent);
final Props props = new Props(parentProps, propsParams);
props.setSource(source);
return props;
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
props.setSource(name);
properties.add(new Pair<String, Props>(name, props));
} catch (IOException e) {
代码示例来源:origin: com.linkedin.azkaban/azkaban-common
@Override
public List<Pair<String, Props>> handle(final ResultSet rs) throws SQLException {
if (!rs.next()) {
return Collections.emptyList();
}
final List<Pair<String, Props>> properties = new ArrayList<>();
do {
final String name = rs.getString(3);
final int eventType = rs.getInt(5);
final byte[] dataBytes = rs.getBytes(6);
final EncodingType encType = EncodingType.fromInteger(eventType);
String propertyString = null;
try {
if (encType == EncodingType.GZIP) {
// Decompress the sucker.
propertyString = GZIPUtils.unGzipString(dataBytes, "UTF-8");
} else {
propertyString = new String(dataBytes, "UTF-8");
}
final Props props = PropsUtils.fromJSONString(propertyString);
props.setSource(name);
properties.add(new Pair<>(name, props));
} catch (final IOException e) {
throw new SQLException(e);
}
} while (rs.next());
return properties;
}
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
public void setJobOverrideProperty(Project project, Props prop, String jobName) throws ProjectManagerException {
prop.setSource(jobName+".jor");
Props oldProps = projectLoader.fetchProjectProperty(project, prop.getSource());
if(oldProps == null) {
projectLoader.uploadProjectProperty(project, prop);
}
else {
projectLoader.updateProjectProperty(project, prop);
}
return;
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
try {
parent = new Props(parent, file);
parent.setSource(relative);
Props prop = new Props(parent, file);
String relative = getRelativeFilePath(base, file.getPath());
prop.setSource(relative);
代码示例来源:origin: com.linkedin.azkaban/azkaban-common
try {
parent = new Props(parent, file);
parent.setSource(relative);
final Props prop = new Props(parent, file);
final String relative = getRelativeFilePath(base, file.getPath());
prop.setSource(relative);
代码示例来源:origin: com.linkedin.azkaban/azkaban-common
private Flow convertAzkabanFlowToFlow(final AzkabanFlow azkabanFlow, final String flowName,
final File flowFile) {
final Flow flow = new Flow(flowName);
flow.setAzkabanFlowVersion(Constants.AZKABAN_FLOW_VERSION_2_0);
final Props props = azkabanFlow.getProps();
FlowLoaderUtils.addEmailPropsToFlow(flow, props);
props.setSource(flowFile.getName());
flow.addAllFlowProperties(ImmutableList.of(new FlowProps(props)));
// Convert azkabanNodes to nodes inside the flow.
azkabanFlow.getNodes().values().stream()
.map(n -> convertAzkabanNodeToNode(n, flowName, flowFile, azkabanFlow))
.forEach(n -> flow.addNode(n));
// Add edges for the flow.
buildFlowEdges(azkabanFlow, flowName);
if (this.edgeMap.containsKey(flowName)) {
flow.addAllEdges(this.edgeMap.get(flowName));
}
// Todo jamiesjc: deprecate startNodes, endNodes and numLevels, and remove below method finally.
// Blow method will construct startNodes, endNodes and numLevels for the flow.
flow.initialize();
return flow;
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
props.setSource(path.getPath());
代码示例来源:origin: com.linkedin.azkaban/azkaban-common
prop.setSource(jobName + Constants.JOB_OVERRIDE_SUFFIX);
oldProps = this.projectLoader.fetchProjectProperty(project, prop.getSource());
内容来源于网络,如有侵权,请联系作者删除!