Skip to content

Commit

Permalink
Update Tapestry dependency to the newly released 5.3, and make minor …
Browse files Browse the repository at this point in the history
…adjustments for changed APIs and behaviors
  • Loading branch information
hlship committed Nov 22, 2011
1 parent bfd1c1b commit 1a155d1
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 75 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
description = "Collection of add-ons for Tapestry 5"

tapestryVersion = "5.3-beta-19"
tapestryVersion = "5.3"

if (!project.hasProperty('deployUserName')) deployUserName = '*UNSET-USERNAME*'
if (!project.hasProperty('deployPassword')) deployPassword = '*UNSET-PASSWORD*'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2009, 2010 Howard M. Lewis Ship
// Copyright 2009, 2010, 2011 Howard M. Lewis Ship
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -14,9 +14,9 @@

package com.howardlewisship.tapx.templating;

import java.io.File;
import java.io.IOException;

import com.howardlewisship.tapx.templating.internal.TemplateContext;
import com.howardlewisship.tapx.templating.services.TemplateModule;
import com.howardlewisship.tapx.templating.services.TemplateRendererSource;
import org.apache.tapestry5.internal.TapestryAppInitializer;
import org.apache.tapestry5.ioc.Registry;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
Expand All @@ -25,16 +25,14 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.howardlewisship.tapx.templating.internal.TemplateContext;
import com.howardlewisship.tapx.templating.services.TemplateModule;
import com.howardlewisship.tapx.templating.services.TemplateRendererSource;
import java.io.File;
import java.io.IOException;

/**
* Responsible for starting up the Tapestry Template Library, analagous to how TapestryFilter starts up a Tapestry
* application.
*/
public class TemplateAPI implements TemplateRendererSource
{
public class TemplateAPI implements TemplateRendererSource {
private final Logger logger = LoggerFactory.getLogger(TemplateAPI.class);

private final TemplateRendererSource templateRendererSource;
Expand All @@ -52,15 +50,13 @@ public class TemplateAPI implements TemplateRendererSource
* @param applicationPackage root package name to search for pages, components and services
* @param contextDirectory directory containing static resources and template files
*/
public TemplateAPI(String applicationPackage, File contextDirectory)
{
public TemplateAPI(String applicationPackage, File contextDirectory) {
assert InternalUtils.isNonBlank(applicationPackage);
assert contextDirectory != null;

Context context = new TemplateContext(contextDirectory);

TapestryAppInitializer initializer = new TapestryAppInitializer(logger, applicationPackage, "app",
TemplateConstants.TEMPLATE_MODE);
TapestryAppInitializer initializer = new TapestryAppInitializer(logger, applicationPackage, "app");

initializer.addModules(TemplateModule.class);

Expand All @@ -84,8 +80,7 @@ public TemplateAPI(String applicationPackage, File contextDirectory)
* This method must be called after rendering content; it ensures that any resources used during rendering are
* cleaned up (this includes returning page instances to the page pool for later reuse).
*/
public void cleanupThread()
{
public void cleanupThread() {
registry.cleanupThread();
}

Expand All @@ -98,8 +93,7 @@ public void cleanupThread()
* (it is intended to support location-specific content delivery servers)
* @return the renderer
*/
public TemplateRenderer createRenderer(String templateName, String localeName, String location)
{
public TemplateRenderer createRenderer(String templateName, String localeName, String location) {
return templateRendererSource.createRenderer(templateName, localeName, location);
}

Expand All @@ -116,16 +110,12 @@ public TemplateRenderer createRenderer(String templateName, String localeName, S
*/
public void performTemplateRendererOperation(String templateName, String localeName, String location,
TemplateRendererCallback callback)
throws IOException
{
try
{
throws IOException {
try {
TemplateRenderer renderer = createRenderer(templateName, localeName, location);

callback.performOperation(renderer);
}
finally
{
} finally {
cleanupThread();
}
}
Expand All @@ -137,16 +127,14 @@ public void performTemplateRendererOperation(String templateName, String localeN
*
* @return the services registry
*/
public Registry getRegistry()
{
public Registry getRegistry() {
return registry;
}

/**
* Shuts down the Registry, which immediately invalidates all services.
*/
public void shutdown()
{
public void shutdown() {
registry.shutdown();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2009 Howard M. Lewis Ship
// Copyright 2009, 2011 Howard M. Lewis Ship
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,12 +15,12 @@
package com.howardlewisship.tapx.templating.internal.services;

import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.ioc.Invocation;
import org.apache.tapestry5.ioc.MethodAdvice;
import org.apache.tapestry5.ioc.annotations.IntermediateType;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier;
import org.apache.tapestry5.ioc.util.TimeInterval;
import org.apache.tapestry5.plastic.MethodAdvice;
import org.apache.tapestry5.plastic.MethodInvocation;
import org.apache.tapestry5.services.UpdateListenerHub;

import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -87,7 +87,7 @@ public CheckForUpdatesAdvice(UpdateListenerHub updateListenerHub,
}


public void advise(final Invocation invocation)
public void advise(final MethodInvocation invocation)
{
Runnable checkAndProceed = new Runnable()
{
Expand All @@ -98,7 +98,6 @@ public void run()

// And, now, back to code within the read lock.


invocation.proceed();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,7 @@ public int getServerPort()
return 80;
}

public String getRemoteHost() {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2009, 2010 Howard M. Lewis Ship
// Copyright 2009, 2010, 2011 Howard M. Lewis Ship
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -15,7 +15,6 @@
package com.howardlewisship.tapx.templating.services;

import com.howardlewisship.tapx.templating.internal.services.*;

import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.InternalSymbols;
import org.apache.tapestry5.ioc.MappedConfiguration;
Expand Down Expand Up @@ -53,7 +52,7 @@ public static void contributeFactoryDefaults(MappedConfiguration<String, String>
*/
public static void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration)
{
configuration.override("InjectDefaultStyleheet", null);
configuration.override("InjectDefaultStylesheet", null);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2009 Howard M. Lewis Ship
// Copyright 2009, 2011 Howard M. Lewis Ship
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,6 @@
import com.howardlewisship.tapx.templating.RenderedStream;
import com.howardlewisship.tapx.templating.TemplateAPI;
import com.howardlewisship.tapx.templating.TemplateRenderer;

import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.TapestryInternalUtils;
import org.apache.tapestry5.ioc.Registry;
Expand Down Expand Up @@ -101,12 +100,6 @@ protected void compare(RenderedStream renderedStream, String expectedContentType
}
}

protected void compare(InputStream actualStream, String contentFile)
throws IOException
{
compare(actualStream, getClass().getResourceAsStream(contentFile));
}

protected void compare(InputStream actualStream, InputStream expectedStream)
throws IOException
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta></head>
<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/></head>
<img src="http://eurocdn.foo.com/public/1.1/shared-content/images/ball_fr.png"/>
</html>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<html><head>
<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta>
<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/>
</head>
<img src="http://defaultcdn.foo.com/content/1.1/images/ball.png"/>
</html>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<html>
<head>
<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator">
</meta>
<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/>
</head>
<body>
<dl><dt>Global</dt>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta></head><body>
<html><head><meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/></head><body>
The number is: 42
</body></html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"></meta>
<meta content="Apache Tapestry Framework (version [TAPVERSION])" name="generator"/>
</head>
<h1>Simple Template Test</h1>
</html>

0 comments on commit 1a155d1

Please sign in to comment.