public static boolean RuleHasParameters(RuleBaseType rule, PCS pcs, SecurityWrapper c) { if (rule instanceof AndOrNot) { return true; } if (rule instanceof SLARuleGeneric) { SLARuleGeneric x = (SLARuleGeneric) rule; GetPluginInformationResponseMsg info = GetPluginInfo(x.getClassName(), "SLA_RULE", pcs, c); if (info != null) { return !info.getRequiredParameter().isEmpty() && !info.getOptionalParameter().isEmpty(); } } return false; } static Map pluginCache = new HashMap();
Class c = null; try { c = Thread.currentThread().getContextClassLoader().loadClass(x.getClassName()); } catch (ClassNotFoundException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); obj = c.newInstance(); } catch (InstantiationException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); cast = (SLARuleInterface) obj; } catch (ClassCastException ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleTypeCast"), x.getClassName(), SLARuleInterface.class.getCanonicalName()), ex); log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
if (Utility.stringIsNullOrEmpty(r.getClassName())) { ref.set(ref.get() + " Rule class name is not defined"); return false; Class<SLARuleInterface> forName = (Class<SLARuleInterface>) Class.forName(r.getClassName()); SLARuleInterface newInstance = forName.newInstance(); if (!newInstance.GetAppliesTo().contains(pol.getPolicyType())) { ref.set(ref.get() + " The specified Rule, class name=" + r.getClassName() + " does not apply to the policy type of " + pol.getPolicyType().value()); return false; ref.set(ref.get() + " The specified Rule, class name=" + r.getClassName() + " could not be loaded, " + ex.getMessage()); return false;
/** * recursive used to determine if we need to record the request/response * pair * * @param rule * @return */ protected boolean doesSLARuleContainXpath(RuleBaseType rule) { if (rule == null) { return false; } if (rule instanceof SLARuleGeneric) { SLARuleGeneric r = (SLARuleGeneric) rule; if (r.getClassName().equalsIgnoreCase("org.miloss.fgsms.sla.rules.XPathExpression")) { return true; } } if (rule instanceof AndOrNot) { AndOrNot t1 = (AndOrNot) rule; return doesSLARuleContainXpath(t1.getLHS()) || doesSLARuleContainXpath(t1.getRHS()); } return false; }
Class c = null; try { c = Thread.currentThread().getContextClassLoader().loadClass(x.getClassName()); } catch (ClassNotFoundException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); obj = c.newInstance(); } catch (InstantiationException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); cast = (SLARuleInterface) obj; } catch (ClassCastException ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleTypeCast"), x.getClassName(), SLARuleInterface.class.getCanonicalName()), ex); log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
Class c = null; try { c = Thread.currentThread().getContextClassLoader().loadClass(x.getClassName()); } catch (ClassNotFoundException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); obj = c.newInstance(); } catch (InstantiationException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); cast = (SLARuleInterface) obj; } catch (ClassCastException ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleTypeCast"), x.getClassName(), SLARuleInterface.class.getCanonicalName()), ex); log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
Class c = null; try { c = Thread.currentThread().getContextClassLoader().loadClass(x.getClassName()); } catch (ClassNotFoundException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; obj = c.newInstance(); } catch (InstantiationException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; } catch (IllegalAccessException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; cast = (SLARuleInterface) obj; } catch (ClassCastException ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleTypeCast"), x.getClassName(), SLARuleInterface.class.getCanonicalName()), ex); return false; log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
Class c = null; try { c = Thread.currentThread().getContextClassLoader().loadClass(x.getClassName()); } catch (ClassNotFoundException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; obj = c.newInstance(); } catch (InstantiationException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; } catch (IllegalAccessException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; cast = (SLARuleInterface) obj; } catch (ClassCastException ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleTypeCast"), x.getClassName(), SLARuleInterface.class.getCanonicalName()), ex); return false; log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
SLARuleGeneric x = (SLARuleGeneric) rule; for (int i = 0; i < rule_plugins.size(); i++) { if (rule_plugins.get(i).getClassname().equalsIgnoreCase(x.getClassName())) { return rule_plugins.get(i).getDisplayname(); return "Plugin: " + Utility.encodeHTML(x.getClassName()) + " ";
private static boolean containsChangeInStatus(RuleBaseType b) { if (b == null) { return false; } if (b instanceof SLARuleGeneric) { { SLARuleGeneric asd = (SLARuleGeneric) b; if (asd.getClassName().equalsIgnoreCase(ChangeInAvailabilityStatus.class.getCanonicalName())) { return true; } } } if (b instanceof AndOrNot) { AndOrNot x = (AndOrNot) b; if (x.getFlag() == JoiningType.AND) { return containsChangeInStatus(x.getLHS()) && containsChangeInStatus(x.getRHS()); } if (x.getFlag() == JoiningType.OR) { return containsChangeInStatus(x.getLHS()) || containsChangeInStatus(x.getRHS()); } } return false; }
if (ret.getServiceLevelAggrements().getSLA().get(i).getRule() instanceof SLARuleGeneric) { SLARuleGeneric r = (SLARuleGeneric) ret.getServiceLevelAggrements().getSLA().get(i).getRule(); if (r.getClassName().equalsIgnoreCase("org.miloss.fgsms.sla.rules.ChangeInAvailabilityStatus")) { existingSla = true; if (ret.getServiceLevelAggrements().getSLA().get(i).getRule() instanceof SLARuleGeneric) { SLARuleGeneric r = (SLARuleGeneric) ret.getServiceLevelAggrements().getSLA().get(i).getRule(); if (r.getClassName().equalsIgnoreCase("org.miloss.fgsms.sla.rules.StaleData")) { existingSla = true;
GetPluginInformationResponseMsg GetPluginInfo = GetPluginInfo(r.getClassName(), "SLA_RULE", pcs, c); if (GetPluginInfo == null) { return "Unknown SLA Rule<br>";
SLARuleGeneric x = (SLARuleGeneric) rule; return SLAPARAM_RULE_CLASS + Utility.encodeHTML(x.getClassName()) + "\"><br>Process at: " + RenderRuleRunAt(x.getProcessAt());