-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- rewrite the ConversationModerator.js as a javascript module - remove RequestHandlerDecorator and refactor to an inline aspect - update dependencies and change metadata to point to github in pom.xml - fix tests and clean up
- Loading branch information
Showing
14 changed files
with
303 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,21 +4,27 @@ | |
<artifactId>tapestry-conversations</artifactId> | ||
<name>Tynamo Conversations</name> | ||
<packaging>jar</packaging> | ||
<version>0.1.3-SNAPSHOT</version> | ||
<version>0.2.0-SNAPSHOT</version> | ||
<description> | ||
An implementation of conversation-within-page concept for Tapestry 5 | ||
</description> | ||
|
||
<parent> | ||
<groupId>org.tynamo</groupId> | ||
<artifactId>tynamo-parent</artifactId> | ||
<version>0.0.6</version> | ||
<version>0.2.2</version> | ||
</parent> | ||
<properties> | ||
<tapestry-release-version>5.2.2</tapestry-release-version> | ||
<tapestry-release-version>5.4.0</tapestry-release-version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>1.0.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.tapestry</groupId> | ||
<artifactId>tapestry-core</artifactId> | ||
|
@@ -27,8 +33,8 @@ | |
</dependency> | ||
<dependency> | ||
<groupId>org.tynamo</groupId> | ||
<artifactId>tapestry-model-test</artifactId> | ||
<version>0.1.0</version> | ||
<artifactId>tynamo-test</artifactId> | ||
<version>0.1.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
|
@@ -40,15 +46,6 @@ | |
</dependency> | ||
</dependencies> | ||
|
||
|
||
<distributionManagement> | ||
<site> | ||
<id>tynamo-site</id> | ||
<!-- Note the url. Only static files deployed in /constant/ can be decorated by Unity --> | ||
<url>dav:https://dav.codehaus.org/tynamo/constant/sites/tapestry-conversations</url> | ||
</site> | ||
</distributionManagement> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
|
@@ -59,7 +56,7 @@ | |
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
|
@@ -72,69 +69,33 @@ | |
</archive> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-changes-plugin</artifactId> | ||
<configuration> | ||
<!-- I couldn't get either this or filter tag to work properly --> | ||
<component>13675</component> | ||
<onlyCurrentVersion>true</onlyCurrentVersion> | ||
<statusIds>Resolved, Closed</statusIds> | ||
|
||
<template>release-announcement.vm</template> | ||
<!-- Unbelievable, but changes plugin requires to keep the announcement in src/main/resources directory.. It doesn't accept e.g. ../ --> | ||
<templateDirectory>announcements</templateDirectory> | ||
<smtpHost>localhost</smtpHost> | ||
<fromDeveloperId>kaosko</fromDeveloperId> | ||
<mailSender> | ||
<name>Tynamo Dev Team</name> | ||
<email>[email protected]</email> | ||
</mailSender> | ||
<toAddresses> | ||
<!-- Codehaus just doesn't accept me sending email with this mailSender from local sendmail | ||
to the list, so just send to my own email for now | ||
<toAddress>[email protected]</toAddress> | ||
<toAddress>[email protected]</toAddress> | ||
<toAddress>[email protected]</toAddress> | ||
--> | ||
<toAddress>[email protected]</toAddress> | ||
</toAddresses> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-release-plugin</artifactId> | ||
<configuration> | ||
<!-- send announcement email automatically --> | ||
<!-- Disable changes plugin for now since need to figure out how to integrate with Jira version numbers | ||
(conversations-0.1.0 rather than just 0.1.0) | ||
<goals>deploy site-deploy changes:announcement-mail -DgenerateJiraAnnouncement=true</goals> | ||
--> | ||
<goals>deploy site-deploy</goals> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<!-- Reloading needs to be disabled because the constructor of Conversation is package-private | ||
<!-- Reloading needs to be disabled because the constructor of Conversation is package-private | ||
but I don't want to use .preventReloading() since that would make the module T5.2 specific | ||
--> | ||
<argLine>-Dtapestry.service-reloading-enabled=false</argLine> | ||
<redirectTestOutputToFile>false</redirectTestOutputToFile> | ||
</configuration> | ||
</plugin> | ||
<!-- needed only for testing --> | ||
<!-- run the test app in the port 8180 with "mvn jetty:run" --> | ||
<plugin> | ||
<groupId>org.mortbay.jetty</groupId> | ||
<artifactId>maven-jetty-plugin</artifactId> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-maven-plugin</artifactId> | ||
<version>9.2.4.v20141103</version> | ||
<configuration> | ||
<contextPath>/</contextPath> | ||
<useTestClasspath>true</useTestClasspath> | ||
<webAppSourceDirectory>${basedir}/src/test/webapp</webAppSourceDirectory> | ||
<systemProperties> | ||
<systemProperty> | ||
<name>jetty.port</name> | ||
<value>8180</value> | ||
</systemProperty> | ||
<systemProperty> | ||
<name>tapestry.compress-whitespace</name> | ||
<value>false</value> | ||
|
@@ -146,12 +107,13 @@ | |
</systemProperties> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</plugins> | ||
</build> | ||
|
||
<scm> | ||
<connection>scm:svn:http://svn.codehaus.org/tynamo/trunk/tapestry-conversations</connection> | ||
<developerConnection>scm:svn:https://svn.codehaus.org/tynamo/trunk/tapestry-conversations</developerConnection> | ||
<url>http://svn.tynamo.codehaus.org/tynamo/trunk/tapestry-conversations</url> | ||
<scm> | ||
<connection>scm:git:[email protected]:tynamo/tapestry-conversations.git</connection> | ||
<developerConnection>scm:git:[email protected]:tynamo/tapestry-conversations.git</developerConnection> | ||
<url>https://github.com/tynamo/tapestry-conversations</url> | ||
<tag>HEAD</tag> | ||
</scm> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 33 additions & 22 deletions
55
src/main/java/org/tynamo/conversations/services/ConversationModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,62 @@ | ||
package org.tynamo.conversations.services; | ||
|
||
import java.io.IOException; | ||
import java.util.Properties; | ||
import java.lang.reflect.Method; | ||
|
||
import org.apache.tapestry5.SymbolConstants; | ||
import org.apache.tapestry5.ioc.Configuration; | ||
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.Match; | ||
import org.apache.tapestry5.ioc.annotations.Order; | ||
import org.apache.tapestry5.ioc.services.ApplicationDefaults; | ||
import org.apache.tapestry5.ioc.services.SymbolProvider; | ||
import org.apache.tapestry5.plastic.MethodAdvice; | ||
import org.apache.tapestry5.plastic.MethodInvocation; | ||
import org.apache.tapestry5.services.LibraryMapping; | ||
import org.apache.tapestry5.services.PersistentFieldStrategy; | ||
import org.apache.tapestry5.services.Request; | ||
import org.apache.tapestry5.services.RequestGlobals; | ||
|
||
public class ConversationModule { | ||
private static final String version; | ||
static { | ||
Properties moduleProperties = new Properties(); | ||
String aVersion = "unversioned"; | ||
try { | ||
moduleProperties.load(ConversationModule.class.getResourceAsStream("module.properties")); | ||
aVersion = moduleProperties.getProperty("module.version"); | ||
} catch (IOException e) { | ||
// ignore | ||
} | ||
version = aVersion; | ||
public static void bind(ServiceBinder binder) { | ||
binder.bind(ConversationManager.class); | ||
} | ||
|
||
public static void bind(ServiceBinder binder) { | ||
binder.bind(RequestHandlerDecorator.class, RequestHandlerDecoratorImpl.class); | ||
binder.bind(ConversationManager.class, ConversationManagerImpl.class); | ||
@Contribute(SymbolProvider.class) | ||
@ApplicationDefaults | ||
public static void setApplicationDefaults(MappedConfiguration<String, Object> configuration) { | ||
configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "jquery"); | ||
} | ||
|
||
public static void contributeComponentClassResolver(Configuration<LibraryMapping> configuration) { | ||
configuration.add(new LibraryMapping("conversation", "org.tynamo.conversations")); | ||
} | ||
|
||
public static void contributeClasspathAssetAliasManager(MappedConfiguration<String, String> configuration) { | ||
configuration.add("tynamo-conversations-" + version, "org/tynamo/conversations"); | ||
} | ||
|
||
public static void contributePersistentFieldManager(MappedConfiguration<String, PersistentFieldStrategy> configuration, RequestGlobals requestGlobals, | ||
Request request, ConversationManager conversationManager) { | ||
configuration.add("conversation", new ConversationalPersistentFieldStrategy(request, conversationManager)); | ||
} | ||
|
||
public static <T> T decorateComponentRequestHandler(Class<T> serviceInterface, T delegate, RequestHandlerDecorator decorator) { | ||
return decorator.build(serviceInterface, delegate); | ||
// public static <T> T decorateComponentRequestHandler(Class<T> serviceInterface, T delegate, RequestHandlerDecorator decorator) { | ||
// return decorator.build(serviceInterface, delegate); | ||
// } | ||
|
||
@Match("ComponentRequestHandler") | ||
@Order("before:*") | ||
public static void adviseComponentRequestHandler(final MethodAdviceReceiver receiver, | ||
final ConversationManager conversationManager) { | ||
MethodAdvice advice = new MethodAdvice() { | ||
public void advise(MethodInvocation invocation) { | ||
conversationManager.activateConversation(invocation.getParameter(0)); | ||
invocation.proceed(); | ||
} | ||
}; | ||
|
||
for (Method method : receiver.getInterface().getMethods()) | ||
receiver.adviseMethod(method, advice); | ||
|
||
} | ||
|
||
} |
6 changes: 0 additions & 6 deletions
6
src/main/java/org/tynamo/conversations/services/RequestHandlerDecorator.java
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
src/main/java/org/tynamo/conversations/services/RequestHandlerDecoratorImpl.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.