[Yanel-commits] rev 22033 - public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources

michi at wyona.com michi at wyona.com
Tue Jan 23 10:02:40 CET 2007


Author: michi
Date: 2007-01-23 10:02:38 +0100 (Tue, 23 Jan 2007)
New Revision: 22033

Modified:
   public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
Log:
get property switch implemented

Modified: public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java
===================================================================
--- public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java	2007-01-23 09:01:34 UTC (rev 22032)
+++ public/yanel/trunk/src/resources/xml/src/java/org/wyona/yanel/impl/resources/XMLResource.java	2007-01-23 09:02:38 UTC (rev 22033)
@@ -18,6 +18,7 @@
 
 import org.wyona.yanel.core.Path;
 import org.wyona.yanel.core.Resource;
+import org.wyona.yanel.core.ResourceConfiguration;
 import org.wyona.yanel.core.Topic;
 import org.wyona.yanel.core.Yanel;
 import org.wyona.yanel.core.api.attributes.ModifiableV2;
@@ -85,7 +86,7 @@
         String mimeType = getMimeType(getPath(), viewId);
         defaultView.setMimeType(mimeType);
 
-        String yanelPath = getRTI().getProperty("yanel-path");
+        String yanelPath = getProperty("yanel-path");
         //if (yanelPath == null) yanelPath = path.toString();
 
         Path xsltPath = getXSLTPath(getPath());
@@ -184,8 +185,8 @@
     /**
      * Get mime type
      */
-    private String getMimeType(Path path, String viewId) {
-        String mimeType = getRTI().getProperty("mime-type");
+    private String getMimeType(Path path, String viewId) throws Exception {
+        String mimeType = getProperty("mime-type");
         if (mimeType != null) return mimeType;
 
         String suffix = path.getSuffix();
@@ -253,8 +254,8 @@
     /**
      * Get XSLT path
      */
-    private Path getXSLTPath(Path path) {
-        String xsltPath = getRTI().getProperty("xslt");
+    private Path getXSLTPath(Path path) throws Exception {
+        String xsltPath = getProperty("xslt");
         if (xsltPath != null) return new Path(xsltPath);
         log.info("No XSLT Path within: " + path);
         return null;
@@ -329,4 +330,13 @@
             return null;
         }
     }
+
+    /**
+     * Get property value from resource configuration
+     */
+    private String getProperty(String name) throws Exception {
+        ResourceConfiguration rc = getConfiguration();
+        if (rc != null) return rc.getProperty(name);
+        return getRTI().getProperty(name);
+    }
 }




More information about the Yanel-commits mailing list