private List<String> getProcessListByHostname(String hostname, String domainName) { List<String> r = new ArrayList<String>(); Connection con = Utility.getConfigurationDBConnection(); PreparedStatement com = null; ResultSet rs = null; try { com = con.prepareStatement("select uri from servicepolicies where hostname=? and domaincol=? and policytype=?;"); com.setString(1, hostname); com.setString(2, domainName); com.setInt(3, PolicyType.PROCESS.ordinal()); rs = com.executeQuery(); while (rs.next()) { r.add(rs.getString(1)); } } catch (Exception ex) { log.log(Level.ERROR, null, ex); } finally { DBUtils.safeClose(rs); DBUtils.safeClose(com); DBUtils.safeClose(con); } return r; }
public static PolicyType fromValue(String v) { for (PolicyType c: PolicyType.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
protected static boolean isPolicyTypeOf(String uri, PolicyType p) { Connection con = Utility.getConfigurationDBConnection(); PreparedStatement com = null; ResultSet rs = null; try { com = con.prepareStatement("select policytype from servicepolicies where uri=?"); com.setString(1, uri); rs = com.executeQuery(); if (rs.next()) { int x = rs.getInt(1); if (PolicyType.values()[x].equals(p)) { return true; } } } catch (Exception ex) { log.log(Level.WARN, null, ex); } finally { DBUtils.safeClose(rs); DBUtils.safeClose(com); DBUtils.safeClose(con); } return false; }
/** * convenience method, does the list contain the policy type * * @param appliesTo * @param optionalPolicyTypeFilter * @return */ public static boolean containsPolicyType(List<PolicyType> appliesTo, PolicyType optionalPolicyTypeFilter) { if (appliesTo == null) { return false; } if (optionalPolicyTypeFilter == null) { return false; } for (int i = 0; i < appliesTo.size(); i++) { if (appliesTo.get(i).equals(optionalPolicyTypeFilter)) { return true; } } return false; }
SLAActionInterface newInstance = forName.newInstance(); if (!newInstance.GetAppliesTo().contains(pol.getPolicyType())) { ref.set(ref.get() + " The specified action, class name=" + action.get(i).getImplementingClassName() + " does not apply to the policy type of " + pol.getPolicyType().value()); return false;
Utility.encodeHTML(agentUsername), Utility.encodeHTML(url), p.value(), props.getProperty("fgsms.GUI.URL")) + GenerateManageLink(url, props.getProperty("fgsms.GUI.URL")), bundle.getString("EmailEncodingType"));
comm.setInt(1, p.ordinal()); comm.setString(2, hostname); comm.setInt(2, p.ordinal()); comm.setString(3, hostname); temp.setURL(results.getString("URI")); temp.setDisplayName(results.getString("displayname")); temp.setPolicyType(PolicyType.values()[results.getInt("policytype")]); list.getServiceType().add(temp); count++;
com.setInt(1, PolicyType.STATUS.ordinal()); ResultSet rs = com.executeQuery(); while (rs.next()) { //for each service
public static List<PolicyType> getAllPolicyTypes() { List<PolicyType> r = new ArrayList<PolicyType>(); PolicyType[] values = PolicyType.values(); r.addAll(Arrays.asList(values)); return r; }
public static boolean isPolicyTypeOf(String uri, PolicyType p) { Connection con = Utility.getConfigurationDBConnection(); PreparedStatement com = null; ResultSet rs = null; try { com = con.prepareStatement("select policytype from servicepolicies where uri=?"); com.setString(1, uri); rs = com.executeQuery(); if (rs.next()) { int x = rs.getInt(1); if (PolicyType.values()[x].equals(p)) { return true; } } } catch (Exception ex) { log.log(Level.WARN, null, ex); } finally { DBUtils.safeClose(rs); DBUtils.safeClose(com); DBUtils.safeClose(con); } return false; }
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;
comm.setInt(1, p.ordinal()); comm.setInt(2, p.ordinal()); temp.setURL(results.getString("URI")); temp.setDisplayName(results.getString("displayname")); temp.setPolicyType(PolicyType.values()[results.getInt("policytype")]); temp.setDomainname(results.getString("domaincol")); temp.setHostname(results.getString("hostname"));
com.setInt(1, PolicyType.MACHINE.ordinal()); com.setInt(2, PolicyType.PROCESS.ordinal()); rs = com.executeQuery(); while (rs.next()) { //for each service up.setLong(5, getAvgMem(rs.getString("uri"), periods.get(i), PerfCon)); up.setLong(6, getAvgThread(rs.getString("uri"), periods.get(i), PerfCon)); if (rs.getInt("policytype") == PolicyType.PROCESS.ordinal()) { up.setLong(7, getAvgFile(rs.getString("uri"), periods.get(i), PerfCon)); } else {
ServicePolicy ret = null; PolicyType pt = PolicyType.values()[results.getInt("policytype")];
retention = Long.parseLong(d.getKeyNameValue().getPropertyValue()); } catch (Exception ex) { log.log(Level.WARN, String.format(SLACommon.getBundleString("ErrorUnableToParse"), "defaultRetention" + p.value(), "Long"), ex);
com.setLong(2, 500000); com.setBoolean(3, true); com.setInt(4, PolicyType.TRANSACTIONAL.ordinal()); TransactionalWebServicePolicy twp = new TransactionalWebServicePolicy(); twp.setURL(uri);
ServicePolicy ret = null; PolicyType pt = PolicyType.values()[results.getInt("policytype")];
com.setInt(1, PolicyType.STATISTICAL.ordinal()); rs = com.executeQuery(); while (rs.next()) { //for each service