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 2007/03/10 06:25:15 UTC
svn commit: r516653 - in
/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc:
.settings/ src/main/java/org/apache/tapestry/ioc/
src/main/java/org/apache/tapestry/ioc/annotations/
src/main/java/org/apache/tapestry/ioc/def/ src/main/jav...
Author: hlship
Date: Fri Mar 9 21:25:07 2007
New Revision: 516653
URL: http://svn.apache.org/viewvc?view=rev&rev=516653
Log:
Remove the @Private annotation, and the concept of service visibility (all services are now visible).
Added:
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryWrapper.java
Removed:
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/annotations/Private.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/ServiceObjectProviderModule.java
Modified:
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/.settings/org.eclipse.jdt.core.prefs
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/GlobPatternMatcher.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceDefImpl.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceLocatorImpl.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceObjectProvider.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/util/Orderer.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/FredModule.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/RegistryBuilderOverrideTest.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTestModule.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/OneShotServiceCreatorTest.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImplTest.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/util/LocationImplTest.java
tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/util/CaseInsensitiveMapTest.java
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/.settings/org.eclipse.jdt.core.prefs?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/.settings/org.eclipse.jdt.core.prefs (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/.settings/org.eclipse.jdt.core.prefs Fri Mar 9 21:25:07 2007
@@ -1,4 +1,4 @@
-#Mon Nov 20 20:08:12 PST 2006
+#Fri Mar 09 21:19:19 PST 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -8,6 +8,56 @@
org.eclipse.jdt.core.codeComplete.localSuffixes=
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java Fri Mar 9 21:25:07 2007
@@ -28,6 +28,7 @@
import org.apache.tapestry.ioc.internal.DefaultModuleDefImpl;
import org.apache.tapestry.ioc.internal.LogSourceImpl;
import org.apache.tapestry.ioc.internal.RegistryImpl;
+import org.apache.tapestry.ioc.internal.RegistryWrapper;
import org.apache.tapestry.ioc.internal.util.OneShotLock;
import org.apache.tapestry.ioc.services.TapestryIOCModule;
@@ -126,7 +127,8 @@
{
_lock.lock();
- return new RegistryImpl(_modules, _classLoader, _logSource, _serviceOverrides);
+ return new RegistryWrapper(new RegistryImpl(_modules, _classLoader, _logSource,
+ _serviceOverrides));
}
public ClassLoader getClassLoader()
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java Fri Mar 9 21:25:07 2007
@@ -48,13 +48,6 @@
String getServiceLifeycle();
/**
- * Returns true if the service is private, visible only within the same module.
- *
- * @see org.apache.tapestry.ioc.annotations.Private
- */
- boolean isPrivate();
-
- /**
* Returns true if the service should be eagerly loaded at Registry startup.
*
* @see org.apache.tapestry.ioc.annotations.EagerLoad
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java Fri Mar 9 21:25:07 2007
@@ -24,8 +24,6 @@
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newSet;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Comparator;
@@ -41,7 +39,6 @@
import org.apache.tapestry.ioc.annotations.Lifecycle;
import org.apache.tapestry.ioc.annotations.Match;
import org.apache.tapestry.ioc.annotations.Order;
-import org.apache.tapestry.ioc.annotations.Private;
import org.apache.tapestry.ioc.def.ContributionDef;
import org.apache.tapestry.ioc.def.DecoratorDef;
import org.apache.tapestry.ioc.def.ModuleDef;
@@ -121,15 +118,6 @@
return _serviceDefs.get(serviceId);
}
- // This appears useless, but it's really about some kind of ambiguity in Class, which seems
- // to think getAnnotation() returns Object, not <? extends Annotation>. This may be a bug
- // in Eclipse's Java compiler.
-
- private <T extends Annotation> T getAnnotation(AnnotatedElement element, Class<T> annotationType)
- {
- return element.getAnnotation(annotationType);
- }
-
private void grind()
{
Method[] methods = _builderClass.getMethods();
@@ -300,11 +288,9 @@
}
String lifecycle = extractLifecycle(method);
- boolean isPrivate = method.isAnnotationPresent(Private.class);
boolean eagerLoad = method.isAnnotationPresent(EagerLoad.class);
- _serviceDefs.put(serviceId, new ServiceDefImpl(serviceId, lifecycle, method, isPrivate,
- eagerLoad));
+ _serviceDefs.put(serviceId, new ServiceDefImpl(serviceId, lifecycle, method, eagerLoad));
}
private String extractLifecycle(Method method)
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/GlobPatternMatcher.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/GlobPatternMatcher.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/GlobPatternMatcher.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/GlobPatternMatcher.java Fri Mar 9 21:25:07 2007
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007The 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.
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java Fri Mar 9 21:25:07 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.
@@ -100,9 +100,9 @@
}
protected final <T> void train_getService(InternalRegistry registry, String serviceId,
- Class<T> serviceInterface, Module module, T service)
+ Class<T> serviceInterface, T service)
{
- expect(registry.getService(serviceId, serviceInterface, module)).andReturn(service);
+ expect(registry.getService(serviceId, serviceInterface)).andReturn(service);
}
protected final Module newModule()
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java Fri Mar 9 21:25:07 2007
@@ -90,10 +90,6 @@
return MESSAGES.format("builder-method-returned-null", asString(method), serviceId);
}
- static String serviceIsPrivate(String serviceId)
- {
- return MESSAGES.format("service-is-private", serviceId);
- }
static String noServiceMatchesType(Class serviceInterface)
{
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java Fri Mar 9 21:25:07 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.
@@ -34,22 +34,18 @@
public interface InternalRegistry extends Registry, LogSource, RegistryShutdownHub
{
/**
- * Locates a service given a fully qualified service id and the corresponding service interface
- * type. This is typically invoked by a module (passing itself as the third parameter), but may
- * also be invoked by the registry itself, passing null for module.
+ * Locates a service given a service id and the corresponding service interface type.
*
* @param <T>
* @param serviceId
- * the simple or fully qualified service id
+ * the unique service id (case insensitive)
* @param serviceInterface
* the interface the service implements
- * @param module
- * the module requesting the service (used for visibility checks)
* @return the service's proxy
* @throws RuntimeException
* if the service does not exist (this is considered programmer error)
*/
- <T> T getService(String serviceId, Class<T> serviceInterface, Module module);
+ <T> T getService(String serviceId, Class<T> serviceInterface);
/**
* Locates a service given just a service interface. A single service must implement the service
@@ -60,14 +56,12 @@
* @param <T>
* @param serviceInterface
* the interface the service implements
- * @param module
- * the module requesting the service (used for visibility checks)
* @return the service's proxy
* @throws RuntimeException
* if the service does not exist (this is considered programmer error), or multiple
* services implement the service interface
*/
- <T> T getService(Class<T> serviceInterface, Module module);
+ <T> T getService(Class<T> serviceInterface);
/**
* Returns a service lifecycle by name.
@@ -144,7 +138,7 @@
ClassFab newClass(Class serviceInterface);
/**
- * Provides an object by delegating to the tapestry.ioc.MasterObjectProvider service.
+ * Provides an object by delegating to the {@link ObjectProvider MasterObjectProvider} service.
*
* @param reference
* A string used to identify the objecty to be provided
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java Fri Mar 9 21:25:07 2007
@@ -39,26 +39,20 @@
* identifies the service to access
* @param serviceInterface
* the interface the service implements
- * @param module
- * the module requesting the service, or null for no module; this is used for
- * performing visibility checks
* @return the service's proxy
* @throws RuntimeException
- * if the service does not exist (this is considered programmer error)
+ * if there is an error instantiating the service proxy
*/
- <T> T getService(String serviceId, Class<T> serviceInterface, Module module);
+ <T> T getService(String serviceId, Class<T> serviceInterface);
/**
- * Locates the ids of all services that implement the provided service interface. The requesting
- * module is passed, so that visibility rules may be enforced.
+ * Locates the ids of all services that implement the provided service interface.
*
* @param serviceInterface
* the interface to search for
- * @param module
- * the module requesting the search, or null if no module is requesting the search
* @return a collection of service ids
*/
- Collection<String> findServiceIdsForInterface(Class serviceInterface, Module module);
+ Collection<String> findServiceIdsForInterface(Class serviceInterface);
/**
* Locates all the decorators that should apply the identified service. This includes visibility
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java Fri Mar 9 21:25:07 2007
@@ -83,7 +83,7 @@
/** Keyed on fully qualified service id; values are instantiated services (proxies). */
private final Map<String, Object> _services = newCaseInsensitiveMap();
- public <T> T getService(String serviceId, Class<T> serviceInterface, Module module)
+ public <T> T getService(String serviceId, Class<T> serviceInterface)
{
notBlank(serviceId, "serviceId");
notNull(serviceInterface, "serviceInterface");
@@ -94,9 +94,6 @@
// RegistryImpl should already have checked that the service exists.
assert def != null;
- if (notVisible(def, module))
- throw new RuntimeException(IOCMessages.serviceIsPrivate(serviceId));
-
Object service = findOrCreate(def);
try
@@ -126,11 +123,6 @@
return result;
}
- private boolean notVisible(ServiceDef def, Module module)
- {
- return def.isPrivate() && this != module;
- }
-
public List<ServiceDecorator> findDecoratorsForService(String serviceId)
{
ServiceDef sd = _moduleDef.getServiceDef(serviceId);
@@ -138,7 +130,7 @@
return _registry.findDecoratorsForService(sd);
}
- public Collection<String> findServiceIdsForInterface(Class serviceInterface, Module module)
+ public Collection<String> findServiceIdsForInterface(Class serviceInterface)
{
notNull(serviceInterface, "serviceInterface");
@@ -149,8 +141,6 @@
ServiceDef def = _moduleDef.getServiceDef(id);
if (def.getServiceInterface() != serviceInterface) continue;
-
- if (notVisible(def, module)) continue;
result.add(id);
}
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java Fri Mar 9 21:25:07 2007
@@ -18,7 +18,6 @@
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newList;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -55,6 +54,7 @@
import org.apache.tapestry.ioc.services.RegistryShutdownListener;
import org.apache.tapestry.ioc.services.ServiceLifecycleSource;
import org.apache.tapestry.ioc.services.SymbolSource;
+import org.apache.tapestry.ioc.services.TapestryIOCModule;
import org.apache.tapestry.ioc.services.ThreadCleanupHub;
public class RegistryImpl implements Registry, InternalRegistry
@@ -145,7 +145,7 @@
for (ModuleDef def : moduleDefs)
{
- Log log = _logSource.getLog(def.getBuilderClass().getName());
+ Log log = _logSource.getLog(def.getBuilderClass());
Module module = new ModuleImpl(this, def, log);
@@ -166,19 +166,19 @@
addBuiltin(LOG_SOURCE_SERVICE_ID, LogSource.class, _logSource);
- Log log = _logSource.getLog(RegistryImpl.CLASS_FACTORY_SERVICE_ID);
+ Log log = logForService(TapestryIOCModule.class, CLASS_FACTORY_SERVICE_ID);
_classFactory = new ClassFactoryImpl(contextClassLoader, log);
- addBuiltin(RegistryImpl.CLASS_FACTORY_SERVICE_ID, ClassFactory.class, _classFactory);
+ addBuiltin(CLASS_FACTORY_SERVICE_ID, ClassFactory.class, _classFactory);
- log = _logSource.getLog(THREAD_CLEANUP_HUB_SERVICE_ID);
+ log = logForService(TapestryIOCModule.class, THREAD_CLEANUP_HUB_SERVICE_ID);
_cleanupHub = new ThreadCleanupHubImpl(log);
addBuiltin(THREAD_CLEANUP_HUB_SERVICE_ID, ThreadCleanupHub.class, _cleanupHub);
- log = _logSource.getLog(REGISTRY_SHUTDOWN_HUB_SERVICE_ID);
+ log = logForService(TapestryIOCModule.class, REGISTRY_SHUTDOWN_HUB_SERVICE_ID);
_registryShutdownHub = new RegistryShutdownHubImpl(log);
@@ -195,6 +195,11 @@
m.eagerLoadServices();
}
+ private Log logForService(Class moduleClass, String serviceId)
+ {
+ return _logSource.getLog(moduleClass.getName() + "." + serviceId);
+ }
+
private <T> void addBuiltin(String serviceId, Class<T> serviceInterface, T service)
{
_builtinTypes.put(serviceId, serviceInterface);
@@ -209,7 +214,7 @@
}
/** Internal access, usually from another module. */
- public <T> T getService(String serviceId, Class<T> serviceInterface, Module module)
+ public <T> T getService(String serviceId, Class<T> serviceInterface)
{
_lock.check();
@@ -224,7 +229,7 @@
Module containingModule = locateModuleForService(serviceId);
- return containingModule.getService(serviceId, serviceInterface, module);
+ return containingModule.getService(serviceId, serviceInterface);
}
private <T> T checkForBuiltinService(String serviceId, Class<T> serviceInterface)
@@ -261,16 +266,6 @@
}
}
- /**
- * Access for a service from the outside world (limited to publically visible services).
- */
- public <T> T getService(String serviceId, Class<T> serviceInterface)
- {
- _lock.check();
-
- return getService(expandSymbols(serviceId), serviceInterface, null);
- }
-
public void cleanupThread()
{
_lock.check();
@@ -303,7 +298,7 @@
}
};
- Collection<Module> modules = modulesThatContributeToService(serviceDef);
+ Collection<Module> modules = _modules;
for (Module m : modules)
addToUnorderedConfiguration(configuration, objectType, serviceDef, m);
@@ -321,7 +316,7 @@
OrderedConfiguration<T> configuration = new OrderedConfigurationToOrdererAdaptor<T>(orderer);
- Collection<Module> modules = modulesThatContributeToService(serviceDef);
+ Collection<Module> modules = _modules;
for (Module m : modules)
addToOrderedConfiguration(configuration, objectType, serviceDef, m);
@@ -346,7 +341,7 @@
Map<K, ContributionDef> keyToContribution = newMap();
- Collection<Module> modules = modulesThatContributeToService(serviceDef);
+ Collection<Module> modules = _modules;
for (Module m : modules)
addToMappedConfiguration(
@@ -360,19 +355,6 @@
return result;
}
- private Collection<Module> modulesThatContributeToService(ServiceDef serviceDef)
- {
- if (serviceDef.isPrivate())
- {
- String serviceId = serviceDef.getServiceId();
- Module module = locateModuleForService(serviceId);
-
- return Arrays.asList(module);
- }
-
- return _modules;
- }
-
private <K, V> void addToMappedConfiguration(MappedConfiguration<K, V> configuration,
Map<K, ContributionDef> keyToContribution, Class<K> keyClass, Class<V> valueType,
ServiceDef serviceDef, Module module)
@@ -448,7 +430,7 @@
}
// Seems like something that could be cached.
- public <T> T getService(Class<T> serviceInterface, Module module)
+ public <T> T getService(Class<T> serviceInterface)
{
_lock.check();
@@ -456,7 +438,7 @@
for (Module m : _modules)
{
- Collection<String> matchingIds = m.findServiceIdsForInterface(serviceInterface, module);
+ Collection<String> matchingIds = m.findServiceIdsForInterface(serviceInterface);
ids.addAll(matchingIds);
}
@@ -470,7 +452,7 @@
String serviceId = ids.get(0);
- return getService(serviceId, serviceInterface, module);
+ return getService(serviceId, serviceInterface);
default:
@@ -480,13 +462,6 @@
}
}
- public <T> T getService(Class<T> serviceInterface)
- {
- _lock.check();
-
- return getService(serviceInterface, null);
- }
-
public ServiceLifecycle getServiceLifecycle(String lifecycle)
{
_lock.check();
@@ -549,18 +524,11 @@
private void addDecoratorDefsToOrderer(Orderer<DecoratorDef> orderer, ServiceDef serviceDef)
{
- if (serviceDef.isPrivate())
- {
- Set<DecoratorDef> privateDecorators = findDecoratorsDefsForPrivateService(serviceDef);
- addToOrderer(orderer, privateDecorators);
- }
- else
+
+ for (Module m : _modules)
{
- for (Module m : _modules)
- {
- Set<DecoratorDef> moduleDecorators = m.findMatchingDecoratorDefs(serviceDef);
- addToOrderer(orderer, moduleDecorators);
- }
+ Set<DecoratorDef> moduleDecorators = m.findMatchingDecoratorDefs(serviceDef);
+ addToOrderer(orderer, moduleDecorators);
}
}
@@ -570,13 +538,6 @@
{
orderer.add(df.getDecoratorId(), df, df.getConstraints());
}
- }
-
- private Set<DecoratorDef> findDecoratorsDefsForPrivateService(ServiceDef serviceDef)
- {
- Module module = locateModuleForService(serviceDef.getServiceId());
-
- return module.findMatchingDecoratorDefs(serviceDef);
}
public Log getLog(Class clazz)
Added: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryWrapper.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryWrapper.java?view=auto&rev=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryWrapper.java (added)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryWrapper.java Fri Mar 9 21:25:07 2007
@@ -0,0 +1,60 @@
+// Copyright 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.
+// 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;
+
+import org.apache.tapestry.ioc.Registry;
+import org.apache.tapestry.ioc.ServiceLocator;
+
+/**
+ * A wrapper around {@link InternalRegistry} that exists to expand symbols in a service id before
+ * invoking {@link ServiceLocator#getService(Class)}.
+ */
+public class RegistryWrapper implements Registry
+{
+ private final InternalRegistry _registry;
+
+ public RegistryWrapper(final InternalRegistry registry)
+ {
+ _registry = registry;
+ }
+
+ public void cleanupThread()
+ {
+ _registry.cleanupThread();
+ }
+
+ public void shutdown()
+ {
+ _registry.shutdown();
+ }
+
+ public <T> T getObject(String reference, Class<T> objectType)
+ {
+ return _registry.getObject(reference, objectType);
+ }
+
+ public <T> T getService(String serviceId, Class<T> serviceInterface)
+ {
+ String expandedServiceId = _registry.expandSymbols(serviceId);
+
+ return _registry.getService(expandedServiceId, serviceInterface);
+ }
+
+ public <T> T getService(Class<T> serviceInterface)
+ {
+ return _registry.getService(serviceInterface);
+ }
+
+}
\ No newline at end of file
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceDefImpl.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceDefImpl.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceDefImpl.java Fri Mar 9 21:25:07 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,79 +12,67 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.ioc.internal;
-
-import java.lang.reflect.Method;
-
-import org.apache.tapestry.ioc.ObjectCreator;
-import org.apache.tapestry.ioc.ServiceBuilderResources;
-import org.apache.tapestry.ioc.def.ServiceDef;
+package org.apache.tapestry.ioc.internal;
+
+import java.lang.reflect.Method;
+
+import org.apache.tapestry.ioc.ObjectCreator;
+import org.apache.tapestry.ioc.ServiceBuilderResources;
+import org.apache.tapestry.ioc.def.ServiceDef;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
-
-/**
- *
- */
-public class ServiceDefImpl implements ServiceDef
-{
- private final Method _builderMethod;
-
- private final String _serviceId;
-
- private final String _lifecycle;
-
- private final boolean _private;
-
- private final boolean _eagerLoad;
-
- ServiceDefImpl(String serviceId, String lifecycle, Method builderMethod, boolean isprivate,
- boolean eagerLoad)
- {
- _serviceId = serviceId;
- _lifecycle = lifecycle;
- _builderMethod = builderMethod;
- _private = isprivate;
- _eagerLoad = eagerLoad;
- }
-
- @Override
- public String toString()
- {
- return InternalUtils.asString(_builderMethod);
- }
-
- Method getBuilderMethod()
- {
- return _builderMethod;
- }
-
- public ObjectCreator createServiceCreator(ServiceBuilderResources resources)
- {
- return new ServiceBuilderMethodInvoker(_builderMethod, resources);
- }
-
- public String getServiceId()
- {
- return _serviceId;
- }
-
- public Class getServiceInterface()
- {
- return _builderMethod.getReturnType();
- }
-
- public String getServiceLifeycle()
- {
- return _lifecycle;
- }
-
- public boolean isPrivate()
- {
- return _private;
- }
-
- public boolean isEagerLoad()
- {
- return _eagerLoad;
- }
-
-}
+
+public class ServiceDefImpl implements ServiceDef
+{
+ private final Method _builderMethod;
+
+ private final String _serviceId;
+
+ private final String _lifecycle;
+
+ private final boolean _eagerLoad;
+
+ ServiceDefImpl(String serviceId, String lifecycle, Method builderMethod, boolean eagerLoad)
+ {
+ _serviceId = serviceId;
+ _lifecycle = lifecycle;
+ _builderMethod = builderMethod;
+ _eagerLoad = eagerLoad;
+ }
+
+ @Override
+ public String toString()
+ {
+ return InternalUtils.asString(_builderMethod);
+ }
+
+ Method getBuilderMethod()
+ {
+ return _builderMethod;
+ }
+
+ public ObjectCreator createServiceCreator(ServiceBuilderResources resources)
+ {
+ return new ServiceBuilderMethodInvoker(_builderMethod, resources);
+ }
+
+ public String getServiceId()
+ {
+ return _serviceId;
+ }
+
+ public Class getServiceInterface()
+ {
+ return _builderMethod.getReturnType();
+ }
+
+ public String getServiceLifeycle()
+ {
+ return _lifecycle;
+ }
+
+ public boolean isEagerLoad()
+ {
+ return _eagerLoad;
+ }
+
+}
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceLocatorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceLocatorImpl.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceLocatorImpl.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceLocatorImpl.java Fri Mar 9 21:25:07 2007
@@ -36,12 +36,12 @@
{
String expandedServiceId = _registry.expandSymbols(serviceId);
- return _registry.getService(expandedServiceId, serviceInterface, _module);
+ return _registry.getService(expandedServiceId, serviceInterface);
}
public <T> T getService(Class<T> serviceInterface)
{
- return _registry.getService(serviceInterface, _module);
+ return _registry.getService(serviceInterface);
}
public <T> T getObject(String reference, Class<T> objectType)
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceObjectProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceObjectProvider.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceObjectProvider.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceObjectProvider.java Fri Mar 9 21:25:07 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,27 +12,25 @@
// 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.ObjectProvider;
-import org.apache.tapestry.ioc.ServiceLocator;
-
-/**
- * Simple implementation of {@link org.apache.tapestry.ioc.ObjectProvider} that is mapped to the
- * "service" provider prefix.
- *
- *
- */
-public class ServiceObjectProvider implements ObjectProvider
-{
- /**
- * Interprets the expression as a local or fully qualified service id.
- *
- * @see ServiceLocator#getService(String, Class)
- */
- public <T> T provide(String expression, Class<T> objectType, ServiceLocator locator)
- {
- return locator.getService(expression, objectType);
- }
-
-}
+package org.apache.tapestry.ioc.internal.services;
+
+import org.apache.tapestry.ioc.ObjectProvider;
+import org.apache.tapestry.ioc.ServiceLocator;
+
+/**
+ * Simple implementation of {@link org.apache.tapestry.ioc.ObjectProvider} that is mapped to the
+ * "service" provider prefix.
+ */
+public class ServiceObjectProvider implements ObjectProvider
+{
+ /**
+ * Interprets the expression as a service id.
+ *
+ * @see ServiceLocator#getService(String)
+ */
+ public <T> T provide(String expression, Class<T> objectType, ServiceLocator locator)
+ {
+ return locator.getService(expression, objectType);
+ }
+
+}
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/util/Orderer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/util/Orderer.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/util/Orderer.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/java/org/apache/tapestry/ioc/internal/util/Orderer.java Fri Mar 9 21:25:07 2007
@@ -22,7 +22,6 @@
import java.util.Map;
import org.apache.commons.logging.Log;
-import org.apache.tapestry.ioc.IOCUtilities;
import org.apache.tapestry.ioc.IdMatcher;
import org.apache.tapestry.ioc.Orderable;
import org.apache.tapestry.ioc.internal.IdMatcherImpl;
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties Fri Mar 9 21:25:07 2007
@@ -25,9 +25,8 @@
builder-method-error=Error invoking service builder method %s (for service '%s'): %s
decorator-method-error=Error invoking service decorator method %s (for service '%s'): %s
builder-method-returned-null=Builder method %s (for service '%s') returned null.
-service-is-private=Service '%s' is private, and may not be referenced outside of its containing module.
-no-service-matches-type=No (visible) service implements the interface %s.
-many-service-matches=Service interface %s is matched by %d (visible) services: %s. \
+no-service-matches-type=No service implements the interface %s.
+many-service-matches=Service interface %s is matched by %d services: %s. \
Automatic dependency resolution requires that exactly one service implement the interface.
unknown-lifecycle=Unknown service lifecycle '%s'.
decorator-method-needs-delegate-parameter=Decorator methods must a parameter for the service delegate \
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/FredModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/FredModule.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/FredModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/FredModule.java Fri Mar 9 21:25:07 2007
@@ -20,10 +20,8 @@
import java.util.Collections;
import java.util.List;
-import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.ioc.annotations.Match;
import org.apache.tapestry.ioc.annotations.Order;
-import org.apache.tapestry.ioc.annotations.Private;
/**
* Module used to demonstrate decorator ordering.
@@ -45,21 +43,8 @@
};
}
- @Private
- public Runnable buildPrivateFred()
- {
- return buildFred();
- }
-
- /** A public alias of a private service. */
- public Runnable buildPrivateFredAlias(@InjectService("PrivateFred")
- Runnable privateFred)
- {
- return privateFred;
- }
-
@Match(
- { "UnorderedNames", "Fred", "PrivateFredAlias", "PrivateFred" })
+ { "UnorderedNames", "Fred" })
@Order("before:Beta")
public Object decorateAlpha(Object delegate, DecoratorList list)
{
@@ -69,7 +54,7 @@
}
@Match(
- { "UnorderedNames", "Fred", "PrivateFredAlias", "PrivateFred" })
+ { "UnorderedNames", "Fred" })
public Object decorateBeta(Object delegate, DecoratorList list)
{
list.add("beta");
@@ -119,23 +104,5 @@
{
configuration.add("UnorderedNames");
configuration.add("Beta");
- }
-
- @Private
- public NameListHolder buildPrivateUnorderedNames(final Collection<String> configuration)
- {
- return buildUnorderedNames(configuration);
- }
-
- public void contributePrivateUnorderedNames(Configuration<String> configuration)
- {
- configuration.add("PrivateUnorderedNames");
- configuration.add("Omega");
- }
-
- public NameListHolder buildPrivateUnorderedNamesAlias(@InjectService("PrivateUnorderedNames")
- NameListHolder privateService)
- {
- return privateService;
}
}
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java Fri Mar 9 21:25:07 2007
@@ -133,31 +133,6 @@
assertEquals(names, Arrays.asList("gamma", "beta", "alpha"));
}
- /**
- * Along the way, we are demonstrating that decorators can target multiple services within a
- * module, and can target services in other modules. The main point, though, is the difference
- * between a private and a public service in terms of decoration.
- */
- @Test
- public void private_service_decorator_order()
- {
- Registry r = buildRegistry();
-
- Runnable service = r.getService("PrivateFredAlias", Runnable.class);
-
- // Force creation
-
- service.run();
-
- List<String> names = r.getService(DecoratorList.class).getNames();
-
- // The trick here is that the public service (PrivateFredAlias) was decorated first with the
- // full set (the same as the previous test), then the private service (PrivateFred) was
- // decorated just with decorators from module fred.
-
- assertEquals(names, Arrays.asList("gamma", "beta", "alpha", "beta", "alpha"));
- }
-
@Test
public void public_service_unordered_configuration()
{
@@ -219,18 +194,6 @@
}
@Test
- public void private_service_unordered_configuration()
- {
- Registry r = buildRegistry();
-
- NameListHolder service = r.getService("PrivateUnorderedNamesAlias", NameListHolder.class);
-
- List<String> names = service.getNames();
-
- assertEquals(names, Arrays.asList("Omega", "PrivateUnorderedNames"));
- }
-
- @Test
public void unknown_lifecycle()
{
Registry r = buildRegistry(UnknownLifecycleModule.class);
@@ -310,19 +273,6 @@
r.cleanupThread();
assertNull(holder.getValue());
- }
-
- @Test
- public void use_of_service_object_provider_prefix()
- {
- Registry r = buildRegistry(ServiceObjectProviderModule.class);
-
- StringTransformer st = r.getObject("service:PublicTransformer", StringTransformer.class);
-
- // The PublicTransform gets the PrivateTransformer via
- // an @Inject.
-
- assertEquals(st.transform("fred"), "FRED");
}
@Test
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/RegistryBuilderOverrideTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/RegistryBuilderOverrideTest.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/RegistryBuilderOverrideTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/RegistryBuilderOverrideTest.java Fri Mar 9 21:25:07 2007
@@ -84,15 +84,15 @@
}
}
+ @SuppressWarnings("unchecked")
@Test
public void service_override()
{
builder.addServiceOverride("Service2", new UppercaseTransformer());
registry = builder.build();
- @SuppressWarnings("unchecked")
Transformer<String> s1 = registry.getService("Service1", Transformer.class);
assertEquals(s1.transform("a"), "a");
- @SuppressWarnings("unchecked")
+
Transformer<String> s2 = registry.getService("Service2", Transformer.class);
assertEquals(s2.transform("a"), "A");
}
@@ -104,6 +104,7 @@
registry = builder.build();
@SuppressWarnings("unchecked")
Transformer<String> s3 = registry.getService("Service3", Transformer.class);
+
assertEquals(s3.transform("a"), "A");
}
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java Fri Mar 9 21:25:07 2007
@@ -61,18 +61,7 @@
assertEquals(sd.toString(), className + ".buildFred()");
assertEquals(sd.getServiceLifeycle(), IOCConstants.DEFAULT_LIFECYCLE);
- assertEquals(sd.isPrivate(), false);
assertEquals(sd.isEagerLoad(), false);
-
- sd = md.getServiceDef("Barney");
-
- assertEquals(sd.getServiceId(), "Barney");
-
- assertEquals(sd.getServiceInterface(), FoeService.class);
-
- assertEquals(sd.toString(), className + ".buildBarney()");
- assertEquals(sd.getServiceLifeycle(), "threaded");
- assertEquals(sd.isPrivate(), true);
sd = md.getServiceDef("Wilma");
assertEquals(sd.isEagerLoad(), true);
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java Fri Mar 9 21:25:07 2007
@@ -62,7 +62,7 @@
replay();
- UpcaseService service = module.getService("Upcase", UpcaseService.class, module);
+ UpcaseService service = module.getService("Upcase", UpcaseService.class);
assertEquals(service.upcase("hello"), "HELLO");
@@ -76,67 +76,6 @@
}
@Test
- public void get_service_by_id_private()
- {
- InternalRegistry registry = newInternalRegistry();
- Log log = newLog();
- ClassFactory factory = new ClassFactoryImpl();
-
- ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, log);
-
- Module module = new ModuleImpl(registry, moduleDef, log);
-
- train_getLog(registry, "PrivateUpcase", log);
-
- train_isDebugEnabled(log, false);
-
- train_getLifecycle(registry, "singleton", new SingletonServiceLifecycle());
-
- train_newClass(registry, factory, UpcaseService.class);
-
- registry.addRegistryShutdownListener(isA(RegistryShutdownListener.class));
-
- train_isDebugEnabled(log, false);
-
- train_findDecoratorsForService(registry);
-
- replay();
-
- UpcaseService service = module.getService("PrivateUpcase", UpcaseService.class, module);
-
- assertEquals(service.upcase("hello"), "HELLO");
-
- verify();
- }
-
- @Test
- public void get_service_by_id_private_wrong_module()
- {
- InternalRegistry registry = newInternalRegistry();
- Log log = newLog();
-
- ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, log);
-
- Module module = new ModuleImpl(registry, moduleDef, log);
-
- replay();
-
- try
- {
- module.getService("PrivateUpcase", UpcaseService.class, null);
- unreachable();
- }
- catch (RuntimeException ex)
- {
- assertEquals(
- ex.getMessage(),
- "Service 'PrivateUpcase' is private, and may not be referenced outside of its containing module.");
- }
-
- verify();
- }
-
- @Test
public void find_service_ids_for_interface()
{
InternalRegistry registry = newInternalRegistry();
@@ -148,15 +87,11 @@
replay();
- Collection<String> ids = module.findServiceIdsForInterface(UpcaseService.class, module);
+ Collection<String> ids = module.findServiceIdsForInterface(FieService.class);
assertEquals(ids.size(), 2);
- assertTrue(ids.contains("Upcase"));
- assertTrue(ids.contains("PrivateUpcase"));
-
- ids = module.findServiceIdsForInterface(UpcaseService.class, null);
- assertEquals(ids.size(), 1);
- assertTrue(ids.contains("Upcase"));
+ assertTrue(ids.contains("Fie"));
+ assertTrue(ids.contains("OtherFie"));
verify();
}
@@ -234,7 +169,7 @@
train_expandSymbols(registry, "ClassFactory", "ClassFactory");
- train_getService(registry, "ClassFactory", ClassFactory.class, module, factory);
+ train_getService(registry, "ClassFactory", ClassFactory.class, factory);
replay();
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTestModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTestModule.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTestModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTestModule.java Fri Mar 9 21:25:07 2007
@@ -15,7 +15,6 @@
package org.apache.tapestry.ioc.internal;
import org.apache.tapestry.ioc.annotations.InjectService;
-import org.apache.tapestry.ioc.annotations.Private;
/**
* Module builder used by {@link ModuleImplTest}.
@@ -27,10 +26,9 @@
return new UpcaseServiceImpl();
}
- @Private
- public UpcaseService buildPrivateUpcase()
+ public FieService buildOtherFie()
{
- return new UpcaseServiceImpl();
+ return null;
}
public ToStringService buildToString(final String serviceId)
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/OneShotServiceCreatorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/OneShotServiceCreatorTest.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/OneShotServiceCreatorTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/OneShotServiceCreatorTest.java Fri Mar 9 21:25:07 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.
@@ -33,7 +33,7 @@
ObjectCreator delegate = newObjectCreator();
Object service = new Object();
- ServiceDef def = new ServiceDefImpl("foo.Bar", "singleton", method, false, false);
+ ServiceDef def = new ServiceDefImpl("foo.Bar", "singleton", method, false);
train_createObject(delegate, service);
@@ -70,7 +70,7 @@
ObjectCreator delegate = newObjectCreator();
Object service = new Object();
- ServiceDef def = new ServiceDefImpl("foo.Bar", "singleton", method, false, false);
+ ServiceDef def = new ServiceDefImpl("foo.Bar", "singleton", method, false);
expect(delegate.createObject()).andThrow(failure);
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java Fri Mar 9 21:25:07 2007
@@ -17,21 +17,19 @@
import org.apache.tapestry.ioc.Configuration;
import org.apache.tapestry.ioc.annotations.EagerLoad;
import org.apache.tapestry.ioc.annotations.Lifecycle;
-import org.apache.tapestry.ioc.annotations.Private;
/**
* Used by {@link org.apache.tapestry.ioc.internal.DefaultModuleDefImplTest}.
*/
public class SimpleModule
{
- public FieService buildFred()
+ @Lifecycle("threaded")
+ public FoeService buildBarney()
{
return null;
}
- @Lifecycle("threaded")
- @Private
- public FoeService buildBarney()
+ public FieService buildFred()
{
return null;
}
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImplTest.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImplTest.java Fri Mar 9 21:25:07 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 2007 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.
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/services/TypeCoercerImplTest.java Fri Mar 9 21:25:07 2007
@@ -128,6 +128,7 @@
assertEquals(actual, expected);
}
+ @SuppressWarnings("unchecked")
@DataProvider(name = "coercions_inputs")
public Object[][] coercions_inputs()
{
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/util/LocationImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/util/LocationImplTest.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/util/LocationImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/internal/util/LocationImplTest.java Fri Mar 9 21:25:07 2007
@@ -7,7 +7,6 @@
// 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
Modified: tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/util/CaseInsensitiveMapTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/util/CaseInsensitiveMapTest.java?view=diff&rev=516653&r1=516652&r2=516653
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/util/CaseInsensitiveMapTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/branches/hlship-20070309-simplifyioc/src/test/java/org/apache/tapestry/ioc/util/CaseInsensitiveMapTest.java Fri Mar 9 21:25:07 2007
@@ -315,6 +315,7 @@
assertEquals(keys, Arrays.asList("barney", "betty", "fred", "wilma"));
}
+ @SuppressWarnings("unchecked")
@Test
public void serialize_deserialize() throws Exception
{