Author: hlship
Date: Thu Jan 3 16:58:26 2008
New Revision: 608699
URL: http://svn.apache.org/viewvc?rev=608699&view=rev
Log:
TAPESTRY-1849: There are two virtually identical PersistentLocaleImpl classes,
one unused (probably an incomplete refactoring)
Removed:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentLocaleImpl.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ApplicationStateWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PersistentLocaleImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentLocale.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ApplicationStateWorkerTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PersistentLocaleImplTest.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ApplicationStateWorker.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ApplicationStateWorker.java?rev=608699&r1=608698&r2=608699&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ApplicationStateWorker.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ApplicationStateWorker.java
Thu Jan 3 16:58:26 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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.
@@ -33,11 +33,13 @@
{
private final ApplicationStateManager _applicationStateManager;
- private final ClassLoader _classLoader =
Thread.currentThread().getContextClassLoader();
+ private final ComponentClassCache _componentClassCache;
- public ApplicationStateWorker(ApplicationStateManager
applicationStateManager)
+ public ApplicationStateWorker(ApplicationStateManager
applicationStateManager,
+ ComponentClassCache componentClassCache)
{
_applicationStateManager = applicationStateManager;
+ _componentClassCache = componentClassCache;
}
public void transform(ClassTransformation transformation,
MutableComponentModel model)
@@ -53,17 +55,7 @@
{
String fieldType = transformation.getFieldType(fieldName);
- Class fieldClass;
-
- try
- {
- fieldClass = _classLoader.loadClass(fieldType);
- }
- catch (ClassNotFoundException ex)
- {
- throw new RuntimeException(ex);
-
- }
+ Class fieldClass = _componentClassCache.forName(fieldType);
String typeFieldName =
transformation.addInjectedField(Class.class, fieldName + "_type", fieldClass);
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PersistentLocaleImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PersistentLocaleImpl.java?rev=608699&r1=608698&r2=608699&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PersistentLocaleImpl.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PersistentLocaleImpl.java
Thu Jan 3 16:58:26 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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.
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java?rev=608699&r1=608698&r2=608699&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
Thu Jan 3 16:58:26 2008
@@ -537,6 +537,11 @@
expect(cache.forName(className)).andReturn(cachedClass).atLeastOnce();
}
+ protected void train_forName(ComponentClassCache cache, Class cachedClass)
+ {
+ train_forName(cache, cachedClass.getName(), cachedClass);
+ }
+
protected final ComponentClassCache mockComponentClassCache()
{
return newMock(ComponentClassCache.class);
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentLocale.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentLocale.java?rev=608699&r1=608698&r2=608699&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentLocale.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentLocale.java
Thu Jan 3 16:58:26 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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,7 +17,7 @@
import java.util.Locale;
/**
- * It represents the persistent locale stored as a cookie in the browser.
+ * Manages the persistent locale stored as a cookie in the browser.
*/
public interface PersistentLocale
{
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java?rev=608699&r1=608698&r2=608699&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
Thu Jan 3 16:58:26 2008
@@ -235,7 +235,7 @@
// UnclaimedField is last.
configuration.add("Meta", new MetaWorker());
- configuration.add("ApplicationState", new
ApplicationStateWorker(applicationStateManager));
+ configuration.add("ApplicationState",
locator.autobuild(ApplicationStateWorker.class));
configuration.add("Inject", new InjectWorker(locator,
injectionProvider));
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ApplicationStateWorkerTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ApplicationStateWorkerTest.java?rev=608699&r1=608698&r2=608699&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ApplicationStateWorkerTest.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ApplicationStateWorkerTest.java
Thu Jan 3 16:58:26 2008
@@ -54,7 +54,7 @@
replay();
- ComponentClassTransformWorker worker = new
ApplicationStateWorker(manager);
+ ComponentClassTransformWorker worker = new
ApplicationStateWorker(manager, null);
worker.transform(ct, model);
@@ -69,6 +69,7 @@
Logger logger = mockLogger();
MutableComponentModel model = mockMutableComponentModel();
InternalComponentResources resources =
mockInternalComponentResources();
+ ComponentClassCache cache = mockComponentClassCache();
String componentClassName = StateHolder.class.getName();
Class asoClass = ReadOnlyBean.class;
@@ -82,13 +83,14 @@
loader.delegateLoadingOf("org.apache.tapestry.");
CtClass ctClass = pool.get(componentClassName);
- InternalClassTransformation transformation = new
InternalClassTransformationImpl(ctClass,
-
_contextClassLoader, logger,
-
null);
+ InternalClassTransformation transformation = new
InternalClassTransformationImpl(ctClass, _contextClassLoader,
+
logger, null);
+
+ train_forName(cache, ReadOnlyBean.class);
replay();
- new ApplicationStateWorker(manager).transform(transformation, model);
+ new ApplicationStateWorker(manager, cache).transform(transformation,
model);
verify();
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PersistentLocaleImplTest.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PersistentLocaleImplTest.java?rev=608699&r1=608698&r2=608699&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PersistentLocaleImplTest.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PersistentLocaleImplTest.java
Thu Jan 3 16:58:26 2008
@@ -17,7 +17,6 @@
import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import org.apache.tapestry.services.Cookies;
import org.apache.tapestry.services.PersistentLocale;
-import org.apache.tapestry.services.PersistentLocaleImpl;
import org.testng.Assert;
import org.testng.annotations.Test;