use of com.hortonworks.streamline.streams.catalog.TopologyEditorMetadata in project streamline by hortonworks.
the class StreamCatalogService method copyTopologyDependencies.
private void copyTopologyDependencies(Long topologyId, Long oldVersionId, Long newVersionId) throws Exception {
List<QueryParam> topologyIdVersionIdQueryParams = WSUtils.buildTopologyIdAndVersionIdAwareQueryParams(topologyId, oldVersionId, null);
// topology editor metadata
TopologyEditorMetadata metadata = getTopologyEditorMetadata(topologyId, oldVersionId);
if (metadata != null) {
addTopologyEditorMetadata(topologyId, newVersionId, new TopologyEditorMetadata(metadata));
}
// sources, output streams
Collection<TopologySource> sources = listTopologySources(topologyIdVersionIdQueryParams);
for (TopologySource source : sources) {
addTopologySource(topologyId, newVersionId, new TopologySource(source));
}
// processors, output streams
Collection<TopologyProcessor> processors = listTopologyProcessors(topologyIdVersionIdQueryParams);
for (TopologyProcessor processor : processors) {
addTopologyProcessor(topologyId, newVersionId, new TopologyProcessor(processor));
}
// add sinks
Collection<TopologySink> sinks = listTopologySinks(topologyIdVersionIdQueryParams);
for (TopologySink sink : sinks) {
addTopologySink(topologyId, newVersionId, new TopologySink(sink));
}
// branch rules
Collection<TopologyBranchRule> topologyBranchRules = listBranchRules(topologyIdVersionIdQueryParams);
for (TopologyBranchRule topologyBranchRule : topologyBranchRules) {
addBranchRule(topologyId, newVersionId, new TopologyBranchRule(topologyBranchRule));
}
// windowed rules
Collection<TopologyWindow> topologyWindows = listWindows(topologyIdVersionIdQueryParams);
for (TopologyWindow topologyWindow : topologyWindows) {
addWindow(topologyId, newVersionId, new TopologyWindow(topologyWindow));
}
// rules
Collection<TopologyRule> topologyRules = listRules(topologyIdVersionIdQueryParams);
for (TopologyRule topologyRule : topologyRules) {
addRule(topologyId, newVersionId, new TopologyRule(topologyRule));
}
// add edges
Collection<TopologyEdge> edges = listTopologyEdges(topologyIdVersionIdQueryParams);
for (TopologyEdge edge : edges) {
addTopologyEdge(topologyId, newVersionId, new TopologyEdge(edge));
}
// add topology test run case
Collection<TopologyTestRunCase> runCases = listTopologyTestRunCase(topologyIdVersionIdQueryParams);
for (TopologyTestRunCase runCase : runCases) {
Collection<TopologyTestRunCaseSource> runCaseSources = listTopologyTestRunCaseSource(runCase.getId());
Collection<TopologyTestRunCaseSink> runCaseSinks = listTopologyTestRunCaseSink(runCase.getId());
TopologyTestRunCase newCase = addTopologyTestRunCase(topologyId, newVersionId, new TopologyTestRunCase(runCase));
// add topology test run case source
for (TopologyTestRunCaseSource runCaseSource : runCaseSources) {
addTopologyTestRunCaseSource(newCase.getId(), newVersionId, new TopologyTestRunCaseSource(runCaseSource));
}
// add topology test run case sink
for (TopologyTestRunCaseSink runCaseSink : runCaseSinks) {
addTopologyTestRunCaseSink(newCase.getId(), newVersionId, new TopologyTestRunCaseSink(runCaseSink));
}
}
}
use of com.hortonworks.streamline.streams.catalog.TopologyEditorMetadata in project streamline by hortonworks.
the class StreamCatalogService method listTopologyEditorMetadata.
public Collection<TopologyEditorMetadata> listTopologyEditorMetadata() {
List<TopologyEditorMetadata> metadatas = new ArrayList<>();
Collection<TopologyVersion> currentVersions = listCurrentTopologyVersionInfos();
for (TopologyVersion version : currentVersions) {
List<QueryParam> queryParams = WSUtils.buildTopologyIdAndVersionIdAwareQueryParams(version.getTopologyId(), version.getId(), null);
metadatas.addAll(listTopologyEditorMetadata(queryParams));
}
return metadatas;
}
use of com.hortonworks.streamline.streams.catalog.TopologyEditorMetadata in project streamline by hortonworks.
the class TopologyEditorMetadataResource method addTopologyEditorMetadata.
@POST
@Path("/system/topologyeditormetadata")
@Timed
public Response addTopologyEditorMetadata(TopologyEditorMetadata topologyEditorMetadata, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, Topology.NAMESPACE, topologyEditorMetadata.getTopologyId(), WRITE);
TopologyEditorMetadata addedTopologyEditorMetadata = catalogService.addTopologyEditorMetadata(topologyEditorMetadata.getTopologyId(), topologyEditorMetadata);
return WSUtils.respondEntity(addedTopologyEditorMetadata, CREATED);
}
use of com.hortonworks.streamline.streams.catalog.TopologyEditorMetadata in project streamline by hortonworks.
the class TopologyEditorMetadataResource method getTopologyEditorMetadataByTopologyIdAndVersionId.
@GET
@Path("/system/versions/{versionId}/topologyeditormetadata/{id}/")
@Timed
public Response getTopologyEditorMetadataByTopologyIdAndVersionId(@PathParam("versionId") Long versionId, @PathParam("id") Long topologyId, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ);
TopologyEditorMetadata result = catalogService.getTopologyEditorMetadata(topologyId, versionId);
if (result != null) {
return WSUtils.respondEntity(result, OK);
}
throw EntityNotFoundException.byVersion(topologyId.toString(), versionId.toString());
}
use of com.hortonworks.streamline.streams.catalog.TopologyEditorMetadata in project streamline by hortonworks.
the class TopologyEditorMetadataResource method removeTopologyEditorMetadata.
@DELETE
@Path("/system/topologyeditormetadata/{id}")
@Timed
public Response removeTopologyEditorMetadata(@PathParam("id") Long topologyId, @Context SecurityContext securityContext) {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, Topology.NAMESPACE, topologyId, WRITE);
TopologyEditorMetadata removedTopologyEditorMetadata = catalogService.removeTopologyEditorMetadata(topologyId);
if (removedTopologyEditorMetadata != null) {
return WSUtils.respondEntity(removedTopologyEditorMetadata, OK);
}
throw EntityNotFoundException.byId(topologyId.toString());
}
Aggregations