Move KaptchaModule into a modules package
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/e8e0af57 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/e8e0af57 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/e8e0af57 Branch: refs/heads/master Commit: e8e0af57856e6b984d87db8c64aba13a8b5d5922 Parents: 27d95cc Author: Howard M. Lewis Ship <[email protected]> Authored: Mon Apr 22 17:07:30 2013 -0700 Committer: Howard M. Lewis Ship <[email protected]> Committed: Mon Apr 22 17:07:30 2013 -0700 ---------------------------------------------------------------------- tapestry-kaptcha/build.gradle | 2 +- .../tapestry5/kaptcha/KaptchaSymbolConstants.java | 4 +- .../tapestry5/kaptcha/modules/KaptchaModule.java | 75 +++++++++++++++ .../tapestry5/kaptcha/services/KaptchaModule.java | 74 -------------- .../test/java/kaptcha/demo/services/AppModule.java | 4 +- 5 files changed, 80 insertions(+), 79 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8e0af57/tapestry-kaptcha/build.gradle ---------------------------------------------------------------------- diff --git a/tapestry-kaptcha/build.gradle b/tapestry-kaptcha/build.gradle index be8fded..a3677ba 100644 --- a/tapestry-kaptcha/build.gradle +++ b/tapestry-kaptcha/build.gradle @@ -13,6 +13,6 @@ repositories { jar { manifest { - attributes 'Tapestry-Module-Classes': 'org.apache.tapestry5.kaptcha.services.KaptchaModule' + attributes 'Tapestry-Module-Classes': 'org.apache.tapestry5.kaptcha.modules.KaptchaModule' } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8e0af57/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/KaptchaSymbolConstants.java ---------------------------------------------------------------------- diff --git a/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/KaptchaSymbolConstants.java b/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/KaptchaSymbolConstants.java index 382ae11..f3f3afd 100644 --- a/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/KaptchaSymbolConstants.java +++ b/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/KaptchaSymbolConstants.java @@ -1,4 +1,4 @@ -// Copyright 2012 The Apache Software Foundation +// 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. @@ -15,7 +15,7 @@ package org.apache.tapestry5.kaptcha; /** - * Defines constants used by the {@link org.apache.tapestry5.kaptcha.services.KaptchaModule} and related components. + * Defines constants used by the {@link org.apache.tapestry5.kaptcha.modules.KaptchaModule} and related components. * * @since 5.3 */ http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8e0af57/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/modules/KaptchaModule.java ---------------------------------------------------------------------- diff --git a/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/modules/KaptchaModule.java b/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/modules/KaptchaModule.java new file mode 100644 index 0000000..0327399 --- /dev/null +++ b/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/modules/KaptchaModule.java @@ -0,0 +1,75 @@ +// 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 +// +// 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.kaptcha.modules; + +import org.apache.tapestry5.internal.InternalConstants; +import org.apache.tapestry5.ioc.*; +import org.apache.tapestry5.ioc.annotations.Contribute; +import org.apache.tapestry5.ioc.annotations.Value; +import org.apache.tapestry5.ioc.services.FactoryDefaults; +import org.apache.tapestry5.ioc.services.SymbolProvider; +import org.apache.tapestry5.kaptcha.KaptchaSymbolConstants; +import org.apache.tapestry5.kaptcha.internal.services.KaptchaDataTypeAnalyzer; +import org.apache.tapestry5.kaptcha.internal.services.KaptchaProducerImpl; +import org.apache.tapestry5.kaptcha.services.KaptchaProducer; +import org.apache.tapestry5.services.*; +import org.apache.tapestry5.services.messages.ComponentMessagesSource; + +/** + * Defines core services for Kaptcha support. + * + * @since 5.3 + */ +public class KaptchaModule +{ + public static void bind(ServiceBinder binder) + { + binder.bind(KaptchaProducer.class, KaptchaProducerImpl.class); + } + + @Contribute(SymbolProvider.class) + @FactoryDefaults + public static void factoryDefaults(MappedConfiguration<String, Object> configuration) + { + configuration.add(KaptchaSymbolConstants.KAPTCHA_DEFAULT_VISIBLE, true); + } + + @Contribute(ComponentClassResolver.class) + public static void provideLibraryMapping(Configuration<LibraryMapping> configuration) + { + configuration.add(new LibraryMapping(InternalConstants.CORE_LIBRARY, "org.apache.tapestry5.kaptcha")); + } + + @Contribute(ComponentMessagesSource.class) + public static void provideLibraryMessages( + OrderedConfiguration<Resource> configuration, + @Value("classpath:org/apache/tapestry5/kaptcha/tapestry-kaptcha.properties") + Resource kaptchaCatalog) + { + configuration.add("TapestryKaptcha", kaptchaCatalog, "before:AppCatalog"); + } + + public static void contributeDataTypeAnalyzer(OrderedConfiguration<DataTypeAnalyzer> configuration) + { + configuration.add("Kaptcha", new KaptchaDataTypeAnalyzer(), "after:Annotation"); + } + + @Contribute(BeanBlockSource.class) + public static void provideDefaultBeanBlocks(Configuration<BeanBlockContribution> configuration) + { + configuration.add(new EditBlockContribution("kaptcha", "KaptchaEditBlocks", "kaptcha")); + + } +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8e0af57/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/services/KaptchaModule.java ---------------------------------------------------------------------- diff --git a/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/services/KaptchaModule.java b/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/services/KaptchaModule.java deleted file mode 100644 index 69d8205..0000000 --- a/tapestry-kaptcha/src/main/java/org/apache/tapestry5/kaptcha/services/KaptchaModule.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2011, 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 -// -// 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.kaptcha.services; - -import org.apache.tapestry5.internal.InternalConstants; -import org.apache.tapestry5.ioc.*; -import org.apache.tapestry5.ioc.annotations.Contribute; -import org.apache.tapestry5.ioc.annotations.Value; -import org.apache.tapestry5.ioc.services.FactoryDefaults; -import org.apache.tapestry5.ioc.services.SymbolProvider; -import org.apache.tapestry5.kaptcha.KaptchaSymbolConstants; -import org.apache.tapestry5.kaptcha.internal.services.KaptchaDataTypeAnalyzer; -import org.apache.tapestry5.kaptcha.internal.services.KaptchaProducerImpl; -import org.apache.tapestry5.services.*; -import org.apache.tapestry5.services.messages.ComponentMessagesSource; - -/** - * Defines core services for Kaptcha support. - * - * @since 5.3 - */ -public class KaptchaModule -{ - public static void bind(ServiceBinder binder) - { - binder.bind(KaptchaProducer.class, KaptchaProducerImpl.class); - } - - @Contribute(SymbolProvider.class) - @FactoryDefaults - public static void factoryDefaults(MappedConfiguration<String, Object> configuration) - { - configuration.add(KaptchaSymbolConstants.KAPTCHA_DEFAULT_VISIBLE, true); - } - - @Contribute(ComponentClassResolver.class) - public static void provideLibraryMapping(Configuration<LibraryMapping> configuration) - { - configuration.add(new LibraryMapping(InternalConstants.CORE_LIBRARY, "org.apache.tapestry5.kaptcha")); - } - - @Contribute(ComponentMessagesSource.class) - public static void provideLibraryMessages( - OrderedConfiguration<Resource> configuration, - @Value("classpath:org/apache/tapestry5/kaptcha/tapestry-kaptcha.properties") - Resource kaptchaCatalog) - { - configuration.add("TapestryKaptcha", kaptchaCatalog, "before:AppCatalog"); - } - - public static void contributeDataTypeAnalyzer(OrderedConfiguration<DataTypeAnalyzer> configuration) - { - configuration.add("Kaptcha", new KaptchaDataTypeAnalyzer(), "after:Annotation"); - } - - @Contribute(BeanBlockSource.class) - public static void provideDefaultBeanBlocks(Configuration<BeanBlockContribution> configuration) - { - configuration.add(new EditBlockContribution("kaptcha", "KaptchaEditBlocks", "kaptcha")); - - } -} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e8e0af57/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 9a174b2..604765f 100644 --- a/tapestry-kaptcha/src/test/java/kaptcha/demo/services/AppModule.java +++ b/tapestry-kaptcha/src/test/java/kaptcha/demo/services/AppModule.java @@ -1,4 +1,4 @@ -// Copyright 2011 The Apache Software Foundation +// 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. @@ -21,7 +21,7 @@ import org.apache.tapestry5.ioc.annotations.Contribute; 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.kaptcha.services.KaptchaModule; +import org.apache.tapestry5.kaptcha.modules.KaptchaModule; import org.apache.tapestry5.kaptcha.services.KaptchaProducer; import org.slf4j.Logger;
