private TopologyComponentBundle getTopologyComponentBundle (TopologyComponent topologyComponent) { TopologyComponentBundle topologyComponentBundle = catalogService.getTopologyComponentBundle(topologyComponent.getTopologyComponentBundleId()); if (topologyComponentBundle == null) { String msg = "TopologyComponentBundle not found for topologyComponent " + topologyComponent; LOG.debug(msg); throw new RuntimeException(msg); } return topologyComponentBundle; }
private void handleIotasComponentBundle (StreamlineComponent streamlineComponent) { TopologyComponentBundle topologyComponentBundle = streamCatalogService.getTopologyComponentBundle(Long.parseLong(streamlineComponent. getTopologyComponentBundleId())); if (topologyComponentBundle == null) { throw new RuntimeException("Likely to run in to issues while deployging topology since TopologyComponentBundle not found for id " + streamlineComponent.getTopologyComponentBundleId()); } if (!topologyComponentBundle.getBuiltin()) { topologyComponentBundleSet.add(topologyComponentBundle); } else { LOG.debug("No need to copy any jar for {} since its a builtin bundle", streamlineComponent); } }
/** * Get component bundle registered for a type(SOURCE, SINK, etc) matching the id * <p> * GET api/v1/catalog/streams/componentbundles/SOURCE/5 * </p> */ @GET @Path("/componentbundles/{component}/{id}") @Timed @Produces(MediaType.APPLICATION_JSON) public Response getTopologyComponentBundleById (@PathParam("component") TopologyComponentBundle.TopologyComponentType componentType, @PathParam ("id") Long id, @Context SecurityContext securityContext) { SecurityUtil.checkRole(authorizer, securityContext, Roles.ROLE_TOPOLOGY_COMPONENT_BUNDLE_USER); TopologyComponentBundle result = catalogService.getTopologyComponentBundle(id); if (result != null) { return WSUtils.respondEntity(result, OK); } throw EntityNotFoundException.byId(id.toString()); }
private void storeBundleIdToType(StreamlineComponent component) { TopologyComponentBundle bundle = streamCatalogService.getTopologyComponentBundle( Long.parseLong(component.getTopologyComponentBundleId())); Preconditions.checkNotNull(bundle, "No bundle with id: " + component.getTopologyComponentBundleId()); topologyData.addBundleIdToType(component.getTopologyComponentBundleId(), bundle.getSubType()); } }
public void visit(RulesProcessor rulesProcessor) { try { TopologyComponentBundle componentBundle = streamCatalogService.getTopologyComponentBundle( Long.parseLong(rulesProcessor.getTopologyComponentBundleId())); String subType = componentBundle.getSubType(); RulesHandler rulesHandler = rulesHandlerMap.get(subType); for (Rule rule : rulesProcessor.getRules()) { rulesHandler.handle(rule); } } catch (Exception e) { throw new RuntimeException( String.format("Unexpected exception thrown while trying to add the rule %s", rulesProcessor.getId()), e); } TopologyProcessor topologyProcessor = streamCatalogService.getTopologyProcessor( topologyId, Long.parseLong(rulesProcessor.getId())); topologyData.addProcessor(topologyProcessor); storeBundleIdToType(rulesProcessor); }
private void handleBundleForStreamlineComponent (StreamlineComponent streamlineComponent) { TopologyComponentBundle topologyComponentBundle = catalogService.getTopologyComponentBundle(Long.parseLong(streamlineComponent. getTopologyComponentBundleId())); if (topologyComponentBundle == null) { throw new RuntimeException("Likely to run in to issues while deployging topology since TopologyComponentBundle not found for id " + streamlineComponent.getTopologyComponentBundleId()); } if (!topologyComponentBundle.getBuiltin()) { topologyComponentBundleSet.add(topologyComponentBundle); } else { LOG.debug("No need to copy any jar for {} since its a builtin bundle", streamlineComponent); } if (topologyComponentBundle.getMavenDeps() != null) { mavenArtifacts.add(topologyComponentBundle.getMavenDeps()); } if (TopologyComponentBundle.TopologyComponentType.PROCESSOR.equals(topologyComponentBundle.getType()) && ComponentTypes.CUSTOM.equals (topologyComponentBundle.getSubType())) { try { extraJars.add(CustomProcessorInfo.fromTopologyComponentBundle(topologyComponentBundle).getJarFileName()); } catch (IOException e) { LOG.warn("IOException while getting jar file name for custom processor from bundle", topologyComponentBundle); throw new RuntimeException(e); } } }
@Context SecurityContext securityContext) throws Exception { SecurityUtil.checkRole(authorizer, securityContext, Roles.ROLE_TOPOLOGY_COMPONENT_BUNDLE_USER); TopologyComponentBundle bundle = catalogService.getTopologyComponentBundle(id); if (bundle == null || !bundle.getType().equals(componentType)) { throw EntityNotFoundException.byId("component bundle id: " + id + " with type: " + componentType);