From 1bc77496c4684b583176bb56445eae8a07e3583d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ignji=C4=87?= Date: Wed, 20 Nov 2013 09:40:00 +0100 Subject: [PATCH 1/7] Map More than one name token to presenter Change annotation NameToken value to array of name tokens. Change PlaceImpl. For tab content proxy just use first nametoken. Former-commit-id: c02b44e495decbbbde47b1b503544b658cbd8150 --- .../mvp/client/annotations/NameToken.java | 2 +- .../mvp/client/proxy/PlaceImpl.java | 30 ++++++++--- .../mvp/client/proxy/PlaceWithGatekeeper.java | 6 ++- .../proxy/PlaceWithGatekeeperWithParams.java | 7 ++- .../rebind/PlaceTokenRegistryGenerator.java | 5 +- .../mvp/rebind/ProxyPlaceOutputter.java | 28 +++++++--- .../rebind/TabContentProxyPlaceOutputter.java | 2 +- .../gwt/mvp/AdminPresenterTestUtilGwt.java | 2 +- .../mvp/client/gwt/mvp/MvpGwtTestInSuite.java | 51 ++++++++++++++++++- 9 files changed, 112 insertions(+), 21 deletions(-) diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/annotations/NameToken.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/annotations/NameToken.java index fdcb770dd2..64439d1bd9 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/annotations/NameToken.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/annotations/NameToken.java @@ -28,5 +28,5 @@ */ @Target(ElementType.TYPE) public @interface NameToken { - String value(); + String[] value(); } diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceImpl.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceImpl.java index 409f3b4100..027c91cad5 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceImpl.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceImpl.java @@ -23,10 +23,10 @@ */ public class PlaceImpl implements Place { - private final String nameToken; + private final String[] nameTokens; - public PlaceImpl(String nameToken) { - this.nameToken = nameToken; + public PlaceImpl(String... nameTokens) { + this.nameTokens = nameTokens; } @Override @@ -36,8 +36,17 @@ public boolean canReveal() { @Override public final boolean equals(Object o) { + if (o instanceof PlaceImpl) { + PlaceImpl place = (PlaceImpl) o; + return nameTokens.equals(place.nameTokens); + } if (o instanceof Place) { Place place = (Place) o; + for (String nameToken : nameTokens) { + if (nameToken.equals(place.getNameToken())) { + return true; + } + } return getNameToken().equals(place.getNameToken()); } return false; @@ -45,17 +54,26 @@ public final boolean equals(Object o) { @Override public String getNameToken() { - return nameToken; + return nameTokens[0]; } + public String[] getNameTokens() { + return nameTokens; + } @Override public final int hashCode() { - return 17 * getNameToken().hashCode(); + return 17 * nameTokens.hashCode(); } @Override public final boolean matchesRequest(PlaceRequest request) { - return request.matchesNameToken(getNameToken()); + for (String nameToken : nameTokens) { + if (request.matchesNameToken(nameToken)) { + return true; + } + } + + return false; } @Override diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeper.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeper.java index 584f2d80c9..79849296d6 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeper.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeper.java @@ -24,7 +24,11 @@ public class PlaceWithGatekeeper extends PlaceImpl { private final Gatekeeper gatekeeper; public PlaceWithGatekeeper(String nameToken, Gatekeeper gatekeeper) { - super(nameToken); + this(new String[] { nameToken }, gatekeeper); + } + + public PlaceWithGatekeeper(String[] nameTokens, Gatekeeper gatekeeper) { + super(nameTokens); this.gatekeeper = gatekeeper; } diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeperWithParams.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeperWithParams.java index 2ee887d908..b7dec1470b 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeperWithParams.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeperWithParams.java @@ -29,7 +29,12 @@ public class PlaceWithGatekeeperWithParams extends PlaceImpl { public PlaceWithGatekeeperWithParams(String nameToken, GatekeeperWithParams gatekeeper, String[] params) { - super(nameToken); + this(new String[] { nameToken }, gatekeeper,params); + } + + public PlaceWithGatekeeperWithParams(String[] nameTokens, GatekeeperWithParams gatekeeper, + String[] params) { + super(nameTokens); this.gatekeeper = gatekeeper; this.params = params; } diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/PlaceTokenRegistryGenerator.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/PlaceTokenRegistryGenerator.java index 8131419390..1ec97dbe35 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/PlaceTokenRegistryGenerator.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/PlaceTokenRegistryGenerator.java @@ -38,6 +38,7 @@ * Generates an implementation of {@link PlaceTokenRegistry} based on GWTP's {@link NameToken} annotation. */ public class PlaceTokenRegistryGenerator extends Generator { + @Override public String generate(final TreeLogger treeLogger, GeneratorContext generatorContext, String requestedClass) throws UnableToCompleteException { @@ -65,7 +66,9 @@ private static Map findPlaceTokens(final GeneratorContext ge for (JClassType type : generatorContext.getTypeOracle().getTypes()) { NameToken nameTokenAnnotation = type.getAnnotation(NameToken.class); if (nameTokenAnnotation != null) { - placeTokens.put(nameTokenAnnotation.value(), type); + for (String nameToken : nameTokenAnnotation.value()) { + placeTokens.put(nameToken, type); + } } } diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java index fbe28bd5a6..2291c63739 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java @@ -34,14 +34,14 @@ /** * Proxy outputter for a proxy that is also a place. - * + * * @author Philippe Beaudoin */ public class ProxyPlaceOutputter extends ProxyOutputterBase { public static final String WRAPPED_CLASS_NAME = "WrappedProxy"; - private String nameToken; + private String[] nameTokens; private String getGatekeeperMethod; private String[] gatekeeperParams; @@ -87,8 +87,8 @@ String getSuperclassName() { return ClassCollection.proxyPlaceImplClassName; } - public String getNameToken() { - return nameToken; + public String[] getNameToken() { + return nameTokens; } public String getGatekeeperParamsString() { @@ -134,7 +134,7 @@ private void findNameToken(JClassType proxyInterface) + NameToken.class.getSimpleName() + ".", null); throw new UnableToCompleteException(); } - nameToken = nameTokenAnnotation.value(); + nameTokens = nameTokenAnnotation.value(); } private void findGatekeeperMethod(JClassType proxyInterface) @@ -215,8 +215,9 @@ private String getPlaceInstantiationString() { /** * Writes the method {@code protected void getPlaceTitle(final GetPlaceTitleEvent event)} if * one is needed. - * - * @param writer The {@link SourceWriter}. + * + * @param writer + * The {@link SourceWriter}. */ private void writeGetPlaceTitleMethod(SourceWriter writer) { if (title != null) { @@ -236,13 +237,24 @@ private void writeGetPlaceTitleMethodConstantText(SourceWriter writer) { writer.println("}"); } + protected String createInitNameTokens() { + StringBuilder sb = new StringBuilder(); + sb.append('{'); + for (String tmpNameToken : nameTokens) { + sb.append('"').append(tmpNameToken).append('"').append(','); + } + sb.setLength(sb.length() - 1); + sb.append('}'); + return sb.toString(); + } + @Override void writeSubclassDelayedBind(SourceWriter writer) { writer.println(WRAPPED_CLASS_NAME + " wrappedProxy = GWT.create(" + WRAPPED_CLASS_NAME + ".class);"); writer.println("wrappedProxy.delayedBind( ginjector ); "); writer.println("setProxy(wrappedProxy); "); - writer.println("String nameToken = \"" + getNameToken() + "\"; "); + writer.println("String[] nameToken = " + createInitNameTokens() + "; "); writer.println("String[] gatekeeperParams = " + getGatekeeperParamsString() + ";"); writer.println("setPlace(" + getPlaceInstantiationString() + ");"); } diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/TabContentProxyPlaceOutputter.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/TabContentProxyPlaceOutputter.java index 9ac351deb0..3455bde5dd 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/TabContentProxyPlaceOutputter.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/TabContentProxyPlaceOutputter.java @@ -55,7 +55,7 @@ public TabContentProxyPlaceOutputter(TypeOracle oracle, @Override void initSubclass(JClassType proxyInterface) throws UnableToCompleteException { proxyPlaceOutputter.init(proxyInterface); - nonLeafTabContentProxyOutputter.setNameToken(proxyPlaceOutputter.getNameToken()); + nonLeafTabContentProxyOutputter.setNameToken(proxyPlaceOutputter.getNameToken()[0]); nonLeafTabContentProxyOutputter.init(proxyInterface); } diff --git a/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/AdminPresenterTestUtilGwt.java b/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/AdminPresenterTestUtilGwt.java index 1c68b99dea..e456ecedb6 100644 --- a/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/AdminPresenterTestUtilGwt.java +++ b/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/AdminPresenterTestUtilGwt.java @@ -43,7 +43,7 @@ public interface MyView extends View { * Presenter's proxy. */ @ProxyStandard - @NameToken("admin") + @NameToken({"admin","selfService"}) public interface MyProxy extends ProxyPlace { } diff --git a/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java b/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java index 3f9881e6b0..e19f58ba23 100644 --- a/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java +++ b/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java @@ -17,12 +17,15 @@ package com.gwtplatform.mvp.client.gwt.mvp; import com.google.gwt.core.client.GWT; +import com.google.gwt.core.client.Scheduler; +import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.junit.client.GWTTestCase; import com.gwtplatform.mvp.client.DelayedBindRegistry; +import com.gwtplatform.mvp.client.proxy.PlaceRequest; /** * Integration test for various components of GWTP's MVP module. - * + * * @author Philippe Beaudoin */ public class MvpGwtTestInSuite extends GWTTestCase { @@ -50,4 +53,50 @@ public void testShouldCreateOnlyOneGinjector() { ginjector.getPlaceManager().revealCurrentPlace(); assertEquals(1, InstantiationCounterTestUtilGwt.getCounter()); } + + /** + * Verify multiple name tokens. + */ + public void testMultipleTokens() { + ginjector.getPlaceManager().revealDefaultPlace(); + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + @Override + public void execute() { + assertTrue(ginjector.getMainPresenter().get().isVisible()); + ginjector.getPlaceManager().revealPlace(new PlaceRequest.Builder().nameToken("admin").build()); + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + @Override + public void execute() { + assertFalse(ginjector.getMainPresenter().get().isVisible()); + assertTrue(ginjector.getAdminPresenter().get().isVisible()); + ginjector.getPlaceManager().revealDefaultPlace(); + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + @Override + public void execute() { + + assertTrue(ginjector.getMainPresenter().get().isVisible()); + assertFalse(ginjector.getAdminPresenter().get().isVisible()); + ginjector.getPlaceManager().revealPlace( + new PlaceRequest.Builder().nameToken("selfService").build()); + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + @Override + public void execute() { + assertFalse(ginjector.getMainPresenter().get().isVisible()); + assertTrue(ginjector.getAdminPresenter().get().isVisible()); + finishTest(); + } + }); + } + }); + } + }); + } + }); + delayTestFinish(1000); + } + } From 9f4030bcacb48f40d552a5a6f1d425ef57c4b599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ignji=C4=87?= Date: Fri, 22 Nov 2013 09:45:08 +0100 Subject: [PATCH 2/7] Implement suggested change Former-commit-id: 9493fe700a034de3646a5a8771f3e067c39ec0b7 --- .../gwtplatform/mvp/rebind/ProxyPlaceOutputter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java index 2291c63739..cd341db1b0 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java @@ -109,7 +109,7 @@ public String getGatekeeperParamsString() { @Override void initSubclass(JClassType proxyInterface) throws UnableToCompleteException { - findNameToken(proxyInterface); + findNameTokens(proxyInterface); findGatekeeperMethod(proxyInterface); findGatekeeperParams(proxyInterface); findTitle(proxyInterface); @@ -124,7 +124,7 @@ void addSubclassImports(ClassSourceFileComposerFactory composerFactory) { } } - private void findNameToken(JClassType proxyInterface) + private void findNameTokens(JClassType proxyInterface) throws UnableToCompleteException { NameToken nameTokenAnnotation = proxyInterface.getAnnotation(NameToken.class); if (nameTokenAnnotation == null) { @@ -135,6 +135,12 @@ private void findNameToken(JClassType proxyInterface) throw new UnableToCompleteException(); } nameTokens = nameTokenAnnotation.value(); + if (nameTokens.length == 0) { + logger.log(TreeLogger.ERROR, + "The proxy for '" + presenterInspector.getPresenterClassName() + "' is annotated with '@" + + NameToken.class.getSimpleName() + "', but has no name token specified.", null); + throw new UnableToCompleteException(); + } } private void findGatekeeperMethod(JClassType proxyInterface) From b8246397284a8351b849b00db86d13deea8571fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ignji=C4=87?= Date: Thu, 20 Feb 2014 10:54:22 +0100 Subject: [PATCH 3/7] Rebase and change to new structure. Add dummy javadoc (fix checkstyle) Former-commit-id: c531116b312503802161694f761baf1230319ffb --- .../dispatch/rpc/server/spring/DispatchImpl.java | 6 ++++++ .../dispatch/rpc/server/spring/DispatchModule.java | 6 ++++++ .../rpc/server/spring/DispatchServiceImpl.java | 10 ++++++++-- .../dispatch/rpc/server/spring/HandlerModule.java | 4 ++++ .../server/spring/HttpSessionSecurityCookieFilter.java | 4 ++++ .../dispatch/rpc/server/spring/LoggerFactoryBean.java | 4 ++++ .../rpc/server/spring/RandomSecurityCookieFilter.java | 4 ++++ .../rpc/server/spring/SecureRandomSingleton.java | 4 ++++ .../dispatch/rpc/server/spring/SpringBeanProvider.java | 4 ++++ .../EagerActionHandlerValidatorRegistryImpl.java | 4 ++++ .../LazyActionHandlerValidatorRegistryImpl.java | 4 ++++ .../rpc/server/spring/configuration/DefaultModule.java | 6 ++++++ .../server/spring/request/DefaultRequestProvider.java | 6 ++++++ .../rpc/server/spring/utils/RequestProvider.java | 4 ++++ .../dispatch/rpc/server/spring/utils/SpringUtils.java | 4 ++++ .../mvp/client/gwt/mvp/MvpGwtTestInSuite.java | 8 ++++---- 16 files changed, 76 insertions(+), 6 deletions(-) diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchImpl.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchImpl.java index 55def4c840..a2ed2cfc95 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchImpl.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchImpl.java @@ -21,6 +21,12 @@ import com.gwtplatform.dispatch.rpc.server.AbstractDispatchImpl; import com.gwtplatform.dispatch.rpc.server.actionhandlervalidator.ActionHandlerValidatorRegistry; +/** + * Dispatch implementation for spring. + * + * @author David Ignjic + * + */ public class DispatchImpl extends AbstractDispatchImpl { @Autowired diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchModule.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchModule.java index a816522193..3ae96ea71d 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchModule.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchModule.java @@ -30,6 +30,12 @@ import com.gwtplatform.dispatch.rpc.server.spring.actionhandlervalidator.LazyActionHandlerValidatorRegistryImpl; import com.gwtplatform.dispatch.rpc.server.spring.utils.SpringUtils; +/** + * Dispatch module spring configuration. + * + * @author David Ignjic + * + */ public class DispatchModule { private final Class dispatchClass; diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchServiceImpl.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchServiceImpl.java index 855dbf9130..bc988baa53 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchServiceImpl.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchServiceImpl.java @@ -34,6 +34,12 @@ import com.gwtplatform.dispatch.rpc.server.Dispatch; import com.gwtplatform.dispatch.rpc.server.RequestProvider; +/** + * Dispatch request to the handler. + * + * @author David Ignjic + * + */ @Component("dispatch") public class DispatchServiceImpl extends AbstractDispatchServiceImpl implements HttpRequestHandler, ServletContextAware { @@ -53,7 +59,7 @@ public DispatchServiceImpl(final Logger logger, final Dispatch dispatch, @Override public String getSecurityCookieName() { - return securityCookieName; + return this.securityCookieName; } @Override @@ -69,7 +75,7 @@ public void setServletContext(ServletContext arg0) { @Override public ServletContext getServletContext() { - return servletContext; + return this.servletContext; } } diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HandlerModule.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HandlerModule.java index 03ae181437..cc3bce72ef 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HandlerModule.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HandlerModule.java @@ -29,6 +29,10 @@ import com.gwtplatform.dispatch.rpc.shared.Action; import com.gwtplatform.dispatch.rpc.shared.Result; +/** + * @author Peter Simun + * + */ @Import({DispatchModule.class}) public abstract class HandlerModule { diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HttpSessionSecurityCookieFilter.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HttpSessionSecurityCookieFilter.java index 117851e6a3..46219ed155 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HttpSessionSecurityCookieFilter.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HttpSessionSecurityCookieFilter.java @@ -23,6 +23,10 @@ import com.gwtplatform.dispatch.rpc.server.AbstractHttpSessionSecurityCookieFilter; +/** + * @author Peter Simun + * + */ public class HttpSessionSecurityCookieFilter extends AbstractHttpSessionSecurityCookieFilter { public HttpSessionSecurityCookieFilter(String securityCookieName) { diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/LoggerFactoryBean.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/LoggerFactoryBean.java index 0e18e6a9db..3de7351da6 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/LoggerFactoryBean.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/LoggerFactoryBean.java @@ -20,6 +20,10 @@ import org.springframework.beans.factory.FactoryBean; +/** + * @author Peter Simun + * + */ public class LoggerFactoryBean implements FactoryBean { private final Logger logger; diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/RandomSecurityCookieFilter.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/RandomSecurityCookieFilter.java index 0ff56d72b1..9b3345bbd9 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/RandomSecurityCookieFilter.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/RandomSecurityCookieFilter.java @@ -21,6 +21,10 @@ import com.gwtplatform.dispatch.rpc.server.AbstractRandomSecurityCookieFilter; +/** + * @author Peter Simun + * + */ public class RandomSecurityCookieFilter extends AbstractRandomSecurityCookieFilter { @Autowired RandomSecurityCookieFilter(@Qualifier("SecurityCookie") String securityCookieName, SecureRandomSingleton random) { diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SecureRandomSingleton.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SecureRandomSingleton.java index 738f057e57..e92375312f 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SecureRandomSingleton.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SecureRandomSingleton.java @@ -20,6 +20,10 @@ import org.springframework.stereotype.Component; +/** + * @author Peter Simun + * + */ @Component public class SecureRandomSingleton extends SecureRandom { private static final long serialVersionUID = 462441711297897572L; diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SpringBeanProvider.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SpringBeanProvider.java index c3e68ab432..c6dea5fb08 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SpringBeanProvider.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SpringBeanProvider.java @@ -29,6 +29,10 @@ import com.gwtplatform.dispatch.rpc.server.spring.utils.SpringUtils; +/** + * @author Peter Simun + * + */ public class SpringBeanProvider implements BeanProvider { /** diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/EagerActionHandlerValidatorRegistryImpl.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/EagerActionHandlerValidatorRegistryImpl.java index 68f1620077..de170eceb4 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/EagerActionHandlerValidatorRegistryImpl.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/EagerActionHandlerValidatorRegistryImpl.java @@ -18,5 +18,9 @@ import com.gwtplatform.dispatch.rpc.server.actionhandlervalidator.AbstractEagerActionHandlerValidatorRegistryImpl; +/** + * @author Peter Simun + * + */ public class EagerActionHandlerValidatorRegistryImpl extends AbstractEagerActionHandlerValidatorRegistryImpl { } diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/LazyActionHandlerValidatorRegistryImpl.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/LazyActionHandlerValidatorRegistryImpl.java index f9311f9f37..b0e31da94c 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/LazyActionHandlerValidatorRegistryImpl.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/LazyActionHandlerValidatorRegistryImpl.java @@ -32,6 +32,10 @@ import com.gwtplatform.dispatch.rpc.shared.Action; import com.gwtplatform.dispatch.rpc.shared.Result; +/** + * @author Peter Simun + * + */ public class LazyActionHandlerValidatorRegistryImpl implements LazyActionHandlerValidatorRegistry, ApplicationContextAware { diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/configuration/DefaultModule.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/configuration/DefaultModule.java index 314a383a5a..e177e6b4e1 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/configuration/DefaultModule.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/configuration/DefaultModule.java @@ -23,6 +23,12 @@ import com.gwtplatform.dispatch.rpc.server.spring.HttpSessionSecurityCookieFilter; import com.gwtplatform.dispatch.rpc.server.spring.request.DefaultRequestProvider; +/** + * Default configuration for spring. + * + * @author David Ignjic + * + */ public class DefaultModule { private/* @Value("cookie") */ String securityCookieName; diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/request/DefaultRequestProvider.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/request/DefaultRequestProvider.java index ba85dd234c..80675952ce 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/request/DefaultRequestProvider.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/request/DefaultRequestProvider.java @@ -23,6 +23,12 @@ import com.gwtplatform.dispatch.rpc.server.RequestProvider; +/** + * Request provider. + * + * @author David Ignjic + * + */ public class DefaultRequestProvider implements RequestProvider { public DefaultRequestProvider() { diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/RequestProvider.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/RequestProvider.java index b575fecbf1..6bc3a54b64 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/RequestProvider.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/RequestProvider.java @@ -16,5 +16,9 @@ package com.gwtplatform.dispatch.rpc.server.spring.utils; +/** + * @author Peter Simun + * + */ public class RequestProvider { } diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/SpringUtils.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/SpringUtils.java index 336fed1419..e963fabd81 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/SpringUtils.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/SpringUtils.java @@ -28,6 +28,10 @@ import org.springframework.util.StringUtils; import org.springframework.web.context.support.AbstractRefreshableWebApplicationContext; +/** + * @author Peter Simun + * + */ public class SpringUtils { public static B getOrCreate(ApplicationContext applicationContext, diff --git a/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java b/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java index e19f58ba23..ff311fb2b0 100644 --- a/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java +++ b/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java @@ -21,7 +21,7 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.junit.client.GWTTestCase; import com.gwtplatform.mvp.client.DelayedBindRegistry; -import com.gwtplatform.mvp.client.proxy.PlaceRequest; +import com.gwtplatform.mvp.shared.proxy.PlaceRequest; /** * Integration test for various components of GWTP's MVP module. @@ -30,14 +30,14 @@ */ public class MvpGwtTestInSuite extends GWTTestCase { + GinjectorTestUtilGwt ginjector; + MainPresenterTestUtilGwt presenter; + @Override public String getModuleName() { return "com.gwtplatform.mvp.MvpGwtTest"; } - GinjectorTestUtilGwt ginjector; - MainPresenterTestUtilGwt presenter; - @Override protected void gwtSetUp() throws Exception { super.gwtSetUp(); From dc23fa8b3348dd96259fce36a27bdccc956b6ac4 Mon Sep 17 00:00:00 2001 From: Christopher Viel Date: Fri, 7 Mar 2014 10:53:33 -0500 Subject: [PATCH 4/7] Removed author tags Former-commit-id: def0d4bb6666518f5637c6fee5aec34492180bc7 --- .../rpc/server/spring/DispatchImpl.java | 4 -- .../rpc/server/spring/DispatchModule.java | 7 +- .../server/spring/DispatchServiceImpl.java | 16 ++--- .../rpc/server/spring/HandlerModule.java | 5 -- .../HttpSessionSecurityCookieFilter.java | 5 -- .../rpc/server/spring/LoggerFactoryBean.java | 5 -- .../spring/RandomSecurityCookieFilter.java | 4 -- .../server/spring/SecureRandomSingleton.java | 4 -- .../rpc/server/spring/SpringBeanProvider.java | 7 -- ...gerActionHandlerValidatorRegistryImpl.java | 4 -- ...azyActionHandlerValidatorRegistryImpl.java | 27 +++----- .../spring/configuration/DefaultModule.java | 4 -- .../request/DefaultRequestProvider.java | 5 -- .../server/spring/utils/RequestProvider.java | 4 -- .../rpc/server/spring/utils/SpringUtils.java | 42 +++++------- .../mvp/client/proxy/PlaceImpl.java | 12 ++-- .../mvp/client/proxy/PlaceWithGatekeeper.java | 13 ++-- .../proxy/PlaceWithGatekeeperWithParams.java | 18 ++--- .../rebind/PlaceTokenRegistryGenerator.java | 1 - .../mvp/rebind/ProxyPlaceOutputter.java | 65 ++++++++----------- .../mvp/client/gwt/mvp/MvpGwtTestInSuite.java | 10 +-- 21 files changed, 81 insertions(+), 181 deletions(-) diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchImpl.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchImpl.java index a2ed2cfc95..f752264fd9 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchImpl.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchImpl.java @@ -23,12 +23,8 @@ /** * Dispatch implementation for spring. - * - * @author David Ignjic - * */ public class DispatchImpl extends AbstractDispatchImpl { - @Autowired public DispatchImpl(ActionHandlerValidatorRegistry actionHandlerValidatorRegistry) { super(actionHandlerValidatorRegistry); diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchModule.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchModule.java index 3ae96ea71d..1746e36dac 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchModule.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchModule.java @@ -32,12 +32,8 @@ /** * Dispatch module spring configuration. - * - * @author David Ignjic - * */ public class DispatchModule { - private final Class dispatchClass; private final Class lazyActionHandlerValidatorRegistryClass; @@ -90,7 +86,6 @@ public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderCon @Bean public Dispatch getDispatch() { - Dispatch instance = SpringUtils.getOrCreate(context, dispatchClass); - return instance; + return SpringUtils.getOrCreate(context, dispatchClass); } } diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchServiceImpl.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchServiceImpl.java index bc988baa53..c580437b0c 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchServiceImpl.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/DispatchServiceImpl.java @@ -36,14 +36,10 @@ /** * Dispatch request to the handler. - * - * @author David Ignjic - * */ @Component("dispatch") public class DispatchServiceImpl extends AbstractDispatchServiceImpl implements HttpRequestHandler, ServletContextAware { - private static final long serialVersionUID = 136176741488585959L; @Value("${securityCookieName:JSESSIONID}") @@ -52,14 +48,13 @@ public class DispatchServiceImpl extends AbstractDispatchServiceImpl implements private ServletContext servletContext; @Autowired - public DispatchServiceImpl(final Logger logger, final Dispatch dispatch, - RequestProvider requestProvider) { + public DispatchServiceImpl(Logger logger, Dispatch dispatch, RequestProvider requestProvider) { super(logger, dispatch, requestProvider); } @Override public String getSecurityCookieName() { - return this.securityCookieName; + return securityCookieName; } @Override @@ -69,13 +64,12 @@ public void handleRequest(HttpServletRequest request, HttpServletResponse respon } @Override - public void setServletContext(ServletContext arg0) { - this.servletContext = arg0; + public void setServletContext(ServletContext servletContext) { + this.servletContext = servletContext; } @Override public ServletContext getServletContext() { - return this.servletContext; + return servletContext; } - } diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HandlerModule.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HandlerModule.java index cc3bce72ef..3c032bcdaf 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HandlerModule.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HandlerModule.java @@ -29,13 +29,8 @@ import com.gwtplatform.dispatch.rpc.shared.Action; import com.gwtplatform.dispatch.rpc.shared.Result; -/** - * @author Peter Simun - * - */ @Import({DispatchModule.class}) public abstract class HandlerModule { - @Autowired protected ApplicationContext applicationContext; diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HttpSessionSecurityCookieFilter.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HttpSessionSecurityCookieFilter.java index 46219ed155..eb5a9c3c46 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HttpSessionSecurityCookieFilter.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/HttpSessionSecurityCookieFilter.java @@ -23,12 +23,7 @@ import com.gwtplatform.dispatch.rpc.server.AbstractHttpSessionSecurityCookieFilter; -/** - * @author Peter Simun - * - */ public class HttpSessionSecurityCookieFilter extends AbstractHttpSessionSecurityCookieFilter { - public HttpSessionSecurityCookieFilter(String securityCookieName) { super(securityCookieName); } diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/LoggerFactoryBean.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/LoggerFactoryBean.java index 3de7351da6..3e95d1887e 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/LoggerFactoryBean.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/LoggerFactoryBean.java @@ -20,12 +20,7 @@ import org.springframework.beans.factory.FactoryBean; -/** - * @author Peter Simun - * - */ public class LoggerFactoryBean implements FactoryBean { - private final Logger logger; public LoggerFactoryBean(Logger logger) { diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/RandomSecurityCookieFilter.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/RandomSecurityCookieFilter.java index 9b3345bbd9..0ff56d72b1 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/RandomSecurityCookieFilter.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/RandomSecurityCookieFilter.java @@ -21,10 +21,6 @@ import com.gwtplatform.dispatch.rpc.server.AbstractRandomSecurityCookieFilter; -/** - * @author Peter Simun - * - */ public class RandomSecurityCookieFilter extends AbstractRandomSecurityCookieFilter { @Autowired RandomSecurityCookieFilter(@Qualifier("SecurityCookie") String securityCookieName, SecureRandomSingleton random) { diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SecureRandomSingleton.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SecureRandomSingleton.java index e92375312f..738f057e57 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SecureRandomSingleton.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SecureRandomSingleton.java @@ -20,10 +20,6 @@ import org.springframework.stereotype.Component; -/** - * @author Peter Simun - * - */ @Component public class SecureRandomSingleton extends SecureRandom { private static final long serialVersionUID = 462441711297897572L; diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SpringBeanProvider.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SpringBeanProvider.java index c6dea5fb08..6a0e16240e 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SpringBeanProvider.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/SpringBeanProvider.java @@ -29,17 +29,11 @@ import com.gwtplatform.dispatch.rpc.server.spring.utils.SpringUtils; -/** - * @author Peter Simun - * - */ public class SpringBeanProvider implements BeanProvider { - /** * Adapter for transforming Guice Binding into BeanProvider implementation. */ public static class SpringBindingDescriptorAdapter extends CommonBindingDescriptor { - public SpringBindingDescriptorAdapter(Entry binding) { super(binding.getValue(), binding.getKey()); } @@ -58,7 +52,6 @@ public B getInstance(Class clazz) { @Override public Iterator> getBindings(Class clazz) { - List> result = new ArrayList>(); Map beansOfType = applicationContext.getBeansOfType(clazz); diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/EagerActionHandlerValidatorRegistryImpl.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/EagerActionHandlerValidatorRegistryImpl.java index de170eceb4..68f1620077 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/EagerActionHandlerValidatorRegistryImpl.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/EagerActionHandlerValidatorRegistryImpl.java @@ -18,9 +18,5 @@ import com.gwtplatform.dispatch.rpc.server.actionhandlervalidator.AbstractEagerActionHandlerValidatorRegistryImpl; -/** - * @author Peter Simun - * - */ public class EagerActionHandlerValidatorRegistryImpl extends AbstractEagerActionHandlerValidatorRegistryImpl { } diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/LazyActionHandlerValidatorRegistryImpl.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/LazyActionHandlerValidatorRegistryImpl.java index b0e31da94c..514a497bdf 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/LazyActionHandlerValidatorRegistryImpl.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/actionhandlervalidator/LazyActionHandlerValidatorRegistryImpl.java @@ -32,17 +32,12 @@ import com.gwtplatform.dispatch.rpc.shared.Action; import com.gwtplatform.dispatch.rpc.shared.Result; -/** - * @author Peter Simun - * - */ public class LazyActionHandlerValidatorRegistryImpl implements LazyActionHandlerValidatorRegistry, ApplicationContextAware { - private ApplicationContext applicationContext; - private final Map>, ActionHandlerValidatorClass, - ? extends Result>> actionHandlerValidatorClasses; + private final Map>, ActionHandlerValidatorClass, ? extends Result>> + actionHandlerValidatorClasses; private final Map>, ActionHandlerValidatorInstance> actionHandlerValidatorInstances; private final Map, ActionValidator> validators; @@ -69,14 +64,12 @@ public void clearActionHandlerValidators() { @SuppressWarnings("unchecked") @Override public , R extends Result> ActionHandlerValidatorInstance findActionHandlerValidator(A action) { - - ActionHandlerValidatorInstance actionHandlerValidatorInstance = actionHandlerValidatorInstances.get(action - .getClass()); + ActionHandlerValidatorInstance actionHandlerValidatorInstance = + actionHandlerValidatorInstances.get(action.getClass()); if (actionHandlerValidatorInstance == null) { ActionHandlerValidatorClass, ? extends Result> actionHandlerValidatorClass = - actionHandlerValidatorClasses.get(action - .getClass()); + actionHandlerValidatorClasses.get(action.getClass()); if (actionHandlerValidatorClass != null) { actionHandlerValidatorInstance = createInstance(actionHandlerValidatorClass); if (actionHandlerValidatorInstance != null) { @@ -97,9 +90,8 @@ public ActionValidator findActionValidator(Class acti @Override public , R extends Result> void removeActionHandlerValidatorClass(Class actionClass, ActionHandlerValidatorClass actionHandlerValidatorClass) { - - ActionHandlerValidatorClass oldActionHandlerValidatorClass = actionHandlerValidatorClasses.get( - actionClass); + ActionHandlerValidatorClass oldActionHandlerValidatorClass = + actionHandlerValidatorClasses.get(actionClass); if (oldActionHandlerValidatorClass == actionHandlerValidatorClass) { actionHandlerValidatorClasses.remove(actionClass); @@ -121,9 +113,8 @@ private boolean containValidator(ActionValidator actionValidator) { return false; } - private ActionHandlerValidatorInstance createInstance(ActionHandlerValidatorClass, - ? extends Result> actionHandlerValidatorClass) { - + private ActionHandlerValidatorInstance createInstance( + ActionHandlerValidatorClass, ? extends Result> actionHandlerValidatorClass) { ActionHandlerValidatorInstance actionHandlerValidatorInstance = null; ActionValidator actionValidator = findActionValidator(actionHandlerValidatorClass.getActionValidatorClass()); diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/configuration/DefaultModule.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/configuration/DefaultModule.java index e177e6b4e1..beee319371 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/configuration/DefaultModule.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/configuration/DefaultModule.java @@ -25,12 +25,8 @@ /** * Default configuration for spring. - * - * @author David Ignjic - * */ public class DefaultModule { - private/* @Value("cookie") */ String securityCookieName; @Bean diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/request/DefaultRequestProvider.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/request/DefaultRequestProvider.java index 80675952ce..6d3b8bfa02 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/request/DefaultRequestProvider.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/request/DefaultRequestProvider.java @@ -25,12 +25,8 @@ /** * Request provider. - * - * @author David Ignjic - * */ public class DefaultRequestProvider implements RequestProvider { - public DefaultRequestProvider() { } @@ -39,5 +35,4 @@ public DefaultRequestProvider() { public HttpServletRequest getServletRequest() { return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); } - } diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/RequestProvider.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/RequestProvider.java index 6bc3a54b64..b575fecbf1 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/RequestProvider.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/RequestProvider.java @@ -16,9 +16,5 @@ package com.gwtplatform.dispatch.rpc.server.spring.utils; -/** - * @author Peter Simun - * - */ public class RequestProvider { } diff --git a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/SpringUtils.java b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/SpringUtils.java index e963fabd81..2e7925051c 100644 --- a/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/SpringUtils.java +++ b/gwtp-core/gwtp-dispatch-rpc-server-spring/src/main/java/com/gwtplatform/dispatch/rpc/server/spring/utils/SpringUtils.java @@ -28,14 +28,8 @@ import org.springframework.util.StringUtils; import org.springframework.web.context.support.AbstractRefreshableWebApplicationContext; -/** - * @author Peter Simun - * - */ public class SpringUtils { - - public static B getOrCreate(ApplicationContext applicationContext, - Class clazz) throws BeansException { + public static B getOrCreate(ApplicationContext applicationContext, Class clazz) throws BeansException { try { return getInstance(applicationContext, clazz); } catch (BeansException ex) { @@ -45,44 +39,38 @@ public static B getOrCreate(ApplicationContext applicationContext, } @SuppressWarnings("unchecked") - public static B instantiate(ApplicationContext applicationContext, - Class clazz) throws BeansException { - DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory( - applicationContext); - return (B) beanFactory.createBean(clazz, - AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR, false); + public static B instantiate(ApplicationContext applicationContext, Class clazz) throws BeansException { + DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(applicationContext); + return (B) beanFactory.createBean(clazz, AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR, false); } public static void registerBean(ApplicationContext applicationContext, B instance) throws BeansException { if (applicationContext instanceof GenericApplicationContext) { - ConfigurableListableBeanFactory beanFactory = ((GenericApplicationContext) applicationContext) - .getBeanFactory(); + ConfigurableListableBeanFactory beanFactory = + ((GenericApplicationContext) applicationContext).getBeanFactory(); beanFactory.registerSingleton(generateName(beanFactory, createBeanDefinition(instance)), instance); } else if (applicationContext instanceof AbstractRefreshableWebApplicationContext) { - ConfigurableListableBeanFactory beanFactory = ((AbstractRefreshableWebApplicationContext) - applicationContext).getBeanFactory(); + ConfigurableListableBeanFactory beanFactory = + ((AbstractRefreshableWebApplicationContext) applicationContext).getBeanFactory(); beanFactory.registerSingleton(generateName(beanFactory, createBeanDefinition(instance)), instance); } } - public static B getInstance(ApplicationContext applicationContext, - Class clazz) throws BeansException { - DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory( - applicationContext); + public static B getInstance(ApplicationContext applicationContext, Class clazz) throws BeansException { + DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory(applicationContext); return beanFactory.getBean(clazz); } private static RootBeanDefinition createBeanDefinition(B instance) { - RootBeanDefinition bd = new RootBeanDefinition(instance.getClass(), - AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR, false); + RootBeanDefinition bd = new RootBeanDefinition(instance.getClass(), AbstractBeanDefinition.AUTOWIRE_CONSTRUCTOR, + false); bd.setScope(BeanDefinition.SCOPE_SINGLETON); return bd; } - private static String generateName(ConfigurableListableBeanFactory registry, - RootBeanDefinition definition) { + private static String generateName(ConfigurableListableBeanFactory registry, RootBeanDefinition definition) { String generatedBeanName = definition.getBeanClassName(); if (generatedBeanName == null) { if (definition.getParentName() != null) { @@ -93,8 +81,8 @@ private static String generateName(ConfigurableListableBeanFactory registry, } if (!StringUtils.hasText(generatedBeanName)) { throw new BeanDefinitionStoreException( - "Unnamed bean definition specifies neither " - + "'class' nor 'parent' nor 'factory-bean' - can't generate bean name"); + "Unnamed bean definition specifies neither 'class' nor 'parent' nor 'factory-bean' - can't " + + "generate bean name"); } String id = generatedBeanName; diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceImpl.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceImpl.java index 027c91cad5..a2cd8ec4fa 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceImpl.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceImpl.java @@ -16,13 +16,11 @@ package com.gwtplatform.mvp.client.proxy; +import java.util.Arrays; + import com.gwtplatform.mvp.shared.proxy.PlaceRequest; -/** - * @author Philippe Beaudoin - */ public class PlaceImpl implements Place { - private final String[] nameTokens; public PlaceImpl(String... nameTokens) { @@ -38,7 +36,7 @@ public boolean canReveal() { public final boolean equals(Object o) { if (o instanceof PlaceImpl) { PlaceImpl place = (PlaceImpl) o; - return nameTokens.equals(place.nameTokens); + return Arrays.equals(nameTokens, place.nameTokens); } if (o instanceof Place) { Place place = (Place) o; @@ -60,9 +58,10 @@ public String getNameToken() { public String[] getNameTokens() { return nameTokens; } + @Override public final int hashCode() { - return 17 * nameTokens.hashCode(); + return 17 * Arrays.hashCode(nameTokens); } @Override @@ -80,5 +79,4 @@ public final boolean matchesRequest(PlaceRequest request) { public final String toString() { return getNameToken(); } - } diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeper.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeper.java index 79849296d6..aed40373f8 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeper.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeper.java @@ -16,19 +16,20 @@ package com.gwtplatform.mvp.client.proxy; -/** - * @author Philippe Beaudoin - */ public class PlaceWithGatekeeper extends PlaceImpl { - private final Gatekeeper gatekeeper; - public PlaceWithGatekeeper(String nameToken, Gatekeeper gatekeeper) { + public PlaceWithGatekeeper( + String nameToken, + Gatekeeper gatekeeper) { this(new String[] { nameToken }, gatekeeper); } - public PlaceWithGatekeeper(String[] nameTokens, Gatekeeper gatekeeper) { + public PlaceWithGatekeeper( + String[] nameTokens, + Gatekeeper gatekeeper) { super(nameTokens); + this.gatekeeper = gatekeeper; } diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeperWithParams.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeperWithParams.java index b7dec1470b..b4621656ae 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeperWithParams.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/client/proxy/PlaceWithGatekeeperWithParams.java @@ -17,24 +17,26 @@ package com.gwtplatform.mvp.client.proxy; /** - * Specialized {@link PlaceWithGatekeeper} which uses a {@link GatekeeperWithParams} - * and an array of parameters to protect the {@link Place}. - * - * @author Juan Carlos González + * Specialized {@link PlaceWithGatekeeper} which uses a {@link GatekeeperWithParams} and an array of parameters to + * protect the {@link Place}. */ public class PlaceWithGatekeeperWithParams extends PlaceImpl { - private final GatekeeperWithParams gatekeeper; private final String[] params; - public PlaceWithGatekeeperWithParams(String nameToken, GatekeeperWithParams gatekeeper, + public PlaceWithGatekeeperWithParams( + String nameToken, + GatekeeperWithParams gatekeeper, String[] params) { - this(new String[] { nameToken }, gatekeeper,params); + this(new String[] { nameToken }, gatekeeper, params); } - public PlaceWithGatekeeperWithParams(String[] nameTokens, GatekeeperWithParams gatekeeper, + public PlaceWithGatekeeperWithParams( + String[] nameTokens, + GatekeeperWithParams gatekeeper, String[] params) { super(nameTokens); + this.gatekeeper = gatekeeper; this.params = params; } diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/PlaceTokenRegistryGenerator.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/PlaceTokenRegistryGenerator.java index 1ec97dbe35..aaa87f8c07 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/PlaceTokenRegistryGenerator.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/PlaceTokenRegistryGenerator.java @@ -38,7 +38,6 @@ * Generates an implementation of {@link PlaceTokenRegistry} based on GWTP's {@link NameToken} annotation. */ public class PlaceTokenRegistryGenerator extends Generator { - @Override public String generate(final TreeLogger treeLogger, GeneratorContext generatorContext, String requestedClass) throws UnableToCompleteException { diff --git a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java index cd341db1b0..4250762a7e 100644 --- a/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java +++ b/gwtp-core/gwtp-mvp-client/src/main/java/com/gwtplatform/mvp/rebind/ProxyPlaceOutputter.java @@ -34,11 +34,8 @@ /** * Proxy outputter for a proxy that is also a place. - * - * @author Philippe Beaudoin */ public class ProxyPlaceOutputter extends ProxyOutputterBase { - public static final String WRAPPED_CLASS_NAME = "WrappedProxy"; private String[] nameTokens; @@ -48,7 +45,8 @@ public class ProxyPlaceOutputter extends ProxyOutputterBase { private String title; private PresenterTitleMethod presenterTitleMethod; - public ProxyPlaceOutputter(TypeOracle oracle, + public ProxyPlaceOutputter( + TypeOracle oracle, TreeLogger logger, ClassCollection classCollection, GinjectorInspector ginjectorInspector, @@ -107,8 +105,7 @@ public String getGatekeeperParamsString() { } @Override - void initSubclass(JClassType proxyInterface) - throws UnableToCompleteException { + void initSubclass(JClassType proxyInterface) throws UnableToCompleteException { findNameTokens(proxyInterface); findGatekeeperMethod(proxyInterface); findGatekeeperParams(proxyInterface); @@ -124,56 +121,49 @@ void addSubclassImports(ClassSourceFileComposerFactory composerFactory) { } } - private void findNameTokens(JClassType proxyInterface) - throws UnableToCompleteException { + private void findNameTokens(JClassType proxyInterface) throws UnableToCompleteException { NameToken nameTokenAnnotation = proxyInterface.getAnnotation(NameToken.class); if (nameTokenAnnotation == null) { logger.log(TreeLogger.ERROR, - "The proxy for '" + presenterInspector.getPresenterClassName() - + "' is a Place, but is not annotated with @' +" - + NameToken.class.getSimpleName() + ".", null); + String.format("The proxy for '%s' is a Place, but is not annotated with @' +%s.", + presenterInspector.getPresenterClassName(), NameToken.class.getSimpleName())); throw new UnableToCompleteException(); } nameTokens = nameTokenAnnotation.value(); if (nameTokens.length == 0) { logger.log(TreeLogger.ERROR, - "The proxy for '" + presenterInspector.getPresenterClassName() + "' is annotated with '@" - + NameToken.class.getSimpleName() + "', but has no name token specified.", null); + String.format("The proxy for '%s' is annotated with '@%s', but has no name token specified.", + presenterInspector.getPresenterClassName(), NameToken.class.getSimpleName())); throw new UnableToCompleteException(); } } - private void findGatekeeperMethod(JClassType proxyInterface) - throws UnableToCompleteException { + private void findGatekeeperMethod(JClassType proxyInterface) throws UnableToCompleteException { UseGatekeeper gatekeeperAnnotation = proxyInterface.getAnnotation(UseGatekeeper.class); if (gatekeeperAnnotation != null) { String gatekeeperName = gatekeeperAnnotation.value().getCanonicalName(); JClassType customGatekeeperClass = oracle.findType(gatekeeperName); if (customGatekeeperClass == null) { - logger.log(TreeLogger.ERROR, "The class '" + gatekeeperName - + "' provided to @" + UseGatekeeper.class.getSimpleName() - + " can't be found.", null); + logger.log(TreeLogger.ERROR, String.format("The class '%s' provided to @%s can't be found.", + gatekeeperName, UseGatekeeper.class.getSimpleName())); throw new UnableToCompleteException(); } if (!customGatekeeperClass.isAssignableTo(classCollection.gatekeeperClass)) { - logger.log(TreeLogger.ERROR, "The class '" + gatekeeperName - + "' provided to @" + UseGatekeeper.class.getSimpleName() - + " does not inherit from '" + ClassCollection.gatekeeperClassName + "'.", null); + logger.log(TreeLogger.ERROR, String.format("The class '%s' provided to @%s does not inherit from '%s'.", + gatekeeperName, UseGatekeeper.class.getSimpleName(), ClassCollection.gatekeeperClassName)); throw new UnableToCompleteException(); } // Find the appropriate get method in the Ginjector getGatekeeperMethod = ginjectorInspector.findGetMethod(customGatekeeperClass); if (getGatekeeperMethod == null) { logger.log(TreeLogger.ERROR, - "The Ginjector '" + ginjectorInspector.getGinjectorClassName() - + "' does not have a get() method returning '" - + gatekeeperName + "'. This is required when using @" - + UseGatekeeper.class.getSimpleName() + ".", null); + String.format("The Ginjector '%s' does not have a get() method returning '%s'. This is " + + "required when using @%s.", ginjectorInspector.getGinjectorClassName(), gatekeeperName, + UseGatekeeper.class.getSimpleName())); throw new UnableToCompleteException(); } } - if (getGatekeeperMethod == null - && proxyInterface.getAnnotation(NoGatekeeper.class) == null) { + if (getGatekeeperMethod == null && proxyInterface.getAnnotation(NoGatekeeper.class) == null) { // No Gatekeeper specified, see if there is a DefaultGatekeeper defined in the ginjector getGatekeeperMethod = ginjectorInspector.findAnnotatedGetMethod( classCollection.gatekeeperClass, DefaultGatekeeper.class, true); @@ -195,11 +185,10 @@ private void findTitle(JClassType proxyInterface) title = titleAnnotation.value(); } if (presenterTitleMethod != null && title != null) { - logger.log(TreeLogger.ERROR, "The proxy for '" + presenterInspector.getPresenterClassName() - + "' is annotated with @' +" + Title.class.getSimpleName() - + " and its presenter has a method annotated with @" - + TitleFunction.class.getSimpleName() + ". Only once can be used.", - null); + logger.log(TreeLogger.ERROR, String.format( + "The proxy for '%s' is annotated with @' +%s and its presenter has a method annotated with @%s. " + + "Only once can be used.", presenterInspector.getPresenterClassName(), + Title.class.getSimpleName(), TitleFunction.class.getSimpleName())); throw new UnableToCompleteException(); } } @@ -221,9 +210,8 @@ private String getPlaceInstantiationString() { /** * Writes the method {@code protected void getPlaceTitle(final GetPlaceTitleEvent event)} if * one is needed. - * - * @param writer - * The {@link SourceWriter}. + * + * @param writer The {@link SourceWriter}. */ private void writeGetPlaceTitleMethod(SourceWriter writer) { if (title != null) { @@ -246,8 +234,8 @@ private void writeGetPlaceTitleMethodConstantText(SourceWriter writer) { protected String createInitNameTokens() { StringBuilder sb = new StringBuilder(); sb.append('{'); - for (String tmpNameToken : nameTokens) { - sb.append('"').append(tmpNameToken).append('"').append(','); + for (String nameToken : nameTokens) { + sb.append('"').append(nameToken).append('"').append(','); } sb.setLength(sb.length() - 1); sb.append('}'); @@ -256,8 +244,7 @@ protected String createInitNameTokens() { @Override void writeSubclassDelayedBind(SourceWriter writer) { - writer.println(WRAPPED_CLASS_NAME + " wrappedProxy = GWT.create(" + WRAPPED_CLASS_NAME - + ".class);"); + writer.println(WRAPPED_CLASS_NAME + " wrappedProxy = GWT.create(" + WRAPPED_CLASS_NAME + ".class);"); writer.println("wrappedProxy.delayedBind( ginjector ); "); writer.println("setProxy(wrappedProxy); "); writer.println("String[] nameToken = " + createInitNameTokens() + "; "); diff --git a/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java b/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java index ff311fb2b0..f9e74ed7b7 100644 --- a/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java +++ b/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java @@ -25,11 +25,8 @@ /** * Integration test for various components of GWTP's MVP module. - * - * @author Philippe Beaudoin */ public class MvpGwtTestInSuite extends GWTTestCase { - GinjectorTestUtilGwt ginjector; MainPresenterTestUtilGwt presenter; @@ -59,24 +56,23 @@ public void testShouldCreateOnlyOneGinjector() { */ public void testMultipleTokens() { ginjector.getPlaceManager().revealDefaultPlace(); - Scheduler.get().scheduleDeferred(new ScheduledCommand() { + Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { assertTrue(ginjector.getMainPresenter().get().isVisible()); ginjector.getPlaceManager().revealPlace(new PlaceRequest.Builder().nameToken("admin").build()); - Scheduler.get().scheduleDeferred(new ScheduledCommand() { + Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { assertFalse(ginjector.getMainPresenter().get().isVisible()); assertTrue(ginjector.getAdminPresenter().get().isVisible()); ginjector.getPlaceManager().revealDefaultPlace(); - Scheduler.get().scheduleDeferred(new ScheduledCommand() { + Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { - assertTrue(ginjector.getMainPresenter().get().isVisible()); assertFalse(ginjector.getAdminPresenter().get().isVisible()); ginjector.getPlaceManager().revealPlace( From b30f0c2debf00f5ab9fab8bca7a3343e0116b56d Mon Sep 17 00:00:00 2001 From: Christopher Viel Date: Fri, 7 Mar 2014 10:57:57 -0500 Subject: [PATCH 5/7] Added toString to PlaceRequest Former-commit-id: 2757fee179b48ad40f079fcd1b1ae4b038905a7d --- .../mvp/shared/proxy/PlaceRequest.java | 5 +++++ .../mvp/shared/proxy/PlaceRequestTest.java | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/gwtp-core/gwtp-mvp-shared/src/main/java/com/gwtplatform/mvp/shared/proxy/PlaceRequest.java b/gwtp-core/gwtp-mvp-shared/src/main/java/com/gwtplatform/mvp/shared/proxy/PlaceRequest.java index 11ee75e4e7..9016525a80 100644 --- a/gwtp-core/gwtp-mvp-shared/src/main/java/com/gwtplatform/mvp/shared/proxy/PlaceRequest.java +++ b/gwtp-core/gwtp-mvp-shared/src/main/java/com/gwtplatform/mvp/shared/proxy/PlaceRequest.java @@ -166,6 +166,11 @@ public int hashCode() { return 11 * (nameToken.hashCode() + (params == null ? 0 : params.hashCode())); } + @Override + public String toString() { + return "PlaceRequest(nameToken=" + nameToken + ", params=" + params + ")"; + } + /** * Checks if this place request has the same name token as the one passed in. * diff --git a/gwtp-core/gwtp-mvp-shared/src/test/java/com/gwtplatform/mvp/shared/proxy/PlaceRequestTest.java b/gwtp-core/gwtp-mvp-shared/src/test/java/com/gwtplatform/mvp/shared/proxy/PlaceRequestTest.java index cadc90981a..483e95388e 100644 --- a/gwtp-core/gwtp-mvp-shared/src/test/java/com/gwtplatform/mvp/shared/proxy/PlaceRequestTest.java +++ b/gwtp-core/gwtp-mvp-shared/src/test/java/com/gwtplatform/mvp/shared/proxy/PlaceRequestTest.java @@ -87,4 +87,21 @@ public void shouldBuildRequestFromExistingRequest() { // then assertEquals(request, copyOfRequest); } + + @Test + public void testToString() { + // given + PlaceRequest request = new PlaceRequest.Builder() + .nameToken("nameToken") + .with("name1", "value1") + .with("name2", "value2") + .build(); + + // when + String result = request.toString(); + + // then + assertNotNull(result); + assertEquals("PlaceRequest(nameToken=nameToken, params={name1=value1, name2=value2})", result); + } } From d86c9b0af8eea123699d85d36f46c4cc4821ed03 Mon Sep 17 00:00:00 2001 From: Christopher Viel Date: Fri, 7 Mar 2014 11:09:32 -0500 Subject: [PATCH 6/7] Updated POM versions Former-commit-id: aa0f71772c845f91efde849fe9185a3a6d2cb306 --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 1a9b2ba249..a29f76204e 100644 --- a/pom.xml +++ b/pom.xml @@ -216,7 +216,7 @@ 1.7 - 2.5.1 + 2.6.0 1.0.0 2.7 2.3.2 @@ -231,7 +231,7 @@ 2.12 - 2.5.1 + 2.6.0 2.1.2 1.3.2 0.4.0 @@ -243,7 +243,7 @@ 1.8.8 3.0 1 - 16.0 + 16.0.1 4.0b3 1.0 2.5 From e23dd9f2d66321307e531d4e6899acfa94fac4cf Mon Sep 17 00:00:00 2001 From: Christopher Viel Date: Fri, 7 Mar 2014 12:20:33 -0500 Subject: [PATCH 7/7] Cleanup test case Former-commit-id: ef799d4cde14c328dc0d2b9b9305d09abd9830b8 --- .../mvp/client/gwt/mvp/MvpGwtTestInSuite.java | 79 ++++++++++++------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java b/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java index f9e74ed7b7..42c128129f 100644 --- a/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java +++ b/gwtp-core/gwtp-mvp-client/src/test/java/com/gwtplatform/mvp/client/gwt/mvp/MvpGwtTestInSuite.java @@ -22,6 +22,7 @@ import com.google.gwt.junit.client.GWTTestCase; import com.gwtplatform.mvp.client.DelayedBindRegistry; import com.gwtplatform.mvp.shared.proxy.PlaceRequest; +import com.gwtplatform.mvp.shared.proxy.PlaceRequest.Builder; /** * Integration test for various components of GWTP's MVP module. @@ -38,6 +39,7 @@ public String getModuleName() { @Override protected void gwtSetUp() throws Exception { super.gwtSetUp(); + InstantiationCounterTestUtilGwt.resetCounter(); ginjector = GWT.create(GinjectorTestUtilGwt.class); DelayedBindRegistry.bind(ginjector); @@ -48,6 +50,7 @@ protected void gwtSetUp() throws Exception { */ public void testShouldCreateOnlyOneGinjector() { ginjector.getPlaceManager().revealCurrentPlace(); + assertEquals(1, InstantiationCounterTestUtilGwt.getCounter()); } @@ -61,38 +64,56 @@ public void testMultipleTokens() { @Override public void execute() { assertTrue(ginjector.getMainPresenter().get().isVisible()); - ginjector.getPlaceManager().revealPlace(new PlaceRequest.Builder().nameToken("admin").build()); - - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - @Override - public void execute() { - assertFalse(ginjector.getMainPresenter().get().isVisible()); - assertTrue(ginjector.getAdminPresenter().get().isVisible()); - ginjector.getPlaceManager().revealDefaultPlace(); - - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - @Override - public void execute() { - assertTrue(ginjector.getMainPresenter().get().isVisible()); - assertFalse(ginjector.getAdminPresenter().get().isVisible()); - ginjector.getPlaceManager().revealPlace( - new PlaceRequest.Builder().nameToken("selfService").build()); - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - - @Override - public void execute() { - assertFalse(ginjector.getMainPresenter().get().isVisible()); - assertTrue(ginjector.getAdminPresenter().get().isVisible()); - finishTest(); - } - }); - } - }); - } - }); + assertFalse(ginjector.getAdminPresenter().get().isVisible()); + + revealAdmin(); } }); + delayTestFinish(1000); } + private void revealAdmin() { + PlaceRequest placeRequest = new Builder().nameToken("admin").build(); + ginjector.getPlaceManager().revealPlace(placeRequest); + + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + @Override + public void execute() { + assertFalse(ginjector.getMainPresenter().get().isVisible()); + assertTrue(ginjector.getAdminPresenter().get().isVisible()); + + revealDefaultPlace(); + } + }); + } + + private void revealDefaultPlace() { + ginjector.getPlaceManager().revealDefaultPlace(); + + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + @Override + public void execute() { + assertTrue(ginjector.getMainPresenter().get().isVisible()); + assertFalse(ginjector.getAdminPresenter().get().isVisible()); + + revealSelfService(); + } + }); + } + + private void revealSelfService() { + PlaceRequest placeRequest = new Builder().nameToken("selfService").build(); + ginjector.getPlaceManager().revealPlace(placeRequest); + + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + @Override + public void execute() { + assertFalse(ginjector.getMainPresenter().get().isVisible()); + assertTrue(ginjector.getAdminPresenter().get().isVisible()); + + finishTest(); + } + }); + } }