You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2007/11/12 23:23:28 UTC
svn commit: r594319 [32/40] - in /tapestry/tapestry5/trunk: ./
tapestry-annotations/
tapestry-annotations/src/main/java/org/apache/tapestry/beaneditor/
tapestry-annotations/src/site/ tapestry-component-report/
tapestry-component-report/src/main/java/or...
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/InjectService.java Mon Nov 12 14:22:31 2007
@@ -1,25 +1,24 @@
-// 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.annotations;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.PARAMETER;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
@Target(PARAMETER)
@Retention(RUNTIME)
@@ -28,10 +27,11 @@
* Annotation used with parameters of service builder methods to identify the service to be injected
* into the service builder method via the parameter. In many cases the
* {@link org.apache.tapestry.ioc.annotations.Inject} annotation is more flexible or appropriate.
- *
- *
+ *
+ *
*/
-public @interface InjectService {
+public @interface InjectService
+{
/**
* The id of the service to inject; either a fully qualified id, or the unqualified id of a
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Marker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Marker.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Marker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Marker.java Mon Nov 12 14:22:31 2007
@@ -14,31 +14,32 @@
package org.apache.tapestry.ioc.annotations;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import org.apache.tapestry.ioc.def.ServiceDef;
import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
-import org.apache.tapestry.ioc.def.ServiceDef;
-
/**
* Used to define a {@linkplain ServiceDef#getMarkers() marker annotation} for a service
* implementation. This allows for injection based on the combination of type and marker interface.
* These marker interfaces should not have any values. The mere presence of the marker annotation is
* all that is needed.
- * <p>
+ * <p/>
* When applied to a module class, this sets the default marker for all services within the module
* (whereas the normal default marker is null).
*/
@Target(
-{ TYPE, METHOD })
+ {TYPE, METHOD})
@Retention(RUNTIME)
@Documented
public @interface Marker
{
- /** The type of annotation (which will be present at the injection point). */
+ /**
+ * The type of annotation (which will be present at the injection point).
+ */
Class value();
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Match.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Match.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Match.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Match.java Mon Nov 12 14:22:31 2007
@@ -1,45 +1,43 @@
-// 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.annotations;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
/**
* Optional, but typically used, annotation for service decorator methods, used to define which
* services the decorator applies to. This annotation defines a number of <em>patterns</em> that
* allow services across multiple modules to be selected. A decorator is applied to a service if any
* of its patterns match the service.
- * <p>
+ * <p/>
* TODO: Describe pattern glob-match syntax
- * <p>
+ * <p/>
* When the Match annotation is not supplied, then the decorator only applies to a single service:
* the service whose id matches the decorators id; that is, method <code>decorateMyService()</code>
* would decorate only the service provided by the <code>buildMyService()</code> method, within
* the same module.
- *
- *
*/
@Target(METHOD)
@Retention(RUNTIME)
@Documented
-public @interface Match {
+public @interface Match
+{
/**
* Defines a list of patterns matched against potential service ids to identify to which
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Order.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Order.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Order.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Order.java Mon Nov 12 14:22:31 2007
@@ -1,37 +1,36 @@
-// 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.annotations;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
/**
* Used with a service decorator method to control the order in which decorations occur. Identifies
* other decorators which should occur before the annotated decorator.
- *
- *
+ *
* @see org.apache.tapestry.ioc.def.DecoratorDef
*/
@Target(METHOD)
@Retention(RUNTIME)
@Documented
-public @interface Order {
+public @interface Order
+{
/**
* Any number of ordering constraint strings.
*/
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Primary.java Mon Nov 12 14:22:31 2007
@@ -14,17 +14,16 @@
package org.apache.tapestry.ioc.annotations;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import org.apache.tapestry.ioc.services.ChainBuilder;
+import org.apache.tapestry.ioc.services.StrategyBuilder;
import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
-import org.apache.tapestry.ioc.services.ChainBuilder;
-import org.apache.tapestry.ioc.services.StrategyBuilder;
-
/**
* Marker annotation used to denote a service that is the primary instance of some common interface.
* This is often used when a service is a {@linkplain ChainBuilder chain of command} or
@@ -32,7 +31,7 @@
* interface.
*/
@Target(
-{ PARAMETER, FIELD })
+ {PARAMETER, FIELD})
@Retention(RUNTIME)
@Documented
public @interface Primary
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java Mon Nov 12 14:22:31 2007
@@ -14,18 +14,17 @@
package org.apache.tapestry.ioc.annotations;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import org.apache.tapestry.ioc.ServiceBinder;
+import org.apache.tapestry.ioc.ServiceLifecycle;
+import org.apache.tapestry.ioc.services.ServiceLifecycleSource;
import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
-import org.apache.tapestry.ioc.ServiceBinder;
-import org.apache.tapestry.ioc.ServiceLifecycle;
-import org.apache.tapestry.ioc.services.ServiceLifecycleSource;
-
/**
* An optional annotation that may be placed on a service building method of a module. The
* annotation overrides the default scope for services (the default being a global singleton that is
@@ -34,16 +33,18 @@
* scope should have a corresponding {@link ServiceLifecycle} implementation. The linkage from scope
* name to service lifecycle occurs via a contribution to the {@link ServiceLifecycleSource} service
* configuration.
- * <p>
+ * <p/>
* The annotation may also be placed directly on a service implementation class, when using service
* autobuilding (via the {@link ServiceBinder}.
*/
@Target(
-{ TYPE, METHOD })
+ {TYPE, METHOD})
@Retention(RUNTIME)
@Documented
public @interface Scope
{
- /** An identifier used to look up a non-default lifecycle. */
+ /**
+ * An identifier used to look up a non-default lifecycle.
+ */
String value();
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/SubModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/SubModule.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/SubModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/SubModule.java Mon Nov 12 14:22:31 2007
@@ -1,37 +1,37 @@
-// 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.annotations;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
/**
* Attached to a module class, this annotation identifies other module classes that should also be
* added to the Registry. This is often easier than updating the JAR Manifest.
- *
- *
*/
@Target(TYPE)
@Retention(RUNTIME)
@Documented
-public @interface SubModule {
+public @interface SubModule
+{
- /** One or more classes that are also modules and should also be loaded. */
+ /**
+ * One or more classes that are also modules and should also be loaded.
+ */
Class[] value();
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Symbol.java Mon Nov 12 14:22:31 2007
@@ -14,12 +14,11 @@
package org.apache.tapestry.ioc.annotations;
+import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
/**
@@ -28,11 +27,13 @@
* allows the annotation to reference a public constant variable.
*/
@Target(
-{ PARAMETER, FIELD })
+ {PARAMETER, FIELD})
@Retention(RUNTIME)
@Documented
public @interface Symbol
{
- /** The name of the symbol to inject. */
+ /**
+ * The name of the symbol to inject.
+ */
String value();
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Value.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Value.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Value.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/annotations/Value.java Mon Nov 12 14:22:31 2007
@@ -14,32 +14,33 @@
package org.apache.tapestry.ioc.annotations;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import org.apache.tapestry.ioc.services.SymbolSource;
+import org.apache.tapestry.ioc.services.TypeCoercer;
import java.lang.annotation.Documented;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
-import org.apache.tapestry.ioc.services.SymbolSource;
-import org.apache.tapestry.ioc.services.TypeCoercer;
-
/**
* Used in conjunction with {@link Inject} to inject a literal value, rather than a service. Symbols
* in the value are expanded and the resulting string is coerced to the desired type. For IoC, this
* annotation is only applied to parameters (on service builder methods, and on service
* constructors); for components, it may also be applied to field.
- *
+ *
* @see SymbolSource
* @see TypeCoercer
*/
@Target(
-{ PARAMETER, FIELD })
+ {PARAMETER, FIELD})
@Retention(RUNTIME)
@Documented
public @interface Value
{
- /** The value to be coerced and injected. */
+ /**
+ * The value to be coerced and injected.
+ */
String value();
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ContributionDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ContributionDef.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ContributionDef.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ContributionDef.java Mon Nov 12 14:22:31 2007
@@ -14,69 +14,58 @@
package org.apache.tapestry.ioc.def;
-import org.apache.tapestry.ioc.Configuration;
-import org.apache.tapestry.ioc.MappedConfiguration;
-import org.apache.tapestry.ioc.ModuleBuilderSource;
-import org.apache.tapestry.ioc.ObjectLocator;
-import org.apache.tapestry.ioc.OrderedConfiguration;
+import org.apache.tapestry.ioc.*;
/**
* Contribution to a service configuration.
- * <p>
+ * <p/>
* The toString() method of the ContributionDef will be used for some exception reporting and should
* clearly identify where the contribution comes from; the normal behavior is to identify the class
* and method of the contribution method.
*/
public interface ContributionDef
{
- /** Identifies the service contributed to. */
+ /**
+ * Identifies the service contributed to.
+ */
String getServiceId();
/**
* Performs the work needed to contribute into the standard, unordered configuration.
- *
- * @param moduleBuilderSource
- * the source, if needed, of the module builder instance associated with the
- * contribution
- * @param locator
- * allows access to services visible to the module builder instance
- * @param configuration
- * the unordered configuration into which values should be loaded. This instance will
- * encapsulate all related error checks (such as passing of nulls or inappropriate
- * classes).
+ *
+ * @param moduleBuilderSource the source, if needed, of the module builder instance associated with the
+ * contribution
+ * @param locator allows access to services visible to the module builder instance
+ * @param configuration the unordered configuration into which values should be loaded. This instance will
+ * encapsulate all related error checks (such as passing of nulls or inappropriate
+ * classes).
*/
void contribute(ModuleBuilderSource moduleBuilderSource, ObjectLocator locator,
- Configuration configuration);
+ Configuration configuration);
/**
* Performs the work needed to contribute into the ordered configuration.
- *
- * @param moduleBuilderSource
- * the source, if needed, of the module builder instance associated with the
- * contribution
- * @param locator
- * allows access to services visible to the module builder instance
- * @param configuration
- * the ordered configuration into which values should be loaded. This instance will
- * encapsulate all related error checks (such as passing of nulls or inappropriate
- * classes).
+ *
+ * @param moduleBuilderSource the source, if needed, of the module builder instance associated with the
+ * contribution
+ * @param locator allows access to services visible to the module builder instance
+ * @param configuration the ordered configuration into which values should be loaded. This instance will
+ * encapsulate all related error checks (such as passing of nulls or inappropriate
+ * classes).
*/
void contribute(ModuleBuilderSource moduleBuilderSource, ObjectLocator locator,
- OrderedConfiguration configuration);
+ OrderedConfiguration configuration);
/**
* Performs the work needed to contribute into the mapped configuration.
- *
- * @param moduleBuilderSource
- * the source, if needed, of the module builder instance associated with the
- * contribution
- * @param locator
- * allows access to services visible to the module builder instance
- * @param configuration
- * the mapped configuration into which values should be loaded. This instance will
- * encapsulate all related error checks (such as passing of null keys or values or
- * inappropriate classes, or duplicate keys).
+ *
+ * @param moduleBuilderSource the source, if needed, of the module builder instance associated with the
+ * contribution
+ * @param locator allows access to services visible to the module builder instance
+ * @param configuration the mapped configuration into which values should be loaded. This instance will
+ * encapsulate all related error checks (such as passing of null keys or values or
+ * inappropriate classes, or duplicate keys).
*/
void contribute(ModuleBuilderSource moduleBuilderSource, ObjectLocator locator,
- MappedConfiguration configuration);
+ MappedConfiguration configuration);
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/DecoratorDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/DecoratorDef.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/DecoratorDef.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/DecoratorDef.java Mon Nov 12 14:22:31 2007
@@ -20,14 +20,14 @@
/**
* Definition of a service decorator, which (by default) is derived from a service decorator method.
- * <p>
+ * <p/>
* A note on decorator scheduling. The scheduling is based on the desired order of <em>behavior</em>.
* Thus, if logging should occur before security checks, and security checks should occur before
* transaction management, then the desired decorator order is Logging, Security, Transactions. This
* might be specified as having Security occur after Logging, and Transactions occur after Security.
* It might also be specified by having Logging ordered "before:*", and Transactions ordered
* "after:*" with no specified scheduling for Security.
- * <p>
+ * <p/>
* Once this order is established, decorators are <em>applied</em> in reverse order. Each
* decorator's job is to create an <em>interceptor</em> for the service, that delegates to the
* next implementation. This implies that the decorators are executed last to first. In the above
@@ -55,23 +55,21 @@
/**
* Creates an object that can perform the decoration (in the default case, by invoking the
* decorator method on the module builder instance.
- *
- * @param moduleBuilderSource
- * the module builder instance associated with the module containing the decorator
- * (not necessarily the module containing the service being decorated)
- * @param resources
- * the resources visible <em>to the decorator</em> (which may be in a different
- * module than the service being decorated). Other resource properties (serviceId,
- * serviceInterface, log, etc.) are for the service being decorated.
+ *
+ * @param moduleBuilderSource the module builder instance associated with the module containing the decorator
+ * (not necessarily the module containing the service being decorated)
+ * @param resources the resources visible <em>to the decorator</em> (which may be in a different
+ * module than the service being decorated). Other resource properties (serviceId,
+ * serviceInterface, log, etc.) are for the service being decorated.
*/
ServiceDecorator createDecorator(ModuleBuilderSource moduleBuilderSource,
- ServiceResources resources);
+ ServiceResources resources);
/**
* Used to determine which services may be decorated by this decorator. When decorating a
* service, first the decorators that target the service are identified, then ordering occurs,
* then the {@link ServiceDecorator}s are invoked.
- *
+ *
* @param serviceDef
* @return true if the decorator applies to the service
*/
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ModuleDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ModuleDef.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ModuleDef.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ModuleDef.java Mon Nov 12 14:22:31 2007
@@ -14,24 +14,25 @@
package org.apache.tapestry.ioc.def;
-import java.util.Set;
-
import org.slf4j.Logger;
+import java.util.Set;
+
/**
* Defines the contents of a module. In the default case, this is information about the services
* provided by the module builder class.
*/
public interface ModuleDef
{
- /** Returns the ids of the services built/provided by the module. */
+ /**
+ * Returns the ids of the services built/provided by the module.
+ */
Set<String> getServiceIds();
/**
* Returns a service definition via the service's id.
- *
- * @param serviceId
- * the id of the service to retrieve
+ *
+ * @param serviceId the id of the service to retrieve
* @return service definition or null if it doesn't exist
*/
ServiceDef getServiceDef(String serviceId);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java Mon Nov 12 14:22:31 2007
@@ -14,11 +14,11 @@
package org.apache.tapestry.ioc.def;
-import java.util.Set;
-
import org.apache.tapestry.ioc.ObjectCreator;
import org.apache.tapestry.ioc.ServiceBuilderResources;
+import java.util.Set;
+
/**
* Service definition derived, by default, from a service builder method.
*/
@@ -26,9 +26,8 @@
{
/**
* Returns an {@link ObjectCreator} that can create the core service implementation.
- *
- * @param resources
- * used to resolve dependencies of the service, or access its configuration
+ *
+ * @param resources used to resolve dependencies of the service, or access its configuration
* @return an object that can (later) be used to instantiate the service itself
*/
ObjectCreator createServiceCreator(ServiceBuilderResources resources);
@@ -46,7 +45,7 @@
* disambiguate services; the combination of a marker annotation and a service type is expected
* to be unique. The annotation is placed on the field or method/constructor parameter and the
* service is located by combining the marker with service type (the parameter or field type).
- *
+ *
* @return the annotation, or null if the service has no annotation
*/
Set<Class> getMarkers();
@@ -63,7 +62,7 @@
* Returns the lifecycle defined for the service. This is indicated by adding a
* {@link org.apache.tapestry.ioc.annotations.Scope} annotation to the service builder method
* for the service.
- * <p>
+ * <p/>
* Services that are not proxied will ignore their scope; such services are always treated as
* singletons.
*/
@@ -71,7 +70,7 @@
/**
* Returns true if the service should be eagerly loaded at Registry startup.
- *
+ *
* @see org.apache.tapestry.ioc.annotations.EagerLoad
*/
boolean isEagerLoad();
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java Mon Nov 12 14:22:31 2007
@@ -14,10 +14,12 @@
package org.apache.tapestry.ioc.internal;
-import static org.apache.tapestry.ioc.internal.ConfigurationType.MAPPED;
-import static org.apache.tapestry.ioc.internal.ConfigurationType.ORDERED;
-import static org.apache.tapestry.ioc.internal.ConfigurationType.UNORDERED;
+import org.apache.tapestry.ioc.ObjectCreator;
+import org.apache.tapestry.ioc.ServiceBuilderResources;
+import org.apache.tapestry.ioc.ServiceResources;
+import static org.apache.tapestry.ioc.internal.ConfigurationType.*;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
+import org.slf4j.Logger;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
@@ -25,11 +27,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.tapestry.ioc.ObjectCreator;
-import org.apache.tapestry.ioc.ServiceBuilderResources;
-import org.apache.tapestry.ioc.ServiceResources;
-import org.slf4j.Logger;
-
/**
* Abstract implementation of {@link ObjectCreator} geared towards the creation of the core service
* implementation, either by invoking a service builder method on a module, or by invoking a
@@ -129,7 +126,7 @@
@SuppressWarnings("unchecked")
private final void addOrderedConfigurationParameter(Map<Class, Object> parameterDefaults,
- Type genericType)
+ Type genericType)
{
Class valueType = findParameterizedTypeFromGenericType(genericType);
List configuration = _resources.getOrderedConfiguration(valueType);
@@ -139,7 +136,7 @@
@SuppressWarnings("unchecked")
private void addUnorderedConfigurationParameter(Map<Class, Object> parameterDefaults,
- Type genericType)
+ Type genericType)
{
Class valueType = findParameterizedTypeFromGenericType(genericType);
Collection configuration = _resources.getUnorderedConfiguration(valueType);
@@ -149,7 +146,7 @@
@SuppressWarnings("unchecked")
private void addMappedConfigurationParameter(Map<Class, Object> parameterDefaults,
- Type genericType)
+ Type genericType)
{
Class keyType = findParameterizedTypeFromGenericType(genericType, 0);
Class valueType = findParameterizedTypeFromGenericType(genericType, 1);
@@ -166,9 +163,8 @@
* Extracts from a generic type the underlying parameterized type. I.e., for List<Runnable>,
* will return Runnable. This is limited to simple parameterized types, not the more complex
* cases involving wildcards and upper/lower boundaries.
- *
- * @param type
- * the genetic type of the parameter, i.e., List<Runnable>
+ *
+ * @param type the genetic type of the parameter, i.e., List<Runnable>
* @return the parameterize type (i.e. Runnable.class if type represents List<Runnable>).
*/
@@ -188,11 +184,9 @@
* then Object.class is returned. Otherwise, the type must be a ParameterizedType. We check to
* make sure it has the correct number of a actual types (1 for a Collection or List, 2 for a
* Map). The actual types must be classes (wildcards just aren't supported)
- *
- * @param type
- * a Class or ParameterizedType to inspect
- * @param typeIndex
- * the index within the ParameterizedType to extract
+ *
+ * @param type a Class or ParameterizedType to inspect
+ * @param typeIndex the index within the ParameterizedType to extract
* @return the actual type, or Object.class if the input type is not generic, or null if any
* other pre-condition is not met
*/
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConfigurationType.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConfigurationType.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConfigurationType.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConfigurationType.java Mon Nov 12 14:22:31 2007
@@ -1,30 +1,35 @@
-// 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;
/**
* Defines the three types of configurations a service may request.
- *
- *
*/
-public enum ConfigurationType {
+public enum ConfigurationType
+{
- /** @see org.apache.tapestry.ioc.Configuration */
+ /**
+ * @see org.apache.tapestry.ioc.Configuration
+ */
UNORDERED,
- /** @see org.apache.tapestry.ioc.OrderedConfiguration */
+ /**
+ * @see org.apache.tapestry.ioc.OrderedConfiguration
+ */
ORDERED,
- /** @see org.apache.tapestry.ioc.MappedConfiguration */
+ /**
+ * @see org.apache.tapestry.ioc.MappedConfiguration
+ */
MAPPED
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java Mon Nov 12 14:22:31 2007
@@ -14,13 +14,13 @@
package org.apache.tapestry.ioc.internal;
+import org.apache.tapestry.ioc.ServiceBuilderResources;
+import org.apache.tapestry.ioc.internal.util.InternalUtils;
+
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
-import org.apache.tapestry.ioc.ServiceBuilderResources;
-import org.apache.tapestry.ioc.internal.util.InternalUtils;
-
/**
* A service creator based on an implementation class' constructor, rather than a service builder
* method.
@@ -30,7 +30,7 @@
private final Constructor _constructor;
public ConstructorServiceCreator(ServiceBuilderResources resources, String creatorDescription,
- Constructor constructor)
+ Constructor constructor)
{
super(resources, creatorDescription);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ContributionDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ContributionDefImpl.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ContributionDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ContributionDefImpl.java Mon Nov 12 14:22:31 2007
@@ -14,21 +14,16 @@
package org.apache.tapestry.ioc.internal;
+import org.apache.tapestry.ioc.*;
+import org.apache.tapestry.ioc.def.ContributionDef;
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
+import org.apache.tapestry.ioc.internal.util.InternalUtils;
+import org.apache.tapestry.ioc.services.ClassFactory;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
-import org.apache.tapestry.ioc.Configuration;
-import org.apache.tapestry.ioc.MappedConfiguration;
-import org.apache.tapestry.ioc.ModuleBuilderSource;
-import org.apache.tapestry.ioc.ObjectLocator;
-import org.apache.tapestry.ioc.OrderedConfiguration;
-import org.apache.tapestry.ioc.def.ContributionDef;
-import org.apache.tapestry.ioc.internal.util.InternalUtils;
-import org.apache.tapestry.ioc.services.ClassFactory;
-
public class ContributionDefImpl implements ContributionDef
{
private final String _serviceId;
@@ -56,25 +51,25 @@
}
public void contribute(ModuleBuilderSource moduleBuilderSource, ObjectLocator locator,
- Configuration configuration)
+ Configuration configuration)
{
invokeMethod(moduleBuilderSource, locator, Configuration.class, configuration);
}
public void contribute(ModuleBuilderSource moduleBuilderSource, ObjectLocator locator,
- OrderedConfiguration configuration)
+ OrderedConfiguration configuration)
{
invokeMethod(moduleBuilderSource, locator, OrderedConfiguration.class, configuration);
}
public void contribute(ModuleBuilderSource moduleBuilderSource, ObjectLocator locator,
- MappedConfiguration configuration)
+ MappedConfiguration configuration)
{
invokeMethod(moduleBuilderSource, locator, MappedConfiguration.class, configuration);
}
private <T> void invokeMethod(ModuleBuilderSource source, ObjectLocator locator,
- Class<T> parameterType, T parameterValue)
+ Class<T> parameterType, T parameterValue)
{
Map<Class, Object> parameterDefaults = newMap();
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DecoratorDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DecoratorDefImpl.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DecoratorDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DecoratorDefImpl.java Mon Nov 12 14:22:31 2007
@@ -14,12 +14,6 @@
package org.apache.tapestry.ioc.internal;
-import static org.apache.tapestry.ioc.internal.util.Defense.notBlank;
-import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
import org.apache.tapestry.ioc.IdMatcher;
import org.apache.tapestry.ioc.ModuleBuilderSource;
import org.apache.tapestry.ioc.ServiceDecorator;
@@ -27,9 +21,14 @@
import org.apache.tapestry.ioc.def.DecoratorDef;
import org.apache.tapestry.ioc.def.ServiceDef;
import org.apache.tapestry.ioc.internal.util.CollectionFactory;
+import static org.apache.tapestry.ioc.internal.util.Defense.notBlank;
+import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
import org.apache.tapestry.ioc.services.ClassFactory;
+import java.lang.reflect.Method;
+import java.util.List;
+
public class DecoratorDefImpl implements DecoratorDef
{
private final String _decoratorId;
@@ -43,7 +42,7 @@
private final ClassFactory _classFactory;
public DecoratorDefImpl(String decoratorId, Method decoratorMethod, String[] patterns,
- String[] constraints, ClassFactory classFactory)
+ String[] constraints, ClassFactory classFactory)
{
_decoratorId = notBlank(decoratorId, "decoratorId");
_decoratorMethod = notNull(decoratorMethod, "decoratorMethod");
@@ -80,10 +79,10 @@
}
public ServiceDecorator createDecorator(ModuleBuilderSource moduleBuilderSource,
- ServiceResources resources)
+ ServiceResources resources)
{
return new ServiceDecoratorImpl(_decoratorMethod, moduleBuilderSource, resources,
- _classFactory);
+ _classFactory);
}
/**
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java Mon Nov 12 14:22:31 2007
@@ -14,47 +14,25 @@
package org.apache.tapestry.ioc.internal;
-import static org.apache.tapestry.ioc.internal.ConfigurationType.MAPPED;
-import static org.apache.tapestry.ioc.internal.ConfigurationType.ORDERED;
-import static org.apache.tapestry.ioc.internal.ConfigurationType.UNORDERED;
-import static org.apache.tapestry.ioc.internal.IOCMessages.buildMethodConflict;
-import static org.apache.tapestry.ioc.internal.IOCMessages.buildMethodWrongReturnType;
-import static org.apache.tapestry.ioc.internal.IOCMessages.decoratorMethodWrongReturnType;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newCaseInsensitiveMap;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newSet;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tapestry.ioc.Configuration;
-import org.apache.tapestry.ioc.IOCConstants;
-import org.apache.tapestry.ioc.MappedConfiguration;
-import org.apache.tapestry.ioc.ObjectCreator;
-import org.apache.tapestry.ioc.OrderedConfiguration;
-import org.apache.tapestry.ioc.ServiceBinder;
-import org.apache.tapestry.ioc.ServiceBuilderResources;
-import org.apache.tapestry.ioc.annotations.EagerLoad;
-import org.apache.tapestry.ioc.annotations.Marker;
-import org.apache.tapestry.ioc.annotations.Match;
-import org.apache.tapestry.ioc.annotations.Order;
-import org.apache.tapestry.ioc.annotations.Scope;
+import org.apache.tapestry.ioc.*;
+import org.apache.tapestry.ioc.annotations.*;
import org.apache.tapestry.ioc.def.ContributionDef;
import org.apache.tapestry.ioc.def.DecoratorDef;
import org.apache.tapestry.ioc.def.ModuleDef;
import org.apache.tapestry.ioc.def.ServiceDef;
+import static org.apache.tapestry.ioc.internal.ConfigurationType.*;
+import static org.apache.tapestry.ioc.internal.IOCMessages.*;
import org.apache.tapestry.ioc.internal.util.CollectionFactory;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.*;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.slf4j.Logger;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.*;
+
/**
* Starting from the Class for a module builder, identifies all the services (service builder
* methods), decorators (service decorator methods) and (not yet implemented) contributions (service
@@ -62,13 +40,19 @@
*/
public class DefaultModuleDefImpl implements ModuleDef, ServiceDefAccumulator
{
- /** The prefix used to identify service builder methods. */
+ /**
+ * The prefix used to identify service builder methods.
+ */
private static final String BUILD_METHOD_NAME_PREFIX = "build";
- /** The prefix used to identify service decorator methods. */
+ /**
+ * The prefix used to identify service decorator methods.
+ */
private static final String DECORATE_METHOD_NAME_PREFIX = "decorate";
- /** The prefix used to identify service contribution methods. */
+ /**
+ * The prefix used to identify service contribution methods.
+ */
private static final String CONTRIBUTE_METHOD_NAME_PREFIX = "contribute";
private final Class _builderClass;
@@ -77,10 +61,14 @@
private final ClassFactory _classFactory;
- /** Keyed on service id. */
+ /**
+ * Keyed on service id.
+ */
private final Map<String, ServiceDef> _serviceDefs = newCaseInsensitiveMap();
- /** Keyed on decorator id. */
+ /**
+ * Keyed on decorator id.
+ */
private final Map<String, DecoratorDef> _decoratorDefs = newCaseInsensitiveMap();
private final Set<ContributionDef> _contributionDefs = newSet();
@@ -97,11 +85,9 @@
}
/**
- * @param builderClass
- * the class that is responsible for building services, etc.
+ * @param builderClass the class that is responsible for building services, etc.
* @param logger
- * @param classFactory
- * TODO
+ * @param classFactory TODO
*/
public DefaultModuleDefImpl(Class<?> builderClass, Logger logger, ClassFactory classFactory)
{
@@ -117,7 +103,9 @@
bind();
}
- /** Identifies the module builder class and a list of service ids within the module. */
+ /**
+ * Identifies the module builder class and a list of service ids within the module.
+ */
@Override
public String toString()
{
@@ -258,10 +246,10 @@
// TODO: Validate constraints here?
String[] patterns = match == null ? new String[]
- { decoratorId } : match.value();
+ {decoratorId} : match.value();
DecoratorDef def = new DecoratorDefImpl(decoratorId, method, patterns, constraints,
- _classFactory);
+ _classFactory);
_decoratorDefs.put(decoratorId, def);
}
@@ -284,7 +272,9 @@
return method.getName().substring(prefix.length());
}
- /** Invoked for public methods that have the proper prefix. */
+ /**
+ * Invoked for public methods that have the proper prefix.
+ */
private void addServiceDef(final Method method)
{
String serviceId = stripMethodPrefix(method, BUILD_METHOD_NAME_PREFIX);
@@ -326,7 +316,7 @@
markers.addAll(extractMarkers(method));
ServiceDefImpl serviceDef = new ServiceDefImpl(returnType, serviceId, markers, scope,
- eagerLoad, source);
+ eagerLoad, source);
addServiceDef(serviceDef);
}
@@ -377,7 +367,9 @@
return _builderClass.getName();
}
- /** See if the build class defined a bind method and invoke it. */
+ /**
+ * See if the build class defined a bind method and invoke it.
+ */
private void bind()
{
Throwable failure = null;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/EagerLoadServiceProxy.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/EagerLoadServiceProxy.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/EagerLoadServiceProxy.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/EagerLoadServiceProxy.java Mon Nov 12 14:22:31 2007
@@ -1,24 +1,22 @@
-// 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;
/**
* Interface implemented by all service proxies. Service proxies are always
* {@link org.apache.tapestry.ioc.services.RegistryShutdownListener}s, they also can be eager-load
- *
- *
*/
public interface EagerLoadServiceProxy
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/GlobPatternMatcher.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/GlobPatternMatcher.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/GlobPatternMatcher.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/GlobPatternMatcher.java Mon Nov 12 14:22:31 2007
@@ -14,10 +14,7 @@
package org.apache.tapestry.ioc.internal;
-import static org.apache.tapestry.ioc.internal.MatchType.ANY;
-import static org.apache.tapestry.ioc.internal.MatchType.INFIX;
-import static org.apache.tapestry.ioc.internal.MatchType.PREFIX;
-import static org.apache.tapestry.ioc.internal.MatchType.SUFFIX;
+import static org.apache.tapestry.ioc.internal.MatchType.*;
public class GlobPatternMatcher
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java Mon Nov 12 14:22:31 2007
@@ -14,23 +14,18 @@
package org.apache.tapestry.ioc.internal;
-import static org.easymock.EasyMock.isA;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.tapestry.ioc.AnnotationProvider;
-import org.apache.tapestry.ioc.Registry;
-import org.apache.tapestry.ioc.RegistryBuilder;
-import org.apache.tapestry.ioc.ServiceDecorator;
-import org.apache.tapestry.ioc.ServiceLifecycle;
+import org.apache.tapestry.ioc.*;
import org.apache.tapestry.ioc.def.ServiceDef;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.test.IOCTestCase;
+import static org.easymock.EasyMock.isA;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
+import java.util.Collections;
+import java.util.List;
+
public class IOCInternalTestCase extends IOCTestCase implements Registry
{
private static Registry _registry;
@@ -78,7 +73,7 @@
return _registry.proxy(interfaceClass, implementationClass);
}
-
+
@BeforeSuite
public final void setup_registry()
{
@@ -128,7 +123,7 @@
}
protected final void train_findDecoratorsForService(Module module, String serviceId,
- List<ServiceDecorator> decorators)
+ List<ServiceDecorator> decorators)
{
expect(module.findDecoratorsForService(serviceId)).andReturn(decorators);
}
@@ -139,13 +134,13 @@
}
protected final void train_getLifecycle(InternalRegistry registry, String scope,
- ServiceLifecycle lifecycle)
+ ServiceLifecycle lifecycle)
{
expect(registry.getServiceLifecycle(scope)).andReturn(lifecycle);
}
protected final <T> void train_getService(InternalRegistry registry, String serviceId,
- Class<T> serviceInterface, T service)
+ Class<T> serviceInterface, T service)
{
expect(registry.getService(serviceId, serviceInterface)).andReturn(service);
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java Mon Nov 12 14:22:31 2007
@@ -14,7 +14,13 @@
package org.apache.tapestry.ioc.internal;
+import org.apache.tapestry.ioc.Messages;
+import org.apache.tapestry.ioc.def.ContributionDef;
+import org.apache.tapestry.ioc.def.ServiceDef;
+import org.apache.tapestry.ioc.internal.util.InternalUtils;
import static org.apache.tapestry.ioc.internal.util.InternalUtils.asString;
+import org.apache.tapestry.ioc.internal.util.MessagesImpl;
+import org.apache.tapestry.ioc.services.ClassFabUtils;
import static org.apache.tapestry.ioc.services.ClassFabUtils.toJavaClassName;
import java.lang.reflect.Constructor;
@@ -24,13 +30,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.tapestry.ioc.Messages;
-import org.apache.tapestry.ioc.def.ContributionDef;
-import org.apache.tapestry.ioc.def.ServiceDef;
-import org.apache.tapestry.ioc.internal.util.InternalUtils;
-import org.apache.tapestry.ioc.internal.util.MessagesImpl;
-import org.apache.tapestry.ioc.services.ClassFabUtils;
-
final class IOCMessages
{
private static final Messages MESSAGES = MessagesImpl.forClass(IOCMessages.class);
@@ -58,7 +57,7 @@
}
static String serviceWrongInterface(String serviceId, Class actualInterface,
- Class requestedInterface)
+ Class requestedInterface)
{
return MESSAGES.format(
"service-wrong-interface",
@@ -126,7 +125,7 @@
}
static String decoratorReturnedWrongType(Method method, String serviceId, Object returned,
- Class serviceInterface)
+ Class serviceInterface)
{
return MESSAGES.format(
"decorator-returned-wrong-type",
@@ -196,14 +195,14 @@
}
static String contributionWrongValueType(String serviceId, ContributionDef def,
- Class actualClass, Class expectedClass)
+ Class actualClass, Class expectedClass)
{
return MESSAGES.format("contribution-wrong-value-type", serviceId, def, actualClass
.getName(), expectedClass.getName());
}
static String contributionWrongKeyType(String serviceId, ContributionDef def,
- Class actualClass, Class expectedClass)
+ Class actualClass, Class expectedClass)
{
return MESSAGES.format(
"contribution-wrong-key-type",
@@ -224,7 +223,7 @@
}
static String contributionDuplicateKey(String serviceId, ContributionDef contributionDef,
- ContributionDef existingDef)
+ ContributionDef existingDef)
{
return MESSAGES.format(
"contribution-duplicate-key",
@@ -313,7 +312,7 @@
}
static String manyServicesMatchMarker(Class objectType, Class marker,
- Collection<ServiceDef> matchingServices)
+ Collection<ServiceDef> matchingServices)
{
return MESSAGES.format("many-services-match-marker", ClassFabUtils
.toJavaClassName(objectType), ClassFabUtils.toJavaClassName(marker), InternalUtils
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InterceptorStackBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InterceptorStackBuilder.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InterceptorStackBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InterceptorStackBuilder.java Mon Nov 12 14:22:31 2007
@@ -14,12 +14,12 @@
package org.apache.tapestry.ioc.internal;
-import java.util.Collections;
-import java.util.List;
-
import org.apache.tapestry.ioc.ObjectCreator;
import org.apache.tapestry.ioc.ServiceDecorator;
+import java.util.Collections;
+import java.util.List;
+
/**
* Responsible for constructing the interceptor stack, on demand, by invoking an ordered series of
* decorators ({@link org.apache.tapestry.ioc.def.DecoratorDef} (which are converted into
@@ -34,13 +34,10 @@
private final Module _module;
/**
- * @param module
- * the module containing the decorator method
- * @param serviceId
- * identifies the service to be decorated
- * @param coreServiceCreator
- * responsible for creating the core service which is then decorated with a stack of
- * interceptors
+ * @param module the module containing the decorator method
+ * @param serviceId identifies the service to be decorated
+ * @param coreServiceCreator responsible for creating the core service which is then decorated with a stack of
+ * interceptors
*/
public InterceptorStackBuilder(Module module, String serviceId, ObjectCreator coreServiceCreator)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java Mon Nov 12 14:22:31 2007
@@ -14,10 +14,6 @@
package org.apache.tapestry.ioc.internal;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
import org.apache.tapestry.ioc.Registry;
import org.apache.tapestry.ioc.ServiceDecorator;
import org.apache.tapestry.ioc.ServiceLifecycle;
@@ -26,6 +22,10 @@
import org.apache.tapestry.ioc.services.RegistryShutdownHub;
import org.slf4j.Logger;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
/**
* Internal view of the module registry, adding additional methods needed by modules.
*/
@@ -33,12 +33,10 @@
{
/**
* Returns a service lifecycle by service scope name.
- *
- * @param scope
- * the name of the service scope (case insensitive)
+ *
+ * @param scope the name of the service scope (case insensitive)
* @return the lifecycle corresponding to the scope
- * @throws RuntimeException
- * if the lifecycle name does not match a known lifecycle
+ * @throws RuntimeException if the lifecycle name does not match a known lifecycle
*/
ServiceLifecycle getServiceLifecycle(String scope);
@@ -52,12 +50,10 @@
/**
* Builds up an unordered collection by invoking service contributor methods that target the
* service (from any module, unless the service is private).
- *
+ *
* @param <T>
- * @param serviceDef
- * defines the service for which configuration data is being assembled
- * @param valueType
- * identifies the type of object allowed into the collection
+ * @param serviceDef defines the service for which configuration data is being assembled
+ * @param valueType identifies the type of object allowed into the collection
* @return the final collection
*/
<T> Collection<T> getUnorderedConfiguration(ServiceDef serviceDef, Class<T> valueType);
@@ -67,12 +63,10 @@
* service (from any module, unless the service is private). Once all values have been added
* (each with an id, and pre/post constraints), the values are ordered, null values dropped, and
* the final sorted list is returned.
- *
+ *
* @param <T>
- * @param serviceDef
- * defines the service for which configuration data is being assembled
- * @param valueType
- * identifies the type of object allowed into the collection
+ * @param serviceDef defines the service for which configuration data is being assembled
+ * @param valueType identifies the type of object allowed into the collection
* @return the final ordered list
*/
<T> List<T> getOrderedConfiguration(ServiceDef serviceDef, Class<T> valueType);
@@ -82,33 +76,28 @@
* service (from any module, unless the service is private). Values and keys may not be null.
* Invalid values (keys or values that are the wrong type, or duplicate keys) result in warnings
* and are ignored.
- *
- * @param <K,
- * V>
- * @param serviceDef
- * defines the service for which configuration data is being assembled
- * @param keyType
- * identifies the type of key object allowed into the map
- * @param valueType
- * identifies the type of value object allowed into the map
+ *
+ * @param <K, V>
+ * @param serviceDef defines the service for which configuration data is being assembled
+ * @param keyType identifies the type of key object allowed into the map
+ * @param valueType identifies the type of value object allowed into the map
* @return the final ordered list
*/
<K, V> Map<K, V> getMappedConfiguration(ServiceDef serviceDef, Class<K> keyType,
- Class<V> valueType);
+ Class<V> valueType);
/**
* Convieience for creating a new {@link ClassFab} instance using a
* {@link org.apache.tapestry.ioc.services.ClassFactory}.
- *
- * @param serviceInterface
- * the interface to be implemented by the provided class
+ *
+ * @param serviceInterface the interface to be implemented by the provided class
*/
ClassFab newClass(Class serviceInterface);
/**
* Given an input string that <em>may</em> contain symbols, returns the string with any and
* all symbols fully expanded.
- *
+ *
* @param input
* @return expanded input
*/
@@ -117,7 +106,7 @@
/**
* Returns a logger for the service, which consists of the Module's
* {@link Module#getLoggerName() log name} suffixed with a period and the service id.
- *
+ *
* @param serviceId
* @return the logger for the service
*/
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/LifecycleWrappedServiceCreator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/LifecycleWrappedServiceCreator.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/LifecycleWrappedServiceCreator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/LifecycleWrappedServiceCreator.java Mon Nov 12 14:22:31 2007
@@ -35,7 +35,7 @@
private final ObjectCreator _creator;
public LifecycleWrappedServiceCreator(InternalRegistry registry, String serviceScope,
- ServiceResources resources, ObjectCreator creator)
+ ServiceResources resources, ObjectCreator creator)
{
_registry = registry;
_serviceScope = serviceScope;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/MatchType.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/MatchType.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/MatchType.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/MatchType.java Mon Nov 12 14:22:31 2007
@@ -1,22 +1,23 @@
-// 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;
-enum MatchType {
+enum MatchType
+{
EXACT, PREFIX, SUFFIX, INFIX, ANY
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java Mon Nov 12 14:22:31 2007
@@ -14,16 +14,16 @@
package org.apache.tapestry.ioc.internal;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
import org.apache.tapestry.ioc.ModuleBuilderSource;
import org.apache.tapestry.ioc.ServiceDecorator;
import org.apache.tapestry.ioc.def.ContributionDef;
import org.apache.tapestry.ioc.def.DecoratorDef;
import org.apache.tapestry.ioc.def.ServiceDef;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
/**
* A module within the Tapestry IoC registry. Each Module is constructed around a corresponding
* module builder instance; the methods and annotations of that instance define the services
@@ -33,15 +33,12 @@
{
/**
* Locates a service given a service id and the corresponding service interface type.
- *
+ *
* @param <T>
- * @param serviceId
- * identifies the service to access
- * @param serviceInterface
- * the interface the service implements
+ * @param serviceId identifies the service to access
+ * @param serviceInterface the interface the service implements
* @return the service's proxy
- * @throws RuntimeException
- * if there is an error instantiating the service proxy
+ * @throws RuntimeException if there is an error instantiating the service proxy
*/
<T> T getService(String serviceId, Class<T> serviceInterface);
@@ -49,9 +46,8 @@
* Locates the ids of all services that implement the provided service interface, or whose
* service interface is assignable to the provided service interface (is a super-class or
* super-interface).
- *
- * @param serviceInterface
- * the interface to search for
+ *
+ * @param serviceInterface the interface to search for
* @return a collection of service ids
*/
Collection<String> findServiceIdsForInterface(Class serviceInterface);
@@ -62,9 +58,8 @@
* filtering rules. The resulting list is ordered and from the list of
* {@link org.apache.tapestry.ioc.def.DecoratorDef}s, a list of {@link ServiceDecorator}s is
* returned.
- *
- * @param serviceId
- * identifies the service to be decorated
+ *
+ * @param serviceId identifies the service to be decorated
* @return the ordered list of service decorators
*/
List<ServiceDecorator> findDecoratorsForService(String serviceId);
@@ -72,14 +67,15 @@
/**
* Iterates over any decorator definitions defined by the module and returns those that apply to
* the provided service definition.
- *
- * @param serviceDef
- * for which decorators are being assembled
+ *
+ * @param serviceDef for which decorators are being assembled
* @return set of decorators, possibly empty (but not null)
*/
Set<DecoratorDef> findMatchingDecoratorDefs(ServiceDef serviceDef);
- /** Finds any contributions that are targetted at the indicated service. */
+ /**
+ * Finds any contributions that are targetted at the indicated service.
+ */
Set<ContributionDef> getContributorDefsForService(String serviceId);
/**
@@ -90,9 +86,8 @@
/**
* Returns the service definition for the given service id.
- *
- * @param serviceId
- * unique id for the service (caseless)
+ *
+ * @param serviceId unique id for the service (caseless)
* @return the service definition or null
*/
ServiceDef getServiceDef(String serviceId);
@@ -100,7 +95,7 @@
/**
* Returns the name used to obtain a logger for the module. Services within the module suffix
* this with a period and the service id.
- *
+ *
* @return module logger name
*/
String getLoggerName();
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java Mon Nov 12 14:22:31 2007
@@ -14,41 +14,24 @@
package org.apache.tapestry.ioc.internal;
-import static java.lang.String.format;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newCaseInsensitiveMap;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newList;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newSet;
-import static org.apache.tapestry.ioc.internal.util.Defense.notBlank;
-import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tapestry.ioc.ObjectCreator;
-import org.apache.tapestry.ioc.ObjectLocator;
-import org.apache.tapestry.ioc.ServiceBuilderResources;
-import org.apache.tapestry.ioc.ServiceDecorator;
-import org.apache.tapestry.ioc.ServiceResources;
+import org.apache.tapestry.ioc.*;
import org.apache.tapestry.ioc.def.ContributionDef;
import org.apache.tapestry.ioc.def.DecoratorDef;
import org.apache.tapestry.ioc.def.ModuleDef;
import org.apache.tapestry.ioc.def.ServiceDef;
import org.apache.tapestry.ioc.internal.services.JustInTimeObjectCreator;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.*;
+import static org.apache.tapestry.ioc.internal.util.Defense.notBlank;
+import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
-import org.apache.tapestry.ioc.services.ClassFab;
-import org.apache.tapestry.ioc.services.ClassFabUtils;
-import org.apache.tapestry.ioc.services.ClassFactory;
-import org.apache.tapestry.ioc.services.Status;
-import org.apache.tapestry.ioc.services.TapestryIOCModule;
+import org.apache.tapestry.ioc.services.*;
import org.slf4j.Logger;
+import static java.lang.String.format;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.*;
+
public class ModuleImpl implements Module
{
private final InternalRegistry _registry;
@@ -76,11 +59,13 @@
// the constructor. Guarded by MUTEX.
private boolean _insideConstructor;
- /** Keyed on fully qualified service id; values are instantiated services (proxies). */
+ /**
+ * Keyed on fully qualified service id; values are instantiated services (proxies).
+ */
private final Map<String, Object> _services = newCaseInsensitiveMap();
public ModuleImpl(InternalRegistry registry, ServiceActivityTracker tracker,
- ModuleDef moduleDef, ClassFactory classFactory, Logger logger)
+ ModuleDef moduleDef, ClassFactory classFactory, Logger logger)
{
_registry = registry;
_tracker = tracker;
@@ -155,13 +140,11 @@
/**
* Locates the service proxy for a particular service (from the service definition).
- * <p>
+ * <p/>
* Access is synchronized via {@link #MUTEX}.
- *
- * @param def
- * defines the service
- * @param eagerLoadProxies
- * TODO
+ *
+ * @param def defines the service
+ * @param eagerLoadProxies TODO
* @return the service proxy
*/
private Object findOrCreate(ServiceDef def, List<EagerLoadServiceProxy> eagerLoadProxies)
@@ -203,9 +186,8 @@
/**
* Creates the service and updates the cache of created services. Access is synchronized via
* {@link #MUTEX}.
- *
- * @param eagerLoadProxies
- * a list into which any eager loaded proxies should be added
+ *
+ * @param eagerLoadProxies a list into which any eager loaded proxies should be added
*/
private Object create(ServiceDef def, List<EagerLoadServiceProxy> eagerLoadProxies)
{
@@ -218,7 +200,7 @@
try
{
ServiceBuilderResources resources = new ServiceResourcesImpl(_registry, this, def,
- _classFactory, logger);
+ _classFactory, logger);
// Build up a stack of operations that will be needed to realize the service
// (by the proxy, at a later date).
@@ -234,7 +216,7 @@
if (!serviceInterface.isInterface()) return creator.createObject();
creator = new LifecycleWrappedServiceCreator(_registry, def.getServiceScope(),
- resources, creator);
+ resources, creator);
// Don't allow the core IOC services services to be decorated.
@@ -246,7 +228,7 @@
creator = new RecursiveServiceCreationCheckWrapper(def, creator, logger);
JustInTimeObjectCreator delegate = new JustInTimeObjectCreator(_tracker, creator,
- serviceId);
+ serviceId);
Object proxy = createProxy(resources, delegate);
@@ -280,7 +262,9 @@
}
}
- /** Access synchronized by MUTEX. */
+ /**
+ * Access synchronized by MUTEX.
+ */
private Object instantiateModuleBuilder()
{
Class builderClass = _moduleDef.getBuilderClass();
@@ -363,7 +347,7 @@
}
private Object createProxyInstance(ObjectCreator creator, String serviceId,
- Class serviceInterface, String description)
+ Class serviceInterface, String description)
{
ClassFab cf = _registry.newClass(serviceInterface);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/NullAnnotationProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/NullAnnotationProvider.java?rev=594319&r1=594318&r2=594319&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/NullAnnotationProvider.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/NullAnnotationProvider.java Mon Nov 12 14:22:31 2007
@@ -14,17 +14,19 @@
package org.apache.tapestry.ioc.internal;
-import java.lang.annotation.Annotation;
-
import org.apache.tapestry.ioc.AnnotationProvider;
+import java.lang.annotation.Annotation;
+
/**
* A null implementation of {@link AnnotationProvider}, used when there is not appropriate source
* of annotations.
*/
public class NullAnnotationProvider implements AnnotationProvider
{
- /** Always returns null. */
+ /**
+ * Always returns null.
+ */
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
{
return null;