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 2007/03/10 04:04:04 UTC
svn commit: r516646 [1/2] - in
/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src:
main/java/org/apache/tapestry/
main/java/org/apache/tapestry/corelib/components/
main/java/org/apache/tapestry/corelib/pages/ main/java/org/apach...
Author: hlship
Date: Fri Mar 9 19:04:02 2007
New Revision: 516646
URL: http://svn.apache.org/viewvc?view=rev&rev=516646
Log:
TAPESTRY-1339: Remove module ids and treat service (and decorator) ids as unique (without qualification).
Modified:
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/TapestryFilter.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/corelib/components/Form.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/corelib/pages/ExceptionReport.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/TapestryAppInitializer.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ApplicationStateManagerImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/AssetSourceImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ClasspathAssetFactory.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ComponentClassTransformerImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ComponentTemplateSourceImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/LocalizationSetterImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/MessagesSourceImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/MetaDataLocatorImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/PropertyConduitSourceImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ResourceCacheImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ValidationMessagesSourceImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/util/URLChangeTracker.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/services/TapestryModule.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/test/pagelevel/ActionLinkInvoker.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/test/pagelevel/PageTester.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/util/EnumSelectModel.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/app0/services/FooModule.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/app1/components/RenderableProvider.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/app1/services/AppModule.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/app2/services/LocaleAppModule.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/internal/TapestryAppInitializerTest.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/internal/bindings/PropBindingFactoryTest.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/internal/services/ComponentInstantiatorSourceImplTest.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/internal/services/InternalClassTransformationImplTest.java
tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/TapestryFilter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/TapestryFilter.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/TapestryFilter.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/TapestryFilter.java Fri Mar 9 19:04:02 2007
@@ -78,13 +78,13 @@
long toRegistry = appInitializer.getRegistryCreatedTime();
ServletApplicationInitializer ai = _registry.getService(
- "tapestry.ServletApplicationInitializer",
+ "ServletApplicationInitializer",
ServletApplicationInitializer.class);
ai.initializeApplication(filterConfig.getServletContext());
_handler = _registry.getService(
- "tapestry.HttpServletRequestHandler",
+ "HttpServletRequestHandler",
HttpServletRequestHandler.class);
long toFinish = System.currentTimeMillis();
@@ -116,8 +116,7 @@
(HttpServletRequest) request,
(HttpServletResponse) response);
- if (!handled)
- chain.doFilter(request, response);
+ if (!handled) chain.doFilter(request, response);
}
finally
{
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/corelib/components/Form.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/corelib/components/Form.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/corelib/components/Form.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/corelib/components/Form.java Fri Mar 9 19:04:02 2007
@@ -147,7 +147,7 @@
@Environmental
private PageRenderSupport _pageRenderSupport;
- @Inject("service:tapestry.internal.FormParameterLookup")
+ @Inject("service:FormParameterLookup")
private FormParameterLookup _paramLookup;
@Inject("infrastructure:ComponentSource")
@@ -180,8 +180,7 @@
public ValidationTracker getDefaultTracker()
{
- if (_defaultTracker == null)
- _defaultTracker = new ValidationTrackerImpl();
+ if (_defaultTracker == null) _defaultTracker = new ValidationTrackerImpl();
return _defaultTracker;
}
@@ -310,8 +309,7 @@
public boolean handleResult(Object result, Component component,
String methodDescription)
{
- if (result instanceof Boolean)
- return ((Boolean) result);
+ if (result instanceof Boolean) return ((Boolean) result);
holder.put(_eventResultProcessor.processComponentEvent(
result,
@@ -324,8 +322,7 @@
_resources.triggerEvent(PREPARE, context, handler);
- if (holder.hasValue())
- return holder.get();
+ if (holder.hasValue()) return holder.get();
// TODO: Ajax stuff will eventually mean there are multiple values for this parameter
// name
@@ -368,8 +365,7 @@
_resources.triggerEvent(VALIDATE, context, handler);
- if (holder.hasValue())
- return holder.get();
+ if (holder.hasValue()) return holder.get();
_formSupport.executeDeferred();
@@ -380,15 +376,13 @@
// as well, so that the next page render will be "clean" and show
// true persistent data, not value from the previous form submission.
- if (!_tracker.getHasErrors())
- _tracker.clear();
+ if (!_tracker.getHasErrors()) _tracker.clear();
_resources.triggerEvent(tracker.getHasErrors() ? FAILURE : SUCCESS, context, handler);
// Lastly, tell anyone whose interested that the form is completely submitted.
- if (holder.hasValue())
- return holder.get();
+ if (holder.hasValue()) return holder.get();
_resources.triggerEvent(SUBMIT, context, handler);
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/corelib/pages/ExceptionReport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/corelib/pages/ExceptionReport.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/corelib/pages/ExceptionReport.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/corelib/pages/ExceptionReport.java Fri Mar 9 19:04:02 2007
@@ -40,7 +40,7 @@
private String _attributeName;
- @Inject("service:tapestry.ioc.ExceptionAnalyzer")
+ @Inject("service:ExceptionAnalyzer")
private ExceptionAnalyzer _analyzer;
@Inject("infrastructure:Request")
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/TapestryAppInitializer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/TapestryAppInitializer.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/TapestryAppInitializer.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/TapestryAppInitializer.java Fri Mar 9 19:04:02 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -12,150 +12,151 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.internal;
-
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.tapestry.ioc.IOCUtilities;
-import org.apache.tapestry.ioc.Registry;
-import org.apache.tapestry.ioc.RegistryBuilder;
-import org.apache.tapestry.ioc.internal.util.InternalUtils;
-import org.apache.tapestry.services.ComponentClassResolver;
-import org.apache.tapestry.services.Infrastructure;
-import org.apache.tapestry.services.TapestryModule;
-
-/**
- * This class is used to build the {@link Registry}. The registry contains
- * {@link org.apache.tapestry.ioc.services.TapestryIOCModule} and {@link TapestryModule}, any
- * modules identified by {@link #addModules(RegistryBuilder)}, plus the application module.
- * <p>
- * The application module is optional.
- * <p>
- * The application module is identified as <em>package</em>.services.<em>appName</em>Module,
- * where <em>package</em> and the <em>appName</em> are specified by the caller.
- */
-public class TapestryAppInitializer
-{
- private String _appPackage;
-
- private String _appName;
-
- private String _infrastructureMode;
-
- private Registry _registry;
-
- private long _startTime;
-
- private long _registryCreatedTime;
-
- private final Map<String, Object> _serviceOverrides;
-
- public TapestryAppInitializer(String appPackage, String appName, String infrastructureMode)
- {
- this(appPackage, appName, infrastructureMode, null);
- }
-
- public TapestryAppInitializer(String appPackage, String appName, String infrastructureMode,
- Map<String, Object> serviceOverrides)
- {
- _appPackage = appPackage;
- _appName = appName;
- _infrastructureMode = infrastructureMode;
- _serviceOverrides = serviceOverrides;
- _startTime = System.currentTimeMillis();
- createRegistry();
- _registryCreatedTime = System.currentTimeMillis();
- setupServices();
- }
-
- private void createRegistry()
- {
- RegistryBuilder builder = new RegistryBuilder();
-
- builder.add(TapestryModule.class);
-
- String className = _appPackage + ".services." + InternalUtils.capitalize(_appName)
- + "Module";
-
- try
- {
- // This class is possibly loaded by a parent class loader of the application class
- // loader. The context class loader should have the approprite view to the module class,
- // if any.
-
- Class moduleClass = Thread.currentThread().getContextClassLoader().loadClass(className);
- builder.add(moduleClass);
- }
- catch (ClassNotFoundException ex)
- {
- // That's OK, not all applications will have a module class, even though any
- // non-trivial application will.
- }
-
- addModules(builder);
-
- overrideServices(builder);
-
- _registry = builder.build();
- }
-
- private void overrideServices(RegistryBuilder builder)
- {
- if (_serviceOverrides != null)
- {
- for (Entry<String, Object> e : _serviceOverrides.entrySet())
- {
- builder.addServiceOverride(e.getKey(), e.getValue());
- }
- }
- }
-
- private void setupServices()
- {
- Infrastructure infra = _registry
- .getService("tapestry.Infrastructure", Infrastructure.class);
- infra.setMode(_infrastructureMode);
-
- ComponentClassResolver resolver = _registry.getService(
- "tapestry.ComponentClassResolver",
- ComponentClassResolver.class);
-
- resolver.setApplicationPackage(_appPackage);
- }
-
- /**
- * Adds additional modules to the builder. This implementation adds any modules identified by
- * {@link IOCUtilities#addDefaultModules(RegistryBuilder)}. Most subclasses will invoke this
- * implementation, and add additional modules to the RegistryBuilder besides.
- * {@link org.apache.tapestry.ioc.services.TapestryIOCModule} and {@link TapestryModule} will
- * already have been added, as will an application module if present.
- *
- * @param builder
- */
- protected void addModules(RegistryBuilder builder)
- {
- IOCUtilities.addDefaultModules(builder);
- }
-
- public Registry getRegistry()
- {
- return _registry;
- }
-
- /**
- * @return the system time (in ms) when the registry has been created successfully.
- */
- public long getRegistryCreatedTime()
- {
- return _registryCreatedTime;
- }
-
- /**
- * @return the time when the initialization was started.
- */
- public long getStartTime()
- {
- return _startTime;
- }
-}
+package org.apache.tapestry.internal;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.tapestry.ioc.IOCUtilities;
+import org.apache.tapestry.ioc.Registry;
+import org.apache.tapestry.ioc.RegistryBuilder;
+import org.apache.tapestry.ioc.internal.util.InternalUtils;
+import org.apache.tapestry.services.ComponentClassResolver;
+import org.apache.tapestry.services.Infrastructure;
+import org.apache.tapestry.services.TapestryModule;
+
+/**
+ * This class is used to build the {@link Registry}. The registry contains
+ * {@link org.apache.tapestry.ioc.services.TapestryIOCModule} and {@link TapestryModule}, any
+ * modules identified by {@link #addModules(RegistryBuilder)}, plus the application module.
+ * <p>
+ * The application module is optional.
+ * <p>
+ * The application module is identified as <em>package</em>.services.<em>appName</em>Module,
+ * where <em>package</em> and the <em>appName</em> are specified by the caller.
+ */
+public class TapestryAppInitializer
+{
+ private String _appPackage;
+
+ private String _appName;
+
+ private String _infrastructureMode;
+
+ private Registry _registry;
+
+ private long _startTime;
+
+ private long _registryCreatedTime;
+
+ private final Map<String, Object> _serviceOverrides;
+
+ public TapestryAppInitializer(String appPackage, String appName, String infrastructureMode)
+ {
+ this(appPackage, appName, infrastructureMode, null);
+ }
+
+ public TapestryAppInitializer(String appPackage, String appName, String infrastructureMode,
+ Map<String, Object> serviceOverrides)
+ {
+ _appPackage = appPackage;
+ _appName = appName;
+ _infrastructureMode = infrastructureMode;
+ _serviceOverrides = serviceOverrides;
+ _startTime = System.currentTimeMillis();
+ createRegistry();
+ _registryCreatedTime = System.currentTimeMillis();
+ setupServices();
+ }
+
+ private void createRegistry()
+ {
+ RegistryBuilder builder = new RegistryBuilder();
+
+ builder.add(TapestryModule.class);
+
+ String className = _appPackage + ".services." + InternalUtils.capitalize(_appName)
+ + "Module";
+
+ try
+ {
+ // This class is possibly loaded by a parent class loader of the application class
+ // loader. The context class loader should have the approprite view to the module class,
+ // if any.
+
+ Class moduleClass = Thread.currentThread().getContextClassLoader().loadClass(className);
+ builder.add(moduleClass);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // That's OK, not all applications will have a module class, even though any
+ // non-trivial application will.
+ }
+
+ addModules(builder);
+
+ overrideServices(builder);
+
+ _registry = builder.build();
+ }
+
+ private void overrideServices(RegistryBuilder builder)
+ {
+ if (_serviceOverrides != null)
+ {
+ for (Entry<String, Object> e : _serviceOverrides.entrySet())
+ {
+ builder.addServiceOverride(e.getKey(), e.getValue());
+ }
+ }
+ }
+
+ private void setupServices()
+ {
+ Infrastructure infra = _registry.getService("Infrastructure", Infrastructure.class);
+ infra.setMode(_infrastructureMode);
+
+ // This should not be needed ... it's handled inside the container now.
+
+ ComponentClassResolver resolver = _registry.getService(
+ "ComponentClassResolver",
+ ComponentClassResolver.class);
+
+ resolver.setApplicationPackage(_appPackage);
+ }
+
+ /**
+ * Adds additional modules to the builder. This implementation adds any modules identified by
+ * {@link IOCUtilities#addDefaultModules(RegistryBuilder)}. Most subclasses will invoke this
+ * implementation, and add additional modules to the RegistryBuilder besides.
+ * {@link org.apache.tapestry.ioc.services.TapestryIOCModule} and {@link TapestryModule} will
+ * already have been added, as will an application module if present.
+ *
+ * @param builder
+ */
+ protected void addModules(RegistryBuilder builder)
+ {
+ IOCUtilities.addDefaultModules(builder);
+ }
+
+ public Registry getRegistry()
+ {
+ return _registry;
+ }
+
+ /**
+ * @return the system time (in ms) when the registry has been created successfully.
+ */
+ public long getRegistryCreatedTime()
+ {
+ return _registryCreatedTime;
+ }
+
+ /**
+ * @return the time when the initialization was started.
+ */
+ public long getStartTime()
+ {
+ return _startTime;
+ }
+}
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/TapestryInternalUtils.java Fri Mar 9 19:04:02 2007
@@ -30,7 +30,6 @@
import org.apache.tapestry.PropertyConduit;
import org.apache.tapestry.SelectModel;
import org.apache.tapestry.beaneditor.Order;
-import org.apache.tapestry.ioc.IOCUtilities;
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import org.apache.tapestry.ioc.internal.util.Defense;
@@ -50,26 +49,14 @@
public static final void close(Closeable stream)
{
- if (stream != null)
- try
- {
- stream.close();
- }
- catch (IOException ex)
- {
- // Ignore.
- }
- }
-
- /**
- * Converts the first character of a string to lowercase, leavining the rest of the string
- * unchanged.
- */
- public static String decapitalize(String input)
- {
- char first = input.charAt(0);
-
- return Character.toLowerCase(first) + input.substring(1);
+ if (stream != null) try
+ {
+ stream.close();
+ }
+ catch (IOException ex)
+ {
+ // Ignore.
+ }
}
/**
@@ -106,8 +93,7 @@
boolean upperCase = Character.isUpperCase(ch);
- if (upperCase && !postSpace)
- builder.append(' ');
+ if (upperCase && !postSpace) builder.append(' ');
builder.append(ch);
@@ -146,8 +132,7 @@
int equalsx = input.indexOf('=');
- if (equalsx < 0)
- return new OptionModelImpl(input, false, input);
+ if (equalsx < 0) return new OptionModelImpl(input, false, input);
String value = input.substring(0, equalsx);
String label = input.substring(equalsx + 1);
@@ -297,8 +282,7 @@
{
int pos = input.indexOf('=');
- if (pos < 1)
- throw new IllegalArgumentException(InternalMessages.badKeyValue(input));
+ if (pos < 1) throw new IllegalArgumentException(InternalMessages.badKeyValue(input));
String key = input.substring(0, pos);
String value = input.substring(pos + 1);
@@ -308,8 +292,7 @@
public static int defaultOrder(PropertyConduit conduit)
{
- if (conduit == null)
- return 0;
+ if (conduit == null) return 0;
Order order = conduit.getAnnotation(Order.class);
@@ -337,11 +320,20 @@
{
String key = id + "-label";
- if (messages.contains(key))
- return messages.get(key);
+ if (messages.contains(key)) return messages.get(key);
+
+ return toUserPresentable(extractIdFromPropertyExpression(lastTerm(propertyExpression)));
+ }
+
+ /**
+ * Strips a dotted sequence (such as a property expression, or a qualified class name) down to
+ * the last term of that expression, by locating the last period ('.') in the string.
+ */
+ public static String lastTerm(String input)
+ {
+ int dotx = input.lastIndexOf('.');
- return toUserPresentable(extractIdFromPropertyExpression(IOCUtilities
- .toSimpleId(propertyExpression)));
+ return input.substring(dotx + 1);
}
private static class PropertyOrder implements Comparable<PropertyOrder>
@@ -363,11 +355,9 @@
{
int result = _classDepth - o._classDepth;
- if (result == 0)
- result = _sortKey - o._sortKey;
+ if (result == 0) result = _sortKey - o._sortKey;
- if (result == 0)
- result = _propertyName.compareTo(o._propertyName);
+ if (result == 0) result = _propertyName.compareTo(o._propertyName);
return result;
}
@@ -396,8 +386,7 @@
{
PropertyAdapter pa = classAdapter.getPropertyAdapter(name);
- if (pa.getAnnotation(Order.class) != null)
- continue;
+ if (pa.getAnnotation(Order.class) != null) continue;
Method readMethod = pa.getReadMethod();
@@ -421,9 +410,9 @@
{
int depth = 0;
Class c = method.getDeclaringClass();
-
+
// When the method originates in an interface, the parent may be null, not Object.
-
+
while (c != null && c != Object.class)
{
depth++;
@@ -447,18 +436,16 @@
String key = prefix + "." + name;
- if (messages.contains(key))
- return messages.get(key);
+ if (messages.contains(key)) return messages.get(key);
- if (messages.contains(name))
- return messages.get(name);
+ if (messages.contains(name)) return messages.get(name);
return toUserPresentable(name.toLowerCase());
}
public static String getLabelForEnum(Messages messages, Enum value)
{
- String prefix = IOCUtilities.toSimpleId(value.getClass().getName());
+ String prefix = lastTerm(value.getClass().getName());
return getLabelForEnum(messages, prefix, value);
}
@@ -474,7 +461,7 @@
throw new RuntimeException(ex);
}
}
-
+
public static String urlDecode(String input)
{
try
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ApplicationStateManagerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ApplicationStateManagerImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ApplicationStateManagerImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ApplicationStateManagerImpl.java Fri Mar 9 19:04:02 2007
@@ -14,7 +14,7 @@
package org.apache.tapestry.internal.services;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import java.util.Map;
@@ -67,7 +67,7 @@
public ApplicationStateManagerImpl(Map<Class, ApplicationStateContribution> configuration,
ApplicationStatePersistenceStrategySource source)
{
- _classToAdapter = newThreadSafeMap();
+ _classToAdapter = newConcurrentMap();
_source = source;
for (Class asoClass : configuration.keySet())
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/AssetSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/AssetSourceImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/AssetSourceImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/AssetSourceImpl.java Fri Mar 9 19:04:02 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -15,7 +15,7 @@
package org.apache.tapestry.internal.services;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import static org.apache.tapestry.ioc.internal.util.Defense.notBlank;
import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
@@ -38,7 +38,7 @@
private final Map<String, Resource> _prefixToRootResource = newMap();
- private final Map<Resource, Asset> _cache = newThreadSafeMap();
+ private final Map<Resource, Asset> _cache = newConcurrentMap();
public AssetSourceImpl(Map<String, AssetFactory> configuration)
{
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ClasspathAssetFactory.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ClasspathAssetFactory.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ClasspathAssetFactory.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ClasspathAssetFactory.java Fri Mar 9 19:04:02 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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,7 +14,7 @@
package org.apache.tapestry.internal.services;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import java.util.Map;
@@ -37,7 +37,7 @@
private final ClasspathAssetAliasManager _aliasManager;
- private final Map<Resource, String> _resourceToClientURL = newThreadSafeMap();
+ private final Map<Resource, String> _resourceToClientURL = newConcurrentMap();
public ClasspathAssetFactory(final ResourceCache cache,
final ClasspathAssetAliasManager aliasManager)
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ComponentClassTransformerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ComponentClassTransformerImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ComponentClassTransformerImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ComponentClassTransformerImpl.java Fri Mar 9 19:04:02 2007
@@ -14,7 +14,7 @@
package org.apache.tapestry.internal.services;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import java.lang.reflect.Modifier;
import java.util.Map;
@@ -40,9 +40,9 @@
InvalidationListener
{
/** Map from class name to class transformation. */
- private final Map<String, InternalClassTransformation> _nameToClassTransformation = newThreadSafeMap();
+ private final Map<String, InternalClassTransformation> _nameToClassTransformation = newConcurrentMap();
- private final Map<String, ComponentModel> _nameToComponentModel = newThreadSafeMap();
+ private final Map<String, ComponentModel> _nameToComponentModel = newConcurrentMap();
private final ComponentClassTransformWorker _workerChain;
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ComponentTemplateSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ComponentTemplateSourceImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ComponentTemplateSourceImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ComponentTemplateSourceImpl.java Fri Mar 9 19:04:02 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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,7 +14,7 @@
package org.apache.tapestry.internal.services;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import java.net.URL;
import java.util.List;
@@ -51,12 +51,12 @@
* parsed from the same "foo.html" resource). The resource may end up being null, meaning the
* template does not exist in any locale.
*/
- private final Map<MultiKey, Resource> _templateResources = newThreadSafeMap();
+ private final Map<MultiKey, Resource> _templateResources = newConcurrentMap();
/**
* Cache of parsed templates, keyed on resource.
*/
- private final Map<Resource, ComponentTemplate> _templates = newThreadSafeMap();
+ private final Map<Resource, ComponentTemplate> _templates = newConcurrentMap();
private final ComponentTemplate _missingTemplate = new ComponentTemplate()
{
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/InternalModule.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/InternalModule.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/InternalModule.java Fri Mar 9 19:04:02 2007
@@ -36,8 +36,6 @@
import org.apache.tapestry.ioc.LogSource;
import org.apache.tapestry.ioc.MappedConfiguration;
import org.apache.tapestry.ioc.OrderedConfiguration;
-import org.apache.tapestry.ioc.annotations.Contribute;
-import org.apache.tapestry.ioc.annotations.Id;
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.ioc.annotations.Lifecycle;
@@ -73,7 +71,6 @@
import org.apache.tapestry.services.ResourceDigestGenerator;
import org.apache.tapestry.services.Response;
-@Id("tapestry.internal")
public final class InternalModule
{
private final ComponentInstantiatorSource _componentInstantiatorSource;
@@ -106,16 +103,16 @@
@InjectService("UpdateListenerHub")
UpdateListenerHub updateListenerHub,
- @InjectService("tapestry.ioc.ThreadCleanupHub")
+ @InjectService("ThreadCleanupHub")
ThreadCleanupHub threadCleanupHub,
@InjectService("ComponentTemplateSource")
ComponentTemplateSource componentTemplateSource,
- @InjectService("tapestry.ComponentClassResolver")
+ @InjectService("ComponentClassResolver")
ComponentClassResolver componentClassResolver,
- @InjectService("tapestry.ioc.ChainBuilder")
+ @InjectService("ChainBuilder")
ChainBuilder chainBuilder,
@Inject("infrastructure:Request")
@@ -127,7 +124,7 @@
@InjectService("LinkFactory")
LinkFactory linkFactory,
- @InjectService("tapestry.ioc.ThreadLocale")
+ @InjectService("ThreadLocale")
ThreadLocale threadLocale,
@Inject("infrastructure:RequestGlobals")
@@ -151,8 +148,8 @@
}
public ComponentClassTransformer buildComponentClassTransformer(
- @InjectService("tapestry.ComponentClassTransformWorker")
- ComponentClassTransformWorker workerChain, @InjectService("tapestry.ioc.LogSource")
+ @InjectService("ComponentClassTransformWorker")
+ ComponentClassTransformWorker workerChain, @InjectService("LogSource")
LogSource logSource)
{
ComponentClassTransformerImpl transformer = new ComponentClassTransformerImpl(workerChain,
@@ -164,7 +161,7 @@
}
public ComponentInstantiatorSource buildComponentInstantiatorSource(
- @InjectService("tapestry.ioc.ClassFactory")
+ @InjectService("ClassFactory")
ClassFactory classFactory, @InjectService("ComponentClassTransformer")
ComponentClassTransformer transformer, Log log)
{
@@ -209,7 +206,7 @@
public PageLoader buildPageLoader(@InjectService("PageElementFactory")
PageElementFactory pageElementFactory,
- @InjectService("tapestry.BindingSource")
+ @InjectService("BindingSource")
BindingSource bindingSource,
@Inject("infrastructure:PersistentFieldManager")
@@ -271,38 +268,42 @@
public static PageResponseRenderer buildPageResponseRenderer(
@InjectService("PageMarkupRenderer")
- PageMarkupRenderer markupRenderer, @InjectService("tapestry.MarkupWriterFactory")
+ PageMarkupRenderer markupRenderer, @InjectService("MarkupWriterFactory")
MarkupWriterFactory markupWriterFactory)
{
return new PageResponseRendererImpl(markupWriterFactory, markupRenderer);
}
public static PageMarkupRenderer buildPageMarkupRenderer(
- @InjectService("tapestry.PageRenderInitializer")
+ @InjectService("PageRenderInitializer")
PageRenderInitializer pageRenderInitializer)
{
return new PageMarkupRendererImpl(pageRenderInitializer);
}
/**
- * Adds a filter that checks for updates to classes and other resources. It is ordered
- * before:*.*.
+ * Adds a filter that checks for updates to classes and other resources. It is ordered before:*.
*/
- @Contribute("tapestry.RequestHandler")
- public void contributeRequestFilters(OrderedConfiguration<RequestFilter> configuration,
- @InjectService("tapestry.RequestGlobals")
- final RequestGlobals requestGlobals, @Inject("${tapestry.file-check-interval}")
- long checkInterval, @InjectService("LocalizationSetter")
+ public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
+ @InjectService("RequestGlobals")
+ final RequestGlobals requestGlobals,
+
+ @Inject("${tapestry.file-check-interval}")
+ long checkInterval,
+
+ @InjectService("LocalizationSetter")
LocalizationSetter localizationSetter)
{
configuration.add("CheckForUpdates", new CheckForUpdatesFilter(_updateListenerHub,
- checkInterval), "before:*.*");
+ checkInterval), "before:*");
configuration.add("Localization", new LocalizationFilter(localizationSetter));
}
- public LocalizationSetter buildLocalizationSetter(@InjectService("tapestry.PersistentLocale")
- PersistentLocale persistentLocale, @Inject("${tapestry.supported-locales}")
+ public LocalizationSetter buildLocalizationSetter(@InjectService("PersistentLocale")
+ PersistentLocale persistentLocale,
+
+ @Inject("${tapestry.supported-locales}")
String localeNames)
{
return new LocalizationSetterImpl(persistentLocale, _threadLocale, localeNames);
@@ -311,7 +312,6 @@
/**
* Contributes factory defaults that map be overridden.
*/
- @Contribute("tapestry.ioc.FactoryDefaults")
public static void contributeFactoryDefaults(MappedConfiguration<String, String> configuration)
{
// Remember this is request-to-request time, presumably it'll take the developer more than
@@ -337,8 +337,7 @@
* Adds a filter that sets the application package (for class loading purposes). The filter is
* ordered before:*.*".
*/
- @Contribute("tapestry.ApplicationInitializer")
- public void contributeApplicationInitializerFilters(
+ public void contributeApplicationInitializer(
OrderedConfiguration<ApplicationInitializerFilter> configuration,
@Inject("infrastructure:ApplicationGlobals")
@@ -670,7 +669,6 @@
};
}
- @Contribute("tapestry.Infrastructure")
public static void contributeInfrastructure(
Configuration<InfrastructureContribution> configuration,
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/LocalizationSetterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/LocalizationSetterImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/LocalizationSetterImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/LocalizationSetterImpl.java Fri Mar 9 19:04:02 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -15,7 +15,7 @@
package org.apache.tapestry.internal.services;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newSet;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import java.util.Locale;
import java.util.Map;
@@ -36,7 +36,7 @@
private final Set<String> _acceptedLocaleNames;
- private final Map<String, Locale> _localeCache = newThreadSafeMap();
+ private final Map<String, Locale> _localeCache = newConcurrentMap();
private PersistentLocale _persistentLocale;
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/MessagesSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/MessagesSourceImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/MessagesSourceImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/MessagesSourceImpl.java Fri Mar 9 19:04:02 2007
@@ -16,7 +16,7 @@
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newCaseInsensitiveMap;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newList;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import java.io.BufferedInputStream;
import java.io.InputStream;
@@ -46,19 +46,19 @@
private final URLChangeTracker _tracker;
/** Keyed on bundle id and locale. */
- private final Map<MultiKey, Messages> _messagesByBundleIdAndLocale = newThreadSafeMap();
+ private final Map<MultiKey, Messages> _messagesByBundleIdAndLocale = newConcurrentMap();
/**
* Keyed on bundle id and locale, the coooked properties include properties inherited from less
* locale-specific properties files, or inherited from parent bundles.
*/
- private final Map<MultiKey, Map<String, String>> _cookedProperties = newThreadSafeMap();
+ private final Map<MultiKey, Map<String, String>> _cookedProperties = newConcurrentMap();
/**
* Raw properties represent just the properties read from a specific properties file, in
* isolation.
*/
- private final Map<Resource, Map<String, String>> _rawProperties = newThreadSafeMap();
+ private final Map<Resource, Map<String, String>> _rawProperties = newConcurrentMap();
private final Map<String, String> _emptyMap = Collections.emptyMap();
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/MetaDataLocatorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/MetaDataLocatorImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/MetaDataLocatorImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/MetaDataLocatorImpl.java Fri Mar 9 19:04:02 2007
@@ -28,7 +28,7 @@
{
private final Map<String, Map<String, String>> _defaultsByFolder = newCaseInsensitiveMap();
- private final Map<String, String> _cache = CollectionFactory.newThreadSafeMap();
+ private final Map<String, String> _cache = CollectionFactory.newConcurrentMap();
private final ComponentClassResolver _componentClassResolver;
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/PropertyConduitSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/PropertyConduitSourceImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/PropertyConduitSourceImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/PropertyConduitSourceImpl.java Fri Mar 9 19:04:02 2007
@@ -14,7 +14,7 @@
package org.apache.tapestry.internal.services;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import static org.apache.tapestry.ioc.internal.util.Defense.notBlank;
import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
@@ -45,7 +45,7 @@
private final ClassFactory _classFactory;
/** Keyed on combination of root class and expression. */
- private final Map<MultiKey, PropertyConduit> _cache = newThreadSafeMap();
+ private final Map<MultiKey, PropertyConduit> _cache = newConcurrentMap();
private static final MethodSignature GET_SIGNATURE = new MethodSignature(Object.class, "get",
new Class[]
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ResourceCacheImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ResourceCacheImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ResourceCacheImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ResourceCacheImpl.java Fri Mar 9 19:04:02 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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,7 +14,7 @@
package org.apache.tapestry.internal.services;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import java.net.URL;
import java.util.Map;
@@ -32,7 +32,7 @@
private final ResourceDigestGenerator _digestGenerator;
- private final Map<Resource, Cached> _cache = newThreadSafeMap();
+ private final Map<Resource, Cached> _cache = newConcurrentMap();
final static long MISSING_RESOURCE_TIME_MODIFIED = -1l;
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ValidationMessagesSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ValidationMessagesSourceImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ValidationMessagesSourceImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/services/ValidationMessagesSourceImpl.java Fri Mar 9 19:04:02 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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,7 +14,7 @@
package org.apache.tapestry.internal.services;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import java.util.Collection;
import java.util.Locale;
@@ -33,7 +33,7 @@
private final MessagesBundle _bundle;
- private final Map<Locale, Messages> _cache = newThreadSafeMap();
+ private final Map<Locale, Messages> _cache = newConcurrentMap();
private class ValidationMessagesBundle implements MessagesBundle
{
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java Fri Mar 9 19:04:02 2007
@@ -33,12 +33,12 @@
import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.dom.Element;
import org.apache.tapestry.internal.InternalComponentResources;
+import org.apache.tapestry.internal.TapestryInternalUtils;
import org.apache.tapestry.internal.services.ComponentEventImpl;
import org.apache.tapestry.internal.services.EventImpl;
import org.apache.tapestry.internal.services.Instantiator;
import org.apache.tapestry.internal.util.NotificationEventHandler;
import org.apache.tapestry.ioc.BaseLocatable;
-import org.apache.tapestry.ioc.IOCUtilities;
import org.apache.tapestry.ioc.Location;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
import org.apache.tapestry.ioc.internal.util.TapestryException;
@@ -150,16 +150,14 @@
private void add(RenderCommand command)
{
- if (_commands == null)
- _commands = newList();
+ if (_commands == null) _commands = newList();
_commands.add(command);
}
public void queueCommands(RenderQueue queue)
{
- if (_commands == null)
- return;
+ if (_commands == null) return;
for (RenderCommand command : _commands)
queue.push(command);
@@ -183,8 +181,7 @@
invoke(true, callback);
- if (!handler.getResult())
- queue.push(_beginRender);
+ if (!handler.getResult()) queue.push(_beginRender);
handler.queueCommands(queue);
}
@@ -213,8 +210,7 @@
invoke(true, callback);
- if (!handler.getResult())
- queue.push(_beforeRenderBody);
+ if (!handler.getResult()) queue.push(_beforeRenderBody);
handler.queueCommands(queue);
}
@@ -243,8 +239,7 @@
invoke(true, callback);
- if (!handler.getResult())
- queue.push(_beforeRenderTemplate);
+ if (!handler.getResult()) queue.push(_beforeRenderTemplate);
handler.queueCommands(queue);
}
@@ -275,8 +270,7 @@
queue.push(_afterRenderBody);
- if (handler.getResult())
- pushElements(queue, _body);
+ if (handler.getResult()) pushElements(queue, _body);
handler.queueCommands(queue);
}
@@ -307,8 +301,7 @@
queue.push(_afterRenderTemplate);
- if (handler.getResult())
- pushElements(queue, _template);
+ if (handler.getResult()) pushElements(queue, _template);
handler.queueCommands(queue);
}
@@ -343,8 +336,7 @@
// renderBody element is added as the lone element of the component's template.
// So every component will have a non-empty template.
- if (handler.getResult())
- queue.push(_beforeRenderTemplate);
+ if (handler.getResult()) queue.push(_beforeRenderTemplate);
handler.queueCommands(queue);
}
@@ -475,8 +467,7 @@
queue.push(_cleanupRender);
- if (handler.getResult())
- queue.push(_beginRender);
+ if (handler.getResult()) queue.push(_beginRender);
handler.queueCommands(queue);
}
@@ -583,8 +574,7 @@
public void addEmbeddedElement(ComponentPageElement child)
{
- if (_children == null)
- _children = newCaseInsensitiveMap();
+ if (_children == null) _children = newCaseInsensitiveMap();
String childId = child.getId();
@@ -605,7 +595,7 @@
}
String mixinClassName = instantiator.getModel().getComponentClassName();
- String mixinName = IOCUtilities.toSimpleId(mixinClassName);
+ String mixinName = TapestryInternalUtils.lastTerm(mixinClassName);
InternalComponentResourcesImpl resources = new InternalComponentResourcesImpl(this,
_coreResources, instantiator, _typeCoercer, _messagesSource);
@@ -681,8 +671,7 @@
public void addToBody(PageElement element)
{
- if (_body == null)
- _body = newList();
+ if (_body == null) _body = newList();
_body.add(element);
}
@@ -699,8 +688,7 @@
for (String name : model.getParameterNames())
{
- if (resource.isBound(name))
- continue;
+ if (resource.isBound(name)) continue;
ParameterModel parameterModel = model.getParameterModel(name);
@@ -740,8 +728,7 @@
{
Component mixin = i.next();
- if (mixin.getComponentResources().getComponentModel().isMixinAfter())
- continue;
+ if (mixin.getComponentResources().getComponentModel().isMixinAfter()) continue;
ordered.add(mixin);
@@ -789,8 +776,7 @@
{
// If no body, then no beforeRenderBody or afterRenderBody
- if (_body != null)
- queue.push(_beforeRenderBody);
+ if (_body != null) queue.push(_beforeRenderBody);
}
public String getCompleteId()
@@ -888,8 +874,7 @@
{
// Simple case: no mixins
- if (_components == null)
- return _coreComponent.handleComponentEvent(event);
+ if (_components == null) return _coreComponent.handleComponentEvent(event);
// Otherwise, iterate over mixins + core component
@@ -899,8 +884,7 @@
{
result |= component.handleComponentEvent(event);
- if (event.isAborted())
- break;
+ if (event.isAborted()) break;
}
return result;
@@ -953,8 +937,7 @@
// While loading the page (i.e., when setting field defaults), ignore these
// changes.
- if (_loaded)
- _page.persistFieldChange(resources, fieldName, newValue);
+ if (_loaded) _page.persistFieldChange(resources, fieldName, newValue);
}
/** Generate a toString() for the inner classes that represent render phases. */
@@ -988,8 +971,7 @@
// Provide a default handler for when the provided handler is null.
- if (handler == null)
- handler = new NotificationEventHandler(eventType, _completeId);
+ if (handler == null) handler = new NotificationEventHandler(eventType, _completeId);
ComponentPageElement component = this;
String componentId = "";
@@ -1001,8 +983,7 @@
result |= component.handleEvent(event);
- if (event.isAborted())
- return result;
+ if (event.isAborted()) return result;
// On each bubble up, make the event appear to come from the previous component
// in which the event was triggered.
@@ -1024,8 +1005,7 @@
for (String name : InternalUtils.sortedKeys(_mixinsByShortName))
addUnboundParameterNames(name, unbound, _mixinsByShortName.get(name));
- if (unbound.isEmpty())
- return;
+ if (unbound.isEmpty()) return;
throw new TapestryException(StructureMessages.missingParameters(unbound, this), this, null);
}
@@ -1065,8 +1045,7 @@
public void addBlock(String blockId, Block block)
{
- if (_blocks == null)
- _blocks = newCaseInsensitiveMap();
+ if (_blocks == null) _blocks = newCaseInsensitiveMap();
if (_blocks.containsKey(blockId))
throw new TapestryException(StructureMessages.duplicateBlock(this, blockId), block,
@@ -1103,8 +1082,7 @@
ParameterModel pm = _coreResources.getComponentModel().getParameterModel(parameterName);
- if (pm != null)
- return pm.getDefaultBindingPrefix();
+ if (pm != null) return pm.getDefaultBindingPrefix();
// Search for mixin that it is a formal parameter of
@@ -1114,8 +1092,7 @@
pm = resources.getComponentModel().getParameterModel(parameterName);
- if (pm != null)
- return pm.getDefaultBindingPrefix();
+ if (pm != null) return pm.getDefaultBindingPrefix();
}
// Not a formal parameter of the core component or any mixin.
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/util/URLChangeTracker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/util/URLChangeTracker.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/util/URLChangeTracker.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/internal/util/URLChangeTracker.java Fri Mar 9 19:04:02 2007
@@ -14,7 +14,7 @@
package org.apache.tapestry.internal.util;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
import java.io.File;
import java.net.URI;
@@ -30,7 +30,7 @@
{
private static final long FILE_DOES_NOT_EXIST_TIMESTAMP = -1l;
- private final Map<File, Long> _fileToTimestamp = newThreadSafeMap();
+ private final Map<File, Long> _fileToTimestamp = newConcurrentMap();
/**
* Stores a new URL into the tracker, or returns the previous time stamp for a previously added
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/services/TapestryModule.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/services/TapestryModule.java Fri Mar 9 19:04:02 2007
@@ -157,15 +157,12 @@
import org.apache.tapestry.internal.services.ValidationMessagesSourceImpl;
import org.apache.tapestry.internal.structure.DefaultComponentParameterBindingSourceImpl;
import org.apache.tapestry.ioc.Configuration;
-import org.apache.tapestry.ioc.IOCUtilities;
import org.apache.tapestry.ioc.Location;
import org.apache.tapestry.ioc.MappedConfiguration;
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.ObjectProvider;
import org.apache.tapestry.ioc.OrderedConfiguration;
import org.apache.tapestry.ioc.ServiceLocator;
-import org.apache.tapestry.ioc.annotations.Contribute;
-import org.apache.tapestry.ioc.annotations.Id;
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.ioc.annotations.Lifecycle;
@@ -199,7 +196,6 @@
/**
* The root module for Tapestry.
*/
-@Id("tapestry")
@SubModule(InternalModule.class)
public final class TapestryModule
{
@@ -242,10 +238,10 @@
// service builder and contributor methods static as possible to avoid recursive build
// exceptions.
- public TapestryModule(@InjectService("tapestry.ioc.PipelineBuilder")
+ public TapestryModule(@InjectService("PipelineBuilder")
PipelineBuilder pipelineBuilder,
- @InjectService("tapestry.ioc.PropertyShadowBuilder")
+ @InjectService("PropertyShadowBuilder")
PropertyShadowBuilder shadowBuilder,
@Inject("infrastructure:RequestGlobals")
@@ -254,13 +250,13 @@
@Inject("infrastructure:ApplicationGlobals")
ApplicationGlobals applicationGlobals,
- @InjectService("tapestry.ioc.ChainBuilder")
+ @InjectService("ChainBuilder")
ChainBuilder chainBuilder,
- @InjectService("tapestry.internal.RequestPageCache")
+ @InjectService("RequestPageCache")
RequestPageCache requestPageCache,
- @InjectService("tapestry.internal.PageResponseRenderer")
+ @InjectService("PageResponseRenderer")
PageResponseRenderer pageResponseRenderer,
@Inject("infrastructure:Request")
@@ -269,13 +265,13 @@
@Inject("infrastructure:Environment")
Environment environment,
- @InjectService("tapestry.ioc.StrategyBuilder")
+ @InjectService("StrategyBuilder")
StrategyBuilder strategyBuilder,
- @InjectService("tapestry.internal.ComponentInstantiatorSource")
+ @InjectService("ComponentInstantiatorSource")
ComponentInstantiatorSource componentInstantiatorSource,
- @InjectService("tapestry.internal.LinkFactory")
+ @InjectService("LinkFactory")
LinkFactory linkFactory,
@Inject("infrastructure:PropertyConduitSource")
@@ -317,7 +313,7 @@
{
for (Class serviceInterface : serviceInterfaces)
{
- String serviceId = IOCUtilities.toSimpleId(serviceInterface.getName());
+ String serviceId = TapestryInternalUtils.lastTerm(serviceInterface.getName());
Object service = locator.getService(serviceId, serviceInterface);
@@ -441,7 +437,7 @@
}
public static MarkupWriterFactory buildMarkupWriterFactory(
- @InjectService("tapestry.internal.ComponentInvocationMap")
+ @InjectService("ComponentInvocationMap")
final ComponentInvocationMap componentInvocationMap)
{
// Temporary ...
@@ -510,7 +506,7 @@
}
/**
- * Contributes filter "tapestry.StaticFilesFilter" that identifies requests for static resources
+ * Contributes filter "StaticFilesFilter" that identifies requests for static resources
* and terminates the pipeline by returning false. Generally, most filters should be ordered
* after this filter.
*/
@@ -563,10 +559,10 @@
ServiceLocator locator,
- @InjectService("tapestry.ioc.TypeCoercer")
+ @InjectService("TypeCoercer")
TypeCoercer typeCoercer,
- @InjectService("tapestry.ioc.PropertyAccess")
+ @InjectService("PropertyAccess")
PropertyAccess propertyAccess)
{
add(
@@ -610,8 +606,7 @@
* Contributes the {@link ObjectProvider} provided by {@link Infrastructure#getObjectProvider()}
* mapped to the provider prefix "infrastructure".
*/
- @Contribute("tapestry.ioc.MasterObjectProvider")
- public static void contributeInfrastructureToMasterObjectProvider(
+ public static void contributeMasterObjectProvider(
MappedConfiguration<String, ObjectProvider> configuration,
@InjectService("Infrastructure")
@@ -642,19 +637,19 @@
@Inject("infrastructure:ClasspathAssetAliasManager")
ClasspathAssetAliasManager aliasManager,
- @InjectService("tapestry.internal.ResourceCache")
+ @InjectService("ResourceCache")
ResourceCache resourceCache,
- @InjectService("tapestry.internal.ResourceStreamer")
+ @InjectService("ResourceStreamer")
ResourceStreamer streamer,
- @InjectService("tapestry.internal.PageLinkHandler")
+ @InjectService("PageLinkHandler")
PageLinkHandler pageLinkHandler,
- @InjectService("tapestry.internal.ActionLinkHandler")
+ @InjectService("ActionLinkHandler")
ActionLinkHandler actionLinkHandler,
- @InjectService("tapestry.ComponentClassResolver")
+ @InjectService("ComponentClassResolver")
ComponentClassResolver componentClassResolver,
@Inject("${tapestry.start-page-name}")
@@ -712,7 +707,7 @@
public static void contributeBindingSource(
MappedConfiguration<String, BindingFactory> configuration,
- @InjectService("tapestry.internal.PropBindingFactory")
+ @InjectService("PropBindingFactory")
BindingFactory propBindingFactory,
@Inject("infrastructure:FieldValidatorSource")
@@ -804,7 +799,7 @@
ServiceLocator locator,
- @InjectService("tapestry.ioc.MasterObjectProvider")
+ @InjectService("MasterObjectProvider")
ObjectProvider objectProvider,
@InjectService("InjectionProvider")
@@ -816,13 +811,13 @@
@Inject("infrastructure:ComponentClassResolver")
ComponentClassResolver resolver,
- @InjectService("tapestry.internal.RequestPageCache")
+ @InjectService("RequestPageCache")
RequestPageCache requestPageCache,
@Inject("infrastructure:AssetSource")
AssetSource assetSource,
- @Inject("service:tapestry.ioc.SymbolSource")
+ @InjectService("SymbolSource")
SymbolSource symbolSource,
@Inject("infrastructure:BindingSource")
@@ -924,7 +919,7 @@
{
// make the name match the annotation class name.
- String name = IOCUtilities.toSimpleId(annotationClass.getName());
+ String name = TapestryInternalUtils.lastTerm(annotationClass.getName());
configuration.add(name, new ComponentLifecycleMethodWorker(signature, annotationClass,
reverse));
@@ -937,7 +932,7 @@
ComponentClassTransformWorker worker = new PageLifecycleAnnotationWorker(annotationClass,
lifecycleMethodSignature, methodAlias);
- String name = IOCUtilities.toSimpleId(annotationClass.getName());
+ String name = TapestryInternalUtils.lastTerm(annotationClass.getName());
configuration.add(name, worker);
}
@@ -983,7 +978,7 @@
public void contributePageRenderInitializer(
OrderedConfiguration<PageRenderCommand> configuration,
- @InjectService("tapestry.ioc.ThreadLocale")
+ @InjectService("ThreadLocale")
ThreadLocale threadLocale,
@Inject("infrastructure:AssetSource")
@@ -992,10 +987,10 @@
@Inject("infrastructure:ValidationMessagesSource")
ValidationMessagesSource validationMessagesSource,
- @Inject("service:tapestry.ioc.SymbolSource")
+ @Inject("service:SymbolSource")
final SymbolSource symbolSource,
- @Inject("service:tapestry.internal.ClasspathAssetFactory")
+ @Inject("service:ClasspathAssetFactory")
final AssetFactory classpathAssetFactory)
{
configuration.add("PageRenderSupport", new PageRenderCommand()
@@ -1065,23 +1060,21 @@
public void contributePersistentFieldManager(
MappedConfiguration<String, PersistentFieldStrategy> configuration,
- @InjectService("tapestry.internal.SessionHolder")
+ @InjectService("SessionHolder")
SessionHolder sessionHolder)
{
configuration.add("session", new SessionPersistentFieldStrategy(sessionHolder));
configuration.add("flash", new FlashPersistentFieldStrategy(sessionHolder));
}
- public ComponentSource buildComponentSource(
- @InjectService("tapestry.internal.RequestPageCache")
- RequestPageCache pageCache)
+ public ComponentSource buildComponentSource(@InjectService("RequestPageCache")
+ RequestPageCache pageCache)
{
return new ComponentSourceImpl(pageCache);
}
- public ComponentMessagesSource buildComponentMessagesSource(
- @InjectService("tapestry.internal.UpdateListenerHub")
- UpdateListenerHub updateListenerHub)
+ public ComponentMessagesSource buildComponentMessagesSource(@InjectService("UpdateListenerHub")
+ UpdateListenerHub updateListenerHub)
{
ComponentMessagesSourceImpl service = new ComponentMessagesSourceImpl();
@@ -1096,10 +1089,10 @@
* "org/apache/tapestry/internal/ValidationMessages".
*/
public ValidationMessagesSource buildValidationMessagesSource(Collection<String> configuration,
- @InjectService("tapestry.internal.UpdateListenerHub")
+ @InjectService("UpdateListenerHub")
UpdateListenerHub updateListenerHub,
- @InjectService("tapestry.internal.ClasspathAssetFactory")
+ @InjectService("ClasspathAssetFactory")
AssetFactory classpathAssetFactory)
{
ValidationMessagesSourceImpl service = new ValidationMessagesSourceImpl(configuration,
@@ -1121,10 +1114,10 @@
}
public void contributeAssetSource(MappedConfiguration<String, AssetFactory> configuration,
- @InjectService("tapestry.internal.ContextAssetFactory")
+ @InjectService("ContextAssetFactory")
AssetFactory contextAssetFactory,
- @InjectService("tapestry.internal.ClasspathAssetFactory")
+ @InjectService("ClasspathAssetFactory")
AssetFactory classpathAssetFactory)
{
configuration.add("context", contextAssetFactory);
@@ -1137,7 +1130,7 @@
}
public static ClasspathAssetAliasManager buildClasspathAssetAliasManager(
- @InjectService("tapestry.internal.ContextPathSource")
+ @InjectService("ContextPathSource")
ContextPathSource contextPathSource, Map<String, String> configuration)
{
return new ClasspathAssetAliasManagerImpl(contextPathSource, configuration);
@@ -1256,7 +1249,6 @@
* <li>List to {@link SelectModel}
* </ul>
*/
- @Contribute("tapestry.ioc.TypeCoercer")
public static void contributeTypeCoercer(Configuration<CoercionTuple> configuration)
{
add(configuration, String.class, SelectModel.class, new Coercion<String, SelectModel>()
@@ -1393,13 +1385,13 @@
return new PersistentLocaleImpl(cookies);
}
- public static Cookies buildCookies(@InjectService("tapestry.internal.ContextPathSource")
+ public static Cookies buildCookies(@InjectService("ContextPathSource")
ContextPathSource contextPathSource,
- @InjectService("tapestry.internal.CookieSource")
+ @InjectService("CookieSource")
CookieSource cookieSource,
- @InjectService("tapestry.internal.CookieSink")
+ @InjectService("CookieSink")
CookieSink cookieSink,
@Inject("${tapestry.default-cookie-max-age}")
@@ -1459,7 +1451,7 @@
@InjectService("DefaultDataTypeAnalyzer")
DataTypeAnalyzer defaultDataTypeAnalyzer)
{
- configuration.add("Default", defaultDataTypeAnalyzer, "after:*.*");
+ configuration.add("Default", defaultDataTypeAnalyzer, "after:*");
}
/**
@@ -1571,7 +1563,7 @@
return new DefaultComponentParameterBindingSourceImpl(_propertyAccess, bindingSource);
}
- public ObjectRenderer buildObjectRenderer(@InjectService("tapestry.ioc.StrategyBuilder")
+ public ObjectRenderer buildObjectRenderer(@InjectService("StrategyBuilder")
StrategyBuilder strategyBuilder, Map<Class, ObjectRenderer> configuration)
{
StrategyRegistry<ObjectRenderer> registry = StrategyRegistry.newInstance(
@@ -1587,7 +1579,7 @@
*/
public void contributeObjectRenderer(MappedConfiguration<Class, ObjectRenderer> configuration,
- @Inject("service:tapestry.internal.LocationRenderer")
+ @Inject("service:LocationRenderer")
ObjectRenderer locationRenderer)
{
configuration.add(Object.class, new ObjectRenderer()
@@ -1607,7 +1599,7 @@
* A service for building proxies that shadow a value stored in the {@link Environment}.
*/
public EnvironmentalShadowBuilder buildEnvironmentalShadowBuilder(
- @Inject("service:tapestry.ioc.ClassFactory")
+ @Inject("service:ClassFactory")
ClassFactory classFactory)
{
return new EnvironmentalShadowBuilderImpl(classFactory, _environment);
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/test/pagelevel/ActionLinkInvoker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/test/pagelevel/ActionLinkInvoker.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/test/pagelevel/ActionLinkInvoker.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/test/pagelevel/ActionLinkInvoker.java Fri Mar 9 19:04:02 2007
@@ -41,9 +41,7 @@
{
_registry = registry;
_followupInvoker = followupInvoker;
- _actionLinkHandler = _registry.getService(
- "tapestry.internal.ActionLinkHandler",
- ActionLinkHandler.class);
+ _actionLinkHandler = _registry.getService("ActionLinkHandler", ActionLinkHandler.class);
_componentInvocationMap = componentInvocationMap;
}
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/test/pagelevel/PageTester.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/test/pagelevel/PageTester.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/test/pagelevel/PageTester.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/test/pagelevel/PageTester.java Fri Mar 9 19:04:02 2007
@@ -108,9 +108,7 @@
_registry = new TapestryAppInitializer(appPackage, appName, "test",
addDefaultOverrides(serviceOverrides)).getRegistry();
- _localizationSetter = _registry.getService(
- "tapestry.internal.LocalizationSetter",
- LocalizationSetter.class);
+ _localizationSetter = _registry.getService("LocalizationSetter", LocalizationSetter.class);
ApplicationGlobals globals = _registry.getObject(
"infrastructure:ApplicationGlobals",
@@ -133,23 +131,14 @@
{
Map<String, Object> modifiedOverrides = newMap(serviceOverrides);
- addDefaultOverride(
- modifiedOverrides,
- "tapestry.internal.ContextPathSource",
- new FooContextPathSource());
- addDefaultOverride(modifiedOverrides, "tapestry.internal.URLEncoder", new NoOpURLEncoder());
- addDefaultOverride(
- modifiedOverrides,
- "tapestry.internal.ComponentInvocationMap",
- _invocationMap);
- addDefaultOverride(
- modifiedOverrides,
- "tapestry.internal.FormParameterLookup",
- _formParameterLookup);
- addDefaultOverride(modifiedOverrides, "tapestry.internal.SessionHolder", _sessionHolder);
- addDefaultOverride(modifiedOverrides, "tapestry.internal.CookieSource", _cookies);
- addDefaultOverride(modifiedOverrides, "tapestry.internal.CookieSink", _cookies);
-
+ addDefaultOverride(modifiedOverrides, "ContextPathSource", new FooContextPathSource());
+ addDefaultOverride(modifiedOverrides, "URLEncoder", new NoOpURLEncoder());
+ addDefaultOverride(modifiedOverrides, "ComponentInvocationMap", _invocationMap);
+ addDefaultOverride(modifiedOverrides, "FormParameterLookup", _formParameterLookup);
+ addDefaultOverride(modifiedOverrides, "SessionHolder", _sessionHolder);
+ addDefaultOverride(modifiedOverrides, "CookieSource", _cookies);
+ addDefaultOverride(modifiedOverrides, "CookieSink", _cookies);
+
return modifiedOverrides;
}
@@ -201,11 +190,8 @@
private ComponentInvocation getInvocation(Element element)
{
ComponentInvocation invocation = _invocationMap.get(element);
- if (invocation == null)
- {
- throw new IllegalArgumentException(
- "No component invocation object is associated with the Element");
- }
+ if (invocation == null) { throw new IllegalArgumentException(
+ "No component invocation object is associated with the Element"); }
return invocation;
}
@@ -274,10 +260,7 @@
if (element.getName().equals("input"))
{
String type = element.getAttribute("type");
- if (type != null && type.equals("submit"))
- {
- return;
- }
+ if (type != null && type.equals("submit")) { return; }
}
throw new IllegalArgumentException("The specified element is not a submit button");
}
@@ -286,14 +269,9 @@
{
while (true)
{
- if (element == null)
- {
- throw new IllegalArgumentException("The given element is not contained in a form");
- }
- if (element.getName().equalsIgnoreCase("form"))
- {
- return element;
- }
+ if (element == null) { throw new IllegalArgumentException(
+ "The given element is not contained in a form"); }
+ if (element.getName().equalsIgnoreCase("form")) { return element; }
element = element.getParent();
}
}
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/util/EnumSelectModel.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/util/EnumSelectModel.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/util/EnumSelectModel.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/util/EnumSelectModel.java Fri Mar 9 19:04:02 2007
@@ -24,7 +24,6 @@
import org.apache.tapestry.SelectModel;
import org.apache.tapestry.internal.OptionModelImpl;
import org.apache.tapestry.internal.TapestryInternalUtils;
-import org.apache.tapestry.ioc.IOCUtilities;
import org.apache.tapestry.ioc.Messages;
import org.apache.tapestry.ioc.internal.util.Defense;
@@ -54,7 +53,7 @@
Defense.notNull(enumClass, "enumClass");
Defense.notNull(messages, "messages");
- String prefix = IOCUtilities.toSimpleId(enumClass.getName());
+ String prefix = TapestryInternalUtils.lastTerm(enumClass.getName());
for (T value : values)
{
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Fri Mar 9 19:04:02 2007
@@ -201,13 +201,13 @@
clickAndWait("link=Inject Demo");
// This is a test for a named @Inject:
- assertTextPresent("<Proxy for tapestry.Request(org.apache.tapestry.services.Request)>");
+ assertTextPresent("<Proxy for Request(org.apache.tapestry.services.Request)>");
// This is a test for an annonymous @Inject and ComponentResourcesInjectionProvider
assertTextPresent("ComponentResources[org.apache.tapestry.integration.app1.pages.InjectDemo]");
// Another test, DefaultInjectionProvider
- assertTextPresent("<Proxy for tapestry.BindingSource(org.apache.tapestry.services.BindingSource)>");
+ assertTextPresent("<Proxy for BindingSource(org.apache.tapestry.services.BindingSource)>");
}
@Test
@@ -511,8 +511,7 @@
{
int length = is.read(buffer);
- if (length < 0)
- break;
+ if (length < 0) break;
os.write(buffer, 0, length);
}
Modified: tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/app0/services/FooModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/app0/services/FooModule.java?view=diff&rev=516646&r1=516645&r2=516646
==============================================================================
--- tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/app0/services/FooModule.java (original)
+++ tapestry/tapestry5/tapestry-core/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/integration/app0/services/FooModule.java Fri Mar 9 19:04:02 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -12,18 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.integration.app0.services;
-
-import org.apache.tapestry.ioc.annotations.Id;
-import org.apache.tapestry.util.Transformer;
-import org.apache.tapestry.util.UppercaseTransformer;
-
-@Id("m1")
-public class FooModule
-{
- public static Transformer buildService1()
- {
- return new UppercaseTransformer();
- }
-
-}
+package org.apache.tapestry.integration.app0.services;
+
+import org.apache.tapestry.util.Transformer;
+import org.apache.tapestry.util.UppercaseTransformer;
+
+public class FooModule
+{
+ public static Transformer buildService1()
+ {
+ return new UppercaseTransformer();
+ }
+
+}