public TopologyComponentBundleResource(StreamlineAuthorizer authorizer, StreamCatalogService catalogService, EnvironmentService environmentService, Subject subject) { this.authorizer = authorizer; this.catalogService = catalogService; this.environmentService = environmentService; this.subject = subject; this.hintProviderProxyUtil = new ProxyUtil<>(ComponentBundleHintProvider.class); }
public static List<QueryParam> topologyVersionsQueryParam(Long topologyId) { List<QueryParam> params = buildTopologyIdAwareQueryParams(topologyId, null); return params; }
public StreamlineEventModelOutputs(String modelProcessorJson) { this(Utils.createObjectFromJson(modelProcessorJson, ModelProcessor.class)); }
private Response deploy(Topology topology, SecurityContext securityContext) { String asUser = WSUtils.getUserFromSecurityContext(securityContext); try { ParallelStreamUtil.runAsync(() -> actionsService.deployTopology(topology, asUser), forkJoinPool); return WSUtils.respondEntity(topology, OK); } catch (TopologyAlreadyExistsOnCluster ex) { return ex.getResponse(); } }
public static Collection<Class<?>> loadAllClassesFromJar(final File jarFile, final Class<?> superTypeClass) throws IOException { List<Class<?>> classes = JarReader.findConcreteSubtypesOfClass(jarFile, superTypeClass); final ProxyUtil<?> proxyUtil = new ProxyUtil<>(superTypeClass); return Collections2.filter(classes, new Predicate<Class<?>>() { @Override public boolean apply(@Nullable Class<?> s) { try { proxyUtil.loadClassFromJar(jarFile.getAbsolutePath(), s.getName()); return true; } catch (Throwable ex) { LOG.warn("class {} is concrete subtype of {}, but can't be initialized due to exception:", s, superTypeClass, ex); return false; } } }); }
public O loadClassFromJar(String jarPath, String classFqdn) throws ClassNotFoundException, MalformedURLException, InstantiationException, IllegalAccessException { ClassLoader classLoader; if (isClassLoadedFromParent(classFqdn)) { classLoader = parentClassLoader; } else { classLoader = findCachedClassLoader(jarPath); if (classLoader == null) { classLoader = getJarAddedClassLoader(jarPath); } } O actualObject = initInstanceFromClassloader(classFqdn, classLoader); return createClassLoaderAwareProxyInstance(classLoader, actualObject); }
public static List<QueryParam> currentTopologyVersionQueryParam(Long topologyId, UriInfo uriInfo) { List<QueryParam> params = buildTopologyIdAwareQueryParams(topologyId, uriInfo); params.addAll(currentVersionQueryParam()); return params; }
/** * This method takes in a schema represented as a map and returns a {@link Schema} * @param schemaConfig A map representing {@link Schema} * @return schema generated from the map argument * @throws IOException */ public static Schema getSchemaFromConfig (Map schemaConfig) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); return getSchemaFromConfig(objectMapper.writeValueAsString(schemaConfig)); } /**
public static boolean notEqualsToZero(double v) { return !equalsToZero(v); }
private String generateTopologyLogConfigUrl(String topologyId, String asUser) { String baseUrl = stormApiRootUrl + "/topology"; if(StringUtils.isNotEmpty(topologyId)) { baseUrl += "/" + WSUtils.encode(topologyId); } baseUrl += "/logconfig"; if (StringUtils.isNotEmpty(asUser)) { baseUrl += "?doAsUser=" + WSUtils.encode(asUser); } return baseUrl; }
String getNextCloneName(String topologyName) { return Utils.getNextName(topologyName, CLONE_SUFFIX); }
/** * @return A {@link List<QueryParam>} extracted from {@link UriInfo} or an empty list if no query parameters defined */ public static List<QueryParam> buildQueryParams(UriInfo uriInfo) { return addQueryParams(uriInfo, new ArrayList<QueryParam>()); }
private O createClassLoaderAwareProxyInstance(ClassLoader classLoader, O actualObject) { InvocationHandler handler = new ClassLoaderAwareInvocationHandler(classLoader, actualObject); return (O) Proxy.newProxyInstance(parentClassLoader, new Class<?>[]{interfaceClazz}, handler); }
public RulesBolt(String rulesProcessorJson, RuleProcessorRuntime.ScriptType scriptType) { this(Utils.createObjectFromJson(rulesProcessorJson, RulesProcessor.class), scriptType); }
private String generateTopologyUrl(String topologyId, String asUser, String operation) { String baseUrl = stormApiRootUrl + "/topology"; if(StringUtils.isNotEmpty(topologyId)) { baseUrl += "/" + WSUtils.encode(topologyId); } if(StringUtils.isNotEmpty(operation)) { baseUrl += "/" + operation; } if (StringUtils.isNotEmpty(asUser)) { baseUrl += "?doAsUser=" + WSUtils.encode(asUser); } return baseUrl; }
public WindowRulesBolt(String rulesProcessorJson, RuleProcessorRuntime.ScriptType scriptType) { this(Utils.createObjectFromJson(rulesProcessorJson, RulesProcessor.class), scriptType); }
public Map getComponent(String topologyId, String componentId, String asUser) { // topology/<topologyId>/component/<componentId>?doAsUser=<asUser> return doGetRequest(generateTopologyUrl(topologyId, asUser, "component/" + encode(componentId))); }
public TestRunSinkBolt(String testRunSinkJson) { this(Utils.createObjectFromJson(testRunSinkJson, TestRunSink.class)); }
public TestRunSourceSpout(String testRunSourceJson) { this(Utils.createObjectFromJson(testRunSourceJson, TestRunSource.class)); }
public NormalizationBolt(String normalizationProcessorJson) { this(Utils.createObjectFromJson(normalizationProcessorJson, NormalizationProcessor.class)); }