@PUT @Path("/topologies/{topologyId}/windows/{id}") @Timed public Response addOrUpdateWindow(@PathParam("topologyId") Long topologyId, @PathParam("id") Long ruleId, TopologyWindow topologyWindow, @Context SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, Topology.NAMESPACE, topologyId, WRITE); TopologyWindow createdTopologyWindow = catalogService.addOrUpdateWindow(topologyId, ruleId, topologyWindow); return WSUtils.respondEntity(createdTopologyWindow, CREATED); }
@PUT @Path("/system/topologyeditormetadata/{id}") @Timed public Response addOrUpdateTopologyEditorMetadata (@PathParam("id") Long topologyId, TopologyEditorMetadata topologyEditorMetadata, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, Topology.NAMESPACE, topologyId, WRITE); TopologyEditorMetadata newTopologyEditorMetadata = catalogService.addOrUpdateTopologyEditorMetadata(topologyId, topologyEditorMetadata); return WSUtils.respondEntity(newTopologyEditorMetadata, OK); } }
@POST @Path("/topologies/{topologyId}/windows") @Timed public Response addTopologyWindow(@PathParam("topologyId") Long topologyId, TopologyWindow topologyWindow, @Context SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, Topology.NAMESPACE, topologyId, WRITE); TopologyWindow createdTopologyWindow = catalogService.addWindow(topologyId, topologyWindow); return WSUtils.respondEntity(createdTopologyWindow, CREATED); }
@PUT @Path("/clusters/{id}") @Timed public Response addOrUpdateCluster(@PathParam("id") Long clusterId, Cluster cluster, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_SERVICE_POOL_SUPER_ADMIN, NAMESPACE, clusterId, WRITE); Cluster newCluster = environmentService.addOrUpdateCluster(clusterId, cluster); return WSUtils.respondEntity(newCluster, CREATED); }
@POST @Path("/topologies/{topologyId}/actions/deploy") @Timed public Response deployTopology (@PathParam("topologyId") Long topologyId, @Context SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE); Topology topology = catalogService.getTopology(topologyId); if (topology != null) { return deploy(topology, securityContext); } throw EntityNotFoundException.byId(topologyId.toString()); }
@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()); }
@GET @Path("/topologies/{topologyId}") @Timed public Response getTopologyById(@PathParam("topologyId") Long topologyId, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, NAMESPACE, topologyId, READ); Topology result = catalogService.getTopology(topologyId); if (result != null) { return WSUtils.respondEntity(result, OK); } throw EntityNotFoundException.byId(topologyId.toString()); }
@GET @Path("/system/topologyeditormetadata/{id}") @Timed public Response getTopologyEditorMetadataByTopologyId (@PathParam("id") Long topologyId, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ); TopologyEditorMetadata result = catalogService.getTopologyEditorMetadata(topologyId); if (result != null) { return WSUtils.respondEntity(result, OK); } throw EntityNotFoundException.byId(topologyId.toString()); }
@GET @Path("/topologies/{topologyId}/reconfigure") @Timed public Response getComponentsToReconfigure(@PathParam("topologyId") Long topologyId, @Context SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, NAMESPACE, topologyId, READ); Topology topology = catalogService.getTopology(topologyId); if (topology != null) { return WSUtils.respondEntity(catalogService.getComponentsToReconfigure(topology), OK); } throw EntityNotFoundException.byId(topologyId.toString()); }
private Response listTopologyEdges(List<QueryParam> queryParams, Long topologyId, SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ); Collection<TopologyEdge> edges = catalogService.listTopologyEdges(queryParams); if (edges != null) { return WSUtils.respondEntities(edges, OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
private Response listTopologyRules(List<QueryParam> queryParams, Long topologyId, SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ); Collection<TopologyRule> topologyRules = catalogService.listRules(queryParams); if (topologyRules != null) { return WSUtils.respondEntities(topologyRules, OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
private Response listTopologyProcessors(List<QueryParam> queryParams, Long topologyId, SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ); Collection<TopologyProcessor> sources = catalogService.listTopologyProcessors(queryParams); if (sources != null) { return WSUtils.respondEntities(sources, OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
private Response listTopologyBranchRules(List<QueryParam> queryParams, Long topologyId, SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ); Collection<TopologyBranchRule> topologyBranchRules = catalogService.listBranchRules(queryParams); if (topologyBranchRules != null) { return WSUtils.respondEntities(topologyBranchRules, OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
private Response listTopologySinks(List<QueryParam> queryParams, Long topologyId, SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ); Collection<TopologySink> sinks = catalogService.listTopologySinks(queryParams); if (sinks != null) { return WSUtils.respondEntities(sinks, OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
private Response listTopologyWindows(List<QueryParam> queryParams, Long topologyId, SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ); Collection<TopologyWindow> topologyWindows = catalogService.listWindows(queryParams); if (topologyWindows != null) { return WSUtils.respondEntities(topologyWindows, OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
private Response listTopologySources(List<QueryParam> queryParams, Long topologyId, SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ); Collection<TopologySource> sources = catalogService.listTopologySources(queryParams); if (sources != null) { return WSUtils.respondEntities(sources, OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
private Response listTopologyStreams(List<QueryParam> queryParams, Long topologyId, SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, READ); Collection<TopologyStream> sources = catalogService.listStreamInfos(queryParams); if (sources != null) { return WSUtils.respondEntities(sources, OK); } throw EntityNotFoundException.byFilter(queryParams.toString()); }
@POST @Path("/topologies/{topologyId}/actions/kill") @Timed public Response killTopology (@PathParam("topologyId") Long topologyId, @Context SecurityContext securityContext) throws Exception { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_SUPER_ADMIN, NAMESPACE, topologyId, READ, EXECUTE); Topology result = catalogService.getTopology(topologyId); if (result != null) { actionsService.killTopology(result, WSUtils.getUserFromSecurityContext(securityContext)); return WSUtils.respondEntity(result, OK); } throw EntityNotFoundException.byId(topologyId.toString()); }
@POST @Path("/topologies/{topologyId}/testcases/{testCaseId}/sinks") public Response addTestRunCaseSink(@PathParam("topologyId") Long topologyId, @PathParam("testCaseId") Long testCaseId, TopologyTestRunCaseSink testRunCaseSink, @Context SecurityContext securityContext) { SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, WRITE); TopologySink topologySink = getAssociatedTopologySink(topologyId, testCaseId, testRunCaseSink.getSinkId()); testRunCaseSink.setVersionId(topologySink.getVersionId()); TopologyTestRunCaseSink addedCaseSink = catalogService.addTopologyTestRunCaseSink(testRunCaseSink); return WSUtils.respondEntity(addedCaseSink, CREATED); }
@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); }