You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2009/08/25 16:34:01 UTC

svn commit: r807652 - /myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/javaloader/core/JavaScriptingWeaver.java

Author: werpu
Date: Tue Aug 25 14:34:01 2009
New Revision: 807652

URL: http://svn.apache.org/viewvc?rev=807652&view=rev
Log:
added a few comments

https://issues.apache.org/jira/browse/EXTSCRIPT-5

Modified:
    myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/javaloader/core/JavaScriptingWeaver.java

Modified: myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/javaloader/core/JavaScriptingWeaver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/javaloader/core/JavaScriptingWeaver.java?rev=807652&r1=807651&r2=807652&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/javaloader/core/JavaScriptingWeaver.java (original)
+++ myfaces/extensions/scripting/trunk/core/src/main/java/org/apache/myfaces/javaloader/core/JavaScriptingWeaver.java Tue Aug 25 14:34:01 2009
@@ -18,9 +18,9 @@
  */
 package org.apache.myfaces.javaloader.core;
 
+import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.commons.beanutils.BeanUtils;
 import org.apache.myfaces.javaloader.core.jsr199.CompilerFacade;
 import org.apache.myfaces.scripting.api.DynamicCompiler;
 import org.apache.myfaces.scripting.api.ScriptingConst;
@@ -29,11 +29,11 @@
 import org.apache.myfaces.scripting.refresh.ReloadingMetadata;
 
 import java.io.File;
+import java.lang.reflect.InvocationTargetException;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.lang.reflect.InvocationTargetException;
 
 /**
  * @author werpu
@@ -48,6 +48,11 @@
     DynamicCompiler compiler = new CompilerFacade();
 
 
+    /**
+     * add custom source lookup paths
+     *
+     * @param scriptPath the new path which has to be added
+     */
     public void appendCustomScriptPath(String scriptPath) {
         if (scriptPath.endsWith("/") || scriptPath.endsWith("\\/")) {
             scriptPath = scriptPath.substring(0, scriptPath.length() - 1);
@@ -55,6 +60,12 @@
         scriptPaths.add(scriptPath);
     }
 
+    /**
+     * reloads a scripting instance object
+     *
+     * @param scriptingInstance the object which has to be reloaded
+     * @return the reloaded object with all properties transferred or the original object if no reloading was needed
+     */
     public Object reloadScriptingInstance(Object scriptingInstance) {
         Map<String, ReloadingMetadata> classMap = getClassMap();
         if (classMap.size() == 0) {
@@ -95,6 +106,12 @@
 
     }
 
+    /**
+     * helper to map the properties wherever possible
+     *
+     * @param target
+     * @param src
+     */
     private void mapProperties(Object target, Object src) {
         try {
             BeanUtils.copyProperties(target, src);
@@ -130,6 +147,12 @@
         return loadScriptingClassFromFile(metadata.getSourcePath(), metadata.getFileName());
     }
 
+    /**
+     * recompiles and loads a scripting class from a given classname
+     *
+     * @param className the classname including the package
+     * @return a valid class if the sources could be found null if nothing could be found
+     */
     public Class loadScriptingClassFromName(String className) {
         Map<String, ReloadingMetadata> classMap = getClassMap();
         ReloadingMetadata metadata = classMap.get(className);
@@ -152,10 +175,22 @@
         return null;
     }
 
+    /**
+     * helper for accessing the reloading metadata map
+     *
+     * @return
+     */
     private Map<String, ReloadingMetadata> getClassMap() {
         return FileChangedDaemon.getInstance().getClassMap();
     }
 
+    /**
+     * loads a class from a given sourceroot and filename
+     *
+     * @param sourceRoot the source search lookup path
+     * @param file       the filename to be compiled and loaded
+     * @return a valid class if it could be found, null if none was found
+     */
     protected Class loadScriptingClassFromFile(String sourceRoot, String file) {
         //we load the scripting class from the given className
         File currentClassFile = new File(sourceRoot + System.getProperty("file.separator") + file);
@@ -189,4 +224,4 @@
 
         return retVal;
     }
-}
\ No newline at end of file
+}