You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2006/01/12 18:13:34 UTC
svn commit: r368410 [7/10] - in
/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry: ./ bean/
binding/ callback/ coerce/ components/ describe/ engine/ engine/state/
enhance/ error/ event/ form/ form/translator/ form/validator/ html/ link/
li...
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/record/RecordUtils.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/record/RecordUtils.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/record/RecordUtils.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/record/RecordUtils.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -22,28 +22,36 @@
/**
* Utility methods to support implementations of
- * {@link org.apache.tapestry.record.PropertyPersistenceStrategy}. This consists of code refactored
- * out of {@link org.apache.tapestry.record.SessionPropertyPersistenceStrategy} to support other,
- * similar, persistence types with different rules for how long values are stored in the session.
+ * {@link org.apache.tapestry.record.PropertyPersistenceStrategy}. This
+ * consists of code refactored out of
+ * {@link org.apache.tapestry.record.SessionPropertyPersistenceStrategy} to
+ * support other, similar, persistence types with different rules for how long
+ * values are stored in the session.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class RecordUtils
+public final class RecordUtils
{
+
+ /** @since 4.1 */
+ private RecordUtils()
+ {
+ }
+
/**
- * Builds a {@link PropertyChange} instance for the given key and value pulled from the
- * {@link org.apache.tapestry.web.WebSession}.
+ * Builds a {@link PropertyChange} instance for the given key and value
+ * pulled from the {@link org.apache.tapestry.web.WebSession}.
*
* @param key
* a key, previously created by
- * {@link #buildChangeKey(String, String, String, String, String)}, consisting of a
- * strategy id, application id, page name, id path (optional), and a property name,
- * all seperated by commas.
+ * {@link #buildChangeKey(String, String, String, String, String)},
+ * consisting of a strategy id, application id, page name, id
+ * path (optional), and a property name, all seperated by commas.
* @param value
* the value stored in the session with this key
- * @return a {@link PropertyChange} storing the property name and id path (if any), and the
- * value
+ * @return a {@link PropertyChange} storing the property name and id path
+ * (if any), and the value
*/
public static PropertyChange buildChange(String key, Object value)
{
@@ -59,9 +67,10 @@
}
/**
- * Iterates over the attributes stored in the session, invoking a callback on each one that
- * matches the given prefix, applicationid and page name. This is used to operate over all
- * stored data for a particular combination of strategy, applicationId and page.
+ * Iterates over the attributes stored in the session, invoking a callback
+ * on each one that matches the given prefix, applicationid and page name.
+ * This is used to operate over all stored data for a particular combination
+ * of strategy, applicationId and page.
*
* @param strategyId
* a unique identifier for a particular implementation of
@@ -75,8 +84,8 @@
* @param callback
* the callback to invoke on each matching attibute name
*/
- public static void iterateOverMatchingAttributes(String strategyId, String applicationId,
- String pageName, WebSession session, WebSessionAttributeCallback callback)
+ public static void iterateOverMatchingAttributes(String strategyId, String applicationId, String pageName,
+ WebSession session, WebSessionAttributeCallback callback)
{
Defense.notNull(strategyId, "strategyId");
Defense.notNull(applicationId, "applicationId");
@@ -86,18 +95,18 @@
String prefix = strategyId + "," + applicationId + "," + pageName + ",";
Iterator i = session.getAttributeNames().iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
- String name = (String) i.next();
+ String name = (String)i.next();
- if (name.startsWith(prefix))
- callback.handleAttribute(session, name);
+ if (name.startsWith(prefix)) callback.handleAttribute(session, name);
}
}
/**
- * Builds a change key, used to identify the change within the {@link WebSession}. A change key
- * can be used as a session attribute name, without reasonable fear of conflict.
+ * Builds a change key, used to identify the change within the
+ * {@link WebSession}. A change key can be used as a session attribute
+ * name, without reasonable fear of conflict.
*
* @param strategyId
* a unique identifier for a particular implementation of
@@ -107,14 +116,15 @@
* @param pageName
* the name of the page containing the change
* @param idPath
- * the id path of the component within the page containing the page, possibly null
+ * the id path of the component within the page containing the
+ * page, possibly null
* @param propertyName
* the name of the property
- * @return the above values, seperated by commas (well, no comma between the prefix and the
- * application id)
+ * @return the above values, seperated by commas (well, no comma between the
+ * prefix and the application id)
*/
- public static String buildChangeKey(String strategyId, String applicationId, String pageName,
- String idPath, String propertyName)
+ public static String buildChangeKey(String strategyId, String applicationId, String pageName, String idPath,
+ String propertyName)
{
Defense.notNull(strategyId, "strategyId");
Defense.notNull(applicationId, "applicationId");
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/request/IUploadFile.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/request/IUploadFile.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/request/IUploadFile.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/request/IUploadFile.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,81 +18,75 @@
import java.io.InputStream;
/**
- * Represents a file uploaded from a client side form.
+ * Represents a file uploaded from a client side form.
*
- * @author Howard Lewis Ship
- * @since 1.0.8
- *
- **/
+ * @author Howard Lewis Ship
+ * @since 1.0.8
+ */
public interface IUploadFile
{
- /**
- * Returns the name of the file that was uploaded. This
- * is just the filename portion of the complete path.
- *
- **/
-
- public String getFileName();
-
- /**
- * Returns the complete path, as reported by the client
- * browser. Different browsers report different things
- * here.
- *
- *
- * @since 2.0.4
- *
- **/
-
- public String getFilePath();
-
- /**
- * Returns an input stream of the content of the file. There is no guarantee
- * that this stream will be valid after the end of the current request cycle,
- * so it should be processed immediately.
- *
- * <p>As of release 1.0.8, this will be a a {@link java.io.ByteArrayInputStream},
- * but that, too, may change (a future implementation may upload the stream
- * to a temporary file and return an input stream from that).
- *
- **/
- public InputStream getStream();
-
/**
- * Returns the MIME type specified when the file was uploaded. May return null
- * if the content type is not known.
+ * Returns the name of the file that was uploaded. This is just the filename
+ * portion of the complete path.
+ */
+
+ public String getFileName();
+
+ /**
+ * Returns the complete path, as reported by the client browser. Different
+ * browsers report different things here.
*
- * @since 2.2
+ * @since 2.0.4
+ */
+
+ public String getFilePath();
+
+ /**
+ * Returns an input stream of the content of the file. There is no guarantee
+ * that this stream will be valid after the end of the current request
+ * cycle, so it should be processed immediately.
+ * <p>
+ * As of release 1.0.8, this will be a a
+ * {@link java.io.ByteArrayInputStream}, but that, too, may change (a
+ * future implementation may upload the stream to a temporary file and
+ * return an input stream from that).
+ */
+
+ public InputStream getStream();
+
+ /**
+ * Returns the MIME type specified when the file was uploaded. May return
+ * null if the content type is not known.
*
- **/
-
+ * @since 2.2
+ */
+
public String getContentType();
-
+
/**
- * Writes the content of the file to a known location. This should
- * be invoked at most once. In a standard
- * implementation based on Jakarta FileUpload, this will often
- * be implemented efficiently as a file rename.
+ * Writes the content of the file to a known location. This should be
+ * invoked at most once. In a standard implementation based on Jakarta
+ * FileUpload, this will often be implemented efficiently as a file rename.
*
* @since 3.0
*/
-
+
public void write(File file);
-
+
/**
- * Returns true if the uploaded content is in memory. False generally
- * means the content is stored in a temporary file.
+ * Returns true if the uploaded content is in memory. False generally means
+ * the content is stored in a temporary file.
*/
-
+
public boolean isInMemory();
-
+
/**
* Returns the size, in bytes, of the uploaded content.
*
* @since 3.0
- **/
-
- public long getSize();
-}
\ No newline at end of file
+ */
+
+ public long getSize();
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/resolver/AbstractSpecificationResolver.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/resolver/AbstractSpecificationResolver.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/resolver/AbstractSpecificationResolver.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/resolver/AbstractSpecificationResolver.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -20,23 +20,22 @@
import org.apache.tapestry.spec.IComponentSpecification;
/**
- * Base class for resolving a {@link org.apache.tapestry.spec.IComponentSpecification}for a
- * particular page or component, within a specified {@link org.apache.tapestry.INamespace}. In some
- * cases, a search is necessary.
+ * Base class for resolving a
+ * {@link org.apache.tapestry.spec.IComponentSpecification}for a particular
+ * page or component, within a specified {@link org.apache.tapestry.INamespace}.
+ * In some cases, a search is necessary.
*
* @author Howard Lewis Ship
* @since 3.0
*/
-public class AbstractSpecificationResolver
-{
- /** Set by resolve() */
+public class AbstractSpecificationResolver {
+
private INamespace _namespace;
- /** Set by resolve() */
private IComponentSpecification _specification;
- /** Set by container */
+ /** Set by container. */
private ISpecificationSource _specificationSource;
private ISpecificationResolverDelegate _delegate;
@@ -45,7 +44,7 @@
private Resource _contextRoot;
- /** Initialized in initializeService() */
+ /** Initialized in initializeService(). */
private Resource _webInfLocation;
@@ -55,13 +54,15 @@
{
_webInfLocation = _contextRoot.getRelativeResource("WEB-INF/");
- _webInfAppLocation = _webInfLocation.getRelativeResource(_applicationId + "/");
+ _webInfAppLocation = _webInfLocation.getRelativeResource(_applicationId
+ + "/");
}
/**
- * Returns the {@link ISpecificationResolverDelegate}instance registered in the application
- * specification as extension {@link Tapestry#SPECIFICATION_RESOLVER_DELEGATE_EXTENSION_NAME},
- * or null if no such extension exists.
+ * Returns the {@link ISpecificationResolverDelegate}instance registered in
+ * the application specification as extension
+ * {@link Tapestry#SPECIFICATION_RESOLVER_DELEGATE_EXTENSION_NAME}, or null
+ * if no such extension exists.
*/
public ISpecificationResolverDelegate getDelegate()
@@ -120,8 +121,8 @@
}
/**
- * Returns the location of the application-specific subdirectory, under /WEB-INF/, in the
- * servlet context.
+ * Returns the location of the application-specific subdirectory, under
+ * /WEB-INF/, in the servlet context.
*/
protected Resource getWebInfAppLocation()
@@ -139,7 +140,8 @@
}
/**
- * Invoked in subclass to set the final specification the initial inputs are resolved to.
+ * Invoked in subclass to set the final specification the initial inputs are
+ * resolved to.
*/
protected void setSpecification(IComponentSpecification specification)
@@ -190,17 +192,17 @@
/**
* @since 4.0
*/
- protected INamespace findNamespaceForId(INamespace containerNamespace, String libraryId)
+ protected INamespace findNamespaceForId(INamespace containerNamespace,
+ String libraryId)
{
- if (libraryId == null)
- return containerNamespace;
-
+ if (libraryId == null) return containerNamespace;
+
if (libraryId.equals(INamespace.APPLICATION_NAMESPACE))
return getApplicationNamespace();
-
+
if (libraryId.equals(INamespace.FRAMEWORK_NAMESPACE))
return getFrameworkNamespace();
-
+
return containerNamespace.getChildNamespace(libraryId);
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/resolver/ResolverMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/resolver/ResolverMessages.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/resolver/ResolverMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/resolver/ResolverMessages.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
import org.apache.hivemind.HiveMind;
import org.apache.hivemind.Location;
+import org.apache.hivemind.Messages;
import org.apache.hivemind.Resource;
import org.apache.hivemind.impl.MessageFormatter;
import org.apache.tapestry.INamespace;
@@ -27,65 +28,68 @@
* @author Howard Lewis Ship
* @since 4.0
*/
-class ResolverMessages
+final class ResolverMessages
{
- private final static MessageFormatter _formatter = new MessageFormatter(ResolverMessages.class);
+
+ private final static Messages MESSAGES = new MessageFormatter(ResolverMessages.class);
+
+ /** @since 4.1 */
+ private ResolverMessages()
+ {
+ }
static String noSuchComponentType(String type, INamespace namespace)
{
- return _formatter.format("no-such-component-type", type, namespace);
+ return MESSAGES.format("no-such-component-type", type, namespace);
}
static String noSuchPage(String name, INamespace namespace)
{
- return _formatter.format("no-such-page", name, namespace.getNamespaceId());
+ return MESSAGES.format("no-such-page", name, namespace.getNamespaceId());
}
static String resolvingComponent(String type, INamespace namespace)
{
- return _formatter.format("resolving-component", type, namespace);
+ return MESSAGES.format("resolving-component", type, namespace);
}
static String checkingResource(Resource resource)
{
- return _formatter.format("checking-resource", resource);
+ return MESSAGES.format("checking-resource", resource);
}
- static String installingComponent(String type, INamespace namespace,
- IComponentSpecification specification)
+ static String installingComponent(String type, INamespace namespace, IComponentSpecification specification)
{
- return _formatter.format("installing-component", type, namespace, specification);
+ return MESSAGES.format("installing-component", type, namespace, specification);
}
- static String installingPage(String pageName, INamespace namespace,
- IComponentSpecification specification)
+ static String installingPage(String pageName, INamespace namespace, IComponentSpecification specification)
{
- return _formatter.format("installing-page", pageName, namespace, specification);
+ return MESSAGES.format("installing-page", pageName, namespace, specification);
}
static String resolvingPage(String pageName, INamespace namespace)
{
- return _formatter.format("resolving-page", pageName, namespace);
+ return MESSAGES.format("resolving-page", pageName, namespace);
}
static String foundFrameworkPage(String pageName)
{
- return _formatter.format("found-framework-page", pageName);
+ return MESSAGES.format("found-framework-page", pageName);
}
static String foundHTMLTemplate(Resource resource)
{
- return _formatter.format("found-html-template", resource);
+ return MESSAGES.format("found-html-template", resource);
}
public static String componentIsDeprecated(String componentType, Location location)
{
- return _formatter.format("component-is-deprecated", componentType, HiveMind
- .getLocationString(location));
+ return MESSAGES.format("component-is-deprecated", componentType, HiveMind.getLocationString(location));
}
static String webInfNotAllowed(String simpleName)
{
- return _formatter.format("web-inf-not-allowed", simpleName);
+ return MESSAGES.format("web-inf-not-allowed", simpleName);
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/AbstractToken.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/AbstractToken.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/AbstractToken.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/AbstractToken.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@
abstract class AbstractToken implements IScriptToken
{
+
private List _tokens;
private Location _location;
@@ -46,27 +47,25 @@
public void addToken(IScriptToken token)
{
- if (_tokens == null)
- _tokens = new ArrayList();
+ if (_tokens == null) _tokens = new ArrayList();
_tokens.add(token);
}
/**
- * Invokes {@link IScriptToken#write(StringBuffer,ScriptSession)}on each child token (if there
- * are any).
+ * Invokes {@link IScriptToken#write(StringBuffer,ScriptSession)}on each
+ * child token (if there are any).
*/
protected void writeChildren(StringBuffer buffer, ScriptSession session)
{
- if (_tokens == null)
- return;
+ if (_tokens == null) return;
Iterator i = _tokens.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
- IScriptToken token = (IScriptToken) i.next();
+ IScriptToken token = (IScriptToken)i.next();
token.write(buffer, session);
}
@@ -99,7 +98,7 @@
{
try
{
- Boolean b = (Boolean) session.evaluate(expression, Boolean.class);
+ Boolean b = (Boolean)session.evaluate(expression, Boolean.class);
return b.booleanValue();
}
@@ -108,4 +107,4 @@
throw new ApplicationRuntimeException(ex.getMessage(), _location, ex);
}
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/AbstractTokenRule.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/AbstractTokenRule.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/AbstractTokenRule.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/AbstractTokenRule.java Thu Jan 12 09:12:21 2006
@@ -19,47 +19,48 @@
import org.apache.tapestry.util.xml.RuleDirectedParser;
/**
- * Base class for the rules that build {@link org.apache.tapestry.script.IScriptToken}s.
- * Used with classes that can contain a mix of text and elements (those that
- * accept "full content").
+ * Base class for the rules that build
+ * {@link org.apache.tapestry.script.IScriptToken}s. Used with classes that can
+ * contain a mix of text and elements (those that accept "full content").
*
- *
* @author Howard Lewis Ship
* @since 3.0
- **/
+ */
abstract class AbstractTokenRule extends BaseRule
{
+ private static final int STATE_START = 0;
+ private static final int STATE_DOLLAR = 1;
+ private static final int STATE_COLLECT_EXPRESSION = 2;
+
/**
* Adds a token to its parent, the top object on the stack.
*/
protected void addToParent(RuleDirectedParser parser, IScriptToken token)
{
- IScriptToken parent = (IScriptToken) parser.peek();
+ IScriptToken parent = (IScriptToken)parser.peek();
parent.addToken(token);
}
/**
- * Peeks at the top object on the stack (which must be a {@link IScriptToken}),
- * and converts the text into a series of {@link org.apache.tapestry.script.StaticToken} and
+ * Peeks at the top object on the stack (which must be a
+ * {@link IScriptToken}), and converts the text into a series of
+ * {@link org.apache.tapestry.script.StaticToken} and
* {@link org.apache.tapestry.script.InsertToken}s.
*/
public void content(RuleDirectedParser parser, String content)
{
- IScriptToken token = (IScriptToken) parser.peek();
+ IScriptToken token = (IScriptToken)parser.peek();
addTextTokens(token, content, parser.getLocation());
}
- private static final int STATE_START = 0;
- private static final int STATE_DOLLAR = 1;
- private static final int STATE_COLLECT_EXPRESSION = 2;
-
/**
- * Parses the provided text and converts it into a series of
+ * Parses the provided text and converts it into a series of
+ * {@link IScriptToken}s.
*/
protected void addTextTokens(IScriptToken token, String text, Location location)
{
@@ -72,117 +73,110 @@
int i = 0;
int braceDepth = 0;
- while (i < buffer.length)
+ while(i < buffer.length)
{
char ch = buffer[i];
- switch (state)
+ switch(state)
{
- case STATE_START :
+ case STATE_START:
- if (ch == '$')
- {
- state = STATE_DOLLAR;
- i++;
- continue;
- }
-
- blockLength++;
+ if (ch == '$')
+ {
+ state = STATE_DOLLAR;
i++;
continue;
+ }
+
+ blockLength++;
+ i++;
+ continue;
- case STATE_DOLLAR :
+ case STATE_DOLLAR:
- if (ch == '{')
- {
- state = STATE_COLLECT_EXPRESSION;
- i++;
+ if (ch == '{')
+ {
+ state = STATE_COLLECT_EXPRESSION;
+ i++;
- expressionStart = i;
- expressionLength = 0;
- braceDepth = 1;
+ expressionStart = i;
+ expressionLength = 0;
+ braceDepth = 1;
- continue;
- }
+ continue;
+ }
- // The '$' was just what it was, not the start of a ${} expression
- // block, so include it as part of the static text block.
+ // The '$' was just what it was, not the start of a ${}
+ // expression
+ // block, so include it as part of the static text block.
- blockLength++;
+ blockLength++;
- state = STATE_START;
- continue;
+ state = STATE_START;
+ continue;
- case STATE_COLLECT_EXPRESSION :
+ case STATE_COLLECT_EXPRESSION:
- if (ch != '}')
- {
- if (ch == '{')
- braceDepth++;
+ if (ch != '}')
+ {
+ if (ch == '{') braceDepth++;
+
+ i++;
+ expressionLength++;
+ continue;
+ }
- i++;
- expressionLength++;
- continue;
- }
+ braceDepth--;
- braceDepth--;
+ if (braceDepth > 0)
+ {
+ i++;
+ expressionLength++;
+ continue;
+ }
- if (braceDepth > 0)
- {
- i++;
- expressionLength++;
- continue;
- }
+ // Hit the closing brace of an expression.
- // Hit the closing brace of an expression.
+ // Degenerate case: the string "${}".
- // Degenerate case: the string "${}".
+ if (expressionLength == 0) blockLength += 3;
- if (expressionLength == 0)
- blockLength += 3;
+ if (blockLength > 0) token.addToken(constructStatic(text, blockStart, blockLength, location));
- if (blockLength > 0)
- token.addToken(constructStatic(text, blockStart, blockLength, location));
+ if (expressionLength > 0)
+ {
+ String expression = text.substring(expressionStart, expressionStart + expressionLength);
- if (expressionLength > 0)
- {
- String expression =
- text.substring(expressionStart, expressionStart + expressionLength);
+ token.addToken(new InsertToken(expression, location));
+ }
- token.addToken(new InsertToken(expression, location));
- }
+ i++;
+ blockStart = i;
+ blockLength = 0;
- i++;
- blockStart = i;
- blockLength = 0;
+ // And drop into state start
- // And drop into state start
+ state = STATE_START;
- state = STATE_START;
+ continue;
- continue;
+ default:
+ throw new IllegalStateException();
}
}
- // OK, to handle the end. Couple of degenerate cases where
+ // OK, to handle the end. Couple of degenerate cases where
// a ${...} was incomplete, so we adust the block length.
- if (state == STATE_DOLLAR)
- blockLength++;
+ if (state == STATE_DOLLAR) blockLength++;
- if (state == STATE_COLLECT_EXPRESSION)
- blockLength += expressionLength + 2;
+ if (state == STATE_COLLECT_EXPRESSION) blockLength += expressionLength + 2;
- if (blockLength > 0)
- token.addToken(constructStatic(text, blockStart, blockLength, location));
+ if (blockLength > 0) token.addToken(constructStatic(text, blockStart, blockLength, location));
}
- private IScriptToken constructStatic(
- String text,
- int blockStart,
- int blockLength,
- Location location)
+ private IScriptToken constructStatic(String text, int blockStart, int blockLength, Location location)
{
String literal = text.substring(blockStart, blockStart + blockLength);
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/BodyToken.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/BodyToken.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/BodyToken.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/BodyToken.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,39 +16,37 @@
import org.apache.hivemind.Location;
-
/**
- * Generates a String from its child tokens, then applies it
- * to {@link ScriptSessionImpl#setBody(String)}.
- *
- * @author Howard Lewis Ship
- * @since 0.2.9
+ * Generates a String from its child tokens, then applies it to
+ * {@link ScriptSessionImpl#setBody(String)}.
*
- **/
+ * @author Howard Lewis Ship
+ * @since 0.2.9
+ */
class BodyToken extends AbstractToken
{
+
private int _bufferLengthHighwater = 100;
- public BodyToken(Location location)
- {
- super(location);
- }
+ public BodyToken(Location location)
+ {
+ super(location);
+ }
public void write(StringBuffer buffer, ScriptSession session)
{
- if (buffer != null)
- throw new IllegalArgumentException();
+ if (buffer != null) throw new IllegalArgumentException();
buffer = new StringBuffer(_bufferLengthHighwater);
writeChildren(buffer, session);
- session.addBodyScript(buffer.toString());
+ session.addBodyScript(buffer.toString());
// Store the buffer length from this run for the next run, since its
// going to be approximately the right size.
_bufferLengthHighwater = Math.max(_bufferLengthHighwater, buffer.length());
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IScriptToken.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IScriptToken.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IScriptToken.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IScriptToken.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,35 +16,31 @@
import org.apache.hivemind.Locatable;
-
/**
- * Defines the responsibilities of a template token used by a
- * {@link org.apache.tapestry.IScript}.
- *
- * @author Howard Lewis Ship
+ * Defines the responsibilities of a template token used by a
+ * {@link org.apache.tapestry.IScript}.
*
- **/
+ * @author Howard Lewis Ship
+ */
public interface IScriptToken extends Locatable
{
- /**
- * Invoked to have the token
- * add its text to the buffer. A token may need access
- * to the symbols in order to produce its output.
- *
- * <p>Top level tokens (such as BodyToken) can expect that
- * buffer will be null.
- *
- **/
-
- public void write(StringBuffer buffer, ScriptSession session);
-
- /**
- * Invoked during parsing to add the token parameter as a child
- * of this token.
- *
- * @since 0.2.9
- **/
- public void addToken(IScriptToken token);
-}
\ No newline at end of file
+ /**
+ * Invoked to have the token add its text to the buffer. A token may need
+ * access to the symbols in order to produce its output.
+ * <p>
+ * Top level tokens (such as BodyToken) can expect that buffer will be null.
+ */
+
+ public void write(StringBuffer buffer, ScriptSession session);
+
+ /**
+ * Invoked during parsing to add the token parameter as a child of this
+ * token.
+ *
+ * @since 0.2.9
+ */
+
+ public void addToken(IScriptToken token);
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IfRule.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IfRule.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IfRule.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IfRule.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,15 +18,15 @@
import org.xml.sax.Attributes;
/**
- * Constructs an {@link org.apache.tapestry.script.IfToken}
- * from an <if> or <if-not> element, which
- * contains full content.
- *
+ * Constructs an {@link org.apache.tapestry.script.IfToken} from an <if>
+ * or <if-not> element, which contains full content.
+ *
* @author Howard Lewis Ship
* @since 3.0
*/
class IfRule extends AbstractTokenRule
{
+
private boolean _condition;
public IfRule(boolean condition)
@@ -43,14 +43,15 @@
{
String expression = getAttribute(attributes, "expression");
- if (expression == null)
- expression = getAttribute(attributes, "property-path"); // 1.0, 1.1 DTD
-
- IScriptToken token = new IfToken(_condition, expression, parser.getLocation());
-
- addToParent(parser, token);
-
- parser.push(token);
+ if (expression == null) expression = getAttribute(attributes, "property-path"); // 1.0,
+ // 1.1
+ // DTD
+
+ IScriptToken token = new IfToken(_condition, expression, parser.getLocation());
+
+ addToParent(parser, token);
+
+ parser.push(token);
}
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IncludeScriptRule.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IncludeScriptRule.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IncludeScriptRule.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/IncludeScriptRule.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -19,9 +19,9 @@
import org.xml.sax.Attributes;
/**
- * Constructs an {@link org.apache.tapestry.script.IncludeScriptToken}
- * from a <include-script> element, which contains no content.
- *
+ * Constructs an {@link org.apache.tapestry.script.IncludeScriptToken} from a
+ * <include-script> element, which contains no content.
+ *
* @author Howard Lewis Ship
* @since 3.0
*/
@@ -31,10 +31,10 @@
public void startElement(RuleDirectedParser parser, Attributes attributes)
{
String path = getAttribute(attributes, "resource-path");
-
+
IncludeScriptToken token = new IncludeScriptToken(path, parser.getLocation());
- IScriptToken parent = (IScriptToken) parser.peek();
+ IScriptToken parent = (IScriptToken)parser.peek();
parent.addToken(token);
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/InitRule.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/InitRule.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/InitRule.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/InitRule.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,10 +18,9 @@
import org.xml.sax.Attributes;
/**
- * Constructs an {@link org.apache.tapestry.script.InitToken}
- * from an <initialization> element, which
- * contains full content.
- *
+ * Constructs an {@link org.apache.tapestry.script.InitToken} from an
+ * <initialization> element, which contains full content.
+ *
* @author Howard Lewis Ship
* @since 3.0
*/
@@ -30,16 +29,16 @@
public void endElement(RuleDirectedParser parser)
{
- parser.pop();
+ parser.pop();
}
public void startElement(RuleDirectedParser parser, Attributes attributes)
{
- IScriptToken token = new InitToken(parser.getLocation());
-
- addToParent(parser, token);
-
- parser.push(token);
+ IScriptToken token = new InitToken(parser.getLocation());
+
+ addToParent(parser, token);
+
+ parser.push(token);
}
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/StaticToken.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/StaticToken.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/StaticToken.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/script/StaticToken.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,29 +16,27 @@
import org.apache.hivemind.Location;
-
/**
- * A token for static portions of the template.
- *
- * @author Howard Lewis Ship
- *
- **/
+ * A token for static portions of the template.
+ *
+ * @author Howard Lewis Ship
+ */
class StaticToken extends AbstractToken
{
+
private String _text;
StaticToken(String text, Location location)
{
- super(location);
-
+ super(location);
+
_text = text;
}
/**
- * Writes the text to the writer.
- *
- **/
+ * Writes the text to the writer.
+ */
public void write(StringBuffer buffer, ScriptSession session)
{
@@ -49,4 +47,4 @@
{
// Should never be invoked.
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/AbsoluteURLBuilder.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/AbsoluteURLBuilder.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/AbsoluteURLBuilder.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/AbsoluteURLBuilder.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -20,14 +20,15 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public interface AbsoluteURLBuilder
-{
+public interface AbsoluteURLBuilder {
+
/**
- * Constructs a URL from the given URI (that is, service path), schema, server and port.
+ * Constructs a URL from the given URI (that is, service path), schema,
+ * server and port.
*
* @param URI
- * either a complete URL (that is, containing a colon), in which case it is returned
- * unchanged, or the path within the server.
+ * either a complete URL (that is, containing a colon), in which
+ * case it is returned unchanged, or the path within the server.
* @param scheme
* scheme to prefix URI with
* @param server
@@ -35,11 +36,12 @@
* @param port
* to suffix the server with (unless the URI begins with "//")
*/
- public String constructURL(String URI, String scheme, String server, int port);
+ String constructURL(String URI, String scheme, String server, int port);
/**
- * Constructs a URL, defaulting scheme, server and port to the values for the current request.
+ * Constructs a URL, defaulting scheme, server and port to the values for
+ * the current request.
*/
- public String constructURL(String URI);
-}
\ No newline at end of file
+ String constructURL(String URI);
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ApplicationGlobals.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ApplicationGlobals.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ApplicationGlobals.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ApplicationGlobals.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -23,33 +23,36 @@
import org.apache.tapestry.web.WebContext;
/**
- * A "global" holder for various services and configurations. In many cases, these values end up as
- * properties of the {@link org.apache.tapestry.services.Infrastructure}. The servlet and portlet
- * implementations differentiate themselves by storing different values into these properties.
+ * A "global" holder for various services and configurations. In many cases,
+ * these values end up as properties of the
+ * {@link org.apache.tapestry.services.Infrastructure}. The servlet and portlet
+ * implementations differentiate themselves by storing different values into
+ * these properties.
*
* @author Howard Lewis Ship
* @since 4.0
*/
public interface ApplicationGlobals
{
+
/**
- * Invoked by the (indirectly) by the servlet at init(), after parsing the application
- * specification.
+ * Invoked by the (indirectly) by the servlet at init(), after parsing the
+ * application specification.
*/
- public void storeActivator(WebActivator activator);
+ void storeActivator(WebActivator activator);
- public void storeSpecification(IApplicationSpecification applicationSpecification);
+ void storeSpecification(IApplicationSpecification applicationSpecification);
/**
* Invoked (indirectly) by the servlet at init().
*/
- public void storeServletContext(ServletContext context);
+ void storeServletContext(ServletContext context);
/**
* Invoked (indirectly) by the servlet at init().
*/
- public void storeWebContext(WebContext context);
+ void storeWebContext(WebContext context);
/**
* Returns the previously stored context.
@@ -57,35 +60,36 @@
* @see #store(WebContext)}.
*/
- public WebContext getWebContext();
+ WebContext getWebContext();
/**
* Returns the previously stored context.
*
* @see #storeServletContext(ServletContext)
*/
- public ServletContext getServletContext();
+ ServletContext getServletContext();
- public WebActivator getActivator();
+ WebActivator getActivator();
- public IApplicationSpecification getSpecification();
+ IApplicationSpecification getSpecification();
- public String getActivatorName();
+ String getActivatorName();
/**
- * Stores the default set of engine service definitions. Application services override factory
- * services with the same {@link org.apache.tapestry.engine.IEngineService#getName()name}.
+ * Stores the default set of engine service definitions. Application
+ * services override factory services with the same
+ * {@link org.apache.tapestry.engine.IEngineService#getName()name}.
*
* @param factoryServices
* List of {@link org.apache.tapestry.engine.IEngineService}.
*/
- public void storeFactoryServices(List factoryServices);
+ void storeFactoryServices(List factoryServices);
/**
* Returns the factory default services as a List of
* {@link org.apache.tapestry.engine.IEngineService}.
*/
- public List getFactoryServices();
-}
\ No newline at end of file
+ List getFactoryServices();
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/EngineFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/EngineFactory.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/EngineFactory.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/EngineFactory.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -20,14 +20,15 @@
/**
* Responsible for creating new instance of {@link org.apache.tapestry.IEngine}.
- *
+ *
* @author Howard Lewis Ship
* @since 4.0
*/
public interface EngineFactory
{
- /**
- * Creates and initializes a new engine instance for the specified locale.
- */
- public IEngine constructNewEngineInstance(Locale locale);
+
+ /**
+ * Creates and initializes a new engine instance for the specified locale.
+ */
+ IEngine constructNewEngineInstance(Locale locale);
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/EngineManager.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/EngineManager.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/EngineManager.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/EngineManager.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -17,24 +17,26 @@
import org.apache.tapestry.IEngine;
/**
- * Service responsible for obtaining instances of {@link org.apache.tapestry.IEngine}
- * to service the current request. An engine service may be retrieved from a pool, or extracted
- * from the HttpSession. After the request is processed, the engine is re-stored into the
- * HttpSession (if stateful) or back into the pool (if not stateful).
- *
+ * Service responsible for obtaining instances of
+ * {@link org.apache.tapestry.IEngine} to service the current request. An engine
+ * service may be retrieved from a pool, or extracted from the HttpSession.
+ * After the request is processed, the engine is re-stored into the HttpSession
+ * (if stateful) or back into the pool (if not stateful).
+ *
* @author Howard Lewis Ship
* @since 4.0
*/
public interface EngineManager
{
- /**
- * Locates or creates an engine instance for the current request.
- */
- IEngine getEngineInstance();
-
- /**
- * Store the engine back at the end of the current request.
- */
-
- void storeEngineInstance(IEngine engine);
+
+ /**
+ * Locates or creates an engine instance for the current request.
+ */
+ IEngine getEngineInstance();
+
+ /**
+ * Store the engine back at the end of the current request.
+ */
+
+ void storeEngineInstance(IEngine engine);
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ObjectPool.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ObjectPool.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ObjectPool.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ObjectPool.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,24 +14,24 @@
package org.apache.tapestry.services;
-
/**
- * An pool for objects. Objects may be stored in a Pool for later reuse.
- *
+ * An pool for objects. Objects may be stored in a Pool for later reuse.
+ *
* @author Howard Lewis Ship
* @since 4.0
*/
public interface ObjectPool
{
- /**
- * Returns an object from the pool, previously stored with the given key. May
- * return null if no such object exists.
- */
- Object get(Object key);
-
- /**
- * Stores an object into the pool for later retrieval with the provided key.
- */
-
- void store(Object key, Object value);
+
+ /**
+ * Returns an object from the pool, previously stored with the given key.
+ * May return null if no such object exists.
+ */
+ Object get(Object key);
+
+ /**
+ * Stores an object into the pool for later retrieval with the provided key.
+ */
+
+ void store(Object key, Object value);
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ResetEventHub.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ResetEventHub.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ResetEventHub.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/ResetEventHub.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -19,18 +19,19 @@
/**
* Service interface for a source of <b>reset</b> events; this events are used
* to inform other services that they should discard any cached data.
- *
+ *
* @author Howard Lewis Ship
* @since 4.0
*/
public interface ResetEventHub
{
+
public void addResetEventListener(ResetEventListener l);
public void removeResetEventListener(ResetEventListener l);
- /**
- * Notifies registered listeners.
- */
+ /**
+ * Notifies registered listeners.
+ */
public void fireResetEvent();
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/TemplateSource.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/TemplateSource.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/TemplateSource.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/TemplateSource.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -19,54 +19,55 @@
import org.apache.tapestry.parse.ComponentTemplate;
/**
- * A source of localized HTML templates for components.
- * The cache is the means of access for components to load thier templates,
- * which they need not do until just before rendering.
- *
- * <p>The template cache must be able to locate and parse templates as needed.
- * It may maintain templates in memory.
- *
+ * A source of localized HTML templates for components. The cache is the means
+ * of access for components to load thier templates, which they need not do
+ * until just before rendering.
+ * <p>
+ * The template cache must be able to locate and parse templates as needed. It
+ * may maintain templates in memory.
+ *
* @author Howard Ship
*/
public interface TemplateSource
{
+
/**
- * Name of an {@link org.apache.tapestry.IAsset} of a component that provides the template
- * for the asset. This overrides the default (that the template is in
- * the same directory as the specification). This allows
- * pages or component templates to be located properly, relative to static
- * assets (such as images and stylesheets).
- *
- * @since 2.2
+ * Name of an {@link org.apache.tapestry.IAsset} of a component that
+ * provides the template for the asset. This overrides the default (that the
+ * template is in the same directory as the specification). This allows
+ * pages or component templates to be located properly, relative to static
+ * assets (such as images and stylesheets).
*
+ * @since 2.2
*/
-
- public static final String TEMPLATE_ASSET_NAME = "$template";
+
+ String TEMPLATE_ASSET_NAME = "$template";
/**
- * Name of the component parameter that will be automatically bound to
- * the HTML tag that is used to insert the component in the parent template.
- * If the parent component does not have a template (i.e. it extends
- * AbstractComponent, not BaseComponent), then this parameter is bound to null.
- *
- * @since 3.0
+ * Name of the component parameter that will be automatically bound to the
+ * HTML tag that is used to insert the component in the parent template. If
+ * the parent component does not have a template (i.e. it extends
+ * AbstractComponent, not BaseComponent), then this parameter is bound to
+ * null.
*
+ * @since 3.0
*/
-
- public static final String TEMPLATE_TAG_PARAMETER_NAME = "templateTag";
-
+
+ String TEMPLATE_TAG_PARAMETER_NAME = "templateTag";
+
/**
- * Locates the template for the component.
- *
- * @param cycle The request cycle loading the template; this is required
- * in some cases when the template is loaded from an {@link org.apache.tapestry.IAsset}.
- * @param component The component for which a template should be loaded.
- *
- * @throws org.apache.tapestry.ApplicationRuntimeException if the resource cannot be located or loaded.
+ * Locates the template for the component.
*
+ * @param cycle
+ * The request cycle loading the template; this is required in
+ * some cases when the template is loaded from an
+ * {@link org.apache.tapestry.IAsset}.
+ * @param component
+ * The component for which a template should be loaded.
+ * @throws org.apache.tapestry.ApplicationRuntimeException
+ * if the resource cannot be located or loaded.
*/
- public ComponentTemplate getTemplate(IRequestCycle cycle, IComponent component);
-
-}
\ No newline at end of file
+ ComponentTemplate getTemplate(IRequestCycle cycle, IComponent component);
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/WebRequestServicer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/WebRequestServicer.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/WebRequestServicer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/WebRequestServicer.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -20,14 +20,17 @@
import org.apache.tapestry.web.WebResponse;
/**
- * Interface for objects that can handle web requests; few classes implement this, instead they
- * implement {@link org.apache.tapestry.services.WebRequestServicerFilter} and plug into the
- * tapestry.request.WebRequestServicerPipeline configuration point.
+ * Interface for objects that can handle web requests; few classes implement
+ * this, instead they implement
+ * {@link org.apache.tapestry.services.WebRequestServicerFilter} and plug into
+ * the tapestry.request.WebRequestServicerPipeline configuration point.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public interface WebRequestServicer
{
- public void service(WebRequest request, WebResponse response) throws IOException;
-}
\ No newline at end of file
+
+ void service(WebRequest request, WebResponse response)
+ throws IOException;
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/WebRequestServicerFilter.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/WebRequestServicerFilter.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/WebRequestServicerFilter.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/WebRequestServicerFilter.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
*/
public interface WebRequestServicerFilter
{
- public void service(WebRequest request, WebResponse response, WebRequestServicer servicer)
- throws IOException;
-}
\ No newline at end of file
+
+ void service(WebRequest request, WebResponse response, WebRequestServicer servicer)
+ throws IOException;
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/AbsoluteURLBuilderImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/AbsoluteURLBuilderImpl.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/AbsoluteURLBuilderImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/AbsoluteURLBuilderImpl.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -21,24 +21,23 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class AbsoluteURLBuilderImpl implements AbsoluteURLBuilder
-{
+public class AbsoluteURLBuilderImpl implements AbsoluteURLBuilder {
+
private WebRequest _request;
- public String constructURL(String URI, String scheme, String server, int port)
+ public String constructURL(String URI, String scheme, String server,
+ int port)
{
// Though, really, what does a leading colon with no scheme before it
// mean?
- if (URI.indexOf(':') >= 0)
- return URI;
+ if (URI.indexOf(':') >= 0) return URI;
StringBuffer buffer = new StringBuffer();
// Should check the length here, first.
- if (URI.length()> 2 && URI.substring(0, 2).equals("//"))
- {
+ if (URI.length() > 2 && URI.substring(0, 2).equals("//")) {
buffer.append(scheme);
buffer.append(':');
buffer.append(URI);
@@ -49,14 +48,12 @@
buffer.append("://");
buffer.append(server);
- if (port > 0)
- {
+ if (port > 0) {
buffer.append(':');
buffer.append(port);
}
- if (URI.charAt(0) != '/')
- buffer.append('/');
+ if (URI.charAt(0) != '/') buffer.append('/');
buffer.append(URI);
@@ -74,8 +71,7 @@
// Some of the Tomcat code indicates that port 443 is the default
// for https, and that needs to be researched.
- if (scheme.equals("http") && port == 80)
- port = 0;
+ if (scheme.equals("http") && port == 80) port = 0;
return constructURL(URI, scheme, server, port);
}
@@ -84,4 +80,4 @@
{
_request = request;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/AbstractSetupApplicationGlobals.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/AbstractSetupApplicationGlobals.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/AbstractSetupApplicationGlobals.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/AbstractSetupApplicationGlobals.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -26,8 +26,7 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class AbstractSetupApplicationGlobals
-{
+public class AbstractSetupApplicationGlobals {
private ApplicationGlobals _globals;
@@ -56,4 +55,4 @@
{
_infrastructure = infrastructure;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ApplicationSpecificationInitializer.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -37,6 +37,9 @@
*/
public class ApplicationSpecificationInitializer implements ApplicationInitializer
{
+
+ public static final String APP_SPEC_PATH_PARAM = "org.apache.tapestry.application-specification";
+
private Log _log;
private ClasspathResourceFactory _classpathResourceFactory;
@@ -45,8 +48,6 @@
private ISpecificationParser _parser;
- public static final String APP_SPEC_PATH_PARAM = "org.apache.tapestry.application-specification";
-
public void initialize(HttpServlet servlet)
{
IApplicationSpecification spec = null;
@@ -59,8 +60,7 @@
spec = constructStandinSpecification(servlet);
}
- else
- spec = _parser.parseApplicationSpecification(specResource);
+ else spec = _parser.parseApplicationSpecification(specResource);
_globals.storeActivator(new HttpServletWebActivator(servlet));
_globals.storeSpecification(spec);
@@ -70,8 +70,7 @@
{
String path = servlet.getInitParameter(APP_SPEC_PATH_PARAM);
- if (path != null)
- return _classpathResourceFactory.newResource(path);
+ if (path != null) return _classpathResourceFactory.newResource(path);
ServletContext context = servlet.getServletContext();
String servletName = servlet.getServletName();
@@ -81,8 +80,7 @@
Resource webInfAppLocation = webInfLocation.getRelativeResource(servletName + "/");
Resource result = check(webInfAppLocation, expectedName);
- if (result != null)
- return result;
+ if (result != null) return result;
return check(webInfLocation, expectedName);
}
@@ -91,8 +89,7 @@
{
Resource result = resource.getRelativeResource(name);
- if (_log.isDebugEnabled())
- _log.debug("Checking for existence of " + result);
+ if (_log.isDebugEnabled()) _log.debug("Checking for existence of " + result);
if (result.getResourceURL() != null)
{
@@ -111,8 +108,8 @@
// Pretend the file exists in the most common expected location.
- Resource virtualLocation = new ContextResource(servlet.getServletContext(), "/WEB-INF/"
- + servletName + ".application");
+ Resource virtualLocation = new ContextResource(servlet.getServletContext(), "/WEB-INF/" + servletName
+ + ".application");
result.setSpecificationLocation(virtualLocation);
@@ -140,5 +137,4 @@
{
_parser = parser;
}
-
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentMessagesSourceImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentMessagesSourceImpl.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentMessagesSourceImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentMessagesSourceImpl.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -48,20 +48,22 @@
public class ComponentMessagesSourceImpl implements ComponentMessagesSource, ResetEventListener
{
+
private Properties _emptyProperties = new Properties();
private static final String SUFFIX = ".properties";
/**
- * The name of the component/application/etc property that will be used to determine the
- * encoding to use when loading the messages
+ * The name of the component/application/etc property that will be used to
+ * determine the encoding to use when loading the messages
*/
public static final String MESSAGES_ENCODING_PROPERTY_NAME = "org.apache.tapestry.messages-encoding";
/**
- * Map of Maps. The outer map is keyed on component specification location (a{@link Resource}.
- * This inner map is keyed on locale and the value is a {@link Properties}.
+ * Map of Maps. The outer map is keyed on component specification location
+ * (a{@link Resource}. This inner map is keyed on locale and the value is
+ * a {@link Properties}.
*/
private Map _componentCache = new HashMap();
@@ -69,8 +71,9 @@
private ComponentPropertySource _componentPropertySource;
/**
- * Returns an instance of {@link Properties}containing the properly localized messages for the
- * component, in the {@link Locale}identified by the component's containing page.
+ * Returns an instance of {@link Properties}containing the properly
+ * localized messages for the component, in the {@link Locale}identified by
+ * the component's containing page.
*/
protected synchronized Properties getLocalizedProperties(IComponent component)
@@ -82,18 +85,14 @@
Map propertiesMap = findPropertiesMapForResource(specificationLocation);
- Properties result = (Properties) propertiesMap.get(locale);
+ Properties result = (Properties)propertiesMap.get(locale);
if (result == null)
{
// Not found, create it now.
- result = assembleComponentProperties(
- component,
- specificationLocation,
- propertiesMap,
- locale);
+ result = assembleComponentProperties(component, specificationLocation, propertiesMap, locale);
propertiesMap.put(locale, result);
}
@@ -103,7 +102,7 @@
private Map findPropertiesMapForResource(Resource resource)
{
- Map result = (Map) _componentCache.get(resource);
+ Map result = (Map)_componentCache.get(resource);
if (result == null)
{
@@ -122,7 +121,7 @@
Map propertiesMap = findPropertiesMapForResource(namespaceLocation);
- Properties result = (Properties) propertiesMap.get(locale);
+ Properties result = (Properties)propertiesMap.get(locale);
if (result == null)
{
@@ -134,43 +133,42 @@
return result;
}
- private Properties assembleComponentProperties(IComponent component,
- Resource baseResourceLocation, Map propertiesMap, Locale locale)
+ private Properties assembleComponentProperties(IComponent component, Resource baseResourceLocation,
+ Map propertiesMap, Locale locale)
{
List localizations = findLocalizationsForResource(baseResourceLocation, locale);
Properties parent = null;
Properties assembledProperties = null;
-
+
Iterator i = localizations.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
- ResourceLocalization rl = (ResourceLocalization) i.next();
+ ResourceLocalization rl = (ResourceLocalization)i.next();
Locale l = rl.getLocale();
- // Retrieve namespace properties for current locale (and parent locales)
- Properties namespaceProperties = getNamespaceProperties(component, l);
-
- // Use the namespace properties as default for assembled properties
+ // Retrieve namespace properties for current locale (and parent
+ // locales)
+ Properties namespaceProperties = getNamespaceProperties(component, l);
+
+ // Use the namespace properties as default for assembled properties
assembledProperties = new Properties(namespaceProperties);
-
+
// Read localized properties for component
Properties properties = readComponentProperties(component, l, rl.getResource(), null);
// Override parent properties with current locale
- if (parent != null) {
- if (properties != null)
- parent.putAll(properties);
+ if (parent != null)
+ {
+ if (properties != null) parent.putAll(properties);
}
- else
- parent = properties;
-
+ else parent = properties;
+
// Add to assembled properties
- if (parent != null)
- assembledProperties.putAll(parent);
-
+ if (parent != null) assembledProperties.putAll(parent);
+
// Save result in cache
propertiesMap.put(l, assembledProperties);
}
@@ -178,12 +176,9 @@
return assembledProperties;
}
- private Properties assembleNamespaceProperties(INamespace namespace, Map propertiesMap,
- Locale locale)
+ private Properties assembleNamespaceProperties(INamespace namespace, Map propertiesMap, Locale locale)
{
- List localizations = findLocalizationsForResource(
- namespace.getSpecificationLocation(),
- locale);
+ List localizations = findLocalizationsForResource(namespace.getSpecificationLocation(), locale);
// Build them back up in reverse order.
@@ -191,13 +186,13 @@
Iterator i = localizations.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
- ResourceLocalization rl = (ResourceLocalization) i.next();
+ ResourceLocalization rl = (ResourceLocalization)i.next();
Locale l = rl.getLocale();
- Properties properties = (Properties) propertiesMap.get(l);
+ Properties properties = (Properties)propertiesMap.get(l);
if (properties == null)
{
@@ -215,9 +210,9 @@
/**
* Finds the localizations of the provided resource. Returns a List of
- * {@link ResourceLocalization}(each pairing a locale with a localized resource). The list is
- * ordered from most general (i.e., "foo.properties") to most specific (i.e.,
- * "foo_en_US_yokel.properties").
+ * {@link ResourceLocalization}(each pairing a locale with a localized
+ * resource). The list is ordered from most general (i.e., "foo.properties")
+ * to most specific (i.e., "foo_en_US_yokel.properties").
*/
private List findLocalizationsForResource(Resource resource, Locale locale)
@@ -228,7 +223,7 @@
LocalizedNameGenerator g = new LocalizedNameGenerator(baseName, locale, SUFFIX);
- while (g.more())
+ while(g.more())
{
String localizedName = g.next();
Locale l = g.getCurrentLocale();
@@ -250,16 +245,16 @@
return fileName.substring(0, dotx);
}
- private Properties readComponentProperties(IComponent component, Locale locale,
- Resource propertiesResource, Properties parent)
+ private Properties readComponentProperties(IComponent component, Locale locale, Resource propertiesResource,
+ Properties parent)
{
String encoding = getComponentMessagesEncoding(component, locale);
return readPropertiesResource(propertiesResource.getResourceURL(), encoding, parent);
}
- private Properties readNamespaceProperties(INamespace namespace, Locale locale,
- Resource propertiesResource, Properties parent)
+ private Properties readNamespaceProperties(INamespace namespace, Locale locale, Resource propertiesResource,
+ Properties parent)
{
String encoding = getNamespaceMessagesEncoding(namespace, locale);
@@ -268,8 +263,7 @@
private Properties readPropertiesResource(URL resourceURL, String encoding, Properties parent)
{
- if (resourceURL == null)
- return parent;
+ if (resourceURL == null) return parent;
Properties result = new Properties(parent);
@@ -283,16 +277,13 @@
if (encoding == null)
wrapper.load(input);
- else
- wrapper.load(input, encoding);
+ else wrapper.load(input, encoding);
input.close();
}
catch (IOException ex)
{
- throw new ApplicationRuntimeException(ImplMessages.unableToLoadProperties(
- resourceURL,
- ex), ex);
+ throw new ApplicationRuntimeException(ImplMessages.unableToLoadProperties(resourceURL, ex), ex);
}
finally
{
@@ -304,15 +295,14 @@
private void close(InputStream is)
{
- if (is != null)
- try
- {
- is.close();
- }
- catch (IOException ex)
- {
- // Ignore.
- }
+ if (is != null) try
+ {
+ is.close();
+ }
+ catch (IOException ex)
+ {
+ // Ignore.
+ }
}
/**
@@ -326,21 +316,16 @@
public Messages getMessages(IComponent component)
{
- return new ComponentMessages(component.getPage().getLocale(),
- getLocalizedProperties(component));
+ return new ComponentMessages(component.getPage().getLocale(), getLocalizedProperties(component));
}
private String getComponentMessagesEncoding(IComponent component, Locale locale)
{
- String encoding = _componentPropertySource.getLocalizedComponentProperty(
- component,
- locale,
+ String encoding = _componentPropertySource.getLocalizedComponentProperty(component, locale,
MESSAGES_ENCODING_PROPERTY_NAME);
if (encoding == null)
- encoding = _componentPropertySource.getLocalizedComponentProperty(
- component,
- locale,
+ encoding = _componentPropertySource.getLocalizedComponentProperty(component, locale,
TemplateSourceImpl.TEMPLATE_ENCODING_PROPERTY_NAME);
return encoding;
@@ -348,9 +333,7 @@
private String getNamespaceMessagesEncoding(INamespace namespace, Locale locale)
{
- return _componentPropertySource.getLocalizedNamespaceProperty(
- namespace,
- locale,
+ return _componentPropertySource.getLocalizedNamespaceProperty(namespace, locale,
MESSAGES_ENCODING_PROPERTY_NAME);
}
@@ -358,4 +341,4 @@
{
_componentPropertySource = componentPropertySource;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineFactoryImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineFactoryImpl.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineFactoryImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineFactoryImpl.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -25,15 +25,17 @@
import org.apache.tapestry.spec.IApplicationSpecification;
/**
- * Standard implementation of {@link org.apache.tapestry.services.EngineFactory} service. This
- * should do for most purposes, since a major focus of Tapestry 4.0 is to no longer require
- * subclassing of {@link org.apache.tapestry.engine.BaseEngine}.
+ * Standard implementation of {@link org.apache.tapestry.services.EngineFactory}
+ * service. This should do for most purposes, since a major focus of Tapestry
+ * 4.0 is to no longer require subclassing of
+ * {@link org.apache.tapestry.engine.BaseEngine}.
*
* @author Howard Lewis Ship
* @since 4.0
*/
public class EngineFactoryImpl implements EngineFactory
{
+
private IApplicationSpecification _applicationSpecification;
private String _defaultEngineClassName;
@@ -44,8 +46,10 @@
private ErrorLog _errorLog;
+ /** Defines an object that can construct an IEngine instance. */
interface EngineConstructor
{
+
IEngine construct();
}
@@ -53,8 +57,10 @@
// instantiate a BaseEngine instance, without using reflection
// (for efficiency).
+ /** Constructs the engine via reflection (and a class name). */
static class ReflectiveEngineConstructor implements EngineConstructor
{
+
private Class _engineClass;
ReflectiveEngineConstructor(Class engineClass)
@@ -66,13 +72,11 @@
{
try
{
- return (IEngine) _engineClass.newInstance();
+ return (IEngine)_engineClass.newInstance();
}
catch (Exception ex)
{
- throw new ApplicationRuntimeException(ImplMessages.errorInstantiatingEngine(
- _engineClass,
- ex), ex);
+ throw new ApplicationRuntimeException(ImplMessages.errorInstantiatingEngine(_engineClass, ex), ex);
}
}
}
@@ -83,8 +87,7 @@
// TODO: Check in web.xml first.
- if (engineClassName == null)
- engineClassName = _defaultEngineClassName;
+ if (engineClassName == null) engineClassName = _defaultEngineClassName;
Class engineClass = _classResolver.checkForClass(engineClassName);
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineServiceOuterProxy.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineServiceOuterProxy.java?rev=368410&r1=368409&r2=368410&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineServiceOuterProxy.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineServiceOuterProxy.java Thu Jan 12 09:12:21 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -23,22 +23,23 @@
import org.apache.tapestry.engine.ILink;
/**
- * Outer proxy for engine services. The inner proxy resolves the engine service name to a engine
- * service implementation and installed it into the outer proxy as a delegate. Although HiveMind
- * does provide a similar system of inner and outer delegates, Tapestry's engine-service:
- * {@link org.apache.tapestry.services.impl.EngineServiceObjectProvider} object provider can
- * cause exceptions (recurive service build) when attempting to link two services together. This
- * extra layer of proxying resolves that issue.
+ * Outer proxy for engine services. The inner proxy resolves the engine service
+ * name to a engine service implementation and installed it into the outer proxy
+ * as a delegate. Although HiveMind does provide a similar system of inner and
+ * outer delegates, Tapestry's engine-service:
+ * {@link org.apache.tapestry.services.impl.EngineServiceObjectProvider} object
+ * provider can cause exceptions (recurive service build) when attempting to
+ * link two services together. This extra layer of proxying resolves that issue.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public class EngineServiceOuterProxy implements IEngineService, Serializable
{
- /** serialver */
- private static final long serialVersionUID = 2050789495671401625L;
- private final String _serviceName;
+ private static final long serialVersionUID = 2050789495671401625L;
+
+ private final String _serviceName;
private IEngineService _delegate;
@@ -64,7 +65,8 @@
return _delegate.getLink(post, parameter);
}
- public void service(IRequestCycle cycle) throws IOException
+ public void service(IRequestCycle cycle)
+ throws IOException
{
_delegate.service(cycle);
}
@@ -79,4 +81,4 @@
return ImplMessages.engineServiceOuterProxyToString(_serviceName);
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org