http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetsModule.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetsModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetsModule.java deleted file mode 100644 index d727792..0000000 --- a/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetsModule.java +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright 2011, 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 -// -// 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.services.assets; - -import org.apache.tapestry5.SymbolConstants; -import org.apache.tapestry5.internal.AssetConstants; -import org.apache.tapestry5.internal.InternalConstants; -import org.apache.tapestry5.internal.services.*; -import org.apache.tapestry5.internal.services.assets.*; -import org.apache.tapestry5.internal.services.messages.ClientLocalizationMessageResource; -import org.apache.tapestry5.ioc.*; -import org.apache.tapestry5.ioc.annotations.*; -import org.apache.tapestry5.ioc.services.FactoryDefaults; -import org.apache.tapestry5.ioc.services.SymbolProvider; -import org.apache.tapestry5.services.*; -import org.apache.tapestry5.services.messages.ComponentMessagesSource; - -import java.util.Map; - -/** - * @since 5.3 - */ -@Marker(Core.class) -public class AssetsModule -{ - public static void bind(ServiceBinder binder) - { - binder.bind(AssetFactory.class, ClasspathAssetFactory.class).withSimpleId(); - binder.bind(AssetPathConverter.class, IdentityAssetPathConverter.class); - binder.bind(AssetPathConstructor.class, AssetPathConstructorImpl.class); - binder.bind(ClasspathAssetAliasManager.class, ClasspathAssetAliasManagerImpl.class); - binder.bind(AssetSource.class, AssetSourceImpl.class); - binder.bind(StreamableResourceSource.class, StreamableResourceSourceImpl.class); - binder.bind(CompressionAnalyzer.class, CompressionAnalyzerImpl.class); - binder.bind(ContentTypeAnalyzer.class, ContentTypeAnalyzerImpl.class); - binder.bind(ResourceChangeTracker.class, ResourceChangeTrackerImpl.class); - binder.bind(ResourceMinimizer.class, MasterResourceMinimizer.class); - binder.bind(AssetChecksumGenerator.class, AssetChecksumGeneratorImpl.class); - binder.bind(JavaScriptStackAssembler.class, JavaScriptStackAssemblerImpl.class); - } - - @Contribute(AssetSource.class) - public void configureStandardAssetFactories(MappedConfiguration<String, AssetFactory> configuration, - @ContextProvider - AssetFactory contextAssetFactory, - - @ClasspathProvider - AssetFactory classpathAssetFactory) - { - configuration.add(AssetConstants.CONTEXT, contextAssetFactory); - configuration.add(AssetConstants.CLASSPATH, classpathAssetFactory); - } - - - @Contribute(SymbolProvider.class) - @FactoryDefaults - public static void setupSymbols(MappedConfiguration<String, Object> configuration) - { - // Minification may be enabled in production mode, but unless a minimizer is provided, nothing - // will change. - configuration.add(SymbolConstants.MINIFICATION_ENABLED, SymbolConstants.PRODUCTION_MODE_VALUE); - configuration.add(SymbolConstants.GZIP_COMPRESSION_ENABLED, true); - configuration.add(SymbolConstants.COMBINE_SCRIPTS, SymbolConstants.PRODUCTION_MODE_VALUE); - configuration.add(SymbolConstants.ASSET_URL_FULL_QUALIFIED, false); - - configuration.add(SymbolConstants.ASSET_PATH_PREFIX, "asset"); - configuration.add(SymbolConstants.COMPRESSED_ASSET_PATH_PREFIX, "${tapestry.asset-path-prefix}.gz"); - } - - // The use of decorators is to allow third-parties to get their own extensions - // into the pipeline. - - @Decorate(id = "GZipCompression", serviceInterface = StreamableResourceSource.class) - public StreamableResourceSource enableCompression(StreamableResourceSource delegate, - @Symbol(SymbolConstants.GZIP_COMPRESSION_ENABLED) - boolean gzipEnabled, @Symbol(SymbolConstants.MIN_GZIP_SIZE) - int compressionCutoff, - AssetChecksumGenerator checksumGenerator) - { - return gzipEnabled - ? new SRSCompressingInterceptor(delegate, compressionCutoff, checksumGenerator) - : null; - } - - @Decorate(id = "CacheCompressed", serviceInterface = StreamableResourceSource.class) - @Order("before:GZIpCompression") - public StreamableResourceSource enableCompressedCaching(StreamableResourceSource delegate, - @Symbol(SymbolConstants.GZIP_COMPRESSION_ENABLED) - boolean gzipEnabled, ResourceChangeTracker tracker) - { - return gzipEnabled - ? new SRSCompressedCachingInterceptor(delegate, tracker) - : null; - } - - @Decorate(id = "Cache", serviceInterface = StreamableResourceSource.class) - @Order("after:GZipCompression") - public StreamableResourceSource enableUncompressedCaching(StreamableResourceSource delegate, - ResourceChangeTracker tracker) - { - return new SRSCachingInterceptor(delegate, tracker); - } - - // Goes after cache, to ensure that what we are caching is the minified version. - @Decorate(id = "Minification", serviceInterface = StreamableResourceSource.class) - @Order("after:Cache") - public StreamableResourceSource enableMinification(StreamableResourceSource delegate, ResourceMinimizer minimizer, - @Symbol(SymbolConstants.MINIFICATION_ENABLED) - boolean enabled) - { - return enabled - ? new SRSMinimizingInterceptor(delegate, minimizer) - : null; - } - - // Ordering this after minification means that the URL replacement happens first; - // then the minification, then the uncompressed caching, then compression, then compressed - // cache. - @Decorate(id = "CSSURLRewrite", serviceInterface = StreamableResourceSource.class) - @Order("after:Minification") - public StreamableResourceSource enableCSSURLRewriting(StreamableResourceSource delegate, - OperationTracker tracker, - AssetSource assetSource, - AssetChecksumGenerator checksumGenerator) - { - return new CSSURLRewriter(delegate, tracker, assetSource, checksumGenerator); - } - - /** - * Adds content types: - * <dl> - * <dt>css</dt> - * <dd>text/css</dd> - * <dt>js</dt> - * <dd>text/javascript</dd> - * <dt>jpg, jpeg</dt> - * <dd>image/jpeg</dd> - * <dt>gif</dt> - * <dd>image/gif</dd> - * <dt>png</dt> - * <dd>image/png</dd> - * <dt>svg</dt> - * <dd>image/svg+xml</dd> - * <dt>swf</dt> - * <dd>application/x-shockwave-flash</dd> - * </dl> - */ - @Contribute(ContentTypeAnalyzer.class) - public void setupDefaultContentTypeMappings(MappedConfiguration<String, String> configuration) - { - configuration.add("css", "text/css"); - configuration.add("js", "text/javascript"); - configuration.add("gif", "image/gif"); - configuration.add("jpg", "image/jpeg"); - configuration.add("jpeg", "image/jpeg"); - configuration.add("png", "image/png"); - configuration.add("swf", "application/x-shockwave-flash"); - configuration.add("svg", "image/svg+xml"); - } - - /** - * Disables compression for the following content types: - * <ul> - * <li>image/jpeg</li> - * <li>image/gif</li> - * <li>image/png</li> - * <li>application/x-shockwave-flash</li> - * </ul> - */ - @Contribute(CompressionAnalyzer.class) - public void disableCompressionForImageTypes(MappedConfiguration<String, Boolean> configuration) - { - configuration.add("image/jpeg", false); - configuration.add("image/gif", false); - configuration.add("image/png", false); - configuration.add("application/x-shockwave-flash", false); - } - - @Marker(ContextProvider.class) - public static AssetFactory buildContextAssetFactory(ApplicationGlobals globals, - AssetPathConstructor assetPathConstructor, - ResponseCompressionAnalyzer compressionAnalyzer, - ResourceChangeTracker resourceChangeTracker, - StreamableResourceSource streamableResourceSource) - { - return new ContextAssetFactory(compressionAnalyzer, resourceChangeTracker, streamableResourceSource, assetPathConstructor, globals.getContext()); - } - - @Contribute(ClasspathAssetAliasManager.class) - public static void addApplicationAndTapestryMappings(MappedConfiguration<String, String> configuration, - - @Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM) - String appPackage) - { - configuration.add("tapestry", "org/apache/tapestry5"); - - configuration.add("app", toPackagePath(appPackage)); - } - - /** - * Contributes an handler for each mapped classpath alias, as well handlers for context assets - * and stack assets (combined {@link org.apache.tapestry5.services.javascript.JavaScriptStack} files). - */ - @Contribute(Dispatcher.class) - @AssetRequestDispatcher - public static void provideBuiltinAssetDispatchers(MappedConfiguration<String, AssetRequestHandler> configuration, - - @ContextProvider - AssetFactory contextAssetFactory, - - @Autobuild - StackAssetRequestHandler stackAssetRequestHandler, - - ClasspathAssetAliasManager classpathAssetAliasManager, - ResourceStreamer streamer, - AssetSource assetSource) - { - Map<String, String> mappings = classpathAssetAliasManager.getMappings(); - - for (String folder : mappings.keySet()) - { - String path = mappings.get(folder); - - configuration.add(folder, new ClasspathAssetRequestHandler(streamer, assetSource, path)); - } - - configuration.add(RequestConstants.CONTEXT_FOLDER, - new ContextAssetRequestHandler(streamer, contextAssetFactory.getRootResource())); - - configuration.add(RequestConstants.STACK_FOLDER, stackAssetRequestHandler); - - } - - @Contribute(ClasspathAssetAliasManager.class) - public static void addMappingsForLibraryVirtualFolders(MappedConfiguration<String, String> configuration, - ComponentClassResolver resolver) - { - // Each library gets a mapping or its folder automatically - - Map<String, String> folderToPackageMapping = resolver.getFolderToPackageMapping(); - - for (String folder : folderToPackageMapping.keySet()) - { - // This is the 5.3 version, which is still supported: - configuration.add(folder, toPackagePath(folderToPackageMapping.get(folder))); - - // This is the 5.4 version; once 5.3 support is dropped, this can be simplified, and the - // "meta/" prefix stripped out. - String folderSuffix = folder.equals("") ? folder : "/" + folder; - - configuration.add("meta" + folderSuffix, "META-INF/assets" + folderSuffix); - } - } - - private static String toPackagePath(String packageName) - { - return packageName.replace('.', '/'); - } - - /** - * Contributes: - * <dl> - * <dt>ClientLocalization</dt> - * <dd>A virtual resource of formatting symbols for decimal numbers</dd> - * <dt>Core</dt> - * <dd>Built in messages used by Tapestry's default validators and components</dd> - * <dt>AppCatalog</dt> - * <dd>The Resource defined by {@link SymbolConstants#APPLICATION_CATALOG}</dd> - * <dt> - * - * @since 5.2.0 - */ - @Contribute(ComponentMessagesSource.class) - public static void setupGlobalMessageCatalog(AssetSource assetSource, - @Symbol(SymbolConstants.APPLICATION_CATALOG) - Resource applicationCatalog, OrderedConfiguration<Resource> configuration) - { - configuration.add("ClientLocalization", new ClientLocalizationMessageResource()); - configuration.add("Core", assetSource.resourceForPath("org/apache/tapestry5/core.properties")); - configuration.add("AppCatalog", applicationCatalog); - } -}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-core/src/main/java/org/apache/tapestry5/services/compatibility/CompatibilityModule.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/compatibility/CompatibilityModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/compatibility/CompatibilityModule.java deleted file mode 100644 index b81fe01..0000000 --- a/tapestry-core/src/main/java/org/apache/tapestry5/services/compatibility/CompatibilityModule.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 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.services.compatibility; - -import org.apache.tapestry5.internal.services.compatibility.CompatibilityImpl; -import org.apache.tapestry5.internal.services.compatibility.DeprecationWarningImpl; -import org.apache.tapestry5.ioc.ServiceBinder; - -/** - * Defines services for managing compatibility across releases. - * - * @since 5.4 - */ -public class CompatibilityModule -{ - public static void bind(ServiceBinder binder) - { - binder.bind(Compatibility.class, CompatibilityImpl.class); - binder.bind(DeprecationWarning.class, DeprecationWarningImpl.class); - } -} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-core/src/main/java/org/apache/tapestry5/services/dashboard/DashboardModule.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/dashboard/DashboardModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/dashboard/DashboardModule.java deleted file mode 100644 index 98c9529..0000000 --- a/tapestry-core/src/main/java/org/apache/tapestry5/services/dashboard/DashboardModule.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 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.services.dashboard; - -import org.apache.tapestry5.internal.services.dashboard.DashboardManagerImpl; -import org.apache.tapestry5.ioc.OrderedConfiguration; -import org.apache.tapestry5.ioc.ServiceBinder; -import org.apache.tapestry5.ioc.annotations.Contribute; - -public class DashboardModule -{ - public static void bind(ServiceBinder binder) - { - binder.bind(DashboardManager.class, DashboardManagerImpl.class); - } - - @Contribute(DashboardManager.class) - public static void defaultTabs(OrderedConfiguration<DashboardTab> configuration) - { - configuration.add("Pages", new DashboardTab("Pages", "core/PageCatalog")); - configuration.add("Services", new DashboardTab("Services", "core/ServiceStatus")); - } -} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptModule.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptModule.java deleted file mode 100644 index 39417a3..0000000 --- a/tapestry-core/src/main/java/org/apache/tapestry5/services/javascript/JavaScriptModule.java +++ /dev/null @@ -1,300 +0,0 @@ -// 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 -// -// 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.services.javascript; - -import org.apache.tapestry5.MarkupWriter; -import org.apache.tapestry5.SymbolConstants; -import org.apache.tapestry5.annotations.Path; -import org.apache.tapestry5.internal.InternalConstants; -import org.apache.tapestry5.internal.services.DocumentLinker; -import org.apache.tapestry5.internal.services.ajax.JavaScriptSupportImpl; -import org.apache.tapestry5.internal.services.assets.ResourceChangeTracker; -import org.apache.tapestry5.internal.services.javascript.*; -import org.apache.tapestry5.internal.util.MessageCatalogResource; -import org.apache.tapestry5.ioc.MappedConfiguration; -import org.apache.tapestry5.ioc.OrderedConfiguration; -import org.apache.tapestry5.ioc.Resource; -import org.apache.tapestry5.ioc.ServiceBinder; -import org.apache.tapestry5.ioc.annotations.Contribute; -import org.apache.tapestry5.ioc.annotations.Symbol; -import org.apache.tapestry5.ioc.services.FactoryDefaults; -import org.apache.tapestry5.ioc.services.SymbolProvider; -import org.apache.tapestry5.ioc.util.IdAllocator; -import org.apache.tapestry5.json.JSONObject; -import org.apache.tapestry5.services.*; -import org.apache.tapestry5.services.assets.AssetRequestHandler; -import org.apache.tapestry5.services.compatibility.Compatibility; -import org.apache.tapestry5.services.compatibility.Trait; -import org.apache.tapestry5.services.messages.ComponentMessagesSource; - -import java.util.Locale; - -/** - * Defines the services related to JavaScript. - * - * @since 5.4 - */ -public class JavaScriptModule -{ - private final Environment environment; - - private final EnvironmentalShadowBuilder environmentalBuilder; - - public JavaScriptModule(Environment environment, EnvironmentalShadowBuilder environmentalBuilder) - { - this.environment = environment; - this.environmentalBuilder = environmentalBuilder; - } - - public static void bind(ServiceBinder binder) - { - binder.bind(ModuleManager.class, ModuleManagerImpl.class); - binder.bind(JavaScriptStackSource.class, JavaScriptStackSourceImpl.class); - binder.bind(JavaScriptStack.class, ExtensibleJavaScriptStack.class).withMarker(Core.class).withId("CoreJavaScriptStack"); - } - - /** - * Contributes the "core" {@link JavaScriptStack}s - * - * @since 5.2.0 - */ - @Contribute(JavaScriptStackSource.class) - public static void provideBuiltinJavaScriptStacks(MappedConfiguration<String, JavaScriptStack> configuration, @Core JavaScriptStack coreStack) - { - configuration.add(InternalConstants.CORE_STACK_NAME, coreStack); - } - - @Contribute(JavaScriptStack.class) - @Core - public static void setupCoreJavaScriptStack(OrderedConfiguration<StackExtension> configuration, Compatibility compatibility, @Symbol(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER) String provider) - { - final String ROOT = "${tapestry.asset.root}"; - - if (provider.equals("prototype") && compatibility.enabled(Trait.SCRIPTACULOUS)) - { - add(configuration, StackExtensionType.LIBRARY, - "${tapestry.scriptaculous}/scriptaculous.js", - "${tapestry.scriptaculous}/effects.js"); - } - - if (compatibility.enabled(Trait.INITIALIZERS)) - { - add(configuration, StackExtensionType.LIBRARY, - ROOT + "/t53-compatibility.js" - ); - } - - add(configuration, StackExtensionType.STYLESHEET, - "${tapestry.bootstrap-root}/css/bootstrap.css", - - ROOT + "/tapestry.css", - - ROOT + "/exception-frame.css", - - ROOT + "/tapestry-console.css", - - ROOT + "/tree.css"); - } - - private static void add(OrderedConfiguration<StackExtension> configuration, StackExtensionType type, String... paths) - { - for (String path : paths) - { - int slashx = path.lastIndexOf('/'); - String id = path.substring(slashx + 1); - - configuration.add(id, new StackExtension(type, path)); - } - } - - - /** - * Builds a proxy to the current {@link JavaScriptSupport} inside this thread's {@link org.apache.tapestry5.services.Environment}. - * - * @since 5.2.0 - */ - public JavaScriptSupport buildJavaScriptSupport() - { - return environmentalBuilder.build(JavaScriptSupport.class); - } - - @Contribute(Dispatcher.class) - @AssetRequestDispatcher - public static void provideModuleHandler(MappedConfiguration<String, AssetRequestHandler> configuration) - { - configuration.addInstance("module", ModuleAssetRequestHandler.class); - } - - /** - * Adds page render filters, each of which provides an {@link org.apache.tapestry5.annotations.Environmental} - * service. Filters - * often provide {@link org.apache.tapestry5.annotations.Environmental} services needed by - * components as they render. - * <dl> - * <dt>JavascriptSupport</dt> - * <dd>Provides {@link JavaScriptSupport}</dd> - * </dl> - */ - @Contribute(MarkupRenderer.class) - public void exposeJavaScriptSupportForFullPageRenders(OrderedConfiguration<MarkupRendererFilter> configuration, - final JavaScriptStackSource javascriptStackSource, - final JavaScriptStackPathConstructor javascriptStackPathConstructor) - { - - MarkupRendererFilter javaScriptSupport = new MarkupRendererFilter() - { - public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) - { - DocumentLinker linker = environment.peekRequired(DocumentLinker.class); - - JavaScriptSupportImpl support = new JavaScriptSupportImpl(linker, javascriptStackSource, - javascriptStackPathConstructor); - - environment.push(JavaScriptSupport.class, support); - - renderer.renderMarkup(writer); - - environment.pop(JavaScriptSupport.class); - - support.commit(); - } - }; - - configuration.add("JavaScriptSupport", javaScriptSupport, "after:DocumentLinker"); - } - - /** - * Contributes {@link PartialMarkupRendererFilter}s used when rendering a - * partial Ajax response. - * <dl> - * <dt>JavaScriptSupport - * <dd>Provides {@link JavaScriptSupport}</dd> - * </dl> - */ - @Contribute(PartialMarkupRenderer.class) - public void exposeJavaScriptSupportForPartialPageRender(OrderedConfiguration<PartialMarkupRendererFilter> configuration, - final JavaScriptStackSource javascriptStackSource, - - final JavaScriptStackPathConstructor javascriptStackPathConstructor) - { - PartialMarkupRendererFilter javascriptSupport = new PartialMarkupRendererFilter() - { - public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer) - { - String uid = Long.toHexString(System.nanoTime()); - - String namespace = "_" + uid; - - IdAllocator idAllocator = new IdAllocator(namespace); - - DocumentLinker linker = environment.peekRequired(DocumentLinker.class); - - JavaScriptSupportImpl support = new JavaScriptSupportImpl(linker, javascriptStackSource, - javascriptStackPathConstructor, idAllocator, true); - - environment.push(JavaScriptSupport.class, support); - - renderer.renderMarkup(writer, reply); - - environment.pop(JavaScriptSupport.class); - - support.commit(); - } - }; - - configuration.add("JavaScriptSupport", javascriptSupport, "after:DocumentLinker"); - } - - - @Contribute(ModuleManager.class) - public static void setupBaseModules(MappedConfiguration<String, Object> configuration, - @Path("${tapestry.asset.root}/underscore_1_4_4.js") - Resource underscore, - - @Path("${tapestry.asset.root}/jquery-shim.js") - Resource jqueryShim, - - @Path("${tapestry.scriptaculous}/prototype.js") - Resource prototype, - - @Path("${tapestry.asset.root}/jquery-1.9.1.js") - Resource jQuery, - - @Path("${" + SymbolConstants.BOOTSTRAP_ROOT + "}/js/bootstrap.js") - Resource bootstrap) - { - configuration.add("_", new JavaScriptModuleConfiguration(underscore).exports("_")); - // Hacking around https://github.com/jrburke/requirejs/issues/534 - configuration.add("jquery-library", new JavaScriptModuleConfiguration(jQuery)); - configuration.add("jquery", new JavaScriptModuleConfiguration(jqueryShim)); - configuration.add("prototype", new JavaScriptModuleConfiguration(prototype)); - configuration.add("bootstrap", new JavaScriptModuleConfiguration(bootstrap).dependsOn("jquery")); - } - - @Contribute(SymbolProvider.class) - @FactoryDefaults - public static void declareDefaultJavaScriptInfrastructureProvider(MappedConfiguration<String, Object> configuration) - { - configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "prototype"); - } - - @Contribute(ModuleManager.class) - public static void setupFoundationFramework(MappedConfiguration<String, Object> configuration, - @Symbol(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER) - String provider, - @Path("classpath:org/apache/tapestry5/t5-core-dom-prototype.js") - Resource domPrototype, - @Path("classpath:org/apache/tapestry5/t5-core-dom-jquery.js") - Resource domJQuery) - { - if (provider.equals("prototype")) - { - configuration.add("t5/core/dom", new JavaScriptModuleConfiguration(domPrototype)); - } - - if (provider.equals("jquery")) - { - configuration.add("t5/core/dom", new JavaScriptModuleConfiguration(domJQuery)); - } - - // If someone wants to support a different infastructure, they should set the provider symbol to some other value - // and contribute their own version of the t5/core/dom module. - } - - @Contribute(ModuleManager.class) - public static void setupApplicationCatalogModules(MappedConfiguration<String, Object> configuration, - LocalizationSetter localizationSetter, - ComponentMessagesSource messagesSource, - ResourceChangeTracker resourceChangeTracker, - @Symbol(SymbolConstants.COMPACT_JSON) boolean compactJSON) - { - for (Locale locale : localizationSetter.getSupportedLocales()) - { - MessageCatalogResource resource = new MessageCatalogResource(locale, messagesSource, resourceChangeTracker, compactJSON); - - configuration.add("t5/core/messages/" + locale.toString(), new JavaScriptModuleConfiguration(resource)); - } - } - - /** - * Contributes 'ConfigureHTMLElement', which writes the attributes into the HTML tag to describe locale, etc. - */ - @Contribute(MarkupRenderer.class) - public static void renderLocaleAttributeIntoPages(OrderedConfiguration<MarkupRendererFilter> configuration) - { - configuration.addInstance("ConfigureHTMLElement", ConfigureHTMLElementFilter.class); - } - -} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-core/src/main/java/org/apache/tapestry5/services/pageload/PageLoadModule.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/pageload/PageLoadModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/services/pageload/PageLoadModule.java deleted file mode 100644 index 8825600..0000000 --- a/tapestry-core/src/main/java/org/apache/tapestry5/services/pageload/PageLoadModule.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 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 -// -// 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.services.pageload; - -import org.apache.tapestry5.internal.pageload.DefaultComponentRequestSelectorAnalyzer; -import org.apache.tapestry5.internal.pageload.DefaultComponentResourceLocator; -import org.apache.tapestry5.internal.services.ComponentTemplateSource; -import org.apache.tapestry5.internal.services.ComponentTemplateSourceImpl; -import org.apache.tapestry5.ioc.ServiceBinder; -import org.apache.tapestry5.ioc.annotations.Marker; -import org.apache.tapestry5.services.Core; - -/** - * @since 5.3 - */ -@Marker(Core.class) -public class PageLoadModule -{ - public static void bind(ServiceBinder binder) - { - binder.bind(ComponentRequestSelectorAnalyzer.class, DefaultComponentRequestSelectorAnalyzer.class); - binder.bind(ComponentResourceLocator.class, DefaultComponentResourceLocator.class); - binder.bind(ComponentTemplateSource.class, ComponentTemplateSourceImpl.class); - } -} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImplTest.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImplTest.java b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImplTest.java index 0c17e41..a5e0948 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImplTest.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImplTest.java @@ -1,4 +1,4 @@ -// Copyright 2006, 2007, 2008, 2009, 2010, 2011 The Apache Software Foundation +// 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. @@ -21,8 +21,8 @@ import org.apache.tapestry5.internal.t5internal.pages.BasicComponent; import org.apache.tapestry5.internal.test.InternalBaseTestCase; import org.apache.tapestry5.ioc.Registry; import org.apache.tapestry5.ioc.RegistryBuilder; +import org.apache.tapestry5.modules.TapestryModule; import org.apache.tapestry5.runtime.Component; -import org.apache.tapestry5.services.TapestryModule; import org.apache.tapestry5.services.UpdateListenerHub; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java b/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java index 62b0fcf..42d01c8 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/internal/test/InternalBaseTestCase.java @@ -32,6 +32,7 @@ import org.apache.tapestry5.ioc.services.ClassPropertyAdapter; import org.apache.tapestry5.ioc.services.PropertyAccess; import org.apache.tapestry5.ioc.services.PropertyAdapter; import org.apache.tapestry5.model.ComponentModel; +import org.apache.tapestry5.modules.TapestryModule; import org.apache.tapestry5.root.FieldComponent; import org.apache.tapestry5.runtime.Component; import org.apache.tapestry5.runtime.RenderCommand; http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java index 791c916..1170fe6 100644 --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java +++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/RegistryImpl.java @@ -24,6 +24,7 @@ import org.apache.tapestry5.ioc.def.*; import org.apache.tapestry5.ioc.internal.services.PerthreadManagerImpl; import org.apache.tapestry5.ioc.internal.services.RegistryShutdownHubImpl; import org.apache.tapestry5.ioc.internal.util.*; +import org.apache.tapestry5.ioc.modules.TapestryIOCModule; import org.apache.tapestry5.ioc.services.*; import org.apache.tapestry5.ioc.util.AvailableValues; import org.apache.tapestry5.ioc.util.UnknownValueException; http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/metrics/MetricCollectorImpl.java ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/metrics/MetricCollectorImpl.java b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/metrics/MetricCollectorImpl.java index dae5442..65db295 100644 --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/metrics/MetricCollectorImpl.java +++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/metrics/MetricCollectorImpl.java @@ -194,8 +194,7 @@ public class MetricCollectorImpl extends LockSupport implements MetricCollector, { acquireReadLock(); - F.flow(children.values()).sort().toList(); - + return F.flow(children.values()).sort().toList(); } finally { releaseReadLock(); @@ -229,7 +228,7 @@ public class MetricCollectorImpl extends LockSupport implements MetricCollector, factory = inMemory ? new RrdMemoryBackendFactory() : new RrdNioBackendFactory(); logger.info(String.format("Collecting metrics %s.", - inMemory ? "in memory" : (" to" + dbDir)); + inMemory ? "in memory" : (" to" + dbDir))); } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-ioc/src/test/groovy/ioc/specs/ClassNameLocatorImplSpec.groovy ---------------------------------------------------------------------- diff --git a/tapestry-ioc/src/test/groovy/ioc/specs/ClassNameLocatorImplSpec.groovy b/tapestry-ioc/src/test/groovy/ioc/specs/ClassNameLocatorImplSpec.groovy index f90ff2c..b86ff77 100644 --- a/tapestry-ioc/src/test/groovy/ioc/specs/ClassNameLocatorImplSpec.groovy +++ b/tapestry-ioc/src/test/groovy/ioc/specs/ClassNameLocatorImplSpec.groovy @@ -59,9 +59,10 @@ class ClassNameLocatorImplSpec extends Specification { then: - assertInList names, packageName, "SymbolSource", "TapestryIOCModule" + assertInList names, packageName, "SymbolSource", "CoercionTuple" - assertNotInList names, packageName, 'TapestryIOCMOdules$1' + // This is an inner class and those should never be provided. + assertNotInList names, packageName, 'CoercionTuple$CoercionWrapper' } def "can locate classes in subpackage of local folders"() { http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-upload/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/tapestry-upload/src/test/resources/log4j.properties b/tapestry-upload/src/test/resources/log4j.properties index a5ee8e3..32a84dc 100644 --- a/tapestry-upload/src/test/resources/log4j.properties +++ b/tapestry-upload/src/test/resources/log4j.properties @@ -1,4 +1,4 @@ -# Copyright 2008 The Apache Software Foundation +# 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. @@ -21,7 +21,7 @@ log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=[%p] %c{1} %m%n -log4j.category.org.apache.tapestry5.services.TapestryModule.ComponentEventRequestHandler=debug +log4j.category.org.apache.tapestry5.modules.TapestryModule.ComponentEventRequestHandler=debug # log4j.category.org.apache.tapestry5.corelib.components=debug http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/e764c95b/tapestry-yuicompressor/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/tapestry-yuicompressor/src/test/resources/log4j.properties b/tapestry-yuicompressor/src/test/resources/log4j.properties index 9442cec..09921a9 100644 --- a/tapestry-yuicompressor/src/test/resources/log4j.properties +++ b/tapestry-yuicompressor/src/test/resources/log4j.properties @@ -9,8 +9,8 @@ log4j.appender.A1.layout.ConversionPattern=[%p] %c{1} %m%n # log4j.category.tapestry.render=debug -log4j.category.org.apache.tapestry5.services.assets.AssetsModule.ResourceMinimizer=debug -#log4j.category.org.apache.tapestry5.services.assets.AssetsModule.ResourceMinimizer=error +log4j.category.org.apache.tapestry5.modules.AssetsModule.ResourceMinimizer=debug +#log4j.category.org.apache.tapestry5.modules.AssetsModule.ResourceMinimizer=error log4j.category.org.apache.tapestry5.yuicompressor=debug log4j.category.org.apache.tapestry5.internal.yuicompressor=info
