protected static String stripCommas(String string) { if (Utility.stringIsNullOrEmpty(string)) { return string; } return string.replace(',', ' ').trim(); }
Connection con = null; if (pooled) { con = Utility.getPerformanceDBConnection(); } else { con = Utility.getPerformanceDB_NONPOOLED_Connection();
public void resetClassLevel() throws SQLException { Connection con = Utility.getConfigurationDBConnection(); try { PreparedStatement ps = con.prepareStatement("UPDATE globalpolicies SET classification=?, caveat=?"); ps.setString(1, ClassificationType.U.value()); ps.setString(2, ""); ps.execute(); } catch (Exception x) { x.printStackTrace(); } finally { try { if (!con.isClosed()) { //System.out.println("attempting config connection close"); con.close(); // System.out.println("config connection closed"); } } catch (Exception e) { } } }
public boolean isPublishUpTimePercent() { NameValuePair target = Utility.getNameValuePairByName(ref.getParameterNameValue(), UddiPublisher.OPTION_PUBLISH_UPTIME); if (target != null) { String val = target.getValue(); if (target.isEncrypted()) { val = Utility.DE(val); } if (val.equalsIgnoreCase("true")) { return true; } } return false; }
/** * creates a new send an email sla action * * @param from * @param subject * @param body * @return */ public static SLAAction newEmailAction(String from, String subject, String body) { SLAAction r = new SLAAction(); r.setImplementingClassName("org.miloss.fgsms.sla.actions.EmailAlerter"); if (!stringIsNullOrEmpty(from)) { r.getParameterNameValue().add(newNameValuePair("From", from, false, false)); } r.getParameterNameValue().add(newNameValuePair("Body", body, false, false)); r.getParameterNameValue().add(newNameValuePair("Subject", subject, false, false)); return r; }
Connection PerfCon = null; if (pooled) { ConfigCon = Utility.getConfigurationDBConnection(); PerfCon = Utility.getPerformanceDBConnection(); } else { ConfigCon = Utility.getConfigurationDB_NONPOOLED_Connection(); PerfCon = Utility.getPerformanceDB_NONPOOLED_Connection(); log.log(Level.ERROR, null, ex); AuxHelper.TryUpdateStatus(false, "urn:fgsms:DataPruner:" + Utility.getHostName(), "ERROR", pooled, PolicyType.STATUS, AuxHelper.UNSPECIFIED, SLACommon.GetHostName());
@Override public void run() { UUID random = UUID.randomUUID(); MessageProcessor.getSingletonObject().processMessageInput(SERVICE_NAME, 0, myUrl, "machine/process", "system", random.toString(), new HashMap(), "", this.getClass().getCanonicalName(), "", ""); Connection ConfigCon = Utility.getConfigurationDBConnection(); Connection PerfCon = Utility.getPerformanceDBConnection(); try { doWorkBrokers(ConfigCon, PerfCon, periods); MessageProcessor.getSingletonObject().processMessageOutput(random.toString(), "success", 0, false, System.currentTimeMillis(), new HashMap()); } catch (Exception ex) { MessageProcessor.getSingletonObject().processMessageOutput(random.toString(), "error " + ex.getMessage(), 0, true, System.currentTimeMillis(), new HashMap()); } finally { DBUtils.safeClose(PerfCon); DBUtils.safeClose(ConfigCon); } }
try { if (pooled) { con = Utility.getPerformanceDBConnection(); } else { con = Utility.getPerformanceDB_NONPOOLED_Connection(); if (Utility.stringIsNullOrEmpty(relatedMsgID)) {
try { if (!pooled) { con = Utility.getConfigurationDB_NONPOOLED_Connection(); con = Utility.getConfigurationDBConnection();
con = Utility.getConfigurationDBConnection(); } else { con = Utility.getConfigurationDB_NONPOOLED_Connection(); if (Utility.stringIsNullOrEmpty(data[0]) || Utility.stringIsNullOrEmpty(data[1])) { return null;
if (Utility.stringIsNullOrEmpty(hostname)) { throw new IllegalArgumentException("hostname"); Connection con = Utility.getConfigurationDBConnection(); List<ProcessPolicy> l = new ArrayList<ProcessPolicy>(); PreparedStatement comm = null; Unmarshaller um = Utility.getSerializationContext().createUnmarshaller(); byte[] s = results.getBytes("xmlpolicy");
if ((Utility.stringIsNullOrEmpty(requestURL)) && ctxg != null) { try { StringBuffer buff = ctxg.getRequestURL(); if (Utility.stringIsNullOrEmpty(requestURL)) { log.log(Level.WARN, "Unable to self register this fgsms DCS service, giving up"); return; Connection con = Utility.getConfigurationDBConnection(); try { AuxHelper.CheckPolicyAndCreate(requestURL, con, PolicyType.TRANSACTIONAL, true, AuxHelper.UNSPECIFIED, Utility.getHostName()); Connection con = Utility.getConfigurationDBConnection(); PreparedStatement cmd = null; try { cmd = con.prepareStatement("INSERT INTO dcsservicehosts(hostname) VALUES (?);"); cmd.setString(1, Utility.getHostName()); cmd.executeUpdate(); cmd.close();
public static void CreatePolicy(String uri, FederationPolicyCollection fedpolicies) { Connection con = Utility.getConfigurationDBConnection(); Connection perf = Utility.getPerformanceDBConnection(); try { DatatypeFactory fac = DatatypeFactory.newInstance(); twp.setDataTTL(fac.newDuration(10000000)); Marshaller m = Utility.getSerializationContext().createMarshaller(); StringWriter sw = new StringWriter(); m.marshal(twp, sw);
private String Login(String username, String encryptedpassword) { if (Utility.stringIsNullOrEmpty(username) || Utility.stringIsNullOrEmpty(encryptedpassword)) { return ""; } //return "";/* GetAuthToken request = new GetAuthToken(); request.setUserID(username); request.setCred(Utility.DE(encryptedpassword)); try { AuthToken response = security.getAuthToken(request); return response.getAuthInfo(); } catch (Exception ex) { log.log(Level.ERROR, "Error authenticating to the UDDI server: ", ex); good = false; return ""; } }
public void RemoveTransaction(String id) throws Exception { Connection con = Utility.getPerformanceDBConnection(); try { PreparedStatement cmd = con.prepareStatement("delete from rawdata where transactionid=?"); cmd.setString(1, id); cmd.execute(); cmd.close(); // System.out.println("attempting config connection close"); con.close(); // System.out.println("config connection closed"); } catch (Exception x) { x.printStackTrace(); } finally { try { if (!con.isClosed()) { // System.out.println("attempting config connection close"); con.close(); // System.out.println("config connection closed"); } } catch (Exception e) { } } }
private List<ReportDefinition> loadJobsFromDatabase(boolean pooled, String jobid) throws Exception { JAXBContext GetARSSerializationContext = Utility.getARSSerializationContext(); Unmarshaller u = GetARSSerializationContext.createUnmarshaller(); List<ReportDefinition> ret = new ArrayList<ReportDefinition>(); Connection con; if (pooled) { con = Utility.getPerformanceDBConnection(); } else { con = Utility.getPerformanceDB_NONPOOLED_Connection();
KeyNameValueEnc GetPropertiesFromDB = DBSettingsLoader.GetPropertiesFromDB(pooled, "defaults", "ServicesWar"); if (GetPropertiesFromDB != null && GetPropertiesFromDB.getKeyNameValue() != null) { if (Utility.stringIsNullOrEmpty(GetPropertiesFromDB.getKeyNameValue().getPropertyValue())) { link = "<a href=\"" + GetPropertiesFromDB.getKeyNameValue().getPropertyValue() + "/ReportFetch?reportid=" + URLEncoder.encode(id) + "\">" + Utility.encodeHTML(id) + "</a>"; link = "<a href=\"http://" + Utility.getHostName() + ":8888/fgsmsServices/ReportFetch?reportid=" + URLEncoder.encode(id) + "\">" + Utility.encodeHTML(id) + "</a>"; + "<table><tr><td>Report Name</td><td>" + Utility.encodeHTML(get.getFriendlyName()) + "</td></tr>" + "<tr><td>Generated Report ID</td><td>" + link + "</td></tr></table><br>" + (guess ? "The download urls above may not work because the system administrator has not defined the public url of FGSMS in general settings." : "") + "<table><tr><td>Report Name</td><td>" + Utility.encodeHTML(get.getFriendlyName()) + "</td></tr>" + "<tr><td>Generated Report ID</td><td>" + link + "</td></tr></table><br>" + (guess ? "The download urls above may not work because the system administrator has not defined the public url of FGSMS in general settings." : "")
private void updateServiceHostStats(String host, int count) { Connection config = Utility.getConfigurationDBConnection(); PreparedStatement com = null; if (!hosts.containsKey(host)) { com.setString(2, host); com.setInt(3, count); com.setString(4, Utility.getHostName()); com.execute();
req.setPolicytype(policyType); if (Utility.stringIsNullOrEmpty(hostname)) { req.setMachine(Utility.getHostName()); } else { req.setMachine(hostname);
Connection con = Utility.getConfigurationDBConnection(); JAXBContext jc = Utility.getSerializationContext(); comm = con.prepareStatement("" + "select * from machineinfo where hostname=? and domaincol=?;");