You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by mp...@apache.org on 2003/02/11 20:47:59 UTC
cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python PythonLayoutFactory.java PythonBaseFactory.java PythonPageFactory.java PythonActionFactory.java PythonNavigationFactory.java PythonScreenFactory.java
mpoeschl 2003/02/11 11:47:59
Modified: src/java/org/apache/turbine/services/assemblerbroker
TurbineAssemblerBrokerService.java
AssemblerBrokerService.java
src/java/org/apache/turbine/services/assemblerbroker/util/java
JavaNavigationFactory.java JavaScreenFactory.java
JavaBaseFactory.java JavaPageFactory.java
JavaLayoutFactory.java JavaScheduledJobFactory.java
JavaActionFactory.java
src/java/org/apache/turbine/services/assemblerbroker/util
AssemblerFactory.java
src/java/org/apache/turbine/services/assemblerbroker/util/python
PythonLayoutFactory.java PythonBaseFactory.java
PythonPageFactory.java PythonActionFactory.java
PythonNavigationFactory.java
PythonScreenFactory.java
Log:
javadocs and checkstyle fixes
Revision Changes Path
1.5 +48 -34 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java
Index: TurbineAssemblerBrokerService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/TurbineAssemblerBrokerService.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TurbineAssemblerBrokerService.java 10 Feb 2003 22:39:42 -0000 1.4
+++ TurbineAssemblerBrokerService.java 11 Feb 2003 19:47:57 -0000 1.5
@@ -56,14 +56,13 @@
import java.util.Hashtable;
import java.util.Vector;
-
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.turbine.modules.Assembler;
import org.apache.turbine.services.InitializationException;
import org.apache.turbine.services.TurbineBaseService;
-import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.services.assemblerbroker.util.AssemblerFactory;
import org.apache.turbine.util.TurbineException;
-import org.apache.commons.logging.*;
/**
* TurbineAssemblerBrokerService allows assemblers (like screens,
@@ -72,6 +71,7 @@
* by adding them to the TurbineResources.properties file.
*
* @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
+ * @version $Id$
*/
public class TurbineAssemblerBrokerService
extends TurbineBaseService
@@ -87,20 +87,26 @@
/**
* Get a list of AssemblerFactories of a certain type
+ *
+ * @param type type of Assembler
+ * @return list of AssemblerFactories
*/
- private Vector getFactoryGroup (String type)
+ private Vector getFactoryGroup(String type)
{
- if (!factories.containsKey (type))
+ if (!factories.containsKey(type))
{
- factories.put (type, new Vector());
+ factories.put(type, new Vector());
}
- return (Vector)factories.get(type);
+ return (Vector) factories.get(type);
}
/**
* Utiltiy method to register all factories for a given type.
+ *
+ * @param type type of Assembler
+ * @throws TurbineException
*/
- private void registerFactories (String type)
+ private void registerFactories(String type)
throws TurbineException
{
log.debug("registerFactories: key = " + type);
@@ -109,19 +115,19 @@
log.info("Registering " + names.length + " " + type + " factories.");
- for (int i=0; i<names.length; i++)
+ for (int i = 0; i < names.length; i++)
{
try
{
- Object o = Class.forName (names[i]).newInstance();
- registerFactory (type, (AssemblerFactory)o);
+ Object o = Class.forName(names[i]).newInstance();
+ registerFactory(type, (AssemblerFactory) o);
}
// these must be passed to the VM
- catch(ThreadDeath e)
+ catch (ThreadDeath e)
{
throw e;
}
- catch(OutOfMemoryError e)
+ catch (OutOfMemoryError e)
{
throw e;
}
@@ -129,69 +135,77 @@
// to happen (missing jar files)
catch (Throwable t)
{
- throw new TurbineException("Failed registering " + type + " factories", t);
+ throw new TurbineException("Failed registering " + type
+ + " factories", t);
}
}
}
-
/**
* Initializes the AssemblerBroker and loads the AssemblerFactory
* classes registerd in TurbineResources.Properties.
+ *
+ * @throws InitializationException
*/
- public void init()
- throws InitializationException
+ public void init() throws InitializationException
{
factories = new Hashtable();
try
{
- registerFactories (AssemblerBrokerService.ACTION_TYPE);
- registerFactories (AssemblerBrokerService.SCREEN_TYPE);
- registerFactories (AssemblerBrokerService.NAVIGATION_TYPE);
- registerFactories (AssemblerBrokerService.LAYOUT_TYPE);
- registerFactories (AssemblerBrokerService.PAGE_TYPE);
- registerFactories (AssemblerBrokerService.SCHEDULEDJOB_TYPE);
+ registerFactories(AssemblerBrokerService.ACTION_TYPE);
+ registerFactories(AssemblerBrokerService.SCREEN_TYPE);
+ registerFactories(AssemblerBrokerService.NAVIGATION_TYPE);
+ registerFactories(AssemblerBrokerService.LAYOUT_TYPE);
+ registerFactories(AssemblerBrokerService.PAGE_TYPE);
+ registerFactories(AssemblerBrokerService.SCHEDULEDJOB_TYPE);
}
- catch(TurbineException e)
+ catch (TurbineException e)
{
- throw new InitializationException("AssemblerBrokerService failed to initialize", e);
+ throw new InitializationException(
+ "AssemblerBrokerService failed to initialize", e);
}
setInit(true);
}
/**
* Register a new AssemblerFactory under a certain type
+ *
+ * @param type type of Assembler
+ * @param factory factory to register
*/
public void registerFactory(String type, AssemblerFactory factory)
{
- getFactoryGroup(type).add (factory);
+ getFactoryGroup(type).add(factory);
}
/**
* Attempt to retrieve an Assembler of a given type with
* a name. Cycle through all the registered AssemblerFactory
- * classes of type and retrun the first non-null assembly
+ * classes of type and return the first non-null assembly
* found. If an assembly was not found return null.
+ *
+ * @param type type of Assembler
+ * @param name name of the requested Assembler
+ * @return an Assembler or null
+ * @throws TurbineException
*/
public Assembler getAssembler(String type, String name)
throws TurbineException
{
Vector facs = getFactoryGroup(type);
- for (int i=0; i<facs.size(); i++)
+ for (int i = 0; i < facs.size(); i++)
{
- AssemblerFactory fac = (AssemblerFactory)facs.get(i);
+ AssemblerFactory fac = (AssemblerFactory) facs.get(i);
Assembler assembler = null;
try
{
- assembler = fac.getAssembler (name);
+ assembler = fac.getAssembler(name);
}
catch (Exception e)
{
- throw new TurbineException("Failed to find the "
- + type
- +" named "
- + name, e);
+ throw new TurbineException("Failed to find the " + type
+ + " named " + name, e);
}
if (assembler != null)
1.3 +8 -10 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java
Index: AssemblerBrokerService.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/AssemblerBrokerService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AssemblerBrokerService.java 11 Jan 2003 18:42:33 -0000 1.2
+++ AssemblerBrokerService.java 11 Feb 2003 19:47:57 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -54,7 +54,6 @@
* <http://www.apache.org/>.
*/
-// Turbine Stuff
import org.apache.turbine.modules.Assembler;
import org.apache.turbine.services.Service;
import org.apache.turbine.services.assemblerbroker.util.AssemblerFactory;
@@ -65,9 +64,9 @@
* See TurbineAssemblerBrokerService for more info.
*
* @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
+ * @version $Id$
*/
-public interface AssemblerBrokerService
- extends Service
+public interface AssemblerBrokerService extends Service
{
static final String SERVICE_NAME = "AssemblerBrokerService";
@@ -80,9 +79,8 @@
static final String SCHEDULEDJOB_TYPE = "scheduledjob";
/** Register an AssemblerFactory class for a given type*/
- void registerFactory( String type, AssemblerFactory factory );
+ void registerFactory(String type, AssemblerFactory factory);
/** Attempts to load an Assembler of a type with a given name*/
- Assembler getAssembler( String type, String name )
- throws TurbineException;
+ Assembler getAssembler(String type, String name) throws TurbineException;
}
1.2 +14 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaNavigationFactory.java
Index: JavaNavigationFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaNavigationFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavaNavigationFactory.java 16 Aug 2001 05:08:49 -0000 1.1
+++ JavaNavigationFactory.java 11 Feb 2003 19:47:57 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -60,12 +60,19 @@
* A screen factory that attempts to load a java class from
* the module packages defined in the TurbineResource.properties.
*
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
* @version $Id$
*/
public class JavaNavigationFactory extends JavaBaseFactory
{
- public Assembler getAssembler( String name )
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ */
+ public Assembler getAssembler(String name)
{
- return getAssembler ("navigations",name);
+ return getAssembler("navigations", name);
}
}
1.2 +14 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScreenFactory.java
Index: JavaScreenFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScreenFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavaScreenFactory.java 16 Aug 2001 05:08:49 -0000 1.1
+++ JavaScreenFactory.java 11 Feb 2003 19:47:57 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -60,12 +60,19 @@
* A screen factory that attempts to load a java class from
* the module packages defined in the TurbineResource.properties.
*
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
* @version $Id$
*/
public class JavaScreenFactory extends JavaBaseFactory
{
- public Assembler getAssembler( String name )
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ */
+ public Assembler getAssembler(String name)
{
- return getAssembler ("screens",name);
+ return getAssembler("screens", name);
}
}
1.2 +24 -19 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaBaseFactory.java
Index: JavaBaseFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaBaseFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavaBaseFactory.java 16 Aug 2001 05:08:48 -0000 1.1
+++ JavaBaseFactory.java 11 Feb 2003 19:47:57 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -65,33 +65,39 @@
* A screen factory that attempts to load a java class from
* the module packages defined in the TurbineResource.properties.
*
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
* @version $Id$
*/
public abstract class JavaBaseFactory implements AssemblerFactory
{
/** A vector of packages */
- private static Vector packages =
+ private static Vector packages =
TurbineResources.getVector("module.packages");
static
{
- ObjectUtils.addOnce( packages,
- GenericLoader.getBasePackage() );
+ ObjectUtils.addOnce(packages, GenericLoader.getBasePackage());
}
- public Assembler getAssembler( String packageName, String name )
+ /**
+ * Get an Assembler.
+ *
+ * @param packageName java package name
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ */
+ public Assembler getAssembler(String packageName, String name)
{
- Assembler assembler= null;
+ Assembler assembler = null;
- for (int i=0; i<packages.size(); i++)
+ for (int i = 0; i < packages.size(); i++)
{
- String className = ((String) packages.elementAt(i) +
- "."+packageName+"." +
- name);
+ String className = ((String) packages.elementAt(i) + "."
+ + packageName + "." + name);
try
{
- Class servClass = Class.forName( className );
- assembler = ( Assembler ) servClass.newInstance();
+ Class servClass = Class.forName(className);
+ assembler = (Assembler) servClass.newInstance();
return assembler;
}
catch (ClassNotFoundException cnfe)
@@ -123,10 +129,9 @@
// that it will appear on the client browser
return null;
}
-
- // With ClassCastException, InstantiationException we hit big problems
+ // With ClassCastException, InstantiationException
+ // we hit big problems
}
return assembler;
}
-
}
1.2 +14 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaPageFactory.java
Index: JavaPageFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaPageFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavaPageFactory.java 16 Aug 2001 05:08:49 -0000 1.1
+++ JavaPageFactory.java 11 Feb 2003 19:47:57 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -60,12 +60,19 @@
* A screen factory that attempts to load a java class from
* the module packages defined in the TurbineResource.properties.
*
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
* @version $Id$
*/
public class JavaPageFactory extends JavaBaseFactory
{
- public Assembler getAssembler( String name )
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ */
+ public Assembler getAssembler(String name)
{
- return getAssembler ("pages",name);
+ return getAssembler("pages", name);
}
}
1.2 +14 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaLayoutFactory.java
Index: JavaLayoutFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaLayoutFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavaLayoutFactory.java 16 Aug 2001 05:08:49 -0000 1.1
+++ JavaLayoutFactory.java 11 Feb 2003 19:47:57 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -60,12 +60,19 @@
* A screen factory that attempts to load a java class from
* the module packages defined in the TurbineResource.properties.
*
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
* @version $Id$
*/
public class JavaLayoutFactory extends JavaBaseFactory
{
- public Assembler getAssembler( String name )
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ */
+ public Assembler getAssembler(String name)
{
- return getAssembler ("layouts",name);
+ return getAssembler("layouts", name);
}
}
1.2 +14 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScheduledJobFactory.java
Index: JavaScheduledJobFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaScheduledJobFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavaScheduledJobFactory.java 16 Aug 2001 05:08:49 -0000 1.1
+++ JavaScheduledJobFactory.java 11 Feb 2003 19:47:57 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -60,12 +60,19 @@
* A screen factory that attempts to load a java class from
* the module packages defined in the TurbineResource.properties.
*
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
* @version $Id$
*/
public class JavaScheduledJobFactory extends JavaBaseFactory
{
- public Assembler getAssembler( String name )
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ */
+ public Assembler getAssembler(String name)
{
- return getAssembler ("scheduledjobs",name);
+ return getAssembler("scheduledjobs", name);
}
}
1.2 +15 -8 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java
Index: JavaActionFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/java/JavaActionFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavaActionFactory.java 16 Aug 2001 05:08:48 -0000 1.1
+++ JavaActionFactory.java 11 Feb 2003 19:47:57 -0000 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -60,12 +60,19 @@
* An action factory that attempts to load a java class from
* the module packages defined in the TurbineResource.properties.
*
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
* @version $Id$
*/
-public class JavaActionFactory extends JavaBaseFactory
+public class JavaActionFactory extends JavaBaseFactory
{
- public Assembler getAssembler( String name )
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ */
+ public Assembler getAssembler(String name)
{
- return getAssembler ("actions",name);
+ return getAssembler("actions", name);
}
}
1.3 +13 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/AssemblerFactory.java
Index: AssemblerFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/AssemblerFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AssemblerFactory.java 11 Jan 2003 18:42:33 -0000 1.2
+++ AssemblerFactory.java 11 Feb 2003 19:47:57 -0000 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -60,10 +60,16 @@
* Interface for AssemblerFactory's
*
* @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
- * @version $Id$
+ * @version $Id$
*/
public interface AssemblerFactory
{
- Assembler getAssembler( String name ) throws Exception;
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ * @throws Exception generic exception
+ */
+ Assembler getAssembler(String name) throws Exception;
}
-
1.5 +16 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonLayoutFactory.java
Index: PythonLayoutFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonLayoutFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PythonLayoutFactory.java 14 Aug 2002 16:22:30 -0000 1.4
+++ PythonLayoutFactory.java 11 Feb 2003 19:47:58 -0000 1.5
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -62,12 +62,21 @@
* JPython interpreter and execute it as a Turbine screen.
* The JPython script should inherit from Turbine Screen or one
* of its subclasses.
+ *
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
+ * @version $Id$
*/
public class PythonLayoutFactory extends PythonBaseFactory
{
- public Assembler getAssembler( String name ) throws Exception
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ * @throws Exception generic exception
+ */
+ public Assembler getAssembler(String name) throws Exception
{
- return getAssembler ("layouts",name);
+ return getAssembler("layouts", name);
}
-
}
1.5 +44 -48 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonBaseFactory.java
Index: PythonBaseFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonBaseFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PythonBaseFactory.java 4 Jan 2003 03:56:33 -0000 1.4
+++ PythonBaseFactory.java 11 Feb 2003 19:47:58 -0000 1.5
@@ -54,35 +54,25 @@
* <http://www.apache.org/>.
*/
-// JDK Classes
import java.io.File;
-
-// Turbine Classes
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.turbine.modules.Assembler;
-
import org.apache.turbine.services.TurbineServices;
-
import org.apache.turbine.services.assemblerbroker.AssemblerBrokerService;
-
import org.apache.turbine.services.assemblerbroker.util.AssemblerFactory;
-
import org.apache.turbine.services.resources.TurbineResources;
-
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
-
-// JPython Classes
import org.python.core.Py;
-
import org.python.util.PythonInterpreter;
-
-
/**
* A screen factory that attempts to load a python class in the
* JPython interpreter and execute it as a Turbine screen.
* The JPython script should inherit from Turbine Screen or one
* of its subclasses.
+ *
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
+ * @version $Id$
*/
public abstract class PythonBaseFactory implements AssemblerFactory
{
@@ -90,20 +80,27 @@
/** Logging */
private static Log log = LogFactory.getLog(PythonBaseFactory.class);
- public Assembler getAssembler( String subDirectory, String name ) throws Exception
+ /**
+ * Get an Assembler.
+ *
+ * @param subDirectory subdirectory within python.path
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ * @throws Exception generic exception
+ */
+ public Assembler getAssembler(String subDirectory, String name)
+ throws Exception
{
Assembler assembler = null;
-
// The filename of the Python script
String fName = null;
String confName = null;
-
- log.info ("Screen name for JPython " + name);
+ log.info("Screen name for JPython " + name);
try
{
- String path = TurbineResources.getString (
+ String path = TurbineResources.getString(
TurbineServices.SERVICE_PREFIX
+ AssemblerBrokerService.SERVICE_NAME
+ ".python.path") + "/";
@@ -112,10 +109,11 @@
}
catch (Exception e)
{
- throw new Exception ("Python path not found - check your Properties");
+ throw new Exception(
+ "Python path not found - check your Properties");
}
- File f = new File (fName);
+ File f = new File(fName);
if (f.exists())
{
try
@@ -127,55 +125,53 @@
// This is necissarry for servlet engines generally has
// their own classloader implementations and servlets aren't
// loaded in the system classloader. The python script will
- // load java package org.apache.turbine.services.assemblerbroker.util.python;
+ // load java package
+ // org.apache.turbine.services.assemblerbroker.util.python;
// the new classes to it as well.
- Py.getSystemState().setClassLoader(this.getClass().getClassLoader());
+ Py.getSystemState().setClassLoader(
+ this.getClass().getClassLoader());
- // We import the Python SYS module. Now we don't need to do this
+ // We import the Python SYS module. Now we don't need to do this
// explicitely in the scrypt. We always use the sys module to
- // do stuff like loading java package org.apache.turbine.services.assemblerbroker.util.python;
+ // do stuff like loading java package
+ // org.apache.turbine.services.assemblerbroker.util.python;
interp.exec("import sys");
// Now we try to load the script file
- interp.execfile (confName);
- interp.execfile (fName);
+ interp.execfile(confName);
+ interp.execfile(fName);
try
{
- // We create an instance of the screen class from the python script
+ // We create an instance of the screen class from the
+ // python script
interp.exec("scr = " + name + "()");
}
catch (Throwable e)
{
- throw new Exception ("\nCannot create an instance of the python class.\n"
- + "You probably gave your class the wrong name.\n"
- + "Your class should have the same name as your filename.\n"
- + "Filenames should be all lowercase and classnames should "
- + "start with a capital.\n"
- + "Expected class name: " + name + "\n");
+ throw new Exception(
+ "\nCannot create an instance of the python class.\n"
+ + "You probably gave your class the wrong name.\n"
+ + "Your class should have the same name as your "
+ + "filename.\nFilenames should be all lowercase and "
+ + "classnames should start with a capital.\n"
+ + "Expected class name: " + name + "\n");
}
-
-
// Here we convert the python sceen instance to a java instance.
-
- assembler = (Assembler) interp.get ("scr", Assembler.class);
-
+ assembler = (Assembler) interp.get("scr", Assembler.class);
}
catch (Exception e)
{
- // We log the error here because this code is not widely tested yet.
- // After we tested the code on a range of platforms this won't be
- // usefull anymore.
- log.error ("PYTHON SCRIPT SCREEN LOADER ERROR:");
- log.error (e.toString());
+ // We log the error here because this code is not widely tested
+ // yet. After we tested the code on a range of platforms this
+ // won't be usefull anymore.
+ log.error("PYTHON SCRIPT SCREEN LOADER ERROR:");
+ log.error(e.toString());
// Let the error fall through like the normal way.
throw e;
}
-
}
-
return assembler;
}
-
}
1.5 +16 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonPageFactory.java
Index: PythonPageFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonPageFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PythonPageFactory.java 8 Dec 2002 17:34:34 -0000 1.4
+++ PythonPageFactory.java 11 Feb 2003 19:47:58 -0000 1.5
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -62,12 +62,21 @@
* JPython interpreter and execute it as a Turbine screen.
* The JPython script should inherit from Turbine Screen or one
* of its subclasses.
+ *
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
+ * @version $Id$
*/
public class PythonPageFactory extends PythonBaseFactory
{
- public Assembler getAssembler( String name ) throws Exception
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ * @throws Exception generic exception
+ */
+ public Assembler getAssembler(String name) throws Exception
{
- return getAssembler ("pages",name);
+ return getAssembler("pages", name);
}
-
}
1.5 +16 -6 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java
Index: PythonActionFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonActionFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PythonActionFactory.java 14 Aug 2002 16:22:30 -0000 1.4
+++ PythonActionFactory.java 11 Feb 2003 19:47:58 -0000 1.5
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -62,12 +62,22 @@
* JPython interpreter and execute it as a Turbine screen.
* The JPython script should inherit from Turbine Screen or one
* of its subclasses.
+ *
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
+ * @version $Id$
*/
public class PythonActionFactory extends PythonBaseFactory
{
- public Assembler getAssembler( String name ) throws Exception
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ * @throws Exception generic exception
+ */
+ public Assembler getAssembler(String name) throws Exception
{
- return getAssembler ("actions",name);
+ return getAssembler("actions", name);
}
}
1.5 +16 -7 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonNavigationFactory.java
Index: PythonNavigationFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonNavigationFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PythonNavigationFactory.java 14 Aug 2002 16:22:30 -0000 1.4
+++ PythonNavigationFactory.java 11 Feb 2003 19:47:58 -0000 1.5
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -62,12 +62,21 @@
* JPython interpreter and execute it as a Turbine screen.
* The JPython script should inherit from Turbine Screen or one
* of its subclasses.
+ *
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
+ * @version $Id$
*/
public class PythonNavigationFactory extends PythonBaseFactory
{
- public Assembler getAssembler( String name ) throws Exception
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ * @throws Exception generic exception
+ */
+ public Assembler getAssembler(String name) throws Exception
{
- return getAssembler ("navigations",name);
+ return getAssembler("navigations", name);
}
-
}
1.5 +16 -6 jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonScreenFactory.java
Index: PythonScreenFactory.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/services/assemblerbroker/util/python/PythonScreenFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PythonScreenFactory.java 14 Aug 2002 16:22:30 -0000 1.4
+++ PythonScreenFactory.java 11 Feb 2003 19:47:58 -0000 1.5
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -62,11 +62,21 @@
* JPython interpreter and execute it as a Turbine screen.
* The JPython script should inherit from Turbine Screen or one
* of its subclasses.
+ *
+ * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
+ * @version $Id$
*/
public class PythonScreenFactory extends PythonBaseFactory
{
- public Assembler getAssembler( String name ) throws Exception
+ /**
+ * Get an Assembler.
+ *
+ * @param name name of the requested Assembler
+ * @return an Assembler
+ * @throws Exception generic exception
+ */
+ public Assembler getAssembler(String name) throws Exception
{
- return getAssembler ("screens",name);
+ return getAssembler("screens", name);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org