127.0.0.1:6379> keys *ServiceConfig*
1) "NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:cbb6c789-ea35-4b05-b97e-aab8e6d5318d"
2) "com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem.serviceTypeKey.NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceTypeMem:97b772b4-3031-4788-936a-127df9ee5a47"
3) "NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:8f18d57d-b0c9-4b5b-b503-8ed04b707b87"
4) "com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem.serviceTypeKey.NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceTypeMem:f047c363-189f-4921-922b-73aa40a194d1"
5) "NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:All"
127.0.0.1:6379> type NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:cbb6c789-ea35-4b05-b97e-aab8e6d5318d
hash
127.0.0.1:6379> hgetall NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:cbb6c789-ea35-4b05-b97e-aab8e6d5318d
1) "serviceDefinedTransportListKey"
2) "\"NGMA_SYSTEM:cbb6c789-ea35-4b05-b97e-aab8e6d5318d:serviceDefinedTransport\""
3) "nameSpace"
4) "{\"productName\":\"NGMA_SYSTEM\"}"
5) "serviceTypeKey"
6) "\"NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceTypeMem:f047c363-189f-4921-922b-73aa40a194d1\""
7) "extendedAttr"
8) "{}"
9) "key"
10) "\"NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:cbb6c789-ea35-4b05-b97e-aab8e6d5318d\""
11) "uuid"
12) "\"cbb6c789-ea35-4b05-b97e-aab8e6d5318d\""
13) "keyAll"
14) "\"NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:All\""
15) "serviceNodeKey"
16) "\"NGMA_SYSTEM:com.polycom.rpum.core.shared.dataobject.NgmaServiceNode:763b79fa-8e5d-47e8-8dd3-73354a6be977\""
17) "serviceName"
18) "\"pd-rpp-tomcat-default\""
127.0.0.1:6379> hget NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:cbb6c789-ea35-4b05-b97e-aab8e6d5318d serviceDefinedTransportListKey
"\"NGMA_SYSTEM:cbb6c789-ea35-4b05-b97e-aab8e6d5318d:serviceDefinedTransport\""
127.0.0.1:6379> type NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceTypeMem:f047c363-189f-4921-922b-73aa40a194d1
hash
127.0.0.1:6379> hgetall NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceTypeMem:f047c363-189f-4921-922b-73aa40a194d1
1) "startTimeout"
2) "60"
3) "serviceTypeFlag"
4) "\"BUSINESS\""
5) "keyAll"
6) "\"NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceTypeMem:All\""
7) "serviceTypeName"
8) "\"pd-rpp-tomcat\""
9) "dependencyUuidStringListKey"
10) "\"NGMA_SYSTEM:f047c363-189f-4921-922b-73aa40a194d1:dependencyList\""
11) "uuid"
12) "\"f047c363-189f-4921-922b-73aa40a194d1\""
13) "key"
14) "\"NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceTypeMem:f047c363-189f-4921-922b-73aa40a194d1\""
15) "loadOnStartup"
16) "true"
17) "defaultTransportListKey"
18) "\"NGMA_SYSTEM:f047c363-189f-4921-922b-73aa40a194d1:defaultTransport\""
19) "stopCommandTemplate"
20) "\"/opt/polycom/rpum/current/bin/test/demo-stop-platform-directory.sh\""
21) "reportStatus"
22) "true"
23) "startupCommandTemplate"
24) "\"/opt/polycom/rpum/current/bin/test/demo-launch-platform-directory.sh\""
25) "stopTimeout"
26) "60"
27) "nameSpace"
28) "{\"productName\":\"NGMA_SYSTEM\"}"
29) "extendedAttr"
30) "{\"restartIfNoStatusReport\":\"false\",\"defaultInstanceID\":\"cbb6c789-ea35-4b05-b97e-aab8e6d5318d\",\"mlaxRestartCount\":\"3\",\"managedService\":\"true\"}"
31) "restart"
32) "false"
33) "permissionListKey"
34) "\"NGMA_SYSTEM:f047c363-189f-4921-922b-73aa40a194d1:permission\""
127.0.0.1:6379> lrange NGMA_SYSTEM:cbb6c789-ea35-4b05-b97e-aab8e6d5318d:serviceDefinedTransport 0 100
1) "NGMA_SYSTEM:com.polycom.rpum.core.shared.dataobject.NgmaTransport:5d886988-6a72-424a-92d3-df45876442b5"
2) "NGMA_SYSTEM:com.polycom.rpum.core.shared.dataobject.NgmaTransport:ac39935b-f4fa-4341-9d1c-dfa9a8806526"
127.0.0.1:6379> type NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:All
set
127.0.0.1:6379> hgetall NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:All
(error) WRONGTYPE Operation against a key holding the wrong kind of value
127.0.0.1:6379> smembers NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:All
1) "NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:8f18d57d-b0c9-4b5b-b503-8ed04b707b87"
2) "NGMA_SYSTEM:com.polycom.rpum.core.dal.memi.NgmaServiceConfigMem:cbb6c789-ea35-4b05-b97e-aab8e6d5318d"
public List getAllServiceConfigs()
throws PlcmStatusException
{
final List serviceConfigList = new ArrayList<>();
logTime(() -> {
serviceConfigList.addAll(serviceDataMemDao.getAllServiceConfigs());
return "serviceDataMemDao.getAllServiceConfigs()";
});
if (serviceConfigList.size() == 0)
{
loadServiceConfigToMem();
logTime(() -> {
serviceConfigList.addAll(serviceDataMemDao.getAllServiceConfigs());
return "serviceDataMemDao.getAllServiceConfigs()";
});
}
return serviceConfigList;
}
@Override
public List getAllServiceConfigs()
throws PlcmStatusException
{
List serviceConfigList = new ArrayList<>();
NgmaServiceConfigMem mem = new NgmaServiceConfigMem();
Set serviceConfigKeys = memoryService.memorySmembers(mem.getKeyAll());
if (!serviceConfigKeys.isEmpty())
{
Iterator iter = serviceConfigKeys.iterator();
while (iter.hasNext())
{ public void saveServiceConfig(NgmaServiceConfig serviceConfig)
throws PlcmStatusException
{
// save transport list
NgmaServiceConfigMem mem = (NgmaServiceConfigMem) ConvertUtils.convert(serviceConfig,
NgmaServiceConfigMem.class);
String lockKey = mem.getKey() + ":Lock";
BlockableLock lock = new BlockableLock(memoryService, lockKey);
try
{
lock.lock();
saveServiceConfigInLocked(serviceConfig, mem);
}
finally
{
lock.unlock();
}
}
public void saveServiceConfig(NgmaServiceConfig serviceConfig)
throws PlcmStatusException
{
// save transport list
NgmaServiceConfigMem mem = (NgmaServiceConfigMem) ConvertUtils.convert(serviceConfig,
NgmaServiceConfigMem.class);
String lockKey = mem.getKey() + ":Lock";
BlockableLock lock = new BlockableLock(memoryService, lockKey);
try
{
lock.lock();
saveServiceConfigInLocked(serviceConfig, mem);
}
finally
{
lock.unlock();
}
}
static
{
ConvertUtils.register(new NgmaServiceConfig2MemConverter(), NgmaServiceConfigMem.class);
ConvertUtils.register(new NgmaServiceConfigFromMemConverter(), NgmaServiceConfig.class);
ConvertUtils.register(new NgmaServiceType2MemConverter(), NgmaServiceTypeMem.class);
ConvertUtils.register(new NgmaServiceTypeFromMemConverter(), NgmaServiceType.class);
}
private static class NgmaServiceConfig2MemConverter implements Converter
{
@Override
public
{
if (type.equals(NgmaServiceConfigMem.class) && value != null
&& value.getClass().equals(NgmaServiceConfig.class))
{
NgmaServiceConfig config = (NgmaServiceConfig) value;
NgmaServiceConfigMem mem = new NgmaServiceConfigMem();
mem.setExtendedAttr(config.getExtendedAttr());
mem.setServiceDefinedTransportListKey(createTransportListKey(config.getUuid()));
mem.setServiceDefinedTransport(config.getServiceDefinedTransport());
mem.setServiceName(config.getServiceName());
mem.setServiceNodeKey(config.getServiceNode().getKey());
NgmaServiceTypeMem serviceTypeMem = (NgmaServiceTypeMem) ConvertUtils.convert(
config.getServiceType(), NgmaServiceTypeMem.class);
mem.setServiceTypeKey(serviceTypeMem.getKey());
mem.setUuid(config.getUuid());
return (T) mem;
}
return null;
}
}