protected String addSecurityToken(String base, String connector, String nodeId, String securityToken) { StringBuilder sb = new StringBuilder(addNodeId(base, nodeId, "?")); sb.append(connector); sb.append(WebConstants.SECURITY_TOKEN); sb.append("="); sb.append(securityToken); append(sb, WebConstants.HOST_NAME, AppUtils.getHostName()); append(sb, WebConstants.IP_ADDRESS, AppUtils.getIpAddress()); return sb.toString(); }
public void refresh() { this.hostName = AppUtils.getHostName(); setIpAddress(AppUtils.getIpAddress()); this.osUser = System.getProperty("user.name"); this.osName = System.getProperty("os.name"); this.osArch = System.getProperty("os.arch"); this.osVersion = System.getProperty("os.version"); this.availableProcessors = Runtime.getRuntime().availableProcessors(); this.freeMemoryBytes = Runtime.getRuntime().freeMemory(); this.totalMemoryBytes = Runtime.getRuntime().totalMemory(); this.maxMemoryBytes = Runtime.getRuntime().maxMemory(); this.javaVersion = System.getProperty("java.version"); this.javaVendor = System.getProperty("java.vendor"); this.symmetricVersion = Version.version(); this.timezoneOffset = AppUtils.getTimezoneOffset(); Calendar cal = Calendar.getInstance(); cal.set(Calendar.MILLISECOND, 0); this.heartbeatTime = cal.getTime(); }
serverId = AppUtils.getHostName(); } catch (Exception ex) { serverId = "unknown";
public X509Certificate generateV1Certificate(String host, KeyPair pair) throws Exception { host = host == null ? AppUtils.getHostName() : host; String certString = String.format( "CN=%s, OU=SymmetricDS, O=JumpMind, L=Unknown, ST=Unknown, C=Unknown", host); log.info("Installing a default SSL certificate: {}", certString); X509V1CertificateGenerator certGen = new X509V1CertificateGenerator(); certGen.setSerialNumber(BigInteger.valueOf(System.currentTimeMillis())); certGen.setIssuerDN(new X500Principal(certString)); certGen.setNotBefore(new Date(System.currentTimeMillis() - 86400000)); certGen.setNotAfter(new Date(System.currentTimeMillis() + 788400000000l)); certGen.setSubjectDN(new X500Principal(certString)); certGen.setPublicKey(pair.getPublic()); certGen.setSignatureAlgorithm("SHA256WithRSAEncryption"); return certGen.generate(pair.getPrivate(), "BC"); }
protected String substituteVariables(String paramKey) { String value = getString(paramKey); if (!StringUtils.isBlank(value)) { if (value.contains("hostName")) { value = FormatUtils.replace("hostName", AppUtils.getHostName(), value); } if (value.contains("ipAddress")) { value = FormatUtils.replace("ipAddress", AppUtils.getIpAddress(), value); } if (value.contains("engineName")) { value = FormatUtils.replace("engineName", getEngineName(), value); } } return value; }
public void insertDataGap(DataGap gap) { try { sqlTemplate.update(getSql("insertDataGapSql"), new Object[] { DataGap.Status.GP.name(), AppUtils.getHostName(), gap.getStartId(), gap.getEndId() }, new int[] { Types.VARCHAR, Types.VARCHAR, Types.NUMERIC, Types.NUMERIC }); } catch (UniqueKeyException ex) { log.warn("A gap already existed for {} to {}. Updating instead.", gap.getStartId(), gap.getEndId()); updateDataGap(gap, DataGap.Status.GP); } }
public void updateDataGap(DataGap gap, DataGap.Status status) { sqlTemplate.update( getSql("updateDataGapSql"), new Object[] { status.name(), AppUtils.getHostName(), gap.getStartId(), gap.getEndId() }, new int[] { Types.VARCHAR, Types.VARCHAR, symmetricDialect.getSqlTypeForIds(), symmetricDialect.getSqlTypeForIds() }); }
public static String buildRegistrationUrl(String baseUrl, Node node) throws IOException { if (baseUrl == null) { baseUrl = ""; } StringBuilder builder = new StringBuilder(baseUrl); builder.append("/registration?"); append(builder, WebConstants.NODE_GROUP_ID, node.getNodeGroupId()); append(builder, WebConstants.EXTERNAL_ID, node.getExternalId()); append(builder, WebConstants.SYNC_URL, node.getSyncUrl()); append(builder, WebConstants.SCHEMA_VERSION, node.getSchemaVersion()); append(builder, WebConstants.DATABASE_TYPE, node.getDatabaseType()); append(builder, WebConstants.DATABASE_VERSION, node.getDatabaseVersion()); append(builder, WebConstants.SYMMETRIC_VERSION, node.getSymmetricVersion()); append(builder, WebConstants.HOST_NAME, AppUtils.getHostName()); append(builder, WebConstants.IP_ADDRESS, AppUtils.getIpAddress()); return builder.toString(); }