You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/05/06 23:52:40 UTC
svn commit: r653936 [3/6] - in /tapestry/tapestry5/trunk/tapestry-ioc/src:
main/java/org/apache/tapestry/ioc/
main/java/org/apache/tapestry/ioc/internal/
main/java/org/apache/tapestry/ioc/internal/services/
main/java/org/apache/tapestry/ioc/internal/ut...
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFabImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFabImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFabImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFabImpl.java Tue May 6 14:52:36 2008
@@ -51,11 +51,11 @@
* Add fields, methods, and constructors are added, their psuedo-code is appended to this description, which is used
* by toString().
*/
- private final StringBuilder _description = new StringBuilder();
+ private final StringBuilder description = new StringBuilder();
- private final Formatter _formatter = new Formatter(_description);
+ private final Formatter formatter = new Formatter(description);
- private final Set<MethodSignature> _addedSignatures = newSet();
+ private final Set<MethodSignature> addedSignatures = newSet();
public ClassFabImpl(CtClassSource source, CtClass ctClass, Logger logger)
{
@@ -77,7 +77,7 @@
{
buffer.append(buildClassAndInheritance());
- buffer.append(_description.toString());
+ buffer.append(description.toString());
}
catch (Exception ex)
{
@@ -135,7 +135,7 @@
public void addField(String name, int modifiers, Class type)
{
- _lock.check();
+ lock.check();
CtClass ctType = toCtClass(type);
@@ -152,14 +152,14 @@
throw new RuntimeException(ServiceMessages.unableToAddField(name, getCtClass(), ex), ex);
}
- _formatter.format("%s %s %s;\n\n", Modifier.toString(modifiers), ClassFabUtils
+ formatter.format("%s %s %s;\n\n", Modifier.toString(modifiers), ClassFabUtils
.toJavaClassName(type), name);
}
public void proxyMethodsToDelegate(Class serviceInterface, String delegateExpression,
String toString)
{
- _lock.check();
+ lock.check();
addInterface(serviceInterface);
@@ -181,7 +181,7 @@
public void addToString(String toString)
{
- _lock.check();
+ lock.check();
MethodSignature sig = new MethodSignature(String.class, "toString", null, null);
@@ -193,9 +193,9 @@
public void addMethod(int modifiers, MethodSignature ms, String body)
{
- _lock.check();
+ lock.check();
- if (_addedSignatures.contains(ms))
+ if (addedSignatures.contains(ms))
throw new RuntimeException(ServiceMessages.duplicateMethodInClass(ms, this));
CtClass ctReturnType = toCtClass(ms.getReturnType());
@@ -218,22 +218,22 @@
throw new RuntimeException(ServiceMessages.unableToAddMethod(ms, getCtClass(), ex), ex);
}
- _addedSignatures.add(ms);
+ addedSignatures.add(ms);
// modifiers, return type, name
- _formatter.format("%s %s %s", Modifier.toString(modifiers), ClassFabUtils
+ formatter.format("%s %s %s", Modifier.toString(modifiers), ClassFabUtils
.toJavaClassName(ms.getReturnType()), ms.getName());
// parameters, exceptions and body from this:
addMethodDetailsToDescription(ms.getParameterTypes(), ms.getExceptionTypes(), body);
- _description.append("\n\n");
+ description.append("\n\n");
}
public void addNoOpMethod(MethodSignature signature)
{
- _lock.check();
+ lock.check();
Class returnType = signature.getReturnType();
@@ -257,7 +257,7 @@
{
Defense.notBlank(body, "body");
- _lock.check();
+ lock.check();
CtClass[] ctParameters = toCtClasses(parameterTypes);
CtClass[] ctExceptions = toCtClasses(exceptions);
@@ -275,17 +275,17 @@
throw new RuntimeException(ServiceMessages.unableToAddConstructor(getCtClass(), ex), ex);
}
- _description.append("public ");
+ description.append("public ");
// This isn't quite right; we should strip the package portion off of the name.
// However, fabricated classes are almost always in the "default" package, so
// this is OK.
- _description.append(getName());
+ description.append(getName());
addMethodDetailsToDescription(parameterTypes, exceptions, body);
- _description.append("\n\n");
+ description.append("\n\n");
}
/**
@@ -298,35 +298,35 @@
private void addMethodDetailsToDescription(Class[] parameterTypes, Class[] exceptions,
String body)
{
- _description.append("(");
+ description.append("(");
int count = InternalUtils.size(parameterTypes);
for (int i = 0; i < count; i++)
{
- if (i > 0) _description.append(", ");
+ if (i > 0) description.append(", ");
- _description.append(ClassFabUtils.toJavaClassName(parameterTypes[i]));
+ description.append(ClassFabUtils.toJavaClassName(parameterTypes[i]));
- _description.append(" $");
- _description.append(i + 1);
+ description.append(" $");
+ description.append(i + 1);
}
- _description.append(")");
+ description.append(")");
count = InternalUtils.size(exceptions);
for (int i = 0; i < count; i++)
{
if (i == 0)
- _description.append("\n throws ");
+ description.append("\n throws ");
else
- _description.append(", ");
+ description.append(", ");
// Since this can never be an array type, we don't need to use getJavaClassName
- _description.append(exceptions[i].getName());
+ description.append(exceptions[i].getName());
}
- _description.append("\n");
- _description.append(body);
+ description.append("\n");
+ description.append(body);
}
}
\ No newline at end of file
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryClassPool.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryClassPool.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryClassPool.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryClassPool.java Tue May 6 14:52:36 2008
@@ -23,18 +23,18 @@
import java.util.Set;
/**
- * Used to ensure that {@link javassist.ClassPool#appendClassPath(javassist.ClassPath)} is invoked
- * within a synchronized lock, and also handles tricky class loading issues (caused by the creation
- * of classes, and class loaders, at runtime).
+ * Used to ensure that {@link javassist.ClassPool#appendClassPath(javassist.ClassPath)} is invoked within a synchronized
+ * lock, and also handles tricky class loading issues (caused by the creation of classes, and class loaders, at
+ * runtime).
*/
public class ClassFactoryClassPool extends ClassPool
{
/**
* Used to identify which class loaders have already been integrated into the pool.
*/
- private final Set<ClassLoader> _allLoaders = newSet();
+ private final Set<ClassLoader> allLoaders = newSet();
- private final Map<ClassLoader, ClassPath> _leafLoaders = newMap();
+ private final Map<ClassLoader, ClassPath> leafLoaders = newMap();
public ClassFactoryClassPool(ClassLoader contextClassLoader)
{
@@ -44,10 +44,9 @@
}
/**
- * Returns the nearest super-class of the provided class that can be converted to a
- * {@link CtClass}. This is used to filter out Hibernate-style proxies (created as subclasses
- * of oridnary classes). This will automatically add the class' classLoader to the pool's class
- * path.
+ * Returns the nearest super-class of the provided class that can be converted to a {@link CtClass}. This is used to
+ * filter out Hibernate-style proxies (created as subclasses of oridnary classes). This will automatically add the
+ * class' classLoader to the pool's class path.
*
* @param clazz class to import
* @return clazz, or a super-class of clazz
@@ -79,13 +78,12 @@
* Convienience method for adding to the ClassPath for a particular class loader.
* <p/>
*
- * @param loader the class loader to add (derived from a loaded class, and may be null for some
- * system classes)
+ * @param loader the class loader to add (derived from a loaded class, and may be null for some system classes)
*/
public synchronized void addClassLoaderIfNeeded(ClassLoader loader)
{
- Set<ClassLoader> leaves = _leafLoaders.keySet();
- if (loader == null || leaves.contains(loader) || _allLoaders.contains(loader)) return;
+ Set<ClassLoader> leaves = leafLoaders.keySet();
+ if (loader == null || leaves.contains(loader) || allLoaders.contains(loader)) return;
// Work out if this loader is a child of a loader we have already.
ClassLoader existingLeaf = loader;
@@ -98,19 +96,19 @@
{
// The new loader is a child of an existing leaf.
// So we remove the old leaf before we add the new loader
- ClassPath priorPath = _leafLoaders.get(existingLeaf);
+ ClassPath priorPath = leafLoaders.get(existingLeaf);
removeClassPath(priorPath);
- _leafLoaders.remove(existingLeaf);
+ leafLoaders.remove(existingLeaf);
}
ClassPath path = new LoaderClassPath(loader);
- _leafLoaders.put(loader, path);
+ leafLoaders.put(loader, path);
insertClassPath(path);
ClassLoader l = loader;
while (l != null)
{
- _allLoaders.add(l);
+ allLoaders.add(l);
l = l.getParent();
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java Tue May 6 14:52:36 2008
@@ -34,16 +34,16 @@
*/
public class ClassFactoryImpl implements ClassFactory
{
- private final Logger _logger;
+ private final Logger logger;
/**
* ClassPool shared by all modules (all CtClassSource instances).
*/
- private final ClassFactoryClassPool _pool;
+ private final ClassFactoryClassPool pool;
- private final CtClassSource _classSource;
+ private final CtClassSource classSource;
- private final ClassLoader _loader;
+ private final ClassLoader loader;
public ClassFactoryImpl(ClassLoader classLoader)
{
@@ -74,13 +74,13 @@
public ClassFactoryImpl(ClassLoader classLoader, ClassFactoryClassPool pool, CtClassSource classSource,
Logger logger)
{
- _loader = classLoader;
+ loader = classLoader;
- _pool = pool;
+ this.pool = pool;
- _classSource = classSource;
+ this.classSource = classSource;
- _logger = logger;
+ this.logger = logger;
}
@@ -97,15 +97,15 @@
public ClassFab newClass(String name, Class superClass)
{
- if (_logger.isDebugEnabled())
- _logger.debug(String.format("Create ClassFab for %s (extends %s)", name, superClass
+ if (logger.isDebugEnabled())
+ logger.debug(String.format("Create ClassFab for %s (extends %s)", name, superClass
.getName()));
try
{
- CtClass ctNewClass = _classSource.newClass(name, superClass);
+ CtClass ctNewClass = classSource.newClass(name, superClass);
- return new ClassFabImpl(_classSource, ctNewClass, _logger);
+ return new ClassFabImpl(classSource, ctNewClass, logger);
}
catch (Exception ex)
{
@@ -115,17 +115,17 @@
public Class importClass(Class clazz)
{
- return _pool.importClass(clazz);
+ return pool.importClass(clazz);
}
public int getCreatedClassCount()
{
- return _classSource.getCreatedClassCount();
+ return classSource.getCreatedClassCount();
}
public ClassLoader getClassLoader()
{
- return _loader;
+ return loader;
}
public Location getMethodLocation(Method method)
@@ -138,7 +138,7 @@
Class declaringClass = method.getDeclaringClass();
Class effectiveClass = importClass(declaringClass);
- CtClass ctClass = _classSource.toCtClass(effectiveClass);
+ CtClass ctClass = classSource.toCtClass(effectiveClass);
StringBuilder builder = new StringBuilder("(");
@@ -179,7 +179,7 @@
builder.append(declaringClass.getName());
builder.append("(");
- CtClass ctClass = _classSource.toCtClass(declaringClass);
+ CtClass ctClass = classSource.toCtClass(declaringClass);
StringBuilder descripton = new StringBuilder("(");
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassNameLocatorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassNameLocatorImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassNameLocatorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassNameLocatorImpl.java Tue May 6 14:52:36 2008
@@ -32,18 +32,18 @@
{
private static final String CLASS_SUFFIX = ".class";
- private final ClassLoader _contextClassLoader = Thread.currentThread().getContextClassLoader();
+ private final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
static class Queued
{
- final URL _packageURL;
+ final URL packageURL;
- final String _packagePath;
+ final String packagePath;
public Queued(final URL packageURL, final String packagePath)
{
- _packageURL = packageURL;
- _packagePath = packagePath;
+ this.packageURL = packageURL;
+ this.packagePath = packagePath;
}
}
@@ -70,7 +70,7 @@
{
Collection<String> result = CollectionFactory.newList();
- Enumeration<URL> urls = _contextClassLoader.getResources(packagePath);
+ Enumeration<URL> urls = contextClassLoader.getResources(packagePath);
while (urls.hasMoreElements())
{
@@ -111,7 +111,7 @@
{
Queued queued = queue.pop();
- scanDirStream(queued._packagePath, queued._packageURL, componentClassNames, queue);
+ scanDirStream(queued.packagePath, queued.packageURL, componentClassNames, queue);
}
}
else
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassPropertyAdapterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassPropertyAdapterImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassPropertyAdapterImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassPropertyAdapterImpl.java Tue May 6 14:52:36 2008
@@ -27,13 +27,13 @@
public class ClassPropertyAdapterImpl implements ClassPropertyAdapter
{
- private final Map<String, PropertyAdapter> _adapters = newCaseInsensitiveMap();
+ private final Map<String, PropertyAdapter> adapters = newCaseInsensitiveMap();
- private final Class _beanType;
+ private final Class beanType;
public ClassPropertyAdapterImpl(Class beanType, List<PropertyDescriptor> descriptors)
{
- _beanType = beanType;
+ this.beanType = beanType;
for (PropertyDescriptor pd : descriptors)
{
@@ -49,31 +49,31 @@
PropertyAdapter pa = new PropertyAdapterImpl(pd.getName(), propertyType, readMethod, pd.getWriteMethod());
- _adapters.put(pa.getName(), pa);
+ adapters.put(pa.getName(), pa);
}
}
public Class getBeanType()
{
- return _beanType;
+ return beanType;
}
@Override
public String toString()
{
- String names = InternalUtils.joinSorted(_adapters.keySet());
+ String names = InternalUtils.joinSorted(adapters.keySet());
- return String.format("<ClassPropertyAdaptor %s : %s>", _beanType.getName(), names);
+ return String.format("<ClassPropertyAdaptor %s : %s>", beanType.getName(), names);
}
public List<String> getPropertyNames()
{
- return InternalUtils.sortedKeys(_adapters);
+ return InternalUtils.sortedKeys(adapters);
}
public PropertyAdapter getPropertyAdapter(String name)
{
- return _adapters.get(name);
+ return adapters.get(name);
}
public Object get(Object instance, String propertyName)
@@ -88,9 +88,9 @@
private PropertyAdapter adaptorFor(String name)
{
- PropertyAdapter pa = _adapters.get(name);
+ PropertyAdapter pa = adapters.get(name);
- if (pa == null) throw new IllegalArgumentException(ServiceMessages.noSuchProperty(_beanType, name));
+ if (pa == null) throw new IllegalArgumentException(ServiceMessages.noSuchProperty(beanType, name));
return pa;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/CompoundCoercion.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/CompoundCoercion.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/CompoundCoercion.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/CompoundCoercion.java Tue May 6 14:52:36 2008
@@ -19,23 +19,20 @@
/**
* Combines two coercions to create a coercsion through an intermediate type.
*
- * @param <S>
- * The source (input) type
- * @param <I>
- * The intermediate type
- * @param <T>
- * The target (output) type
+ * @param <S> The source (input) type
+ * @param <I> The intermediate type
+ * @param <T> The target (output) type
*/
public class CompoundCoercion<S, I, T> implements Coercion<S, T>
{
- private final Coercion<S, I> _op1;
+ private final Coercion<S, I> op1;
- private final Coercion<I, T> _op2;
+ private final Coercion<I, T> op2;
public CompoundCoercion(Coercion<S, I> op1, Coercion<I, T> op2)
{
- _op1 = op1;
- _op2 = op2;
+ this.op1 = op1;
+ this.op2 = op2;
}
public T coerce(S input)
@@ -43,14 +40,14 @@
// Run the input through the first operation (S --> I), then run the result of that through
// the second operation (I --> T).
- I intermediate = _op1.coerce(input);
+ I intermediate = op1.coerce(input);
- return _op2.coerce(intermediate);
+ return op2.coerce(intermediate);
}
@Override
public String toString()
{
- return String.format("%s, %s", _op1, _op2);
+ return String.format("%s, %s", op1, op2);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/CtClassSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/CtClassSourceImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/CtClassSourceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/CtClassSourceImpl.java Tue May 6 14:52:36 2008
@@ -26,26 +26,26 @@
*/
public class CtClassSourceImpl implements CtClassSource
{
- private final ClassFactoryClassPool _pool;
+ private final ClassFactoryClassPool pool;
- private final ClassLoader _loader;
+ private final ClassLoader loader;
- private final ProtectionDomain _domain = getClass().getProtectionDomain();
+ private final ProtectionDomain domain = getClass().getProtectionDomain();
- private int _createdClassCount = 0;
+ private int createdClassCount = 0;
/**
* Returns the number of classes (and interfaces) created by this source.
*/
public synchronized int getCreatedClassCount()
{
- return _createdClassCount;
+ return createdClassCount;
}
public CtClassSourceImpl(ClassFactoryClassPool pool, ClassLoader loader)
{
- _pool = pool;
- _loader = loader;
+ this.pool = pool;
+ this.loader = loader;
}
public CtClass toCtClass(Class searchClass)
@@ -55,7 +55,7 @@
// Add the class loader for the searchClass to the class pool and
// delegating class loader if needed.
- _pool.addClassLoaderIfNeeded(loader);
+ pool.addClassLoaderIfNeeded(loader);
String name = ClassFabUtils.toJavaClassName(searchClass);
@@ -66,7 +66,7 @@
{
try
{
- return _pool.get(name);
+ return pool.get(name);
}
catch (NotFoundException ex)
{
@@ -78,7 +78,7 @@
{
CtClass ctSuperClass = toCtClass(superClass);
- return _pool.makeClass(name, ctSuperClass);
+ return pool.makeClass(name, ctSuperClass);
}
private static final String WRITE_DIR = System.getProperty("javassist-write-dir");
@@ -89,9 +89,9 @@
try
{
- Class result = _pool.toClass(ctClass, _loader, _domain);
+ Class result = pool.toClass(ctClass, loader, domain);
- _createdClassCount++;
+ createdClassCount++;
return result;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImpl.java Tue May 6 14:52:36 2008
@@ -25,24 +25,23 @@
*/
public class DefaultImplementationBuilderImpl implements DefaultImplementationBuilder
{
- private final Map<Class, Object> _cache = newConcurrentMap();
+ private final Map<Class, Object> cache = newConcurrentMap();
- private final ClassFactory _classFactory;
+ private final ClassFactory classFactory;
- public DefaultImplementationBuilderImpl(@Builtin
- ClassFactory classFactory)
+ public DefaultImplementationBuilderImpl(@Builtin ClassFactory classFactory)
{
- _classFactory = classFactory;
+ this.classFactory = classFactory;
}
public <S> S createDefaultImplementation(Class<S> serviceInterface)
{
- S instance = serviceInterface.cast(_cache.get(serviceInterface));
+ S instance = serviceInterface.cast(cache.get(serviceInterface));
if (instance == null)
{
instance = createInstance(serviceInterface);
- _cache.put(serviceInterface, instance);
+ cache.put(serviceInterface, instance);
}
return instance;
@@ -64,7 +63,7 @@
{
S instance = noopClass.newInstance();
- _cache.put(serviceInterface, instance);
+ cache.put(serviceInterface, instance);
return instance;
}
@@ -77,7 +76,7 @@
@SuppressWarnings("unchecked")
private <S> Class<S> createClass(Class<S> serviceInterface)
{
- ClassFab cf = _classFactory.newClass(serviceInterface);
+ ClassFab cf = classFactory.newClass(serviceInterface);
MethodIterator mi = new MethodIterator(serviceInterface);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalysisImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalysisImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalysisImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalysisImpl.java Tue May 6 14:52:36 2008
@@ -1,17 +1,17 @@
-// Copyright 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.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
+// Copyright 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package org.apache.tapestry.ioc.internal.services;
import org.apache.tapestry.ioc.services.ExceptionAnalysis;
@@ -25,22 +25,22 @@
*/
public class ExceptionAnalysisImpl implements ExceptionAnalysis
{
- private final List<ExceptionInfo> _infos;
+ private final List<ExceptionInfo> infos;
public ExceptionAnalysisImpl(final List<ExceptionInfo> infos)
{
- _infos = unmodifiableList(infos);
+ this.infos = unmodifiableList(infos);
}
public List<ExceptionInfo> getExceptionInfos()
{
- return _infos;
+ return infos;
}
@Override
public String toString()
{
- ExceptionInfo first = _infos.get(0);
+ ExceptionInfo first = infos.get(0);
return String.format("ExceptionAnalysis[%s -- %s]", first.getClassName(), first
.getMessage());
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionAnalyzerImpl.java Tue May 6 14:52:36 2008
@@ -25,15 +25,15 @@
public class ExceptionAnalyzerImpl implements ExceptionAnalyzer
{
- private final PropertyAccess _propertyAccess;
+ private final PropertyAccess propertyAccess;
- private final Set<String> _throwableProperties;
+ private final Set<String> throwableProperties;
public ExceptionAnalyzerImpl(PropertyAccess propertyAccess)
{
- _propertyAccess = propertyAccess;
+ this.propertyAccess = propertyAccess;
- _throwableProperties = newSet(_propertyAccess.getAdapter(Throwable.class)
+ throwableProperties = newSet(this.propertyAccess.getAdapter(Throwable.class)
.getPropertyNames());
}
@@ -96,11 +96,11 @@
{
Map<String, Object> properties = newMap();
- ClassPropertyAdapter adapter = _propertyAccess.getAdapter(t);
+ ClassPropertyAdapter adapter = propertyAccess.getAdapter(t);
for (String name : adapter.getPropertyNames())
{
- if (_throwableProperties.contains(name)) continue;
+ if (throwableProperties.contains(name)) continue;
Object value = adapter.get(t, name);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionInfoImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionInfoImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionInfoImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionInfoImpl.java Tue May 6 14:52:36 2008
@@ -23,46 +23,46 @@
public class ExceptionInfoImpl implements ExceptionInfo
{
- private final String _className;
+ private final String className;
- private final String _message;
+ private final String message;
- private final Map<String, Object> _properties;
+ private final Map<String, Object> properties;
- private final List<StackTraceElement> _stackTrace;
+ private final List<StackTraceElement> stackTrace;
public ExceptionInfoImpl(Throwable t, Map<String, Object> properties, List<StackTraceElement> stackTrace)
{
- _className = t.getClass().getName();
- _message = t.getMessage() != null ? t.getMessage() : "";
+ className = t.getClass().getName();
+ message = t.getMessage() != null ? t.getMessage() : "";
- _properties = properties;
- _stackTrace = unmodifiableList(stackTrace);
+ this.properties = properties;
+ this.stackTrace = unmodifiableList(stackTrace);
}
public String getClassName()
{
- return _className;
+ return className;
}
public String getMessage()
{
- return _message;
+ return message;
}
public Object getProperty(String name)
{
- return _properties.get(name);
+ return properties.get(name);
}
public List<String> getPropertyNames()
{
- return InternalUtils.sortedKeys(_properties);
+ return InternalUtils.sortedKeys(properties);
}
public List<StackTraceElement> getStackTrace()
{
- return _stackTrace;
+ return stackTrace;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionTrackerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionTrackerImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionTrackerImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ExceptionTrackerImpl.java Tue May 6 14:52:36 2008
@@ -16,7 +16,7 @@
import static org.apache.tapestry.ioc.IOCConstants.PERTHREAD_SCOPE;
import org.apache.tapestry.ioc.annotations.Scope;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newSet;
+import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import org.apache.tapestry.ioc.services.ExceptionTracker;
import java.util.Set;
@@ -24,13 +24,13 @@
@Scope(PERTHREAD_SCOPE)
public class ExceptionTrackerImpl implements ExceptionTracker
{
- private final Set<Throwable> _exceptions = newSet();
+ private final Set<Throwable> exceptions = CollectionFactory.newSet();
public boolean exceptionLogged(Throwable exception)
{
- boolean result = _exceptions.contains(exception);
+ boolean result = exceptions.contains(exception);
- _exceptions.add(exception);
+ exceptions.add(exception);
return result;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/FilterMethodAnalyzer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/FilterMethodAnalyzer.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/FilterMethodAnalyzer.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/FilterMethodAnalyzer.java Tue May 6 14:52:36 2008
@@ -17,17 +17,16 @@
import org.apache.tapestry.ioc.services.MethodSignature;
/**
- * Used by {@link org.apache.tapestry.ioc.internal.services.PipelineBuilderImpl} to analyze service
- * interface methods against filter interface methods to find the position of the extra service
- * parameter (in the filter method).
+ * Used by {@link org.apache.tapestry.ioc.internal.services.PipelineBuilderImpl} to analyze service interface methods
+ * against filter interface methods to find the position of the extra service parameter (in the filter method).
*/
public class FilterMethodAnalyzer
{
- private final Class _serviceInterface;
+ private final Class serviceInterface;
FilterMethodAnalyzer(Class serviceInterface)
{
- _serviceInterface = serviceInterface;
+ this.serviceInterface = serviceInterface;
}
public int findServiceInterfacePosition(MethodSignature ms, MethodSignature fms)
@@ -53,7 +52,7 @@
for (int i = 0; i < filterParameterCount; i++)
{
- if (filterParameters[i] == _serviceInterface)
+ if (filterParameters[i] == serviceInterface)
{
result = i;
found = true;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/JustInTimeObjectCreator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/JustInTimeObjectCreator.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/JustInTimeObjectCreator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/JustInTimeObjectCreator.java Tue May 6 14:52:36 2008
@@ -21,63 +21,62 @@
import org.apache.tapestry.ioc.services.Status;
/**
- * Invoked from a fabricated service delegate to get or realize (instantiate and configure) the
- * service implementation. This includes synchronization logic, to prevent multiple threads from
- * attempting to realize the same service at the same time (a service should be realized only once).
- * The additional interfaces implemented by this class support eager loading of services (at
- * application startup), and orderly shutdown of proxies.
+ * Invoked from a fabricated service delegate to get or realize (instantiate and configure) the service implementation.
+ * This includes synchronization logic, to prevent multiple threads from attempting to realize the same service at the
+ * same time (a service should be realized only once). The additional interfaces implemented by this class support eager
+ * loading of services (at application startup), and orderly shutdown of proxies.
*/
public class JustInTimeObjectCreator implements ObjectCreator, EagerLoadServiceProxy,
- RegistryShutdownListener
+ RegistryShutdownListener
{
- private final ServiceActivityTracker _tracker;
+ private final ServiceActivityTracker tracker;
- private ObjectCreator _creator;
+ private ObjectCreator creator;
- private boolean _shutdown;
+ private boolean shutdown;
- private Object _object;
+ private Object object;
- private final String _serviceId;
+ private final String serviceId;
public JustInTimeObjectCreator(ServiceActivityTracker tracker, ObjectCreator creator,
String serviceId)
{
- _tracker = tracker;
- _creator = creator;
- _serviceId = serviceId;
+ this.tracker = tracker;
+ this.creator = creator;
+ this.serviceId = serviceId;
}
/**
- * Checks to see if the proxy has been shutdown, then invokes
- * {@link ObjectCreator#createObject()} if it has not already done so.
+ * Checks to see if the proxy has been shutdown, then invokes {@link ObjectCreator#createObject()} if it has not
+ * already done so.
*
* @throws IllegalStateException if the registry has been shutdown
*/
public synchronized Object createObject()
{
- if (_shutdown)
- throw new IllegalStateException(ServiceMessages.registryShutdown(_serviceId));
+ if (shutdown)
+ throw new IllegalStateException(ServiceMessages.registryShutdown(serviceId));
- if (_object == null)
+ if (object == null)
{
try
{
- _object = _creator.createObject();
+ object = creator.createObject();
// And if that's successful ...
- _tracker.setStatus(_serviceId, Status.REAL);
+ tracker.setStatus(serviceId, Status.REAL);
- _creator = null;
+ creator = null;
}
catch (RuntimeException ex)
{
- throw new RuntimeException(ServiceMessages.serviceBuildFailure(_serviceId, ex), ex);
+ throw new RuntimeException(ServiceMessages.serviceBuildFailure(serviceId, ex), ex);
}
}
- return _object;
+ return object;
}
/**
@@ -95,9 +94,9 @@
*/
public synchronized void registryDidShutdown()
{
- _shutdown = true;
- _object = null;
- _creator = null;
+ shutdown = true;
+ object = null;
+ creator = null;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingAdvice.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingAdvice.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingAdvice.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingAdvice.java Tue May 6 14:52:36 2008
@@ -21,16 +21,16 @@
public class LoggingAdvice implements MethodAdvice
{
- private final MethodLogger _methodLogger;
+ private final MethodLogger methodLogger;
public LoggingAdvice(Logger logger, ExceptionTracker exceptionTracker)
{
- _methodLogger = new MethodLogger(logger, exceptionTracker);
+ methodLogger = new MethodLogger(logger, exceptionTracker);
}
public void advise(Invocation invocation)
{
- boolean debug = _methodLogger.isDebugEnabled();
+ boolean debug = methodLogger.isDebugEnabled();
if (!debug)
{
@@ -38,7 +38,7 @@
return;
}
- _methodLogger.entry(invocation);
+ methodLogger.entry(invocation);
try
{
@@ -46,7 +46,7 @@
}
catch (RuntimeException ex)
{
- _methodLogger.fail(invocation, ex);
+ methodLogger.fail(invocation, ex);
throw ex;
}
@@ -55,11 +55,11 @@
{
Exception thrown = invocation.getThrown(Exception.class);
- _methodLogger.fail(invocation, thrown);
+ methodLogger.fail(invocation, thrown);
return;
}
- _methodLogger.exit(invocation);
+ methodLogger.exit(invocation);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java Tue May 6 14:52:36 2008
@@ -22,23 +22,23 @@
public class LoggingDecoratorImpl implements LoggingDecorator
{
- private final AspectDecorator _aspectDecorator;
+ private final AspectDecorator aspectDecorator;
- private final ExceptionTracker _exceptionTracker;
+ private final ExceptionTracker exceptionTracker;
public LoggingDecoratorImpl(AspectDecorator aspectDecorator, ExceptionTracker exceptionTracker)
{
- _aspectDecorator = aspectDecorator;
- _exceptionTracker = exceptionTracker;
+ this.aspectDecorator = aspectDecorator;
+ this.exceptionTracker = exceptionTracker;
}
public <T> T build(Class<T> serviceInterface, T delegate, String serviceId, final Logger logger)
{
- MethodAdvice advice = new LoggingAdvice(logger, _exceptionTracker);
+ MethodAdvice advice = new LoggingAdvice(logger, exceptionTracker);
- return _aspectDecorator.build(serviceInterface, delegate, advice,
- String.format("<Logging interceptor for %s(%s)>", serviceId,
- serviceInterface.getName()));
+ return aspectDecorator.build(serviceInterface, delegate, advice,
+ String.format("<Logging interceptor for %s(%s)>", serviceId,
+ serviceInterface.getName()));
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MapSymbolProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MapSymbolProvider.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MapSymbolProvider.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MapSymbolProvider.java Tue May 6 14:52:36 2008
@@ -19,21 +19,21 @@
import java.util.Map;
/**
- * Provides symbol values from a Map of symbol names and symbol values (typically provided by a
- * Tapestry IOC service configuration).
+ * Provides symbol values from a Map of symbol names and symbol values (typically provided by a Tapestry IOC service
+ * configuration).
*/
public class MapSymbolProvider implements SymbolProvider
{
- private final Map<String, String> _configuration;
+ private final Map<String, String> configuration;
public MapSymbolProvider(final Map<String, String> configuration)
{
- _configuration = configuration;
+ this.configuration = configuration;
}
public String valueForSymbol(String symbolName)
{
- return _configuration.get(symbolName);
+ return configuration.get(symbolName);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MasterObjectProviderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MasterObjectProviderImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MasterObjectProviderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MasterObjectProviderImpl.java Tue May 6 14:52:36 2008
@@ -23,17 +23,17 @@
public class MasterObjectProviderImpl implements MasterObjectProvider
{
- private final List<ObjectProvider> _configuration;
+ private final List<ObjectProvider> configuration;
public MasterObjectProviderImpl(List<ObjectProvider> configuration)
{
- _configuration = configuration;
+ this.configuration = configuration;
}
public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator,
boolean required)
{
- for (ObjectProvider provider : _configuration)
+ for (ObjectProvider provider : configuration)
{
T result = provider.provide(objectType, annotationProvider, locator);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MethodLogger.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MethodLogger.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MethodLogger.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/MethodLogger.java Tue May 6 14:52:36 2008
@@ -35,19 +35,19 @@
private static final String FAIL = " FAIL";
- private final Logger _logger;
+ private final Logger logger;
- private final ExceptionTracker _exceptionTracker;
+ private final ExceptionTracker exceptionTracker;
public MethodLogger(Logger logger, ExceptionTracker exceptionTracker)
{
- _logger = logger;
- _exceptionTracker = exceptionTracker;
+ this.logger = logger;
+ this.exceptionTracker = exceptionTracker;
}
public boolean isDebugEnabled()
{
- return _logger.isDebugEnabled();
+ return logger.isDebugEnabled();
}
/**
@@ -70,7 +70,7 @@
buffer.append(")");
- _logger.debug(buffer.toString());
+ logger.debug(buffer.toString());
}
private void convert(StringBuilder buffer, Object object)
@@ -150,7 +150,7 @@
buffer.append(']');
}
- _logger.debug(buffer.toString());
+ logger.debug(buffer.toString());
}
/**
@@ -161,10 +161,10 @@
*/
public void fail(Invocation invocation, Throwable t)
{
- _logger.debug(
+ logger.debug(
format("[%s] %s -- %s", FAIL,
invocation.getMethodName(),
t.getClass().getName()),
- _exceptionTracker.exceptionLogged(t) ? null : t);
+ exceptionTracker.exceptionLogged(t) ? null : t);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceCreator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceCreator.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceCreator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceCreator.java Tue May 6 14:52:36 2008
@@ -25,33 +25,31 @@
*/
public class PerThreadServiceCreator implements ObjectCreator
{
- private final PerthreadManager _perthreadManager;
+ private final PerthreadManager perthreadManager;
- private final ObjectCreator _delegate;
+ private final ObjectCreator delegate;
public PerThreadServiceCreator(PerthreadManager perthreadManager, ObjectCreator delegate)
{
- _perthreadManager = perthreadManager;
- _delegate = delegate;
+ this.perthreadManager = perthreadManager;
+ this.delegate = delegate;
}
/**
- * For each thread, the first call will use the delegate
- * {@link org.apache.tapestry.ioc.ObjectCreator} to create an instance,
- * and later calls will reuse the same per-thread instance. The instance
- * is stored in the {@link org.apache.tapestry.ioc.services.PerthreadManager} and will
- * be released at the end of the request.
+ * For each thread, the first call will use the delegate {@link org.apache.tapestry.ioc.ObjectCreator} to create an
+ * instance, and later calls will reuse the same per-thread instance. The instance is stored in the {@link
+ * org.apache.tapestry.ioc.services.PerthreadManager} and will be released at the end of the request.
*/
public Object createObject()
{
// Use the ObjectCreator instance as the key. it will be unique.
- Object perthreadInstance = _perthreadManager.get(_delegate);
+ Object perthreadInstance = perthreadManager.get(delegate);
if (perthreadInstance == null)
{
- perthreadInstance = _delegate.createObject();
- _perthreadManager.put(_delegate, perthreadInstance);
+ perthreadInstance = delegate.createObject();
+ perthreadManager.put(delegate, perthreadInstance);
}
return perthreadInstance;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceLifecycle.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceLifecycle.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceLifecycle.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceLifecycle.java Tue May 6 14:52:36 2008
@@ -25,38 +25,36 @@
import java.lang.reflect.Modifier;
/**
- * Allows a service to exist "per thread" (in each thread). This involves an inner proxy,
- * which caches an object
- * derived from a {@link org.apache.tapestry.ioc.ObjectCreator} as a key in the
- * {@link org.apache.tapestry.ioc.services.PerthreadManager}.
+ * Allows a service to exist "per thread" (in each thread). This involves an inner proxy, which caches an object derived
+ * from a {@link org.apache.tapestry.ioc.ObjectCreator} as a key in the {@link org.apache.tapestry.ioc.services.PerthreadManager}.
* Method invocations are delegated to the per-thread service instance.
* <p/>
- * This scheme ensures that, although the service builder method will be invoked many times over the
- * life of the application, the service decoration process occurs only once. The final calling chain
- * is: Service Proxy --> Decorator(s) --> PerThread Proxy --> (per thread) instance.
+ * This scheme ensures that, although the service builder method will be invoked many times over the life of the
+ * application, the service decoration process occurs only once. The final calling chain is: Service Proxy -->
+ * Decorator(s) --> PerThread Proxy --> (per thread) instance.
*/
public class PerThreadServiceLifecycle implements ServiceLifecycle
{
- private final PerthreadManager _perthreadManager;
+ private static final String PER_THREAD_METHOD_NAME = "_perThreadInstance";
- private final ClassFactory _classFactory;
+ private final PerthreadManager perthreadManager;
- private static final String PER_THREAD_METHOD_NAME = "_perThreadInstance";
+ private final ClassFactory classFactory;
public PerThreadServiceLifecycle(PerthreadManager perthreadManager,
@Builtin
ClassFactory classFactory)
{
- _perthreadManager = perthreadManager;
- _classFactory = classFactory;
+ this.perthreadManager = perthreadManager;
+ this.classFactory = classFactory;
}
public Object createService(ServiceResources resources, ObjectCreator creator)
{
Class proxyClass = createProxyClass(resources);
- ObjectCreator perThreadCreator = new PerThreadServiceCreator(_perthreadManager, creator);
+ ObjectCreator perThreadCreator = new PerThreadServiceCreator(perthreadManager, creator);
try
{
@@ -78,14 +76,14 @@
{
Class serviceInterface = resources.getServiceInterface();
- ClassFab cf = _classFactory.newClass(serviceInterface);
+ ClassFab cf = classFactory.newClass(serviceInterface);
cf.addField("_creator", Modifier.PRIVATE | Modifier.FINAL, ObjectCreator.class);
// Constructor takes a ServiceCreator
cf.addConstructor(new Class[]
- {ObjectCreator.class}, null, "_creator = $1;");
+ { ObjectCreator.class }, null, "_creator = $1;");
String body = format("return (%s) _creator.createObject();", serviceInterface.getName());
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerthreadManagerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerthreadManagerImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerthreadManagerImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerthreadManagerImpl.java Tue May 6 14:52:36 2008
@@ -35,19 +35,19 @@
}
}
- private final Logger _logger;
+ private final Logger logger;
- private final MapHolder _holder = new MapHolder();
+ private final MapHolder holder = new MapHolder();
public PerthreadManagerImpl(Logger logger)
{
- _logger = logger;
+ this.logger = logger;
}
private synchronized Map getPerthreadMap()
{
- return _holder.get();
+ return holder.get();
}
@@ -87,7 +87,7 @@
}
catch (Exception ex)
{
- _logger.warn(ServiceMessages.threadCleanupError(listener, ex), ex);
+ logger.warn(ServiceMessages.threadCleanupError(listener, ex), ex);
}
}
@@ -96,7 +96,7 @@
synchronized (this)
{
- _holder.remove();
+ holder.remove();
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java Tue May 6 14:52:36 2008
@@ -24,21 +24,21 @@
public class PipelineBuilderImpl implements PipelineBuilder
{
- private final ClassFactory _classFactory;
+ private final ClassFactory classFactory;
- private final DefaultImplementationBuilder _defaultImplementationBuilder;
+ private final DefaultImplementationBuilder defaultImplementationBuilder;
public PipelineBuilderImpl(@Builtin ClassFactory classFactory,
DefaultImplementationBuilder defaultImplementationBuilder)
{
- _classFactory = classFactory;
- _defaultImplementationBuilder = defaultImplementationBuilder;
+ this.classFactory = classFactory;
+ this.defaultImplementationBuilder = defaultImplementationBuilder;
}
public <S, F> S build(Logger logger, Class<S> serviceInterface, Class<F> filterInterface, List<F> filters)
{
- S terminator = _defaultImplementationBuilder.createDefaultImplementation(serviceInterface);
+ S terminator = defaultImplementationBuilder.createDefaultImplementation(serviceInterface);
return build(logger, serviceInterface, filterInterface, filters, terminator);
}
@@ -48,7 +48,7 @@
{
if (filters.isEmpty()) return terminator;
- BridgeBuilder<S, F> bb = new BridgeBuilder<S, F>(logger, serviceInterface, filterInterface, _classFactory);
+ BridgeBuilder<S, F> bb = new BridgeBuilder<S, F>(logger, serviceInterface, filterInterface, classFactory);
// The first bridge will point to the terminator.
// Like service decorators, we work deepest (last)
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImpl.java Tue May 6 14:52:36 2008
@@ -14,7 +14,7 @@
package org.apache.tapestry.ioc.internal.services;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.*;
+import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import org.apache.tapestry.ioc.services.ClassPropertyAdapter;
import org.apache.tapestry.ioc.services.PropertyAccess;
@@ -29,7 +29,7 @@
public class PropertyAccessImpl implements PropertyAccess
{
- private final Map<Class, ClassPropertyAdapter> _adapters = newConcurrentMap();
+ private final Map<Class, ClassPropertyAdapter> adapters = CollectionFactory.newConcurrentMap();
public Object get(Object instance, String propertyName)
{
@@ -46,7 +46,7 @@
*/
public synchronized void clearCache()
{
- _adapters.clear();
+ adapters.clear();
Introspector.flushCaches();
}
@@ -58,22 +58,21 @@
public ClassPropertyAdapter getAdapter(Class forClass)
{
- ClassPropertyAdapter result = _adapters.get(forClass);
+ ClassPropertyAdapter result = adapters.get(forClass);
if (result == null)
{
result = buildAdapter(forClass);
- _adapters.put(forClass, result);
+ adapters.put(forClass, result);
}
return result;
}
/**
- * Builds a new adapter and updates the _adapters cache. This not only guards access to the
- * adapter cache, but also serializes access to the Java Beans Introspector, which is not thread
- * safe. In addition, handles the case where the class in question is an interface, accumulating
- * properties inherited from super-classes.
+ * Builds a new adapter and updates the _adapters cache. This not only guards access to the adapter cache, but also
+ * serializes access to the Java Beans Introspector, which is not thread safe. In addition, handles the case where
+ * the class in question is an interface, accumulating properties inherited from super-classes.
*/
private synchronized ClassPropertyAdapter buildAdapter(Class forClass)
{
@@ -84,7 +83,7 @@
{
BeanInfo info = Introspector.getBeanInfo(forClass);
- List<PropertyDescriptor> descriptors = newList();
+ List<PropertyDescriptor> descriptors = CollectionFactory.newList();
addAll(descriptors, info.getPropertyDescriptors());
@@ -106,7 +105,7 @@
private void addPropertiesFromExtendedInterfaces(Class forClass, List<PropertyDescriptor> descriptors)
throws IntrospectionException
{
- LinkedList<Class> queue = newLinkedList();
+ LinkedList<Class> queue = CollectionFactory.newLinkedList();
// Seed the queue
addAll(queue, forClass.getInterfaces());
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAdapterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAdapterImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAdapterImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyAdapterImpl.java Tue May 6 14:52:36 2008
@@ -24,67 +24,67 @@
public class PropertyAdapterImpl implements PropertyAdapter
{
- private final String _name;
+ private final String name;
- private final Method _readMethod;
+ private final Method readMethod;
- private final Method _writeMethod;
+ private final Method writeMethod;
- private final Class _type;
+ private final Class type;
- private final boolean _castRequired;
+ private final boolean castRequired;
public PropertyAdapterImpl(String name, Class type, Method readMethod, Method writeMethod)
{
- _name = notBlank(name, "name");
- _type = notNull(type, "type");
+ this.name = notBlank(name, "name");
+ this.type = notNull(type, "type");
- _readMethod = readMethod;
- _writeMethod = writeMethod;
+ this.readMethod = readMethod;
+ this.writeMethod = writeMethod;
- _castRequired = readMethod != null && readMethod.getReturnType() != type;
+ castRequired = readMethod != null && readMethod.getReturnType() != type;
}
public String getName()
{
- return _name;
+ return name;
}
public Method getReadMethod()
{
- return _readMethod;
+ return readMethod;
}
public Class getType()
{
- return _type;
+ return type;
}
public Method getWriteMethod()
{
- return _writeMethod;
+ return writeMethod;
}
public boolean isRead()
{
- return _readMethod != null;
+ return readMethod != null;
}
public boolean isUpdate()
{
- return _writeMethod != null;
+ return writeMethod != null;
}
public Object get(Object instance)
{
- if (_readMethod == null)
- throw new UnsupportedOperationException(ServiceMessages.readNotSupported(instance, _name));
+ if (readMethod == null)
+ throw new UnsupportedOperationException(ServiceMessages.readNotSupported(instance, name));
Throwable fail;
try
{
- return _readMethod.invoke(instance);
+ return readMethod.invoke(instance);
}
catch (InvocationTargetException ex)
{
@@ -95,19 +95,19 @@
fail = ex;
}
- throw new RuntimeException(ServiceMessages.readFailure(_name, instance, fail), fail);
+ throw new RuntimeException(ServiceMessages.readFailure(name, instance, fail), fail);
}
public void set(Object instance, Object value)
{
- if (_writeMethod == null)
- throw new UnsupportedOperationException(ServiceMessages.writeNotSupported(instance, _name));
+ if (writeMethod == null)
+ throw new UnsupportedOperationException(ServiceMessages.writeNotSupported(instance, name));
Throwable fail;
try
{
- _writeMethod.invoke(instance, value);
+ writeMethod.invoke(instance, value);
return;
}
@@ -120,20 +120,20 @@
fail = ex;
}
- throw new RuntimeException(ServiceMessages.writeFailure(_name, instance, fail), fail);
+ throw new RuntimeException(ServiceMessages.writeFailure(name, instance, fail), fail);
}
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
{
- T result = _readMethod != null ? _readMethod.getAnnotation(annotationClass) : null;
+ T result = readMethod != null ? readMethod.getAnnotation(annotationClass) : null;
- if (result == null && _writeMethod != null) result = _writeMethod.getAnnotation(annotationClass);
+ if (result == null && writeMethod != null) result = writeMethod.getAnnotation(annotationClass);
return result;
}
public boolean isCastRequired()
{
- return _castRequired;
+ return castRequired;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyShadowBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyShadowBuilderImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyShadowBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyShadowBuilderImpl.java Tue May 6 14:52:36 2008
@@ -22,23 +22,23 @@
public class PropertyShadowBuilderImpl implements PropertyShadowBuilder
{
- private final ClassFactory _classFactory;
+ private final ClassFactory classFactory;
- private final PropertyAccess _propertyAccess;
+ private final PropertyAccess propertyAccess;
public PropertyShadowBuilderImpl(@Builtin
ClassFactory classFactory,
PropertyAccess propertyAccess)
{
- _classFactory = classFactory;
- _propertyAccess = propertyAccess;
+ this.classFactory = classFactory;
+ this.propertyAccess = propertyAccess;
}
public <T> T build(Object source, String propertyName, Class<T> propertyType)
{
Class sourceClass = source.getClass();
- PropertyAdapter adapter = _propertyAccess.getAdapter(sourceClass).getPropertyAdapter(
+ PropertyAdapter adapter = propertyAccess.getAdapter(sourceClass).getPropertyAdapter(
propertyName);
// TODO: Perhaps extend ClassPropertyAdapter to do these checks?
@@ -56,12 +56,12 @@
adapter.getType(),
propertyType));
- ClassFab cf = _classFactory.newClass(propertyType);
+ ClassFab cf = classFactory.newClass(propertyType);
cf.addField("_source", Modifier.PRIVATE | Modifier.FINAL, sourceClass);
cf.addConstructor(new Class[]
- {sourceClass}, null, "_source = $1;");
+ { sourceClass }, null, "_source = $1;");
String body = format("return _source.%s();", adapter.getReadMethod().getName());
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java Tue May 6 14:52:36 2008
@@ -24,33 +24,33 @@
public class RegistryShutdownHubImpl implements RegistryShutdownHub
{
- private final OneShotLock _lock = new OneShotLock();
+ private final OneShotLock lock = new OneShotLock();
- private final Logger _logger;
+ private final Logger logger;
- private final List<RegistryShutdownListener> _listeners = newThreadSafeList();
+ private final List<RegistryShutdownListener> listeners = newThreadSafeList();
public RegistryShutdownHubImpl(Logger logger)
{
- _logger = logger;
+ this.logger = logger;
}
public void addRegistryShutdownListener(RegistryShutdownListener listener)
{
- _lock.check();
+ lock.check();
- _listeners.add(listener);
+ listeners.add(listener);
}
/**
- * Fires the {@link RegistryShutdownListener#registryDidShutdown()} method on each listener. At
- * the end, all the listeners are discarded.
+ * Fires the {@link RegistryShutdownListener#registryDidShutdown()} method on each listener. At the end, all the
+ * listeners are discarded.
*/
public void fireRegistryDidShutdown()
{
- _lock.lock();
+ lock.lock();
- for (RegistryShutdownListener l : _listeners)
+ for (RegistryShutdownListener l : listeners)
{
try
{
@@ -58,11 +58,11 @@
}
catch (Exception ex)
{
- _logger.error(ServiceMessages.shutdownListenerError(l, ex), ex);
+ logger.error(ServiceMessages.shutdownListenerError(l, ex), ex);
}
}
- _listeners.clear();
+ listeners.clear();
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryStartup.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryStartup.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryStartup.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryStartup.java Tue May 6 14:52:36 2008
@@ -21,36 +21,34 @@
import java.util.List;
/**
- * Startup service for Tapestry IoC: automatically invoked at
- * {@linkplain Registry#performRegistryStartup() registry startup} to execute a series of
- * operations, via its ordered configuration of Runnable objects.
+ * Startup service for Tapestry IoC: automatically invoked at {@linkplain Registry#performRegistryStartup() registry
+ * startup} to execute a series of operations, via its ordered configuration of Runnable objects.
*/
public class RegistryStartup implements Runnable
{
- private final Logger _logger;
+ private final Logger logger;
- private final List<Runnable> _configuration;
+ private final List<Runnable> configuration;
- private final OneShotLock _lock = new OneShotLock();
+ private final OneShotLock lock = new OneShotLock();
public RegistryStartup(Logger logger, final List<Runnable> configuration)
{
- _logger = logger;
- _configuration = configuration;
+ this.logger = logger;
+ this.configuration = configuration;
}
/**
- * Invokes run() on each contributed object. If the object throws a runtime exception, it is
- * logged but startup continues anyway. This method may only be
- * {@linkplain OneShotLock invoked once}.
+ * Invokes run() on each contributed object. If the object throws a runtime exception, it is logged but startup
+ * continues anyway. This method may only be {@linkplain OneShotLock invoked once}.
*/
public void run()
{
- _lock.lock();
+ lock.lock();
// Do we want extra exception catching here?
- for (Runnable r : _configuration)
+ for (Runnable r : configuration)
{
try
{
@@ -58,14 +56,14 @@
}
catch (RuntimeException ex)
{
- _logger.error(ServiceMessages.startupFailure(ex));
+ logger.error(ServiceMessages.startupFailure(ex));
}
}
// We don't need them any more since this method can only be run once. It's a insignificant
// savings, but still a nice thing to do.
- _configuration.clear();
+ configuration.clear();
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImpl.java Tue May 6 14:52:36 2008
@@ -22,12 +22,11 @@
public class StrategyBuilderImpl implements StrategyBuilder
{
- private final ClassFactory _classFactory;
+ private final ClassFactory classFactory;
- public StrategyBuilderImpl(@Builtin
- ClassFactory classFactory)
+ public StrategyBuilderImpl(@Builtin ClassFactory classFactory)
{
- _classFactory = classFactory;
+ this.classFactory = classFactory;
}
public <S> S build(StrategyRegistry<S> registry)
@@ -52,13 +51,13 @@
private Class createImplClass(Class interfaceClass)
{
- ClassFab cf = _classFactory.newClass(interfaceClass);
+ ClassFab cf = classFactory.newClass(interfaceClass);
String interfaceClassName = interfaceClass.getName();
cf.addField("_registry", Modifier.PRIVATE | Modifier.FINAL, StrategyRegistry.class);
cf.addConstructor(new Class[]
- {StrategyRegistry.class}, null, "_registry = $1;");
+ { StrategyRegistry.class }, null, "_registry = $1;");
BodyBuilder builder = new BodyBuilder();
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StringLocation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StringLocation.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StringLocation.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StringLocation.java Tue May 6 14:52:36 2008
@@ -22,20 +22,20 @@
*/
public final class StringLocation implements Location
{
- private final String _description;
+ private final String description;
- private final int _line;
+ private final int line;
public StringLocation(String description, int line)
{
- _description = description;
- _line = line;
+ this.description = description;
+ this.line = line;
}
@Override
public String toString()
{
- return _description;
+ return description;
}
/**
@@ -48,12 +48,11 @@
public int getLine()
{
- return _line;
+ return line;
}
/**
- * Returns null; we don't know where the file really is (it's probably a class on the class
- * path).
+ * Returns null; we don't know where the file really is (it's probably a class on the class path).
*/
public Resource getResource()
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolObjectProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolObjectProvider.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolObjectProvider.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolObjectProvider.java Tue May 6 14:52:36 2008
@@ -28,16 +28,16 @@
*/
public class SymbolObjectProvider implements ObjectProvider
{
- private final SymbolSource _symbolSource;
+ private final SymbolSource symbolSource;
- private final TypeCoercer _typeCoercer;
+ private final TypeCoercer typeCoercer;
public SymbolObjectProvider(@Builtin SymbolSource symbolSource,
@Builtin TypeCoercer typeCoercer)
{
- _symbolSource = symbolSource;
- _typeCoercer = typeCoercer;
+ this.symbolSource = symbolSource;
+ this.typeCoercer = typeCoercer;
}
public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator)
@@ -46,13 +46,13 @@
if (annotation == null) return null;
- Object value = _symbolSource.valueForSymbol(annotation.value());
+ Object value = symbolSource.valueForSymbol(annotation.value());
IntermediateType it = annotationProvider.getAnnotation(IntermediateType.class);
- if (it != null) value = _typeCoercer.coerce(value, it.value());
+ if (it != null) value = typeCoercer.coerce(value, it.value());
- return _typeCoercer.coerce(value, objectType);
+ return typeCoercer.coerce(value, objectType);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolSourceImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolSourceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolSourceImpl.java Tue May 6 14:52:36 2008
@@ -14,7 +14,7 @@
package org.apache.tapestry.ioc.internal.services;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
+import org.apache.tapestry.ioc.internal.util.CollectionFactory;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newLinkedList;
import org.apache.tapestry.ioc.services.SymbolProvider;
import org.apache.tapestry.ioc.services.SymbolSource;
@@ -25,20 +25,19 @@
public class SymbolSourceImpl implements SymbolSource
{
- private final List<SymbolProvider> _providers;
+ private final List<SymbolProvider> providers;
/**
* Cache of symbol name to fully expanded symbol value.
*/
- private final Map<String, String> _cache = newConcurrentMap();
+ private final Map<String, String> _cache = CollectionFactory.newConcurrentMap();
/**
- * Contains execution data needed when performing an expansion (largely, to check for endless
- * recursion).
+ * Contains execution data needed when performing an expansion (largely, to check for endless recursion).
*/
private class SymbolExpansion
{
- private final LinkedList<String> _expandingSymbols = newLinkedList();
+ private final LinkedList<String> expandingSymbols = newLinkedList();
String expandSymbols(String input)
{
@@ -72,7 +71,7 @@
if (endx < 0)
{
- String message = _expandingSymbols.isEmpty() ? ServiceMessages
+ String message = expandingSymbols.isEmpty() ? ServiceMessages
.missingSymbolCloseBrace(input) : ServiceMessages
.missingSymbolCloseBraceInPath(input, path());
@@ -107,19 +106,19 @@
String expandSymbol(String symbolName)
{
- if (_expandingSymbols.contains(symbolName))
+ if (expandingSymbols.contains(symbolName))
{
- _expandingSymbols.add(symbolName);
+ expandingSymbols.add(symbolName);
throw new RuntimeException(ServiceMessages.recursiveSymbol(
symbolName,
pathFrom(symbolName)));
}
- _expandingSymbols.addLast(symbolName);
+ expandingSymbols.addLast(symbolName);
String value = null;
- for (SymbolProvider provider : _providers)
+ for (SymbolProvider provider : providers)
{
value = provider.valueForSymbol(symbolName);
@@ -129,7 +128,7 @@
if (value == null)
{
- String message = _expandingSymbols.size() == 1 ? ServiceMessages
+ String message = expandingSymbols.size() == 1 ? ServiceMessages
.symbolUndefined(symbolName) : ServiceMessages.symbolUndefinedInPath(
symbolName,
path());
@@ -143,7 +142,7 @@
// And we're done expanding this symbol
- _expandingSymbols.removeLast();
+ expandingSymbols.removeLast();
return result;
@@ -155,7 +154,7 @@
boolean first = true;
- for (String symbolName : _expandingSymbols)
+ for (String symbolName : expandingSymbols)
{
if (!first) builder.append(" --> ");
@@ -174,7 +173,7 @@
boolean first = true;
boolean match = false;
- for (String symbolName : _expandingSymbols)
+ for (String symbolName : expandingSymbols)
{
if (!match)
{
@@ -197,7 +196,7 @@
public SymbolSourceImpl(final List<SymbolProvider> providers)
{
- _providers = providers;
+ this.providers = providers;
}
public String expandSymbols(String input)
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ThreadLocaleImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ThreadLocaleImpl.java?rev=653936&r1=653935&r2=653936&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ThreadLocaleImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ThreadLocaleImpl.java Tue May 6 14:52:36 2008
@@ -24,17 +24,17 @@
@Scope(PERTHREAD_SCOPE)
public class ThreadLocaleImpl implements ThreadLocale
{
- private Locale _locale = Locale.getDefault();
+ private Locale locale = Locale.getDefault();
public Locale getLocale()
{
- return _locale;
+ return locale;
}
public void setLocale(Locale locale)
{
notNull(locale, "locale");
- _locale = locale;
+ this.locale = locale;
}
}