Search in sources :

Example 11 with TopologyVersion

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()));
}
Also used : TopologyVersion(com.hortonworks.streamline.streams.catalog.TopologyVersion) StorableKey(com.hortonworks.registries.storage.StorableKey)

Example 12 with TopologyVersion

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;
}
Also used : TopologyVersion(com.hortonworks.streamline.streams.catalog.TopologyVersion)

Example 13 with TopologyVersion

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;
}
Also used : TopologyVersion(com.hortonworks.streamline.streams.catalog.TopologyVersion)

Aggregations

TopologyVersion (com.hortonworks.streamline.streams.catalog.TopologyVersion)13 Timed (com.codahale.metrics.annotation.Timed)3 Path (javax.ws.rs.Path)3 StorableKey (com.hortonworks.registries.storage.StorableKey)2 Topology (com.hortonworks.streamline.streams.catalog.Topology)2 ArrayList (java.util.ArrayList)2 POST (javax.ws.rs.POST)2 QueryParam (com.hortonworks.registries.common.QueryParam)1 FileStorage (com.hortonworks.registries.common.util.FileStorage)1 StorageManager (com.hortonworks.registries.storage.StorageManager)1 ManagedTransaction (com.hortonworks.registries.storage.transaction.ManagedTransaction)1 BadRequestException (com.hortonworks.streamline.common.exception.service.exception.request.BadRequestException)1 EntityNotFoundException (com.hortonworks.streamline.common.exception.service.exception.request.EntityNotFoundException)1 StreamingEngineNotReachableException (com.hortonworks.streamline.common.exception.service.exception.server.StreamingEngineNotReachableException)1 WSUtils.buildEdgesFromQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam)1 WSUtils.buildEdgesToQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam)1 WSUtils.currentVersionQueryParam (com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam)1 WSUtils.versionIdQueryParam (com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam)1 MLModelRegistryClient (com.hortonworks.streamline.registries.model.client.MLModelRegistryClient)1 Projection (com.hortonworks.streamline.streams.catalog.Projection)1