[Yanel-commits] rev 32591 - public/yanel/trunk/src/resources/add-realm/src/java/org/wyona/yanel/impl/resources

michi at wyona.com michi at wyona.com
Wed Feb 27 22:15:54 CET 2008


Author: michi
Date: 2008-02-27 22:15:53 +0100 (Wed, 27 Feb 2008)
New Revision: 32591

Modified:
   public/yanel/trunk/src/resources/add-realm/src/java/org/wyona/yanel/impl/resources/AddRealmResource2.java
Log:
throw exception if realm id of template has not been registered

Modified: public/yanel/trunk/src/resources/add-realm/src/java/org/wyona/yanel/impl/resources/AddRealmResource2.java
===================================================================
--- public/yanel/trunk/src/resources/add-realm/src/java/org/wyona/yanel/impl/resources/AddRealmResource2.java	2008-02-27 21:04:36 UTC (rev 32590)
+++ public/yanel/trunk/src/resources/add-realm/src/java/org/wyona/yanel/impl/resources/AddRealmResource2.java	2008-02-27 21:15:53 UTC (rev 32591)
@@ -332,9 +332,13 @@
     }
 
     /**
-     *
+     * Build DOM in order to enter data for creating a realm from scratch
      */
-    private Document getFromScratchInputDocument() {
+    private Document getFromScratchInputDocument() throws Exception {
+        if (getYanel().getRealmConfiguration().getRealm(getTemplateRealmId()) == null) {
+            throw new Exception("No such realm registered: " + getTemplateRealmId());
+        }
+
         Document doc = getDocument();
         Element rootElement = doc.getDocumentElement();
         Element fromScratchElement = (Element) rootElement.appendChild(doc.createElementNS(NAMESPACE, "from-scratch"));
@@ -692,12 +696,13 @@
     }
 
     /**
-     *
+     * Get id of realm which shall be used as realm template
      */
     private String getTemplateRealmId() {
         String sampleRealmId = null;
         try {
-            sampleRealmId = getConfiguration().getProperty("template-realm-id");
+            //sampleRealmId = getConfiguration().getProperty("template-realm-id");
+            sampleRealmId = getResourceConfigProperty("template-realm-id");
         } catch (Exception e) {
             log.warn(e);
         }



More information about the Yanel-commits mailing list