[Yanel-commits] rev 58126 - public/yanel/contributions/resources/creatable-modifiable-deletable-v3/src/java/org/wyona/yanel/impl/resources/jellyadapterofcmdv3

michi at wyona.com michi at wyona.com
Fri Apr 29 11:48:02 CEST 2011


Author: michi
Date: 2011-04-29 11:48:02 +0200 (Fri, 29 Apr 2011)
New Revision: 58126

Modified:
   public/yanel/contributions/resources/creatable-modifiable-deletable-v3/src/java/org/wyona/yanel/impl/resources/jellyadapterofcmdv3/ControllerAdapter.java
Log:
get adapted resource config from configuration

Modified: public/yanel/contributions/resources/creatable-modifiable-deletable-v3/src/java/org/wyona/yanel/impl/resources/jellyadapterofcmdv3/ControllerAdapter.java
===================================================================
--- public/yanel/contributions/resources/creatable-modifiable-deletable-v3/src/java/org/wyona/yanel/impl/resources/jellyadapterofcmdv3/ControllerAdapter.java	2011-04-29 09:45:26 UTC (rev 58125)
+++ public/yanel/contributions/resources/creatable-modifiable-deletable-v3/src/java/org/wyona/yanel/impl/resources/jellyadapterofcmdv3/ControllerAdapter.java	2011-04-29 09:48:02 UTC (rev 58126)
@@ -10,6 +10,9 @@
 import org.wyona.yanel.core.api.attributes.ViewableV2;
 import org.wyona.yanel.core.attributes.viewable.ViewDescriptor;
 
+/**
+ * TODO
+ */
 abstract class ControllerAdapter extends Resource implements ResourceAdapter, ViewableV2 {
     private static Logger log = Logger.getLogger(ControllerAdapter.class);
     public static String YANEL_CONTINUATION_ID = "yanel.continuation.id";
@@ -40,8 +43,21 @@
      * @return null when the parameter is not found
      * */
     public final String getAdaptedResourcePath() {
-        if(adaptedResourcePath == null){
-            adaptedResourcePath = getParameterAsString(PARAM_ADAPTED_RESOURCE_PATH); 
+        if(adaptedResourcePath == null) {
+            try {
+                // TODO: TBD order (security, etc.)
+                if (getResourceConfigProperty(PARAM_ADAPTED_RESOURCE_PATH) != null) {
+                    adaptedResourcePath = getResourceConfigProperty(PARAM_ADAPTED_RESOURCE_PATH);
+                    log.debug("Get adapted resource path from resource configuration: " + adaptedResourcePath);
+                } else if (getParameterAsString(PARAM_ADAPTED_RESOURCE_PATH) != null) {
+                    adaptedResourcePath = getParameterAsString(PARAM_ADAPTED_RESOURCE_PATH); 
+                    log.debug("Get adapted resource path from URL/QueryString: " + adaptedResourcePath);
+                } else {
+                    log.error("No adapted resource path!");
+                }
+            } catch(Exception e) {
+                log.error(e, e);
+            }
         }
         return adaptedResourcePath;
     }
@@ -53,9 +69,10 @@
     /**
      * Checks if the usecase was set, otherwise looks into available parameters
      * @return null when usecase can't be determined
-     * */
+     */
     public final Usecase getUsecase() {
         if(usecase == null){
+            // TODO: TBD order (security, etc.)
             String u = getParameterAsString(Constants.Request.YANEL_RESOURCE_USECASE);
             if (u == null) {
                 try {



More information about the Yanel-commits mailing list