mirror of
https://gitee.com/BDWare/cm
synced 2025-01-10 01:44:04 +00:00
optimize build.gradle
This commit is contained in:
parent
c3f1407b6f
commit
7d04d48f50
@ -1,5 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
|
id 'java-library'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@ -28,7 +29,9 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(":common")
|
api project(":common")
|
||||||
|
api 'io.prometheus:simpleclient:0.12.0'
|
||||||
|
api 'org.knowhowlab.osgi:sigar:1.6.5_01'
|
||||||
|
api fileTree(dir: 'libs', include: '*.jar')
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package org.bdware.sc;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonPrimitive;
|
import com.google.gson.JsonPrimitive;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.bdware.sc.ContractResult.Status;
|
import org.bdware.sc.ContractResult.Status;
|
||||||
@ -267,7 +266,7 @@ public class ContractClient {
|
|||||||
(isDebug ? "-debug" : ""));
|
(isDebug ? "-debug" : ""));
|
||||||
File directory = new File("");
|
File directory = new File("");
|
||||||
LOGGER.debug("[CMD] path: " + directory.getAbsolutePath());
|
LOGGER.debug("[CMD] path: " + directory.getAbsolutePath());
|
||||||
LOGGER.debug(StringUtils.join(builder.command(), " "));
|
LOGGER.debug(JsonUtil.toPrettyJson(builder.command()));
|
||||||
|
|
||||||
Map<String, String> map = builder.environment();
|
Map<String, String> map = builder.environment();
|
||||||
map.put("java.library.path", jniPath.getAbsolutePath() + osJni);
|
map.put("java.library.path", jniPath.getAbsolutePath() + osJni);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.bdware.sc;
|
package org.bdware.sc;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.bdware.sc.ContractPort.PortVisitor;
|
import org.bdware.sc.ContractPort.PortVisitor;
|
||||||
@ -113,11 +112,15 @@ public class ContractStatusRecorder extends StatusRecorder<ContractMeta> {
|
|||||||
|
|
||||||
public void reSyncStatusAtStart() {
|
public void reSyncStatusAtStart() {
|
||||||
List<String> toPrint = new ArrayList<>();
|
List<String> toPrint = new ArrayList<>();
|
||||||
|
Set<ContractMeta> toRemove = new HashSet<>();
|
||||||
for (ContractMeta meta : getStatus().values()) {
|
for (ContractMeta meta : getStatus().values()) {
|
||||||
toPrint.add(meta.status + " " + meta.id + " " + meta.name + " ");
|
toPrint.add(meta.status + " " + meta.id + " " + meta.name + " ");
|
||||||
|
if (meta.contract == null)
|
||||||
|
toRemove.add(meta);
|
||||||
}
|
}
|
||||||
LOGGER.debug(JsonUtil.toPrettyJson(toPrint));
|
LOGGER.debug(JsonUtil.toPrettyJson(toPrint));
|
||||||
|
for (ContractMeta meta : toRemove)
|
||||||
|
remove(meta);
|
||||||
for (String id : id2ContractClient.keySet()) {
|
for (String id : id2ContractClient.keySet()) {
|
||||||
ContractMeta meta = getStatus().get(id);
|
ContractMeta meta = getStatus().get(id);
|
||||||
if (null == meta) {
|
if (null == meta) {
|
||||||
@ -251,7 +254,7 @@ public class ContractStatusRecorder extends StatusRecorder<ContractMeta> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ContractClient getContractClient(String idOrName) {
|
public ContractClient getContractClient(String idOrName) {
|
||||||
if (StringUtils.isBlank(idOrName)) {
|
if (idOrName == null || idOrName.length() == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// TODO ensure load contract client
|
// TODO ensure load contract client
|
||||||
|
14
src/main/java/org/bdware/sc/DoipServiceInfoConfigurer.java
Normal file
14
src/main/java/org/bdware/sc/DoipServiceInfoConfigurer.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package org.bdware.sc;
|
||||||
|
|
||||||
|
import org.bdware.doip.application.DoipServiceConfig;
|
||||||
|
import org.bdware.doip.endpoint.doipServer.DoipServiceInfo;
|
||||||
|
|
||||||
|
public interface DoipServiceInfoConfigurer {
|
||||||
|
String getServiceHandle();
|
||||||
|
|
||||||
|
String resetServiceConfig(String configJson);
|
||||||
|
|
||||||
|
DoipServiceConfig getDoipServiceConfig();
|
||||||
|
|
||||||
|
DoipServiceInfo getDoipServiceInfo();
|
||||||
|
}
|
@ -154,7 +154,16 @@ public class MultiContractMeta implements IDSerializable {
|
|||||||
public String[] getMembers() {
|
public String[] getMembers() {
|
||||||
return members;
|
return members;
|
||||||
}
|
}
|
||||||
|
public String joinMembers(String delimiter){
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if (members.length > 0)
|
||||||
|
sb.append(members[0]);
|
||||||
|
else return "";
|
||||||
|
for (int i = 1; i < members.length; i++) {
|
||||||
|
sb.append(delimiter).append(members[i]);
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
public void setMembers(String[] m) {
|
public void setMembers(String[] m) {
|
||||||
members = m;
|
members = m;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user