Improve extensibility and logging.
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 13 Jan 2020 10:24:22 +0000 (11:24 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 13 Jan 2020 10:24:22 +0000 (11:24 +0100)
org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/AbstractRapE4App.java
org.argeo.cms.ui/src/org/argeo/cms/util/CmsTheme.java
org.argeo.cms/src/org/argeo/cms/internal/kernel/DataModels.java

index 8bf16a265c6665a3b1aaa22b613b654a306ae4c6..17c85ffb46630ec79d0073938446e06045af6250 100644 (file)
@@ -21,7 +21,7 @@ public abstract class AbstractRapE4App implements ApplicationConfiguration {
        private Map<String, String> baseProperties = new HashMap<String, String>();
 
        private BundleContext bundleContext;
-       private final static String CONTEXT_NAME_PROPERTY = "contextName";
+       public final static String CONTEXT_NAME_PROPERTY = "contextName";
        private String contextName;
 
        /**
@@ -105,10 +105,14 @@ public abstract class AbstractRapE4App implements ApplicationConfiguration {
                return bundleContext;
        }
 
-       protected String getContextName() {
+       public String getContextName() {
                return contextName;
        }
 
+       public void setContextName(String contextName) {
+               this.contextName = contextName;
+       }
+
        public void init(BundleContext bundleContext, Map<String, Object> properties) {
                this.bundleContext = bundleContext;
                for (String key : properties.keySet()) {
index 76b1854a47f3642f1d52d1ab372850ed3031b097..8bb7098cf98f29e5a105a25164ba6615dc4d143e 100644 (file)
@@ -92,8 +92,8 @@ public class CmsTheme {
                        if (name.startsWith("target/"))
                                continue resources; // skip maven output
                        application.addResource(name, resources.get(name));
-                       if (log.isDebugEnabled())
-                               log.debug("Added resource " + name);
+                       if (log.isTraceEnabled())
+                               log.trace("Added resource " + name);
                }
                for (String name : css.keySet()) {
                        application.addStyleSheet(themeId, name, css.get(name));
index da6328163cc9804c8b95f877440b560f979f7d40..48b6b7fc75f3476caab9b7a9be218feca546e8cf 100644 (file)
@@ -61,8 +61,14 @@ class DataModels implements BundleListener {
        protected void processBundle(Bundle bundle) {
                BundleWiring wiring = bundle.adapt(BundleWiring.class);
                if (wiring == null) {
-                       log.warn("Bundle " + bundle.getSymbolicName() + " #" + bundle.getBundleId() + " (" + bundle.getLocation()
-                                       + ") cannot be adapted to a wiring");
+                       int bundleState = bundle.getState();
+                       if (bundleState != Bundle.INSTALLED && bundleState != Bundle.UNINSTALLED) {// ignore unresolved bundles
+                               log.warn("Bundle " + bundle.getSymbolicName() + " #" + bundle.getBundleId() + " ("
+                                               + bundle.getLocation() + ") cannot be adapted to a wiring");
+                       } else {
+                               if (log.isTraceEnabled())
+                                       log.warn("Bundle " + bundle.getSymbolicName() + " is not resolved.");
+                       }
                        return;
                }
                List<BundleCapability> providedDataModels = wiring.getCapabilities(CMS_DATA_MODEL_NAMESPACE);