use of org.apache.storm.generated.TopologyInfo in project storm by apache.
the class UIHelpers method putTopologyActivate.
/**
* putTopologyActivate.
* @param client client
* @param id id
* @return putTopologyActivate
* @throws TException TException
*/
public static Map<String, Object> putTopologyActivate(Nimbus.Iface client, String id) throws TException {
GetInfoOptions getInfoOptions = new GetInfoOptions();
getInfoOptions.set_num_err_choice(NumErrorsChoice.NONE);
TopologyInfo topologyInfo = client.getTopologyInfoWithOpts(id, getInfoOptions);
client.activate(topologyInfo.get_name());
return getTopologyOpResponse(id, "activate");
}
use of org.apache.storm.generated.TopologyInfo in project storm by apache.
the class UIHelpers method putTopologyDeactivate.
/**
* putTopologyDeactivate.
* @param client client
* @param id id
* @return putTopologyDeactivate
* @throws TException TException
*/
public static Map<String, Object> putTopologyDeactivate(Nimbus.Iface client, String id) throws TException {
GetInfoOptions getInfoOptions = new GetInfoOptions();
getInfoOptions.set_num_err_choice(NumErrorsChoice.NONE);
TopologyInfo topologyInfo = client.getTopologyInfoWithOpts(id, getInfoOptions);
client.deactivate(topologyInfo.get_name());
return getTopologyOpResponse(id, "deactivate");
}
use of org.apache.storm.generated.TopologyInfo in project storm by apache.
the class StormSubmitter method invokeSubmitterHook.
/**
* Invoke submitter hook.
* @throws SubmitterHookException This is thrown when any Exception occurs during initialization or invocation of registered {@link
* ISubmitterHook}
*/
private static void invokeSubmitterHook(String name, String asUser, Map<String, Object> topoConf, StormTopology topology) {
String submissionNotifierClassName = null;
try {
if (topoConf.containsKey(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN)) {
submissionNotifierClassName = topoConf.get(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN).toString();
LOG.info("Initializing the registered ISubmitterHook [{}]", submissionNotifierClassName);
if (submissionNotifierClassName == null || submissionNotifierClassName.isEmpty()) {
throw new IllegalArgumentException(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN + " property must be a non empty string.");
}
ISubmitterHook submitterHook = (ISubmitterHook) Class.forName(submissionNotifierClassName).newInstance();
TopologyInfo topologyInfo = Utils.getTopologyInfo(name, asUser, topoConf);
LOG.info("Invoking the registered ISubmitterHook [{}]", submissionNotifierClassName);
submitterHook.notify(topologyInfo, topoConf, topology);
}
} catch (Exception e) {
LOG.warn("Error occurred in invoking submitter hook:[{}] ", submissionNotifierClassName, e);
throw new SubmitterHookException(e);
}
}
Aggregations