[Yanel-commits] rev 33118 - public/yanel/trunk/src/core/java/org/wyona/yanel/core/map

michi at wyona.com michi at wyona.com
Sun Mar 9 23:53:22 CET 2008


Author: michi
Date: 2008-03-09 23:53:22 +0100 (Sun, 09 Mar 2008)
New Revision: 33118

Modified:
   public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java
Log:
getRepoNavigation() and getName() fixed

Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java	2008-03-09 22:52:44 UTC (rev 33117)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/map/Realm.java	2008-03-09 22:53:22 UTC (rev 33118)
@@ -32,6 +32,7 @@
 import org.wyona.yanel.core.attributes.translatable.DefaultTranslationManager;
 import org.wyona.yanel.core.attributes.translatable.TranslationManager;
 import org.wyona.yanel.core.api.security.WebAuthenticator;
+import org.wyona.yanel.core.navigation.Sitetree;
 import org.wyona.yanel.core.util.ConfigurationUtil;
 import org.wyona.yarep.core.Repository;
 import org.wyona.yarep.core.RepositoryFactory;
@@ -61,6 +62,7 @@
     private WebAuthenticator privateWebAuthenticator;
     private TranslationManager translationManager;
     private LanguageHandler languageHandler;
+    private Sitetree repoNavigation;
     private File configFile;
     private File rootDir;
     private String[] languages;
@@ -111,7 +113,11 @@
         Yanel yanel = Yanel.getInstance();
 	File repoConfig = null;
 
-        // TODO: get name from config (also see realm constructor)!
+        // Set name if not already set by yanel realms registration config
+        Configuration nameConfigElement = config.getChild("name", false);
+        if (name == null && nameConfigElement != null) {
+            name = nameConfigElement.getValue();
+        }
 
 
         // Set PolicyManager for this realm
@@ -252,10 +258,29 @@
             }
         }
         
+        // Set i18n catalogue
         configElement = config.getChild("i18n-catalogue", false);
         if (configElement != null) {
             this.i18nCatalogue = configElement.getValue();
         }
+
+        // Set repo-navigation
+        configElement = config.getChild("repo-navigation", false);
+        if (configElement != null) {
+            try {
+                String customRepoNavigationImplClassName = configElement.getAttribute("class");
+                repoNavigation = (Sitetree) Class.forName(customRepoNavigationImplClassName).newInstance();
+                // TODO: Pass custom configuration!
+                log.info("Custom repo navigation implementation will be used for realm: " + getName());
+            } catch (ConfigurationException e) {
+                log.error(e, e);
+                repoNavigation = (Sitetree) yanel.getBeanFactory().getBean("repo-navigation");
+                log.warn("Default repo navigation implementation will be used for realm: " + getName());
+            }
+        } else {
+            log.info("Default repo navigation implementation will be used for realm: " + getName());
+            repoNavigation = (Sitetree) yanel.getBeanFactory().getBean("repo-navigation");
+        }
     }
 
     /**
@@ -403,6 +428,9 @@
         this.privateIdentityManager = identityManager;
     }
 
+    /**
+     * Get policy manager
+     */
     public PolicyManager getPolicyManager() {
         return privatePolicyManager;
     }
@@ -412,6 +440,13 @@
     }
 
     /**
+     * Get repository navigation
+     */
+    public Sitetree getRepoNavigation() {
+        return repoNavigation;
+    }
+
+    /**
      * Get default language of this realm re content
      */
     public String getDefaultLanguage() {



More information about the Yanel-commits mailing list