Return-Path: Delivered-To: apmail-labs-commits-archive@minotaur.apache.org Received: (qmail 45253 invoked from network); 7 Jul 2009 08:37:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Jul 2009 08:37:57 -0000 Received: (qmail 69515 invoked by uid 500); 7 Jul 2009 08:38:07 -0000 Delivered-To: apmail-labs-commits-archive@labs.apache.org Received: (qmail 69389 invoked by uid 500); 7 Jul 2009 08:38:07 -0000 Mailing-List: contact commits-help@labs.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: labs@labs.apache.org Delivered-To: mailing list commits@labs.apache.org Received: (qmail 69380 invoked by uid 99); 7 Jul 2009 08:38:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jul 2009 08:38:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Jul 2009 08:37:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A62A42388891; Tue, 7 Jul 2009 08:37:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r791750 - in /labs/hupa: ./ lib/ lib/com.google.gwt.inject/ lib/com.google.gwt.inject/jars/ lib/com.google.gwt.inject/poms/ lib/com.google.gwt/ lib/com.google.gwt/jars/ lib/com.google.gwt/poms/ lib/com.google.inject/ lib/com.google.inject/j... Date: Tue, 07 Jul 2009 08:37:29 -0000 To: commits@labs.apache.org From: norman@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090707083730.A62A42388891@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: norman Date: Tue Jul 7 08:37:28 2009 New Revision: 791750 URL: http://svn.apache.org/viewvc?rev=791750&view=rev Log: Commit some work in progress which has the following goals (at the moment most stuff is broken): *use DI (guice/gin) *use Action pattern *replace gwt-mvc with a mvp pattern Added: labs/hupa/lib/ labs/hupa/lib/com.google.gwt/ labs/hupa/lib/com.google.gwt.inject/ labs/hupa/lib/com.google.gwt.inject/jars/ labs/hupa/lib/com.google.gwt.inject/jars/gin-1.0-20090622.jar (with props) labs/hupa/lib/com.google.gwt.inject/poms/ labs/hupa/lib/com.google.gwt.inject/poms/gin-1.0-20090622.pom labs/hupa/lib/com.google.gwt/jars/ labs/hupa/lib/com.google.gwt/jars/gwt-incubator-march-02-2009.jar (with props) labs/hupa/lib/com.google.gwt/poms/ labs/hupa/lib/com.google.gwt/poms/gwt-incubator-march-02-2009.pom labs/hupa/lib/com.google.inject/ labs/hupa/lib/com.google.inject/jars/ labs/hupa/lib/com.google.inject/jars/guice-2.0.jar (with props) labs/hupa/lib/com.google.inject/jars/guice-servlet-2.0.jar (with props) labs/hupa/lib/com.google.inject/poms/ labs/hupa/lib/com.google.inject/poms/guice-2.0.pom labs/hupa/lib/com.google.inject/poms/guice-servlet-2.0.pom labs/hupa/lib/org.cobogw.gwt/ labs/hupa/lib/org.cobogw.gwt/jars/ labs/hupa/lib/org.cobogw.gwt/jars/org.cobogw.gwt-1.2.4.jar (with props) labs/hupa/lib/org.cobogw.gwt/poms/ labs/hupa/lib/org.cobogw.gwt/poms/org.cobogw.gwt-1.2.4.pom labs/hupa/src/main/java/org/apache/hupa/client/Hupa.java - copied, changed from r791388, labs/hupa/src/main/java/org/apache/hupa/client/Hupa.java labs/hupa/src/main/java/org/apache/hupa/client/LoginWidget.java labs/hupa/src/main/java/org/apache/hupa/client/events/ labs/hupa/src/main/java/org/apache/hupa/client/events/EventBus.java labs/hupa/src/main/java/org/apache/hupa/client/gin/ labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java labs/hupa/src/main/java/org/apache/hupa/client/gin/MyGinjector.java labs/hupa/src/main/java/org/apache/hupa/client/rpc/ labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFolders.java labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFoldersResult.java labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUserResult.java labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPHandler.java labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java labs/hupa/src/main/java/org/apache/hupa/server/gin/ labs/hupa/src/main/java/org/apache/hupa/server/gin/MyActionHandlerRegistry.java labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java labs/hupa/src/main/java/org/apache/hupa/server/guice/ labs/hupa/src/main/java/org/apache/hupa/server/guice/DispatchServletModule.java labs/hupa/src/main/java/org/apache/hupa/server/guice/MyGuiceServletConfig.java Modified: labs/hupa/pom.xml labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml labs/hupa/src/main/java/org/apache/hupa/client/services/IMAPService.java labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java labs/hupa/war/WEB-INF/web.xml Added: labs/hupa/lib/com.google.gwt.inject/jars/gin-1.0-20090622.jar URL: http://svn.apache.org/viewvc/labs/hupa/lib/com.google.gwt.inject/jars/gin-1.0-20090622.jar?rev=791750&view=auto ============================================================================== Binary file - no diff available. Propchange: labs/hupa/lib/com.google.gwt.inject/jars/gin-1.0-20090622.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: labs/hupa/lib/com.google.gwt.inject/poms/gin-1.0-20090622.pom URL: http://svn.apache.org/viewvc/labs/hupa/lib/com.google.gwt.inject/poms/gin-1.0-20090622.pom?rev=791750&view=auto ============================================================================== --- labs/hupa/lib/com.google.gwt.inject/poms/gin-1.0-20090622.pom (added) +++ labs/hupa/lib/com.google.gwt.inject/poms/gin-1.0-20090622.pom Tue Jul 7 08:37:28 2009 @@ -0,0 +1,18 @@ + + 4.0.0 + com.google.gwt.inject + gin + Google GIN + 1.0-20090622 + GIN (GWT INjection) is Guice for Google Web Toolkit client-side code + http://code.google.com/p/google-gin/ + + + + com.google.inject + guice + 2.0 + + + + \ No newline at end of file Added: labs/hupa/lib/com.google.gwt/jars/gwt-incubator-march-02-2009.jar URL: http://svn.apache.org/viewvc/labs/hupa/lib/com.google.gwt/jars/gwt-incubator-march-02-2009.jar?rev=791750&view=auto ============================================================================== Binary file - no diff available. Propchange: labs/hupa/lib/com.google.gwt/jars/gwt-incubator-march-02-2009.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: labs/hupa/lib/com.google.gwt/poms/gwt-incubator-march-02-2009.pom URL: http://svn.apache.org/viewvc/labs/hupa/lib/com.google.gwt/poms/gwt-incubator-march-02-2009.pom?rev=791750&view=auto ============================================================================== --- labs/hupa/lib/com.google.gwt/poms/gwt-incubator-march-02-2009.pom (added) +++ labs/hupa/lib/com.google.gwt/poms/gwt-incubator-march-02-2009.pom Tue Jul 7 08:37:28 2009 @@ -0,0 +1,7 @@ + + 4.0.0 + com.google.gwt + gwt-incubator + march-02.2009 + + \ No newline at end of file Added: labs/hupa/lib/com.google.inject/jars/guice-2.0.jar URL: http://svn.apache.org/viewvc/labs/hupa/lib/com.google.inject/jars/guice-2.0.jar?rev=791750&view=auto ============================================================================== Binary file - no diff available. Propchange: labs/hupa/lib/com.google.inject/jars/guice-2.0.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: labs/hupa/lib/com.google.inject/jars/guice-servlet-2.0.jar URL: http://svn.apache.org/viewvc/labs/hupa/lib/com.google.inject/jars/guice-servlet-2.0.jar?rev=791750&view=auto ============================================================================== Binary file - no diff available. Propchange: labs/hupa/lib/com.google.inject/jars/guice-servlet-2.0.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: labs/hupa/lib/com.google.inject/poms/guice-2.0.pom URL: http://svn.apache.org/viewvc/labs/hupa/lib/com.google.inject/poms/guice-2.0.pom?rev=791750&view=auto ============================================================================== --- labs/hupa/lib/com.google.inject/poms/guice-2.0.pom (added) +++ labs/hupa/lib/com.google.inject/poms/guice-2.0.pom Tue Jul 7 08:37:28 2009 @@ -0,0 +1,17 @@ + + + 4.0.0 + com.google.inject + guice + Google Guice + 2.0 + + + + aopalliance + aopalliance + 1.0 + + + + \ No newline at end of file Added: labs/hupa/lib/com.google.inject/poms/guice-servlet-2.0.pom URL: http://svn.apache.org/viewvc/labs/hupa/lib/com.google.inject/poms/guice-servlet-2.0.pom?rev=791750&view=auto ============================================================================== --- labs/hupa/lib/com.google.inject/poms/guice-servlet-2.0.pom (added) +++ labs/hupa/lib/com.google.inject/poms/guice-servlet-2.0.pom Tue Jul 7 08:37:28 2009 @@ -0,0 +1,16 @@ + + 4.0.0 + com.google.inject + guice-servlet + Google Guice Servlet + 2.0 + + + + com.google.inject + guice + 2.0 + + + + \ No newline at end of file Added: labs/hupa/lib/org.cobogw.gwt/jars/org.cobogw.gwt-1.2.4.jar URL: http://svn.apache.org/viewvc/labs/hupa/lib/org.cobogw.gwt/jars/org.cobogw.gwt-1.2.4.jar?rev=791750&view=auto ============================================================================== Binary file - no diff available. Propchange: labs/hupa/lib/org.cobogw.gwt/jars/org.cobogw.gwt-1.2.4.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: labs/hupa/lib/org.cobogw.gwt/poms/org.cobogw.gwt-1.2.4.pom URL: http://svn.apache.org/viewvc/labs/hupa/lib/org.cobogw.gwt/poms/org.cobogw.gwt-1.2.4.pom?rev=791750&view=auto ============================================================================== --- labs/hupa/lib/org.cobogw.gwt/poms/org.cobogw.gwt-1.2.4.pom (added) +++ labs/hupa/lib/org.cobogw.gwt/poms/org.cobogw.gwt-1.2.4.pom Tue Jul 7 08:37:28 2009 @@ -0,0 +1,6 @@ + + 4.0.0 + org.cobogw.gwt + org.cobogw.gwt + 1.2.4 + \ No newline at end of file Modified: labs/hupa/pom.xml URL: http://svn.apache.org/viewvc/labs/hupa/pom.xml?rev=791750&r1=791749&r2=791750&view=diff ============================================================================== --- labs/hupa/pom.xml (original) +++ labs/hupa/pom.xml Tue Jul 7 08:37:28 2009 @@ -1,282 +1,326 @@ - - 4.0.0 - org.apache.hupa - hupa - Hupa - 0.0.1-SNAPSHOT - - Hupa is a GWT based Webmail - - http://labs.apache.org - 2009 - - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.html - repo - - - - - - norman - Norman Maurer - norman at apache.org - 2 - - Developer - - - - - - JIRA - http://issues.apache.org/jira/browse/LABS - - - - scm:svn:http://svn.apache.org/repos/asf/labs/hupa - scm:svn:https://svn.apache.org/repos/asf/labs/hupa - http://svn.apache.org/viewvc/labs/hupa - - - - - gwt-maven - http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/ - - - gwt-mvc - GWT MVC repository at googlecode - http://gwt-mvc.googlecode.com/svn/repository - - - - - - - - gwt-maven - http://gwt-maven.googlecode.com/svn/trunk/mavenrepo - - - - - - 1.6.4 - - - - - - maven-site-plugin - 2.0-beta-5 - - - - - com.totsp.gwt - maven-googlewebtoolkit2-plugin - 2.0-RC1 - - INFO - - org.apache.hupa.Hupa - - org.apache.hupa.Hupa/Hupa.html - - false - -Xmx512m - - - - ${gwtVersion} - - - - - - compile - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack - compile - - unpack - - - - - com.google.gwt - gwt-dev - ${gwtVersion} - ${platform}-libs - zip - false - ${settings.localRepository}/com/google/gwt/gwt-dev/${gwtVersion} - - - - - - - - - org.apache.maven.plugins - maven-war-plugin - - target/web.xml - .gwt-tmp/** - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - - - - - - gwt-dev-windows - - windows - - - true - - windows - - - - - gwt-dev-mac - - mac - - - false - - mac - - - - - gwt-dev-linux - - linux - - - false - - linux - - - - - - - - commons-lang - commons-lang - 2.4 - - - - org.columba - ristretto-common - 1.0 - - - org.columba - ristretto-imap - 1.0 - - - org.columba - ristretto-smtp - 1.0 - - - org.cobogw - gwt - 1.2.4 - - - gwt-mvc - gwt-mvc - 0.2.1-gwt-1.6 - - - - - com.google.gwt - gwt-servlet - ${gwtVersion} - runtime - - - com.google.gwt - gwt-user - ${gwtVersion} - provided - - - com.google.gwt - gwt-dev - ${gwtVersion} - ${platform}-libs - zip - provided - - - com.google.gwt - gwt-dev - ${gwtVersion} - ${platform} - provided - - - junit - junit - 4.1 - test - - + + 4.0.0 + org.apache.hupa + hupa + Hupa + 0.0.1-SNAPSHOT + + Hupa is a GWT based Webmail + + http://labs.apache.org + 2009 + + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + norman + Norman Maurer + norman at apache.org + 2 + + Developer + + + + + + JIRA + http://issues.apache.org/jira/browse/LABS + + + + scm:svn:http://svn.apache.org/repos/asf/labs/hupa + scm:svn:https://svn.apache.org/repos/asf/labs/hupa + http://svn.apache.org/viewvc/labs/hupa + + + + + gwt-maven + http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/ + + + gwt-mvc + GWT MVC repository at googlecode + http://gwt-mvc.googlecode.com/svn/repository + + + gwt-dispatch + GWT Dispatch repository at googlecode + http://gwt-dispatch.googlecode.com/svn/maven2 + + + guice + Guice repository at googlecode + http://guice-maven.googlecode.com/svn/trunk + + + lib-repo + lib-m2-repository + file://${basedir}/lib + legacy + + false + + + ignore + + + + + + + + + + gwt-maven + http://gwt-maven.googlecode.com/svn/trunk/mavenrepo + + + + + + 1.6.4 + + + + + + maven-site-plugin + 2.0-beta-5 + + + + + com.totsp.gwt + maven-googlewebtoolkit2-plugin + 2.0-RC1 + + INFO + + org.apache.hupa.Hupa + + org.apache.hupa.Hupa/Hupa.html + + false + -Xmx512m + + + + ${gwtVersion} + + + + + + compile + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + compile + + unpack + + + + + com.google.gwt + gwt-dev + ${gwtVersion} + ${platform}-libs + zip + false + ${settings.localRepository}/com/google/gwt/gwt-dev/${gwtVersion} + + + + + + + + + org.apache.maven.plugins + maven-war-plugin + + target/web.xml + .gwt-tmp/** + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + + + + + + gwt-dev-windows + + windows + + + true + + windows + + + + + gwt-dev-mac + + mac + + + false + + mac + + + + + gwt-dev-linux + + linux + + + false + + linux + + + + + + + + commons-lang + commons-lang + 2.4 + + + + org.columba + ristretto-common + 1.0 + + + org.columba + ristretto-imap + 1.0 + + + org.columba + ristretto-smtp + 1.0 + + + org.cobogw.gwt + org.cobogw.gwt + 1.2.4 + + + gwt-mvc + gwt-mvc + 0.2.1-gwt-1.6 + + + net.customware.gwt.dispatch + gwt-dispatch + 1.0.0-SNAPSHOT + + + com.google.gwt + gwt-incubator + march-02-2009 + + + + com.google.code.guice + guice + 2.0 + + + com.google.code.guice + guice-servlet + 2.0 + + + + + com.google.gwt + gwt-servlet + ${gwtVersion} + runtime + + + com.google.gwt + gwt-user + ${gwtVersion} + provided + + + com.google.gwt + gwt-dev + ${gwtVersion} + ${platform}-libs + zip + provided + + + com.google.gwt + gwt-dev + ${gwtVersion} + ${platform} + provided + + + junit + junit + 4.1 + test + + \ No newline at end of file Modified: labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml?rev=791750&r1=791749&r2=791750&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml (original) +++ labs/hupa/src/main/java/org/apache/hupa/Hupa.gwt.xml Tue Jul 7 08:37:28 2009 @@ -1,24 +1,27 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + Copied: labs/hupa/src/main/java/org/apache/hupa/client/Hupa.java (from r791388, labs/hupa/src/main/java/org/apache/hupa/client/Hupa.java) URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/Hupa.java?p2=labs/hupa/src/main/java/org/apache/hupa/client/Hupa.java&p1=labs/hupa/src/main/java/org/apache/hupa/client/Hupa.java&r1=791388&r2=791750&rev=791750&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/Hupa.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/Hupa.java Tue Jul 7 08:37:28 2009 @@ -1,32 +1,17 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.hupa.client; - -import org.apache.hupa.client.controller.HupaController; - -import com.googlecode.gwtmvc.client.MvcEntryPoint; - -public class Hupa extends MvcEntryPoint { - - public Hupa() { - super(new HupaController()); - } - -} +package org.apache.hupa.client; + +import org.apache.hupa.client.gin.MyGinjector; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.ui.RootPanel; + +public class Hupa implements EntryPoint{ + private final MyGinjector injector = GWT.create(MyGinjector.class); + + public void onModuleLoad() { + LoginWidget lPanel = injector.getLoginWidget(); + lPanel.go(RootPanel.get()); + } + +} Added: labs/hupa/src/main/java/org/apache/hupa/client/LoginWidget.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/LoginWidget.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/LoginWidget.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/client/LoginWidget.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,208 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.hupa.client; + +import net.customware.gwt.dispatch.client.DispatchAsync; + +import org.apache.hupa.client.events.EventBus; +import org.apache.hupa.client.rpc.LoginUser; +import org.apache.hupa.client.rpc.LoginUserResult; +import org.cobogw.gwt.user.client.ui.Button; +import org.cobogw.gwt.user.client.ui.ButtonBar; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.KeyCodes; +import com.google.gwt.event.dom.client.KeyUpEvent; +import com.google.gwt.event.dom.client.KeyUpHandler; +import com.google.gwt.user.client.Cookies; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.CheckBox; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.Grid; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.Panel; +import com.google.gwt.user.client.ui.PasswordTextBox; +import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.VerticalPanel; +import com.google.inject.Inject; + +public class LoginWidget extends Composite implements KeyUpHandler,ClickHandler{ + + private HupaConstants constants = GWT.create(HupaConstants.class); + private Button loginButton = new Button(constants.loginButton()); + private Button resetButton = new Button(constants.resetButton()); + private TextBox usernameTextBox = new TextBox(); + private PasswordTextBox passwordTextBox = new PasswordTextBox(); + private CheckBox saveBox = new CheckBox(constants.saveLoginLabel()); + private Label errorLabel = new Label(constants.loginInvalid()); + + private int minUsernameLength = 1; + private int minPasswordLength = 1; + private DispatchAsync dispatcher; + private EventBus bus; + + @Inject + public LoginWidget(DispatchAsync dispatcher,EventBus bus) { + this.dispatcher = dispatcher; + VerticalPanel vPanel = new VerticalPanel(); + vPanel.setSpacing(5); + vPanel.setWidth("100%"); + vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); + vPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); + + Label header = new Label(constants.productName()); + + header.setHeight("25px"); + header.setStyleName("hupa-LoginWidgetHeader"); + vPanel.add(header); + vPanel.setCellHorizontalAlignment(header, VerticalPanel.ALIGN_LEFT); + + Grid grid = new Grid(3, 2); + + grid.setText(0, 0, constants.usernameLabel()); + grid.setWidget(0, 1, usernameTextBox); + + grid.setText(1, 0, constants.passwordLabel()); + grid.setWidget(1, 1, passwordTextBox); + grid.setWidget(2, 1, saveBox); + usernameTextBox.addKeyUpHandler(this); + usernameTextBox.setText(Cookies.getCookie("username")); + usernameTextBox.setFocus(true); + + passwordTextBox.addKeyUpHandler(this); + passwordTextBox.setText(Cookies.getCookie("password")); + vPanel.add(grid); + ButtonBar buttonBar = new ButtonBar(); + + buttonBar.add(loginButton); + buttonBar.add(resetButton); + + loginButton.setEnabled(false); + loginButton.addClickHandler(this); + resetButton.addClickHandler(this); + + vPanel.add(buttonBar); + + errorLabel.setStyleName("hupa-ErrorLabel"); + errorLabel.setVisible(false); + vPanel.add(errorLabel); + + initWidget(vPanel); + } + + + + /* + * (non-Javadoc) + * + * @see + * com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event + * .dom.client.ClickEvent) + */ + public void onClick(ClickEvent event) { + if (resetButton.equals(event.getSource())) { + reset(); + } else if (loginButton.equals(event.getSource())) { + dispatcher.execute(new LoginUser(getUsername(), getPassword()), + new AsyncCallback() { + + public void onFailure(Throwable caught) { + error(); + GWT.log("ERROR", caught); + } + + public void onSuccess(LoginUserResult result) { + success(); + GWT.log("SUCCESS", null); + + } + }); + } + } + + private void reset() { + errorLabel.setVisible(false); + loginButton.setEnabled(false); + usernameTextBox.setText(""); + passwordTextBox.setText(""); + usernameTextBox.setFocus(true); + } + + private void error() { + reset(); + errorLabel.setVisible(true); + + if (saveBox.getValue()) { + Cookies.removeCookie("username"); + Cookies.removeCookie("password"); + } + } + + private void success() { + if (saveBox.getValue()) { + Cookies.setCookie("username", getUsername()); + Cookies.setCookie("password", getPassword()); + } + } + + /* + * (non-Javadoc) + * + * @see + * com.google.gwt.event.dom.client.KeyUpHandler#onKeyUp(com.google.gwt.event + * .dom.client.KeyUpEvent) + */ + public void onKeyUp(KeyUpEvent event) { + if (usernameTextBox.getText().length() >= minUsernameLength + && passwordTextBox.getText().length() >= minPasswordLength) { + loginButton.setEnabled(true); + } else { + loginButton.setEnabled(false); + } + + if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { + if (event.getSource().equals(usernameTextBox)) { + passwordTextBox.setFocus(true); + } else if (event.getSource().equals(passwordTextBox)) { + if (loginButton.isEnabled()) { + loginButton.click(); + } + } + } + + } + + + private String getUsername() { + return usernameTextBox.getText(); + } + + private String getPassword() { + return passwordTextBox.getText(); + } + + + public void go(Panel panel) { + panel.clear(); + panel.add(this); + } +} Added: labs/hupa/src/main/java/org/apache/hupa/client/events/EventBus.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/events/EventBus.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/events/EventBus.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/client/events/EventBus.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,11 @@ +package org.apache.hupa.client.events; + +import com.google.gwt.event.shared.HandlerManager; + +public class EventBus extends HandlerManager { + + public EventBus() { + super(null); + } + +} Added: labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/client/gin/MyClientModule.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,17 @@ +package org.apache.hupa.client.gin; + +import org.apache.hupa.client.LoginWidget; +import org.apache.hupa.client.events.EventBus; + +import com.google.gwt.inject.client.AbstractGinModule; +import com.google.inject.Singleton; + +public class MyClientModule extends AbstractGinModule{ + + @Override + protected void configure() { + bind(EventBus.class).in(Singleton.class); + bind(LoginWidget.class).in(Singleton.class); + } + +} Added: labs/hupa/src/main/java/org/apache/hupa/client/gin/MyGinjector.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/gin/MyGinjector.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/gin/MyGinjector.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/client/gin/MyGinjector.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,13 @@ +package org.apache.hupa.client.gin; + +import net.customware.gwt.dispatch.client.gin.ClientDispatchModule; + +import org.apache.hupa.client.LoginWidget; + +import com.google.gwt.inject.client.GinModules; +import com.google.gwt.inject.client.Ginjector; + +@GinModules({ClientDispatchModule.class,MyClientModule.class}) +public interface MyGinjector extends Ginjector { + public LoginWidget getLoginWidget(); +} Added: labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFolders.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFolders.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFolders.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFolders.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,27 @@ +package org.apache.hupa.client.rpc; + +import org.apache.hupa.client.data.IMAPUser; + +import net.customware.gwt.dispatch.shared.Action; + +public class FetchFolders implements Action{ + + + /** + * + */ + private static final long serialVersionUID = 8515539585915762904L; + private IMAPUser user; + + public FetchFolders(IMAPUser user) { + this.user = user; + } + + @SuppressWarnings("unused") + private FetchFolders() { + + } + public IMAPUser getUser() { + return user; + } +} Added: labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFoldersResult.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFoldersResult.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFoldersResult.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/FetchFoldersResult.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,29 @@ +package org.apache.hupa.client.rpc; + +import java.util.ArrayList; + +import org.apache.hupa.client.data.IMAPFolder; + +import net.customware.gwt.dispatch.shared.Result; + +public class FetchFoldersResult implements Result{ + + /** + * + */ + private static final long serialVersionUID = -6215610133650989605L; + private ArrayList folders; + + public FetchFoldersResult(ArrayList folders) { + this.folders=folders; + } + + @SuppressWarnings("unused") + private FetchFoldersResult() { + + } + + public ArrayList getFolders() { + return folders; + } +} Added: labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUser.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,33 @@ +package org.apache.hupa.client.rpc; + + + +import net.customware.gwt.dispatch.shared.Action; + +public class LoginUser implements Action{ + /** + * + */ + private static final long serialVersionUID = -7541443368424711160L; + + + private String userName; + private String password; + + private LoginUser() {} + + public LoginUser(String userName,String password) { + this.userName = userName; + this.password = password; + } + + public String getUserName() { + return userName; + } + + public String getPassword() { + return password; + } + + +} Added: labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUserResult.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUserResult.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUserResult.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/client/rpc/LoginUserResult.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,25 @@ +package org.apache.hupa.client.rpc; + +import org.apache.hupa.client.data.IMAPUser; + +import net.customware.gwt.dispatch.shared.Result; + +public class LoginUserResult implements Result{ + + /** + * + */ + private static final long serialVersionUID = -8740775403377441876L; + private IMAPUser user; + + public LoginUserResult(IMAPUser user) { + this.user = user; + } + + @SuppressWarnings("unused") + private LoginUserResult() {} + + public IMAPUser getUser() { + return user; + } +} Modified: labs/hupa/src/main/java/org/apache/hupa/client/services/IMAPService.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/client/services/IMAPService.java?rev=791750&r1=791749&r2=791750&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/client/services/IMAPService.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/client/services/IMAPService.java Tue Jul 7 08:37:28 2009 @@ -19,7 +19,7 @@ package org.apache.hupa.client.services; -import java.util.List; +import java.util.ArrayList; import org.apache.hupa.client.data.IMAPFolder; import org.apache.hupa.client.data.IMAPMessage; @@ -35,7 +35,7 @@ public IMAPUser login(String username,String password) throws IMAPServiceException; - public List getFolders(IMAPUser user) + public ArrayList getFolders(IMAPUser user) throws IMAPServiceException; public ResultList getMessages(IMAPUser user,IMAPFolder folder, int start, int end, String searchString) throws IMAPServiceException; Added: labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPHandler.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPHandler.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPHandler.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/server/AbstractIMAPHandler.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,26 @@ +package org.apache.hupa.server; + +import java.io.IOException; + +import org.apache.hupa.client.data.IMAPUser; +import org.columba.ristretto.imap.IMAPException; +import org.columba.ristretto.imap.IMAPProtocol; + +import net.customware.gwt.dispatch.server.ActionHandler; +import net.customware.gwt.dispatch.shared.Action; +import net.customware.gwt.dispatch.shared.Result; + + +public abstract class AbstractIMAPHandler, R extends Result> implements ActionHandler{ + + protected IMAPProtocol getProtocol(IMAPUser user) throws IOException, + IMAPException { + IMAPProtocol protocol = new IMAPProtocol("myblog.kicks-ass.org", + IMAPProtocol.DEFAULT_PORT); + protocol.openPort(); + protocol.login(user.getName(), user.getPassword().toCharArray()); + + return protocol; + + } +} Added: labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/server/FetchFoldersHandler.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,128 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.hupa.server; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.hupa.client.data.IMAPFolder; +import org.apache.hupa.client.data.IMAPUser; +import org.apache.hupa.client.rpc.FetchFolders; +import org.apache.hupa.client.rpc.FetchFoldersResult; +import org.apache.hupa.client.services.IMAPServiceException; +import org.columba.ristretto.imap.IMAPException; +import org.columba.ristretto.imap.IMAPProtocol; +import org.columba.ristretto.imap.ListInfo; +import org.columba.ristretto.imap.SearchKey; +import org.columba.ristretto.message.MailboxInfo; + +import net.customware.gwt.dispatch.server.ExecutionContext; +import net.customware.gwt.dispatch.shared.ActionException; + +public class FetchFoldersHandler extends AbstractIMAPHandler{ + + public FetchFoldersResult execute(FetchFolders action, ExecutionContext arg1) + throws ActionException { + try { + return new FetchFoldersResult(getFolders(action.getUser())); + } catch (IMAPServiceException e) { + throw new ActionException(e); + } + } + + public void rollback(FetchFolders arg0, FetchFoldersResult arg1, + ExecutionContext arg2) throws ActionException { + // nothing todo + + } + + public Class getActionType() { + return FetchFolders.class; + } + + protected ArrayList getFolders(IMAPUser user) + throws IMAPServiceException { + ArrayList fList = new ArrayList(); + IMAPProtocol protocol = null; + try { + protocol = getProtocol(user); + ListInfo[] infos = protocol.list("", "*"); + + for (int i = 0; i < infos.length; i++) { + ListInfo info = infos[i]; + + String fullName = info.getName(); + String delimiter = info.getDelimiter(); + MailboxInfo mInfo= protocol.select(info.getName()); + + // we are want to show the not seen flagged message count + int unseen = protocol.search(new SearchKey[]{ new SearchKey(SearchKey.UNSEEN)}).length; + IMAPFolder iFolder = new IMAPFolder(info.getName()); + iFolder.setDelimiter(delimiter); + iFolder.setMessageCount(mInfo.getExists()); + + iFolder.setUnseenMessageCount(unseen); + + System.out.println(mInfo.toString() + " " + mInfo.getRecent()); + int index = fullName.lastIndexOf(delimiter); + if (index > -1) { + String parentFullName = fullName.substring(0, index); + handleIMAPFolderTree(fList, iFolder, parentFullName); + } else { + fList.add(iFolder); + } + } + return fList; + } catch (IOException e) { + e.printStackTrace(); + throw new IMAPServiceException("Unable to get folders for User " + + user); + } catch (IMAPException e) { + e.printStackTrace(); + throw new IMAPServiceException("Unable to get folders for User " + + user); + } finally { + if (protocol != null) { + try { + protocol.close(); + } catch (Exception e) { + // Ignore on close + } + } + } + } + + private void handleIMAPFolderTree(List fList, + IMAPFolder iFolder, String parentFullName) { + for (int a = 0; a < fList.size(); a++) { + IMAPFolder tmpFolder = fList.get(a); + if (tmpFolder.getFullName().equals(parentFullName)) { + tmpFolder.getChildIMAPFolders().add(iFolder); + } else { + List childFolders = tmpFolder.getChildIMAPFolders(); + if (childFolders != null && childFolders.isEmpty() == false) { + handleIMAPFolderTree(childFolders, iFolder, parentFullName); + } + } + } + } + +} Modified: labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java?rev=791750&r1=791749&r2=791750&view=diff ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java (original) +++ labs/hupa/src/main/java/org/apache/hupa/server/IMAPServiceImpl.java Tue Jul 7 08:37:28 2009 @@ -60,6 +60,15 @@ public class IMAPServiceImpl extends RemoteServiceServlet implements IMAPService { + private static IMAPService SERVICE; + + public static IMAPService getInstance() { + if (SERVICE == null) { + SERVICE = new IMAPServiceImpl(); + } + return SERVICE; + } + /** * */ @@ -302,9 +311,9 @@ } - public List getFolders(IMAPUser user) + public ArrayList getFolders(IMAPUser user) throws IMAPServiceException { - List fList = new ArrayList(); + ArrayList fList = new ArrayList(); IMAPProtocol protocol = null; try { protocol = getProtocol(user); Added: labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/server/LoginUserHandler.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,59 @@ +package org.apache.hupa.server; + +import java.io.IOException; +import java.util.Date; + +import net.customware.gwt.dispatch.server.ExecutionContext; +import net.customware.gwt.dispatch.shared.ActionException; + +import org.apache.hupa.client.data.IMAPUser; +import org.apache.hupa.client.rpc.LoginUser; +import org.apache.hupa.client.rpc.LoginUserResult; +import org.apache.hupa.client.services.IMAPServiceException; +import org.columba.ristretto.imap.IMAPException; +import org.columba.ristretto.imap.IMAPProtocol; + +public class LoginUserHandler extends + AbstractIMAPHandler { + + public LoginUserResult execute(LoginUser action, ExecutionContext context) + throws ActionException { + try { + return new LoginUserResult(login(action.getUserName(), action + .getPassword())); + } catch (IMAPServiceException e) { + throw new ActionException(e); + } + } + + public void rollback(LoginUser user, LoginUserResult result, + ExecutionContext context) throws ActionException { + // Nothing todo here + } + + public Class getActionType() { + return LoginUser.class; + } + + protected IMAPUser login(String username, String password) + throws IMAPServiceException { + + try { + IMAPUser user = new IMAPUser(); + user.setName(username); + user.setPassword(password); + IMAPProtocol protocol = getProtocol(user); + protocol.openPort(); + protocol.login(username, password.toCharArray()); + + user.setLoginDate(new Date()); + user.setAuthenticated(true); + return user; + + } catch (IOException e) { + throw new IMAPServiceException(e.getMessage()); + } catch (IMAPException e) { + throw new IMAPServiceException(e.getMessage()); + } + } +} Added: labs/hupa/src/main/java/org/apache/hupa/server/gin/MyActionHandlerRegistry.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/gin/MyActionHandlerRegistry.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/gin/MyActionHandlerRegistry.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/server/gin/MyActionHandlerRegistry.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,50 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.hupa.server.gin; + +import java.util.List; + +import com.google.inject.Binding; +import com.google.inject.Inject; +import com.google.inject.Injector; +import com.google.inject.TypeLiteral; + +import net.customware.gwt.dispatch.server.ActionHandler; +import net.customware.gwt.dispatch.server.DefaultActionHandlerRegistry; + +/** + * HandlerRegistry which takes care of automaticly binding all configured handlers + * + * @author Norman Maurer + * + */ +public class MyActionHandlerRegistry extends DefaultActionHandlerRegistry{ + + @Inject + public MyActionHandlerRegistry(Injector injector) { + super(); + + List> bindings = injector.findBindingsByType( TypeLiteral.get( ActionHandler.class ) ); + for (int i = 0; i < bindings.size();i++) { + addHandler(bindings.get(i).getProvider().get()); + } + + } +} Added: labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/server/gin/ServerModul.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,46 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.hupa.server.gin; + +import net.customware.gwt.dispatch.server.ActionHandlerRegistry; +import net.customware.gwt.dispatch.server.guice.ServerDispatchModule; + +import org.apache.hupa.server.FetchFoldersHandler; +import org.apache.hupa.server.LoginUserHandler; + +/** + * Module which binds the handlers + * + * @author norman + * + */ +public class ServerModul extends ServerDispatchModule{ + + @Override + protected void configureHandlers() { + bindHandler(LoginUserHandler.class); + bindHandler(FetchFoldersHandler.class); + } + + @Override + protected Class getActionHandlerRegistryClass() { + return MyActionHandlerRegistry.class; + } +} Added: labs/hupa/src/main/java/org/apache/hupa/server/guice/DispatchServletModule.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/guice/DispatchServletModule.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/guice/DispatchServletModule.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/server/guice/DispatchServletModule.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,36 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.hupa.server.guice; + + +import net.customware.gwt.dispatch.server.service.DispatchServiceServlet; + +import com.google.inject.servlet.ServletModule; + + +public class DispatchServletModule extends ServletModule{ + @Override + public void configureServlets() { + serve( "/hupa/dispatch" ).with(DispatchServiceServlet.class ); + + } + + +} Added: labs/hupa/src/main/java/org/apache/hupa/server/guice/MyGuiceServletConfig.java URL: http://svn.apache.org/viewvc/labs/hupa/src/main/java/org/apache/hupa/server/guice/MyGuiceServletConfig.java?rev=791750&view=auto ============================================================================== --- labs/hupa/src/main/java/org/apache/hupa/server/guice/MyGuiceServletConfig.java (added) +++ labs/hupa/src/main/java/org/apache/hupa/server/guice/MyGuiceServletConfig.java Tue Jul 7 08:37:28 2009 @@ -0,0 +1,41 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.hupa.server.guice; + +import org.apache.hupa.server.gin.ServerModul; + +import com.google.inject.Guice; +import com.google.inject.Injector; +import com.google.inject.servlet.GuiceServletContextListener; + +/** + * Simple GuiceServletContextListener which just create the injector + * + * @author norman + * + */ +public class MyGuiceServletConfig extends GuiceServletContextListener{ + + @Override + protected Injector getInjector() { + return Guice.createInjector(new ServerModul(),new DispatchServletModule()); + } + +} Modified: labs/hupa/war/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/labs/hupa/war/WEB-INF/web.xml?rev=791750&r1=791749&r2=791750&view=diff ============================================================================== --- labs/hupa/war/WEB-INF/web.xml (original) +++ labs/hupa/war/WEB-INF/web.xml Tue Jul 7 08:37:28 2009 @@ -11,15 +11,28 @@ + + + guiceFilter + com.google.inject.servlet.GuiceFilter + + + guiceFilter + /* + + + + org.apache.hupa.server.guice.MyGuiceServletConfig + --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org For additional commands, e-mail: commits-help@labs.apache.org