diff --git a/dcm4chee-conf-db/pom.xml b/dcm4chee-conf-db/pom.xml
index 5c21346..d377351 100644
--- a/dcm4chee-conf-db/pom.xml
+++ b/dcm4chee-conf-db/pom.xml
@@ -51,7 +51,7 @@
1.0.0-SNAPSHOT
- java:/ConfigDS
+ java:/PacsDS
validate
false
diff --git a/dcm4chee-conf-db/src/main/java/org/dcm4chee/conf/storage/SemiSerializedDBConfigStorage.java b/dcm4chee-conf-db/src/main/java/org/dcm4chee/conf/storage/SemiSerializedDBConfigStorage.java
index 53f5928..4d879d5 100644
--- a/dcm4chee-conf-db/src/main/java/org/dcm4chee/conf/storage/SemiSerializedDBConfigStorage.java
+++ b/dcm4chee-conf-db/src/main/java/org/dcm4chee/conf/storage/SemiSerializedDBConfigStorage.java
@@ -80,7 +80,7 @@ public Map getConfigurationRoot() throws ConfigurationException
@Override
public Object getConfigurationNode(String path, Class configurableClass) throws ConfigurationException {
- return ConfigNodeUtil.getNode(db.getFullTree(), path);
+ return ConfigNodeUtil.getNode(getConfigurationRoot(), path);
}
@Override
diff --git a/dcm4chee-conf-infinispan/src/main/java/infinispan/InfinispanConfigurationCacheFactory.java b/dcm4chee-conf-infinispan/src/main/java/infinispan/InfinispanConfigurationCacheFactory.java
deleted file mode 100644
index c77da0f..0000000
--- a/dcm4chee-conf-infinispan/src/main/java/infinispan/InfinispanConfigurationCacheFactory.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package infinispan;
-
-import org.infinispan.Cache;
-import org.infinispan.manager.EmbeddedCacheManager;
-
-import javax.annotation.Resource;
-import javax.enterprise.context.ApplicationScoped;
-
-@ApplicationScoped
-public class InfinispanConfigurationCacheFactory {
-
- @Resource(lookup="java:jboss/infinispan/dcm4che-config")
- private EmbeddedCacheManager defaultCacheManager;
-
- public Cache getDevicesCache() {
- return defaultCacheManager.getCache();
- }
- public Cache getMetadataCache() {
- return defaultCacheManager.getCache("metadata");
- }
-
-}
diff --git a/dcm4chee-conf-infinispan/src/main/java/infinispan/CachedDicomConfigurationDecorator.java b/dcm4chee-conf-infinispan/src/main/java/infinispan/InfinispanDicomConfigurationDecorator.java
similarity index 71%
rename from dcm4chee-conf-infinispan/src/main/java/infinispan/CachedDicomConfigurationDecorator.java
rename to dcm4chee-conf-infinispan/src/main/java/infinispan/InfinispanDicomConfigurationDecorator.java
index 413fa29..8914e5c 100644
--- a/dcm4chee-conf-infinispan/src/main/java/infinispan/CachedDicomConfigurationDecorator.java
+++ b/dcm4chee-conf-infinispan/src/main/java/infinispan/InfinispanDicomConfigurationDecorator.java
@@ -1,42 +1,54 @@
package infinispan;
-import org.dcm4che3.conf.core.DelegatingConfiguration;
import org.dcm4che3.conf.core.api.Configuration;
import org.dcm4che3.conf.core.api.ConfigurationException;
import org.dcm4che3.conf.core.util.ConfigNodeUtil;
import org.infinispan.Cache;
+import org.infinispan.manager.EmbeddedCacheManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-//TODO: convert to CDI decorator
-public class CachedDicomConfigurationDecorator extends DelegatingConfiguration {
+@Decorator
+public abstract class InfinispanDicomConfigurationDecorator implements Configuration {
- private static Logger log = LoggerFactory
- .getLogger(CachedDicomConfigurationDecorator.class);
+ @Inject
+ @Delegate
+ Configuration delegate;
+
+ @Resource(lookup = "java:jboss/infinispan/dcm4che-config")
+ private EmbeddedCacheManager defaultCacheManager;
+ @PostConstruct
+ public void init() {
+ serializedDevicesCache = defaultCacheManager.getCache();
+ metadataCache = defaultCacheManager.getCache("metadata");
+ }
+
+ private static Logger log = LoggerFactory
+ .getLogger(InfinispanDicomConfigurationDecorator.class);
private Cache serializedDevicesCache;
- private Cache metadataCache;
- public CachedDicomConfigurationDecorator(Configuration delegate, Cache serializedDevicesCache, Cache metadataCache) {
- super(delegate);
- this.serializedDevicesCache = serializedDevicesCache;
- this.metadataCache = metadataCache;
- }
+ private Cache metadataCache;
@Override
public Map getConfigurationRoot() throws ConfigurationException {
// if cache not inited
- if (serializedDevicesCache.isEmpty()) {
- Map configurationRoot = super.getConfigurationRoot();
+ if (!metadataCache.containsKey("deviceNames")) {
+ Map configurationRoot = delegate.getConfigurationRoot();
Map dicomConfigurationRoot = (Map) configurationRoot.get("dicomConfigurationRoot");
Map dicomDevicesRoot = (Map) dicomConfigurationRoot.get("dicomDevicesRoot");
@@ -74,23 +86,22 @@ public Object getConfigurationNode(String path, Class configurableClass) throws
@Override
public boolean nodeExists(String path) throws ConfigurationException {
- return false;
+ return ConfigNodeUtil.nodeExists(getConfigurationRoot(), path);
}
- @Override
- public void persistNode(String path, Map configNode, Class configurableClass) throws ConfigurationException {
- metadataCache.clear();
- serializedDevicesCache.clear();
- }
+ // TODO: opt
@Override
- public void refreshNode(String path) throws ConfigurationException {
+ public void persistNode(String path, Map configNode, Class configurableClass) throws ConfigurationException {
+ delegate.persistNode(path, configNode, configurableClass);
metadataCache.clear();
serializedDevicesCache.clear();
}
+ // TODO: opt
@Override
public void removeNode(String path) throws ConfigurationException {
+ delegate.removeNode(path);
metadataCache.clear();
serializedDevicesCache.clear();
}