use of com.ibm.streamsx.topology.internal.toolkit.info.DescriptionType in project streamsx.topology by IBMStreams.
the class ToolkitRemoteContext method addToolkitInfo.
/**
* Create an info.xml file for the toolkit.
* @throws URISyntaxException
*/
private void addToolkitInfo(File toolkitRoot, JsonObject jsonGraph) throws JAXBException, FileNotFoundException, IOException, URISyntaxException {
File infoFile = new File(toolkitRoot, "info.xml");
ToolkitInfoModelType info = new ToolkitInfoModelType();
info.setIdentity(new IdentityType());
info.getIdentity().setName(toolkitRoot.getName());
info.getIdentity().setDescription(new DescriptionType());
info.getIdentity().setVersion("1.0.0." + System.currentTimeMillis());
info.getIdentity().setRequiredProductVersion("4.0.1.0");
DependenciesType dependencies = new DependenciesType();
List<ToolkitDependencyType> toolkits = dependencies.getToolkit();
GsonUtilities.objectArray(object(jsonGraph, "spl"), TOOLKITS_JSON, tk -> {
ToolkitDependencyType depTkInfo;
String root = jstring(tk, "root");
if (root != null) {
try {
depTkInfo = TkInfo.getTookitDependency(root);
} catch (Exception e) {
throw new RuntimeException(e);
}
} else {
depTkInfo = new ToolkitDependencyType();
depTkInfo.setName(jstring(tk, "name"));
depTkInfo.setVersion(jstring(tk, "version"));
}
toolkits.add(depTkInfo);
});
File topologyToolkitRoot = TkInfo.getTopologyToolkitRoot();
toolkits.add(TkInfo.getTookitDependency(topologyToolkitRoot.getAbsolutePath()));
info.setDependencies(dependencies);
JAXBContext context = JAXBContext.newInstance(ObjectFactory.class);
Marshaller m = context.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
try (FileOutputStream out = new FileOutputStream(infoFile)) {
m.marshal(info, out);
}
}
Aggregations