Repository: tapestry-5 Updated Branches: refs/heads/master 14524fecd -> 160ed331d
Deprecate SubModule annotation in favor of new ImportModule annotation Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/160ed331 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/160ed331 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/160ed331 Branch: refs/heads/master Commit: 160ed331d41b86f40bdd328a21a9c9dd4f4f8fd6 Parents: 14524fe Author: Howard M. Lewis Ship <[email protected]> Authored: Fri May 9 11:03:29 2014 -0700 Committer: Howard M. Lewis Ship <[email protected]> Committed: Fri May 9 11:03:29 2014 -0700 ---------------------------------------------------------------------- 54_RELEASE_NOTES.md | 5 +++ .../org/example/testapp/services/AppModule.java | 47 ++++++++++---------- .../tapestry5/modules/TapestryModule.java | 4 +- .../org/example/app0/services/AppModule.java | 23 +++++----- .../t5internal/modules/InternalTestModule.java | 2 +- .../org/apache/tapestry5/ioc/IOCUtilities.java | 30 +++++-------- .../apache/tapestry5/ioc/RegistryBuilder.java | 34 +++++++++----- .../tapestry5/ioc/annotations/ImportModule.java | 39 ++++++++++++++++ .../tapestry5/ioc/annotations/SubModule.java | 9 ++-- .../org/apache/tapestry5/ioc/HelterModule.java | 6 +-- .../org/apache/tapestry5/ioc/MasterModule.java | 3 +- .../org/apache/tapestry5/ioc/SkelterModule.java | 6 +-- .../org/example/testapp/services/AppModule.java | 6 +-- .../org/example/app1/services/AppModule.java | 8 ++-- .../org/example/app2/services/AppModule.java | 6 +-- .../org/example/app3/services/AppModule.java | 6 +-- .../org/example/app4/services/AppModule.java | 6 +-- .../org/example/app5/services/AppModule.java | 40 +++++++++-------- .../org/example/app6/services/AppModule.java | 8 ++-- .../java/kaptcha/demo/services/AppModule.java | 6 +-- .../org/example/testapp/services/AppModule.java | 6 +-- .../example/testapp1/services/AppModule.java | 6 +-- .../org/example/upload/services/AppModule.java | 6 +-- .../t5/webresources/services/AppModule.java | 8 ++-- 24 files changed, 172 insertions(+), 148 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/54_RELEASE_NOTES.md ---------------------------------------------------------------------- diff --git a/54_RELEASE_NOTES.md b/54_RELEASE_NOTES.md index 1772b20..6a9ac4d 100644 --- a/54_RELEASE_NOTES.md +++ b/54_RELEASE_NOTES.md @@ -39,6 +39,11 @@ attributes. The service proxies created by Tapestry-IoC for services defined on interfaces, not just a concrete class, now have the service implementation class annotations. The same now happens to annotations in service methods too. +## SubModule Deprecated + +The SubModule annotation has been deprecated; the new ImportModule annotation does exactly the same thing, +but is more clearly named. + ## Asset Improvements Prior versions of Tapestry created cacheable URLs for Assets that incorporated the application version number. The http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java b/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java index cb3b5b4..20caf1a 100644 --- a/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java +++ b/tapestry-beanvalidator/src/test/java/org/example/testapp/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2009-2013 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 @@ -11,6 +9,7 @@ // 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.example.testapp.services; import org.apache.tapestry5.SymbolConstants; @@ -19,9 +18,9 @@ import org.apache.tapestry5.beanvalidator.modules.BeanValidatorModule; import org.apache.tapestry5.ioc.Configuration; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.OrderedConfiguration; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; -@SubModule(BeanValidatorModule.class) +@ImportModule(BeanValidatorModule.class) public class AppModule { @@ -30,25 +29,25 @@ public class AppModule configuration.add(SymbolConstants.PRODUCTION_MODE, "false"); configuration.add(SymbolConstants.HMAC_PASSPHRASE, "u93490jhsprf2904rh29-3uj"); } - - public static void contributeBeanValidatorSource( - final OrderedConfiguration<BeanValidatorConfigurer> configuration) - { - configuration.add("Test", new BeanValidatorConfigurer() - { - - public void configure(javax.validation.Configuration<?> configuration) - { - configuration.ignoreXmlConfiguration(); - } - }); - } - - - public static void contributeBeanValidatorGroupSource( - final Configuration<Class> configuration) - { - configuration.add(Foo.class); - } + + public static void contributeBeanValidatorSource( + final OrderedConfiguration<BeanValidatorConfigurer> configuration) + { + configuration.add("Test", new BeanValidatorConfigurer() + { + + public void configure(javax.validation.Configuration<?> configuration) + { + configuration.ignoreXmlConfiguration(); + } + }); + } + + + public static void contributeBeanValidatorGroupSource( + final Configuration<Class> configuration) + { + configuration.add(Foo.class); + } } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java index 2f9ba45..e520b09 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java @@ -1,5 +1,3 @@ -// Copyright 2006-2014 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 @@ -110,7 +108,7 @@ import java.util.regex.Pattern; * The root module for Tapestry. */ @Marker(Core.class) -@SubModule( +@ImportModule( {InternalModule.class, AssetsModule.class, PageLoadModule.class, JavaScriptModule.class, CompatibilityModule.class, DashboardModule.class}) public final class TapestryModule { http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-hibernate/src/test/java/org/example/app0/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-hibernate/src/test/java/org/example/app0/services/AppModule.java b/tapestry-hibernate/src/test/java/org/example/app0/services/AppModule.java index 0d8d994..1eb52ed 100644 --- a/tapestry-hibernate/src/test/java/org/example/app0/services/AppModule.java +++ b/tapestry-hibernate/src/test/java/org/example/app0/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2007, 2008, 2011 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 @@ -24,14 +22,14 @@ import org.apache.tapestry5.ioc.OrderedConfiguration; import org.apache.tapestry5.ioc.ServiceBinder; import org.apache.tapestry5.ioc.ServiceResources; import org.apache.tapestry5.ioc.annotations.Contribute; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.ioc.annotations.Match; -import org.apache.tapestry5.ioc.annotations.SubModule; import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.security.ClientWhitelist; import org.apache.tapestry5.services.security.WhitelistAnalyzer; -// @SubModule just needed for developers running these tests within the IDE -@SubModule({HibernateModule.class, HibernateCoreModule.class}) +// @ImportModule just needed for developers running these tests within the IDE +@ImportModule({HibernateModule.class, HibernateCoreModule.class}) public class AppModule { public static void bind(ServiceBinder binder) @@ -53,17 +51,16 @@ public class AppModule } - @Contribute(ClientWhitelist.class) public static void provideWhitelistAnalyzer(OrderedConfiguration<WhitelistAnalyzer> configuration) { - configuration.add("TestAnalyzer", new WhitelistAnalyzer() - { + configuration.add("TestAnalyzer", new WhitelistAnalyzer() + { - public boolean isRequestOnWhitelist(Request request) - { - return true; - } - }, "before:*"); + public boolean isRequestOnWhitelist(Request request) + { + return true; + } + }, "before:*"); } } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-internal-test/src/main/java/org/apache/tapestry5/internal/t5internal/modules/InternalTestModule.java ---------------------------------------------------------------------- diff --git a/tapestry-internal-test/src/main/java/org/apache/tapestry5/internal/t5internal/modules/InternalTestModule.java b/tapestry-internal-test/src/main/java/org/apache/tapestry5/internal/t5internal/modules/InternalTestModule.java index 3f07ef3..0f19c01 100644 --- a/tapestry-internal-test/src/main/java/org/apache/tapestry5/internal/t5internal/modules/InternalTestModule.java +++ b/tapestry-internal-test/src/main/java/org/apache/tapestry5/internal/t5internal/modules/InternalTestModule.java @@ -8,7 +8,7 @@ import org.apache.tapestry5.services.LibraryMapping; /** * Provides the "t5internal" library, that provides common text utilities needed by some of the other * projects' integration tests. To normalize in-IDE development with command-line development, this module - * is not set up to auto load via a manifest attribute, instead it is referenced via {@link org.apache.tapestry5.ioc.annotations.SubModule}. + * is not set up to auto load via a manifest attribute, instead it is referenced via {@link org.apache.tapestry5.ioc.annotations.ImportModule}. * * @since 5.4 */ http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/IOCUtilities.java ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/IOCUtilities.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/IOCUtilities.java index e1df283..27892ef 100644 --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/IOCUtilities.java +++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/IOCUtilities.java @@ -1,5 +1,3 @@ -// Copyright 2006-2013 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 @@ -14,7 +12,6 @@ package org.apache.tapestry5.ioc; -import org.apache.tapestry5.ioc.annotations.SubModule; import org.apache.tapestry5.ioc.util.ExceptionUtils; import java.io.Closeable; @@ -61,8 +58,9 @@ public final class IOCUtilities * corresponding class to the RegistryBuilder. In addition, looks for a system property named "tapestry.modules" and * adds all of those modules as well. The tapestry.modules approach is intended for development. * - * @param builder the builder to which modules will be added - * @see SubModule + * @param builder + * the builder to which modules will be added + * @see org.apache.tapestry5.ioc.annotations.ImportModule * @see RegistryBuilder#add(String) */ public static void addDefaultModules(RegistryBuilder builder) @@ -80,8 +78,7 @@ public final class IOCUtilities addModulesInList(builder, System.getProperty("tapestry.modules")); - } - catch (IOException ex) + } catch (IOException ex) { throw new RuntimeException(ex.getMessage(), ex); } @@ -106,24 +103,21 @@ public final class IOCUtilities String list = mf.getMainAttributes().getValue(MODULE_BUILDER_MANIFEST_ENTRY_NAME); addModulesInList(builder, list); - } - catch (RuntimeException ex) + } catch (RuntimeException ex) { fail = ex; - } - catch (IOException ex) + } catch (IOException ex) { fail = ex; - } - finally + } finally { close(in); } if (fail != null) throw new RuntimeException(String.format("Exception loading module(s) from manifest %s: %s", - url.toString(), - ExceptionUtils.toMessage(fail)), fail); + url.toString(), + ExceptionUtils.toMessage(fail)), fail); } @@ -142,7 +136,8 @@ public final class IOCUtilities /** * Closes an input stream (or other Closeable), ignoring any exception. * - * @param closeable the thing to close, or null to close nothing + * @param closeable + * the thing to close, or null to close nothing */ private static void close(Closeable closeable) { @@ -151,8 +146,7 @@ public final class IOCUtilities try { closeable.close(); - } - catch (IOException ex) + } catch (IOException ex) { // Ignore. } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java index 42efae9..d68b2da 100644 --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java +++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/RegistryBuilder.java @@ -1,5 +1,3 @@ -// Copyright 2006-2014 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 @@ -14,6 +12,7 @@ package org.apache.tapestry5.ioc; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.ioc.annotations.SubModule; import org.apache.tapestry5.ioc.def.ModuleDef; import org.apache.tapestry5.ioc.def.ModuleDef2; @@ -100,7 +99,7 @@ public final class RegistryBuilder /** * Adds a number of modules (as module classes) to the registry, returning the builder for further configuration. * - * @see org.apache.tapestry5.ioc.annotations.SubModule + * @see org.apache.tapestry5.ioc.annotations.ImportModule */ public RegistryBuilder add(Class... moduleClasses) { @@ -124,12 +123,22 @@ public final class RegistryBuilder ModuleDef def = new DefaultModuleDefImpl(c, logger, proxyFactory); add(def); - SubModule annotation = ((AnnotatedElement) c).getAnnotation(SubModule.class); - if (annotation == null) - continue; + @SuppressWarnings("RedundantCast") + AnnotatedElement element = (AnnotatedElement) c; + + SubModule subModule = element.getAnnotation(SubModule.class); + + if (subModule != null) + { + queue.addAll(Arrays.asList(subModule.value())); + } + ImportModule importModule = element.getAnnotation(ImportModule.class); - queue.addAll(Arrays.asList(annotation.value())); + if (importModule != null) + { + queue.addAll(Arrays.asList(importModule.value())); + } } return this; @@ -139,7 +148,7 @@ public final class RegistryBuilder * Adds a modle class (specified by fully qualified class name) to the registry, returning the builder * for further configuration. * - * @see org.apache.tapestry5.ioc.annotations.SubModule + * @see org.apache.tapestry5.ioc.annotations.ImportModule */ public RegistryBuilder add(String classname) { @@ -189,8 +198,10 @@ public final class RegistryBuilder * performs registry startup. The returned registry is ready to use. The caller is must not invoke * {@link org.apache.tapestry5.ioc.Registry#performRegistryStartup()}. * - * @param moduleDef {@link ModuleDef} to add - * @param moduleClasses modules (as module classes) to add + * @param moduleDef + * {@link ModuleDef} to add + * @param moduleClasses + * modules (as module classes) to add * @return {@link Registry} * @since 5.2.0 */ @@ -215,7 +226,8 @@ public final class RegistryBuilder * performs registry startup. The returned registry is ready to use. The caller is must not invoke * {@link org.apache.tapestry5.ioc.Registry#performRegistryStartup()}. * - * @param moduleClasses modules (as module classes) to add + * @param moduleClasses + * modules (as module classes) to add * @return {@link Registry} * @since 5.2.0 */ http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/ImportModule.java ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/ImportModule.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/ImportModule.java new file mode 100644 index 0000000..248654a --- /dev/null +++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/ImportModule.java @@ -0,0 +1,39 @@ +// 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.tapestry5.ioc.annotations; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Attached to a module class, this annotation identifies other module classes that should also be added to the + * Registry. A class is processed once, even if it is mentioned multiple times. Using this annotation + * is often easier than updating the JAR Manifest to list additional module class names. + * + * @since 5.4 + */ +@Target(TYPE) +@Retention(RUNTIME) +@Documented +@UseWith(AnnotationUseContext.MODULE) +public @interface ImportModule +{ + /** + * One or more classes that are also modules and should also be loaded. + */ + Class[] value(); +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/SubModule.java ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/SubModule.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/SubModule.java index d180372..93fb9c1 100644 --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/SubModule.java +++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/annotations/SubModule.java @@ -1,5 +1,3 @@ -// Copyright 2006, 2009 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 @@ -15,14 +13,17 @@ package org.apache.tapestry5.ioc.annotations; 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; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + /** * 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. + * + * @deprecated Deprecated in 5.4, use {@link org.apache.tapestry5.ioc.annotations.ImportModule} instead. */ @Target(TYPE) @Retention(RUNTIME) http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/HelterModule.java ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/HelterModule.java b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/HelterModule.java index 3e1572d..f2feb6b 100644 --- a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/HelterModule.java +++ b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/HelterModule.java @@ -1,5 +1,3 @@ -// Copyright 2008 The Apache Software Foundation -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -14,10 +12,10 @@ package org.apache.tapestry5.ioc; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; -@SubModule(SkelterModule.class) +@ImportModule(SkelterModule.class) public class HelterModule { public Runnable buildHelter() http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/MasterModule.java ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/MasterModule.java b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/MasterModule.java index 1c392dc..7bd3a6b 100644 --- a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/MasterModule.java +++ b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/MasterModule.java @@ -1,5 +1,3 @@ -// Copyright 2006, 2007, 2012 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 @@ -19,6 +17,7 @@ import org.apache.tapestry5.ioc.annotations.SubModule; /** * Used by {@link ioc.specs.RegistryBuilderSpec}. */ +// Leaving this one here as a compatibility test; other SubModules have been converted to ImportModule. @SubModule( {FredModule.class, BarneyModule.class}) public final class MasterModule http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/SkelterModule.java ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/SkelterModule.java b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/SkelterModule.java index 4bdee3d..a3dc900 100644 --- a/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/SkelterModule.java +++ b/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/SkelterModule.java @@ -1,5 +1,3 @@ -// Copyright 2008 The Apache Software Foundation -// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -14,9 +12,9 @@ package org.apache.tapestry5.ioc; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; -@SubModule(HelterModule.class) +@ImportModule(HelterModule.class) public class SkelterModule { public Runnable buildSkelter() http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-jmx/src/test/java/org/example/testapp/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-jmx/src/test/java/org/example/testapp/services/AppModule.java b/tapestry-jmx/src/test/java/org/example/testapp/services/AppModule.java index ca43f67..e57f506 100644 --- a/tapestry-jmx/src/test/java/org/example/testapp/services/AppModule.java +++ b/tapestry-jmx/src/test/java/org/example/testapp/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2010-2013 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 @@ -18,11 +16,11 @@ import org.apache.tapestry5.SymbolConstants; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.ServiceBinder; import org.apache.tapestry5.ioc.annotations.Decorate; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.jmx.MBeanSupport; import org.apache.tapestry5.jmx.modules.JmxModule; -@SubModule(JmxModule.class) +@ImportModule(JmxModule.class) public class AppModule { public static void bind(ServiceBinder binder) http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-jpa/src/test/java/org/example/app1/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-jpa/src/test/java/org/example/app1/services/AppModule.java b/tapestry-jpa/src/test/java/org/example/app1/services/AppModule.java index e819aed..6713f5c 100644 --- a/tapestry-jpa/src/test/java/org/example/app1/services/AppModule.java +++ b/tapestry-jpa/src/test/java/org/example/app1/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2011-2013 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 @@ -19,8 +17,8 @@ import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.MethodAdviceReceiver; import org.apache.tapestry5.ioc.ServiceBinder; import org.apache.tapestry5.ioc.annotations.Contribute; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.ioc.annotations.Match; -import org.apache.tapestry5.ioc.annotations.SubModule; import org.apache.tapestry5.ioc.services.ApplicationDefaults; import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.jpa.EntityManagerSource; @@ -33,7 +31,7 @@ import org.example.app1.entities.Thang; import org.example.app1.entities.User; import org.example.app1.services.impl.UserDAOImpl; -@SubModule(JpaModule.class) +@ImportModule(JpaModule.class) public class AppModule { @@ -81,7 +79,7 @@ public class AppModule @Match("*DAO") public static void adviseTransactionally(final JpaTransactionAdvisor advisor, - final MethodAdviceReceiver receiver) + final MethodAdviceReceiver receiver) { advisor.addTransactionCommitAdvice(receiver); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-jpa/src/test/java/org/example/app2/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-jpa/src/test/java/org/example/app2/services/AppModule.java b/tapestry-jpa/src/test/java/org/example/app2/services/AppModule.java index 308bce7..c90cf46 100644 --- a/tapestry-jpa/src/test/java/org/example/app2/services/AppModule.java +++ b/tapestry-jpa/src/test/java/org/example/app2/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2011-2013 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 @@ -17,14 +15,14 @@ package org.example.app2.services; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.ServiceBinder; import org.apache.tapestry5.ioc.annotations.Contribute; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.ioc.services.ApplicationDefaults; import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.jpa.JpaSymbols; import org.apache.tapestry5.jpa.modules.JpaModule; import org.example.app2.services.impl.UserDAOImpl; -@SubModule(JpaModule.class) +@ImportModule(JpaModule.class) public class AppModule { http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-jpa/src/test/java/org/example/app3/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-jpa/src/test/java/org/example/app3/services/AppModule.java b/tapestry-jpa/src/test/java/org/example/app3/services/AppModule.java index 9e703a6..f0c47de 100644 --- a/tapestry-jpa/src/test/java/org/example/app3/services/AppModule.java +++ b/tapestry-jpa/src/test/java/org/example/app3/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2011-2013 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 @@ -16,7 +14,7 @@ package org.example.app3.services; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.annotations.Contribute; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.ioc.services.ApplicationDefaults; import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.jpa.EntityManagerSource; @@ -25,7 +23,7 @@ import org.apache.tapestry5.jpa.PersistenceUnitConfigurer; import org.apache.tapestry5.jpa.TapestryPersistenceUnitInfo; import org.apache.tapestry5.jpa.modules.JpaModule; -@SubModule(JpaModule.class) +@ImportModule(JpaModule.class) public class AppModule { @Contribute(SymbolProvider.class) http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-jpa/src/test/java/org/example/app4/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-jpa/src/test/java/org/example/app4/services/AppModule.java b/tapestry-jpa/src/test/java/org/example/app4/services/AppModule.java index 0ead9ab..f13fcfc 100644 --- a/tapestry-jpa/src/test/java/org/example/app4/services/AppModule.java +++ b/tapestry-jpa/src/test/java/org/example/app4/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2011-2013 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 @@ -16,13 +14,13 @@ package org.example.app4.services; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.annotations.Contribute; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.ioc.services.ApplicationDefaults; import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.jpa.JpaSymbols; import org.apache.tapestry5.jpa.modules.JpaModule; -@SubModule(JpaModule.class) +@ImportModule(JpaModule.class) public class AppModule { http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-jpa/src/test/java/org/example/app5/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-jpa/src/test/java/org/example/app5/services/AppModule.java b/tapestry-jpa/src/test/java/org/example/app5/services/AppModule.java index 785b6ca..23221d4 100644 --- a/tapestry-jpa/src/test/java/org/example/app5/services/AppModule.java +++ b/tapestry-jpa/src/test/java/org/example/app5/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2012, 2013 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 @@ -16,7 +14,7 @@ package org.example.app5.services; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.annotations.Contribute; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.ioc.services.ApplicationDefaults; import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.jpa.JpaSymbols; @@ -29,27 +27,33 @@ import javax.persistence.spi.PersistenceProviderResolverHolder; import java.util.Arrays; import java.util.List; -@SubModule(JpaModule.class) -public class AppModule { - - static { - - PersistenceProviderResolverHolder.setPersistenceProviderResolver(new PersistenceProviderResolver() { - public List<PersistenceProvider> getPersistenceProviders() { - return Arrays.<PersistenceProvider>asList(new DummyPersistenceProvider(), new org.eclipse.persistence.jpa.PersistenceProvider()); - } - - public void clearCachedProviders() { - } - } - +@ImportModule(JpaModule.class) +public class AppModule +{ + + static + { + + PersistenceProviderResolverHolder.setPersistenceProviderResolver( + new PersistenceProviderResolver() + { + public List<PersistenceProvider> getPersistenceProviders() + { + return Arrays.<PersistenceProvider>asList(new DummyPersistenceProvider(), new org.eclipse.persistence.jpa.PersistenceProvider()); + } + + public void clearCachedProviders() + { + } + } ); } @Contribute(SymbolProvider.class) @ApplicationDefaults public static void provideApplicationDefaults( - final MappedConfiguration<String, String> configuration) { + final MappedConfiguration<String, String> configuration) + { configuration.add(JpaSymbols.PROVIDE_ENTITY_VALUE_ENCODERS, "false"); configuration.add(JpaSymbols.PERSISTENCE_DESCRIPTOR, "/explicit-persistence-provider-class-persistence-unit.xml"); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-jpa/src/test/java/org/example/app6/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-jpa/src/test/java/org/example/app6/services/AppModule.java b/tapestry-jpa/src/test/java/org/example/app6/services/AppModule.java index e87e8f8..3973ec3 100644 --- a/tapestry-jpa/src/test/java/org/example/app6/services/AppModule.java +++ b/tapestry-jpa/src/test/java/org/example/app6/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2014 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 @@ -19,8 +17,8 @@ import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.MethodAdviceReceiver; import org.apache.tapestry5.ioc.ServiceBinder; import org.apache.tapestry5.ioc.annotations.Contribute; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.ioc.annotations.Match; -import org.apache.tapestry5.ioc.annotations.SubModule; import org.apache.tapestry5.ioc.services.ApplicationDefaults; import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.jpa.EntityManagerSource; @@ -33,7 +31,7 @@ import org.example.app6.entities.Thang; import org.example.app6.entities.User; import org.example.app6.services.impl.UserDAOImpl; -@SubModule(JpaModule.class) +@ImportModule(JpaModule.class) public class AppModule { @@ -81,7 +79,7 @@ public class AppModule @Match("*DAO") public static void adviseTransactionally(final JpaTransactionAdvisor advisor, - final MethodAdviceReceiver receiver) + final MethodAdviceReceiver receiver) { advisor.addTransactionCommitAdvice(receiver); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-kaptcha/src/test/java/kaptcha/demo/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-kaptcha/src/test/java/kaptcha/demo/services/AppModule.java b/tapestry-kaptcha/src/test/java/kaptcha/demo/services/AppModule.java index 604765f..b141291 100644 --- a/tapestry-kaptcha/src/test/java/kaptcha/demo/services/AppModule.java +++ b/tapestry-kaptcha/src/test/java/kaptcha/demo/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2011-2013 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 @@ -18,7 +16,7 @@ import com.google.code.kaptcha.Constants; import org.apache.tapestry5.SymbolConstants; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.annotations.Contribute; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.ioc.services.ApplicationDefaults; import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.kaptcha.modules.KaptchaModule; @@ -27,7 +25,7 @@ import org.slf4j.Logger; import java.awt.image.BufferedImage; -@SubModule(KaptchaModule.class) +@ImportModule(KaptchaModule.class) public class AppModule { @Contribute(SymbolProvider.class) http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-spring/src/test/java/org/example/testapp/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-spring/src/test/java/org/example/testapp/services/AppModule.java b/tapestry-spring/src/test/java/org/example/testapp/services/AppModule.java index 6cace0a..5000527 100644 --- a/tapestry-spring/src/test/java/org/example/testapp/services/AppModule.java +++ b/tapestry-spring/src/test/java/org/example/testapp/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2008-2013 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 @@ -18,14 +16,14 @@ import org.apache.tapestry5.SymbolConstants; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.OrderedConfiguration; import org.apache.tapestry5.ioc.ServiceBinder; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.spring.ApplicationContextCustomizer; import org.apache.tapestry5.spring.modules.SpringModule; import org.springframework.web.context.ConfigurableWebApplicationContext; import javax.servlet.ServletContext; -@SubModule(SpringModule.class) +@ImportModule(SpringModule.class) public class AppModule { public static final void bind(ServiceBinder binder) http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-spring/src/test/java/org/example/testapp1/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-spring/src/test/java/org/example/testapp1/services/AppModule.java b/tapestry-spring/src/test/java/org/example/testapp1/services/AppModule.java index 0e61be9..5db0ab0 100644 --- a/tapestry-spring/src/test/java/org/example/testapp1/services/AppModule.java +++ b/tapestry-spring/src/test/java/org/example/testapp1/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2011-2013 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 @@ -16,10 +14,10 @@ package org.example.testapp1.services; import org.apache.tapestry5.SymbolConstants; import org.apache.tapestry5.ioc.MappedConfiguration; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.spring.modules.SpringModule; -@SubModule(SpringModule.class) +@ImportModule(SpringModule.class) public class AppModule { public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java b/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java index d376800..bb54a7b 100755 --- a/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java +++ b/tapestry-upload/src/test/java/org/example/upload/services/AppModule.java @@ -1,5 +1,3 @@ -// Copyright 2007-2013 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 @@ -16,7 +14,7 @@ package org.example.upload.services; import org.apache.tapestry5.SymbolConstants; import org.apache.tapestry5.ioc.MappedConfiguration; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.upload.modules.UploadModule; import org.apache.tapestry5.upload.services.UploadSymbols; @@ -24,7 +22,7 @@ import org.apache.tapestry5.upload.services.UploadSymbols; * The SubModule is not normally needed, except that during tests of tapestry-upload, the necessary JAR Manifest does * not yet exist, so we force the tapestry-upload module into the registry explicitly. */ -@SubModule(UploadModule.class) +@ImportModule(UploadModule.class) public class AppModule { public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/160ed331/tapestry-webresources/src/test/java/t5/webresources/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-webresources/src/test/java/t5/webresources/services/AppModule.java b/tapestry-webresources/src/test/java/t5/webresources/services/AppModule.java index dcb4bd7..362d647 100644 --- a/tapestry-webresources/src/test/java/t5/webresources/services/AppModule.java +++ b/tapestry-webresources/src/test/java/t5/webresources/services/AppModule.java @@ -4,7 +4,7 @@ import org.apache.tapestry5.SymbolConstants; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.OrderedConfiguration; import org.apache.tapestry5.ioc.annotations.Contribute; -import org.apache.tapestry5.ioc.annotations.SubModule; +import org.apache.tapestry5.ioc.annotations.ImportModule; import org.apache.tapestry5.ioc.services.ApplicationDefaults; import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.services.Core; @@ -15,7 +15,7 @@ import org.apache.tapestry5.services.javascript.StackExtension; import org.apache.tapestry5.services.javascript.StackExtensionType; import org.apache.tapestry5.webresources.modules.WebResourcesModule; -@SubModule(WebResourcesModule.class) +@ImportModule(WebResourcesModule.class) public class AppModule { @Contribute(Compatibility.class) @@ -38,7 +38,7 @@ public class AppModule @Core public static void overrideBootstrapCSS(OrderedConfiguration<StackExtension> configuration) { - configuration.override("bootstrap.css", - new StackExtension(StackExtensionType.STYLESHEET, "context:bootstrap/less/bootstrap.less"), "before:tapestry.css"); + configuration.override("bootstrap.css", + new StackExtension(StackExtensionType.STYLESHEET, "context:bootstrap/less/bootstrap.less"), "before:tapestry.css"); } }
