if (x.getProcessAt() == RunAtLocation.FGSMS_SERVER) { 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); if (cast != null && cast.CheckTransactionalRule(machineData, x.getParameterNameValue(), f)) { outFaultMsg.set(f.get() + " " + outFaultMsg.get()); return true; log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
/** * Create an instance of {@link SLARuleGeneric } * */ public SLARuleGeneric createSLARuleGeneric() { return new SLARuleGeneric(); }
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; SLARuleGeneric r = new SLARuleGeneric(); r.setClassName("org.miloss.fgsms.sla.rules.ChangeInAvailabilityStatus"); r.setProcessAt(RunAtLocation.FGSMS_SERVER); 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; SLARuleGeneric r = new SLARuleGeneric(); r.setProcessAt(RunAtLocation.FGSMS_SERVER); r.setClassName("org.miloss.fgsms.sla.rules.StaleData");
SLARuleGeneric r = new SLARuleGeneric(); try { if (Utility.stringIsNullOrEmpty(s)) { return null; r.setClassName(s); return null; r.getParameterNameValue().add(new NameValuePair(pair.getName(), request.getParameter("plugin_" + pair.getName()), false, "checked".equalsIgnoreCase(request.getParameter("p_enc_" + pair.getName())))); r.getParameterNameValue().add(new NameValuePair(pair.getName(), request.getParameter("plugin_" + pair.getName()), false, "checked".equalsIgnoreCase(request.getParameter("p_enc_" + pair.getName())))); r.setProcessAt(RunAtLocation.valueOf(request.getParameter("slagenericrulerunat"))); } catch (Exception e) { LogHelper.getLog().log(Level.INFO, "error building SLA Rule, unparsable value for RunAtLocation ", e); r.setProcessAt(RunAtLocation.FGSMS_SERVER);
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();
stemp.setGuid(bits[1]); stemp.setAction(new ArrayOfSLAActionBaseType()); stemp.setRule(new SLARuleGeneric()); slaCache.put(bits[1], stemp); rule.setClassName(request.getParameter(key)); String value=request.getParameter(key); boolean enc = value.equalsIgnoreCase("true") || value.equalsIgnoreCase("on"); for (int kk = 0; kk < rule.getParameterNameValue().size(); kk++) { if (rule.getParameterNameValue().get(kk).getName().equalsIgnoreCase(bits[4])) { rule.getParameterNameValue().get(kk).setEncrypted(enc); found = true; break; nvp.setName(bits[4]); nvp.setEncrypted(enc); rule.getParameterNameValue().add(nvp); String value=request.getParameter(key); boolean enc = value.equalsIgnoreCase("true") || value.equalsIgnoreCase("on"); for (int kk = 0; kk < rule.getParameterNameValue().size(); kk++) { if (rule.getParameterNameValue().get(kk).getName().equalsIgnoreCase(bits[4])) { rule.getParameterNameValue().get(kk).setEncryptOnSave(enc); found = true; break; nvp.setName(bits[4]); nvp.setEncryptOnSave(enc);
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; return newInstance.ValidateConfiguration(r.getParameterNameValue(), ref, pol); } catch (Exception ex) { ref.set(ref.get() + " The specified Rule, class name=" + r.getClassName() + " could not be loaded, " + ex.getMessage()); return false;
SLARuleGeneric x = (SLARuleGeneric) rule; return SLAPARAM_RULE_CLASS + Utility.encodeHTML(x.getClassName()) + "\"><br>Process at: " + RenderRuleRunAt(x.getProcessAt());
/** * 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; }
if (x.getProcessAt() == RunAtLocation.FGSMS_SERVER) { 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); if (cast != null && cast.CheckTransactionalRule(req.getBrokerURI(), req.getData(), x.getParameterNameValue(), f)) { alertType.set(cast.GetType()); outFaultMsg.set(f.get() + " " + outFaultMsg.get()); 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()) + " ";
if (x.getProcessAt() == RunAtLocation.FGSMS_SERVER) { 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); if (cast != null && cast.CheckTransactionalRule(req.getMachineData(), x.getParameterNameValue(), f)) { sb = sb.append(f.get()); outFaultmsg.set(sb.toString() + " " + outFaultmsg.get()); log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
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 (x.getProcessAt()==null || x.getProcessAt() == RunAtLocation.FGSMS_SERVER) { 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; boolean CheckRule = cast.CheckTransactionalRule(get, x.getParameterNameValue(), smsg); if (CheckRule) { faultMsg.set(smsg.get()); log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
GetPluginInformationResponseMsg GetPluginInfo = GetPluginInfo(r.getClassName(), "SLA_RULE", pcs, c); if (GetPluginInfo == null) { return "Unknown SLA Rule<br>";
if (x.getProcessAt() == RunAtLocation.FGSMS_SERVER) { 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; boolean CheckNonTransactionalRule = cast.CheckNonTransactionalRule(p, x.getParameterNameValue(), msg, pooled); if (CheckNonTransactionalRule) { faultMsg.append(msg.get()); log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);