[Yanel-commits] rev 44190 - public/yanel/trunk/src/realms/welcome-admin/yanel/resources/show-realms/src/java/org/wyona/yanel/impl/resources

michi at wyona.com michi at wyona.com
Thu Aug 13 23:59:23 CEST 2009


Author: michi
Date: 2009-08-13 23:59:23 +0200 (Thu, 13 Aug 2009)
New Revision: 44190

Modified:
   public/yanel/trunk/src/realms/welcome-admin/yanel/resources/show-realms/src/java/org/wyona/yanel/impl/resources/ShowRealms.java
Log:
output exception and exist method fixed

Modified: public/yanel/trunk/src/realms/welcome-admin/yanel/resources/show-realms/src/java/org/wyona/yanel/impl/resources/ShowRealms.java
===================================================================
--- public/yanel/trunk/src/realms/welcome-admin/yanel/resources/show-realms/src/java/org/wyona/yanel/impl/resources/ShowRealms.java	2009-08-13 21:52:38 UTC (rev 44189)
+++ public/yanel/trunk/src/realms/welcome-admin/yanel/resources/show-realms/src/java/org/wyona/yanel/impl/resources/ShowRealms.java	2009-08-13 21:59:23 UTC (rev 44190)
@@ -22,7 +22,8 @@
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
-import org.apache.log4j.Category;
+import org.apache.log4j.Logger;
+
 import org.wyona.yanel.core.Resource;
 import org.wyona.yanel.core.ResourceTypeDefinition;
 import org.wyona.yanel.core.ResourceTypeRegistry;
@@ -34,11 +35,11 @@
 import org.wyona.yarep.core.Repository;
 
 /**
- * 
+ * Show all realms registered within Yanel instance
  */
 public class ShowRealms extends Resource implements ViewableV2 {
 
-    private static Category log = Category.getInstance(ShowRealms.class);
+    private static Logger log = Logger.getLogger(ShowRealms.class);
 
     /**
      * 
@@ -71,18 +72,19 @@
         
         Realm[] realms = yanel.getRealmConfiguration().getRealms();
         for (int i = 0; i < realms.length; i++) {
-            if (realm instanceof org.wyona.yanel.core.map.RealmWithConfigurationExceptionImpl) {
+            if (realms[i] instanceof org.wyona.yanel.core.map.RealmWithConfigurationExceptionImpl) {
+                String eMessage = ((org.wyona.yanel.core.map.RealmWithConfigurationExceptionImpl) realms[i]).getConfigurationException().getMessage();
+                log.error("Realm '" + realms[i].getID() + "' has thrown a configuration exception: " + eMessage);
                 sb.append("<realm>");
-                sb.append("<name>" + "WARNING: Configuration Exception" + "</name>");
-                sb.append("<id>" + realms[i].getID() + "</id>");
-                sb.append("<mountpoint>" + realms[i].getMountPoint() + "</mountpoint>");
-                //sb.append("<description>" + realms[i].getDescription() + "</description>");
+                sb.append("  <name>" + "WARNING: Configuration Exception '" + eMessage + "' for realm " + realms[i].getID() + "</name>");
+                sb.append("  <id>" + realms[i].getID() + "</id>");
+                sb.append("  <mountpoint>" + realms[i].getMountPoint() + "</mountpoint>");
                 sb.append("</realm>");
             } else {
                 sb.append("<realm>");
-                sb.append("<name>" + realms[i].getName() + "</name>");
-                sb.append("<id>" + realms[i].getID() + "</id>");
-                sb.append("<mountpoint>" + realms[i].getMountPoint() + "</mountpoint>");
+                sb.append("  <name>" + realms[i].getName() + "</name>");
+                sb.append("  <id>" + realms[i].getID() + "</id>");
+                sb.append("  <mountpoint>" + realms[i].getMountPoint() + "</mountpoint>");
                 //sb.append("<description>" + realms[i].getDescription() + "</description>");
                 sb.append("</realm>");
             }
@@ -189,8 +191,7 @@
     } 
   
     public boolean exists() throws Exception {
-        // TODO Auto-generated method stub
-        return false;
+        return true;
     }
     
     public long getSize() throws Exception {



More information about the Yanel-commits mailing list