protected String getHeader() { String x = null; InputStream s = null; try { s = this.getClass().getClassLoader().getResourceAsStream("org/miloss/fgsms/services/rs/impl/header.txt"); x = readAllText(s); } catch (Exception ex) { log.error(null, ex); } finally { if (s != null) { try { s.close(); } catch (IOException ex) { } } } return x; }
protected String getFooter() { String x = null; InputStream s = null; try { s = this.getClass().getClassLoader().getResourceAsStream("org/miloss/fgsms/services/rs/impl/footer.txt"); x = readAllText(s); } catch (Exception ex) { log.error(null, ex); } finally { if (s != null) { try { s.close(); } catch (IOException ex) { } } } return x; }
log.error("SLA Processing failed for " + req.getURI(), ex); } finally { if (is!=null)
log.error("error fetching actions for service", ex); } finally { DBUtils.safeClose(results); log.error("error fetching transactions", ex); } finally { DBUtils.safeClose(records); up.executeUpdate(); } catch (Exception ex) { log.error("error updating statistcs row", ex); } finally { DBUtils.safeClose(up);
LogHelper.getLog().error(ex);
public static List<Plugin> GetPluginList(PCS pcs, SecurityWrapper c, String item_type, PolicyType pt) { if (item_type == null) { return Collections.EMPTY_LIST; } GetPluginListRequestMsg req = new GetPluginListRequestMsg(); req.setClassification(c); req.setPlugintype(item_type); req.setOptionalPolicyTypeFilter(pt); GetPluginList r = new GetPluginList(); r.setRequest(req); try { GetPluginListResponse pluginList = pcs.getPluginList(r); return pluginList.getResponse().getPlugins(); } catch (Exception ex) { LogHelper.getLog().error(ex); } return Collections.EMPTY_LIST; }
/** * * @param action * @param pcs * @param c * @param item_type FEDERATION_PUBLISH,SLA_RULE,SLA_ACTION * @return */ public static String GetPluginHelp(SLAAction action, PCS pcs, SecurityWrapper c, String item_type) { if (action == null) { return "Null Action"; } GetPluginInformationRequestMsg req = new GetPluginInformationRequestMsg(); req.setGetPluginInformationRequestWrapper(new GetPluginInformationRequestWrapper()); req.getGetPluginInformationRequestWrapper().setClassification(c); req.getGetPluginInformationRequestWrapper().setPlugin(new Plugin()); req.getGetPluginInformationRequestWrapper().getPlugin().setClassname(action.getImplementingClassName()); req.getGetPluginInformationRequestWrapper().getPlugin().setPlugintype(item_type); GetPluginInformation r = new GetPluginInformation(); r.setRequest(req); try { GetPluginInformationResponse pluginInformation = pcs.getPluginInformation(r); return pluginInformation.getResponse().getHelp(); } catch (Exception ex) { LogHelper.getLog().error(ex); } return "No help information could be found."; }
/** * report type to a friendly name for report types * * @param r * @return */ public static String ToFriendlyName(String action, PCS pcs, SecurityWrapper c) { if (action == null) { return "Null classname"; } GetPluginInformationRequestMsg req = new GetPluginInformationRequestMsg(); req.setGetPluginInformationRequestWrapper(new GetPluginInformationRequestWrapper()); req.getGetPluginInformationRequestWrapper().setClassification(c); req.getGetPluginInformationRequestWrapper().setPlugin(new Plugin()); req.getGetPluginInformationRequestWrapper().getPlugin().setClassname(action); req.getGetPluginInformationRequestWrapper().getPlugin().setPlugintype("REPORTING"); GetPluginInformation r = new GetPluginInformation(); r.setRequest(req); try { GetPluginInformationResponse pluginInformation = pcs.getPluginInformation(r); return Utility.encodeHTML(pluginInformation.getResponse().getDisplayName()); } catch (Exception ex) { LogHelper.getLog().error(ex); } return "Unrecognized report type " + Utility.encodeHTML(action); }
/** * * @param action * @param pcs * @param c * @param item_type FEDERATION_PUBLISH,SLA_RULE,SLA_ACTION * @return html escaped friendly name of the plugin */ public static String ToFriendlyName(SLAAction action, PCS pcs, SecurityWrapper c) { if (action == null) { return "Null Action"; } GetPluginInformationRequestMsg req = new GetPluginInformationRequestMsg(); req.setGetPluginInformationRequestWrapper(new GetPluginInformationRequestWrapper()); req.getGetPluginInformationRequestWrapper().setClassification(c); req.getGetPluginInformationRequestWrapper().setPlugin(new Plugin()); req.getGetPluginInformationRequestWrapper().getPlugin().setClassname(action.getImplementingClassName()); req.getGetPluginInformationRequestWrapper().getPlugin().setPlugintype("SLA_ACTION"); GetPluginInformation r = new GetPluginInformation(); r.setRequest(req); try { GetPluginInformationResponse pluginInformation = pcs.getPluginInformation(r); return Utility.encodeHTML(pluginInformation.getResponse().getDisplayName()); } catch (Exception ex) { LogHelper.getLog().error(ex); } return "Unrecognized action, " + Utility.encodeHTML(action.getImplementingClassName()); }