use of com.hortonworks.streamline.streams.catalog.TopologyVersion in project streamline by hortonworks.
the class StreamCatalogService method removeTopologyVersionInfo.
public TopologyVersion removeTopologyVersionInfo(Long versionId) {
TopologyVersion topologyVersion = new TopologyVersion();
topologyVersion.setId(versionId);
return dao.remove(new StorableKey(TOPOLOGY_VERSIONINFO_NAMESPACE, topologyVersion.getPrimaryKey()));
}
use of com.hortonworks.streamline.streams.catalog.TopologyVersion in project streamline by hortonworks.
the class StreamCatalogService method addTopology.
public Topology addTopology(Topology topology) {
validateTopology(topology);
boolean storedPlaceholderVersionTopology = false;
if (topology.getId() == null) {
topology.setId(this.dao.nextId(TOPOLOGY_NAMESPACE));
topology.setVersionId(PLACEHOLDER_ID);
this.dao.add(topology);
LOG.debug("Added topology {} with placeholder version", topology);
storedPlaceholderVersionTopology = true;
}
long timestamp = System.currentTimeMillis();
topology.setVersionTimestamp(timestamp);
TopologyVersion versionInfo = addCurrentTopologyVersionInfo(topology.getId(), timestamp);
LOG.debug("Added version info {}", versionInfo);
if (storedPlaceholderVersionTopology) {
// remove topology with placeholder version first
// WARN: don't use removeTopology since it also removes PLACEHOLDER topology version info!
removeOnlyTopologyEntity(topology.getId(), topology.getVersionId());
}
// put actual version id
topology.setVersionId(versionInfo.getId());
this.dao.addOrUpdate(topology);
LOG.debug("Added topology {}", topology);
return topology;
}
use of com.hortonworks.streamline.streams.catalog.TopologyVersion in project streamline by hortonworks.
the class StreamCatalogService method updateVersionTimestamp.
public TopologyVersion updateVersionTimestamp(Long versionId, Long timestamp) {
TopologyVersion topologyVersion = getTopologyVersionInfo(versionId);
if (topologyVersion == null) {
throw new IllegalStateException("No version with version Id " + versionId);
}
topologyVersion.setTimestamp(timestamp);
dao.addOrUpdate(topologyVersion);
return topologyVersion;
}
Aggregations