jour-cvs Mailing List for Jour
Brought to you by:
mishalifschitz,
vlads
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(101) |
Dec
(496) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(52) |
Feb
(76) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vlad S. <vl...@us...> - 2005-02-23 05:59:54
|
Update of /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11458/basewebapp/src/java/net/baseapp/web/components Added Files: Body.java DirectLink.java Form.java JavaScriptLinkRenderer.java Log Message: Post and get using XMLHttpRequest --- NEW FILE: Form.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web.components; import org.apache.log4j.Logger; import org.apache.tapestry.IMarkupWriter; import org.apache.tapestry.engine.ILink; /** * TODO Add docs * * Created on 22.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/23 05:59:44 $ */ public abstract class Form extends org.apache.tapestry.form.Form { private static final Logger log = Logger.getLogger(Form.class); protected void writeAttributes(IMarkupWriter writer, ILink link) { super.writeAttributes(writer, link); log.debug("Form writeAttributes"); writer.attribute("onsubmit", "return jsPostSubmit(\'" + getName() + "\');"); } } --- NEW FILE: Body.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web.components; import org.apache.log4j.Logger; import org.apache.tapestry.IMarkupWriter; import org.apache.tapestry.IRequestCycle; /** * TODO Add docs * * Created on 22.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/23 05:59:44 $ */ public abstract class Body extends org.apache.tapestry.html.Body { private static final Logger log = Logger.getLogger(Body.class); private static final boolean debug = false; private static final boolean disableJavaScript = true; protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) { log.debug("Body renderComponent"); super.renderComponent(writer, cycle); } public void addInitializationScript(String script) { if (!disableJavaScript) { super.addInitializationScript(script); } else if (debug) { log.debug("Body addInitializationScript disabled:" + script); } } public void addBodyScript(String script) { if (!disableJavaScript) { super.addBodyScript(script); } else if (debug) { log.debug("Body addBodyScript disabled:" + script); } } public String getPreloadedImageReference(String URL) { if (!disableJavaScript) { return super.getPreloadedImageReference(URL); } else if (debug) { log.debug("Body getPreloadedImageReference disabled:" + URL); } return ""; } } --- NEW FILE: DirectLink.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web.components; import org.apache.log4j.Logger; import org.apache.tapestry.link.ILinkRenderer; /** * TODO Add docs * * Created on 23.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/23 05:59:44 $ */ public abstract class DirectLink extends org.apache.tapestry.link.DirectLink { public DirectLink() { setRenderer(JavaScriptLinkRenderer.SHARED_INSTANCE); } public ILinkRenderer getRenderer() { return JavaScriptLinkRenderer.SHARED_INSTANCE; } public void setRenderer(ILinkRenderer ilinkrenderer) { } } --- NEW FILE: JavaScriptLinkRenderer.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web.components; import org.apache.log4j.Logger; import org.apache.tapestry.IMarkupWriter; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.components.ILinkComponent; import org.apache.tapestry.link.DefaultLinkRenderer; import org.apache.tapestry.link.ILinkRenderer; /** * TODO Add docs * * Created on 22.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/23 05:59:44 $ */ public class JavaScriptLinkRenderer extends DefaultLinkRenderer { /** * A singleton for the link. **/ public static final ILinkRenderer SHARED_INSTANCE = new JavaScriptLinkRenderer(); protected void afterBodyRender(IMarkupWriter writer, IRequestCycle irequestcycle, ILinkComponent ilinkcomponent) { writer.attribute("onclick", "return jsPostLink(this);"); } } |
From: Vlad S. <vl...@us...> - 2005-02-23 05:59:53
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp/WEB-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11458/basewebapp/src/webapp/WEB-INF Modified Files: Border.html UserAccountList.page baseapp.application Added Files: Body.jwc DirectLink.jwc Form.jwc Log Message: Post and get using XMLHttpRequest Index: UserAccountList.page =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/WEB-INF/UserAccountList.page,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UserAccountList.page 20 Feb 2005 03:14:04 -0000 1.1 --- UserAccountList.page 23 Feb 2005 05:59:44 -0000 1.2 *************** *** 23,26 **** --- 23,27 ---- <binding name="listener" expression="listeners.selectIDListener"/> <binding name="parameters" expression="components.table.tableRow.id"/> + <binding name="renderer" expression="@net.baseapp.web.components.JavaScriptLinkRenderer@SHARED_INSTANCE"/> </component> --- NEW FILE: Body.jwc --- <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- $Id: Body.jwc,v 1.1 2005/02/23 05:59:44 vlads Exp $ --> <!DOCTYPE component-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <component-specification class="net.baseapp.web.components.Body"> <description> Takes the place of the normal HTML <body> element, providing various forms of support to all components it wraps. </description> <parameter name="element" type="java.lang.String" direction="in"> <description> Name of element to use, defaults to "body". </description> </parameter> <reserved-parameter name="onload"/> </component-specification> Index: baseapp.application =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/WEB-INF/baseapp.application,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** baseapp.application 15 Feb 2005 21:49:48 -0000 1.1 --- baseapp.application 23 Feb 2005 05:59:44 -0000 1.2 *************** *** 14,17 **** --- 14,21 ---- <page name="Home" specification-path="Home.page"/> + <component-type type="Body" specification-path="Body.jwc"/> + <component-type type="Form" specification-path="Form.jwc"/> + <component-type type="DirectLink" specification-path="DirectLink.jwc"/> + <library id="contrib" specification-path="/org/apache/tapestry/contrib/Contrib.library"/> --- NEW FILE: Form.jwc --- <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- $Id: Form.jwc,v 1.1 2005/02/23 05:59:44 vlads Exp $ --> <!DOCTYPE component-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <component-specification class="net.baseapp.web.components.Form"> <description> Used to implement an HTML form. </description> <parameter name="method" type="java.lang.String" direction="in"> <description> The method used by the form when it is submitted, defaults to POST. </description> </parameter> <parameter name="listener" type="org.apache.tapestry.IActionListener" required="no" direction="in"> <description> Object invoked when the form is submitted, after all form components have responded to the submission. </description> </parameter> <parameter name="stateful" type="boolean" direction="custom"> <description> If true (the default), then an active HttpSession is required. </description> </parameter> <parameter name="direct" type="boolean" direction="in"> <description> If true (the default), then the more efficient direct service is used. If false, then the action service is used. </description> </parameter> <parameter name="delegate" type="org.apache.tapestry.valid.IValidationDelegate" direction="in"> <description> Specifies the delegate to be used by fields to track input errors. </description> </parameter> <reserved-parameter name="action"/> </component-specification> Index: Border.html =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/WEB-INF/Border.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Border.html 20 Feb 2005 03:14:04 -0000 1.3 --- Border.html 23 Feb 2005 05:59:44 -0000 1.4 *************** *** 3,6 **** --- 3,7 ---- <body jwcid="@Body" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> + <div id="body"> <span jwcid="@Conditional" condition="ognl:!loggedIn"> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> *************** *** 10,22 **** <span jwcid="@Conditional" condition="ognl:loggedIn"> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> ! <a href="#" jwcid="@PageLink" page="Home" stateful="ognl:false" class="rollover1"><span>Home</span></a> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> <span jwcid="@Conditional" condition="ognl:admin"> ! <a href="#" jwcid="@PageLink" page="UserAccountList" stateful="ognl:false" class="rollover1"><span>Admin</span></a> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> </span> ! <a href="#" jwcid="@PageLink" page="Logout" stateful="ognl:false" class="rollover1"><span>Logout</span></a> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> </span> --- 11,23 ---- <span jwcid="@Conditional" condition="ognl:loggedIn"> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> ! <a href="#" jwcid="@PageLink" page="Home" stateful="ognl:false" class="rollover1" renderer="ognl:@net.baseapp.web.components.JavaScriptLinkRenderer@SHARED_INSTANCE"><span>Home</span></a> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> <span jwcid="@Conditional" condition="ognl:admin"> ! <a href="#" jwcid="@PageLink" page="UserAccountList" stateful="ognl:false" class="rollover1" renderer="ognl:@net.baseapp.web.components.JavaScriptLinkRenderer@SHARED_INSTANCE"><span>Admin</span></a> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> </span> ! <a href="#" jwcid="@PageLink" page="Logout" stateful="ognl:false" class="rollover1" renderer="ognl:@net.baseapp.web.components.JavaScriptLinkRenderer@SHARED_INSTANCE"><span>Logout</span></a> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> </span> *************** *** 30,39 **** <span> ! <a jwcid="reset"><img jwcid="resetButton"/></a> <!-- span jwcid="@ServiceLink" service="ognl:@org.apache.tapestry.Tapestry@RESET_SERVICE">Reset</span --> <!-- span jwcid="@ServiceLink" service="ognl:@org.apache.tapestry.Tapestry@RESTART_SERVICE">Restart</span --> <a href="http://jakarta.apache.org/tapestry/">Powered by Tapestry</a> </span> ! </body> </html> --- 31,40 ---- <span> ! <!--a jwcid="reset"><img jwcid="resetButton"/></a--> <!-- span jwcid="@ServiceLink" service="ognl:@org.apache.tapestry.Tapestry@RESET_SERVICE">Reset</span --> <!-- span jwcid="@ServiceLink" service="ognl:@org.apache.tapestry.Tapestry@RESTART_SERVICE">Restart</span --> <a href="http://jakarta.apache.org/tapestry/">Powered by Tapestry</a> </span> ! </div> </body> </html> --- NEW FILE: DirectLink.jwc --- <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- $Id: DirectLink.jwc,v 1.1 2005/02/23 05:59:44 vlads Exp $ --> <!DOCTYPE component-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <component-specification class="net.baseapp.web.components.DirectLink"> <description> Creates a non-contextual link. Non-persistent state can be stored within the link using the context. </description> <parameter name="listener" type="org.apache.tapestry.IActionListener" required="yes" direction="auto"/> <parameter name="parameters" type="java.lang.Object" direction="in"> <description> An object, or list of objects, encoded into the URL as service parameters. </description> </parameter> <parameter name="stateful" type="boolean" direction="custom"/> <parameter name="disabled" type="boolean" direction="in"/> <parameter name="anchor" type="java.lang.String" direction="in"/> <!-- parameter name="renderer" type="org.apache.tapestry.link.ILinkRenderer" direction="in"/--> <reserved-parameter name="href"/> </component-specification> |
From: Vlad S. <vl...@us...> - 2005-02-23 05:59:52
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11458/basewebapp/src/webapp Modified Files: Login.html Logout.html UserAccountList.html index.html Log Message: Post and get using XMLHttpRequest Index: index.html =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/index.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** index.html 15 Feb 2005 21:49:47 -0000 1.1 --- index.html 23 Feb 2005 05:59:43 -0000 1.2 *************** *** 1,9 **** <HTML> ! <meta http-equiv="Refresh" content="0; URL=app" /> <HEADER> ! <TITLE>Jour</TITLE> </HEADER> <BODY> ! <P><A HREF="app">If you are not automatically redirected click here</A></P> </BODY> </HTML> \ No newline at end of file --- 1,9 ---- <HTML> ! <meta http-equiv="Refresh" content="0; URL=mainFrame.htm" /> <HEADER> ! <TITLE>Demo</TITLE> </HEADER> <BODY> ! <P><A HREF="mainFrame.htm">If you are not automatically redirected click here</A></P> </BODY> </HTML> \ No newline at end of file Index: Logout.html =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/Logout.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Logout.html 19 Feb 2005 23:09:27 -0000 1.1 --- Logout.html 23 Feb 2005 05:59:43 -0000 1.2 *************** *** 7,11 **** <p><span>You are logged out.</span></p> ! <p class="txt"><span>You may</span> <a href="#" jwcid="@PageLink" page="Login" stateful="ognl:false" class="link1"> <span>Login in again</span></a></p> </td> --- 7,11 ---- <p><span>You are logged out.</span></p> ! <p class="txt"><span>You may</span> <a href="#" jwcid="@PageLink" renderer="ognl:@net.baseapp.web.components.JavaScriptLinkRenderer@SHARED_INSTANCE" page="Login" stateful="ognl:false" class="link1"> <span>Login in again</span></a></p> </td> Index: Login.html =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/Login.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Login.html 19 Feb 2005 23:09:27 -0000 1.2 --- Login.html 23 Feb 2005 05:59:43 -0000 1.3 *************** *** 1,4 **** --- 1,5 ---- <!-- $Revision$ ($Author$) $Date$ --> <html jwcid="$content$"> + <body jwcid="@Border"> <!-- span jwcid="@ShowError"/><span jwcid="@ShowValidationError" delegate="ognl:beans.delegate"/ --> *************** *** 33,35 **** --- 34,37 ---- </body> + </html> Index: UserAccountList.html =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/UserAccountList.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UserAccountList.html 20 Feb 2005 03:14:05 -0000 1.1 --- UserAccountList.html 23 Feb 2005 05:59:43 -0000 1.2 *************** *** 4,8 **** <span> ! <a href="#" jwcid="@PageLink" page="UserAccountEdit" stateful="ognl:false" class="rollover1"><span>Create New UserAccount</span></a> </span> --- 4,8 ---- <span> ! <a href="#" jwcid="@PageLink" page="UserAccountEdit" renderer="ognl:@net.baseapp.web.components.JavaScriptLinkRenderer@SHARED_INSTANCE" stateful="ognl:false" class="rollover1"><span>Create New UserAccount</span></a> </span> |
From: Vlad S. <vl...@us...> - 2005-02-23 05:57:46
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp/js In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11023/js Log Message: Directory /cvsroot/jour/templates/basewebapp/src/webapp/js added to the repository |
From: Vlad S. <vl...@us...> - 2005-02-20 05:15:13
|
Update of /cvsroot/jour/templates/basewebapp/src/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2863/basewebapp/src/db Modified Files: init_MySQL.sql Log Message: root/root initialization if users table is empty. Index: init_MySQL.sql =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/db/init_MySQL.sql,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** init_MySQL.sql 20 Feb 2005 03:14:02 -0000 1.6 --- init_MySQL.sql 20 Feb 2005 05:15:05 -0000 1.7 *************** *** 1,4 **** --- 1,5 ---- DELETE FROM mysql.user WHERE user='baseapp'; FLUSH PRIVILEGES; + -- MySQL 5 --CREATE USER 'baseapp' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'baseapp'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; *************** *** 7,11 **** -- then run maven db-schema ! -- then create user USE baseapp; insert baseapp.baseapp_user_accounts set id=1, admin=1, name='root', password='root'; --- 8,12 ---- -- then run maven db-schema ! -- then create user, OPTIONAL: PersistenceService will create root/root for you if the table is empty. USE baseapp; insert baseapp.baseapp_user_accounts set id=1, admin=1, name='root', password='root'; |
From: Vlad S. <vl...@us...> - 2005-02-20 05:13:15
|
Update of /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/service In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2372/basewebapp/src/java/net/baseapp/web/service Modified Files: PersistenceService.java Log Message: root/root initialization if users table is empty. Index: PersistenceService.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/service/PersistenceService.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PersistenceService.java 20 Feb 2005 03:14:03 -0000 1.3 --- PersistenceService.java 20 Feb 2005 05:13:05 -0000 1.4 *************** *** 22,25 **** --- 22,27 ---- import java.sql.SQLException; + import java.util.Collection; + import java.util.Date; import java.util.HashMap; import java.util.Iterator; *************** *** 27,31 **** import java.util.Map; import java.util.Vector; - import java.util.Date; import net.baseapp.web.Global; --- 29,32 ---- *************** *** 35,38 **** --- 36,40 ---- import net.sf.hibernate.HibernateException; import net.sf.hibernate.Session; + import net.sf.hibernate.expression.Criterion; import net.sf.hibernate.expression.Expression; *************** *** 56,59 **** --- 58,63 ---- Global global; + + private static boolean initialized = false; /** *************** *** 64,71 **** --- 68,120 ---- } + /** + * Create initial user: root/root + * + */ + private synchronized void initialize() { + if (initialized) { + return; + } + Session session = this.global.openHibernateSession(); + if (session == null) { + return; + } + Criteria criteria = session.createCriteria(UserAccount.class); + criteria.setMaxResults(1); + try { + List list = criteria.list(); + if (list.isEmpty()) { + log.debug("Create root user"); + UserAccount root = new UserAccount(); + root.setName("root"); + root.setPassword("root"); + root.setAdmin(true); + session.save(root); + session.flush(); + session.connection().commit(); + } else { + log.debug("DB Already has at least one user"); + } + } catch (HibernateException e) { + log.error("Error", e); + return; + } catch (SQLException e) { + log.error("SQL Error", e); + return; + } finally { + try { + session.close(); + } catch (HibernateException e1) { + log.error("Error", e1); + } + } + initialized = true; + } + public UserAccount validateUser(String username, String password) { Session session = this.global.openHibernateSession(); UserAccount result = null; if (session != null) { + initialize(); Criteria criteria = session.createCriteria(UserAccount.class); criteria.add(Expression.eq("name", username)); *************** *** 78,82 **** log.debug("Got valid user"); result.setLastAccess(new Date()); ! session.save(result); session.flush(); session.connection().commit(); --- 127,131 ---- log.debug("Got valid user"); result.setLastAccess(new Date()); ! session.update(result); session.flush(); session.connection().commit(); *************** *** 97,100 **** --- 146,155 ---- } + /** + * Entity identified by Primary key. + * @param entityClass + * @param id + * @return + */ public AbstractEntity loadEntity(Class entityClass, Long id) { Map params = new HashMap(); *************** *** 115,118 **** --- 170,181 ---- } + /** + * General search list. + * Support in if value is collection. + * You can pass instance of net.sf.hibernate.expression.Criterion as value in the map. + * @param entityClass + * @param params + * @return + */ public List queryEntity(Class entityClass, Map params) { List result = new Vector(); *************** *** 124,128 **** String key = (String) i.next(); Object value = params.get(key); ! criteria.add(Expression.eq(key, value)); } } --- 187,199 ---- String key = (String) i.next(); Object value = params.get(key); ! Criterion oper; ! if (value instanceof Collection) { ! oper = Expression.in(key, (Collection)value); ! } else if (value instanceof Criterion) { ! oper = (Criterion)value; ! } else { ! oper = Expression.eq(key, value); ! } ! criteria.add(oper); } } *************** *** 146,149 **** --- 217,226 ---- } + /** + * Common method to create Entity from the html form attributes. + * @param entityClass + * @param attributes + * @return + */ public AbstractEntity newEntity(Class entityClass, Map attributes) { AbstractEntity entity = null; *************** *** 177,180 **** --- 254,262 ---- } + /** + * Common method to update Entity from the html form attributes. + * @param entity + * @param attributes + */ public void updateEntity(AbstractEntity entity, Map attributes) { entity.updateEntityAttributes(attributes); |
From: Vlad S. <vl...@us...> - 2005-02-20 05:13:15
|
Update of /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2372/basewebapp/src/java/net/baseapp/web Modified Files: Global.java Log Message: root/root initialization if users table is empty. Index: Global.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/Global.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Global.java 19 Feb 2005 23:09:25 -0000 1.2 --- Global.java 20 Feb 2005 05:13:04 -0000 1.3 *************** *** 21,32 **** package net.baseapp.web; ! import org.apache.log4j.Logger; ! import net.baseapp.web.service.*; import net.sf.hibernate.HibernateException; import net.sf.hibernate.Session; import net.sf.hibernate.SessionFactory; import net.sf.hibernate.cfg.Configuration; ! import java.net.URL; /** --- 21,33 ---- package net.baseapp.web; ! import java.net.URL; ! import net.baseapp.web.service.PersistenceService; import net.sf.hibernate.HibernateException; import net.sf.hibernate.Session; import net.sf.hibernate.SessionFactory; import net.sf.hibernate.cfg.Configuration; ! ! import org.apache.log4j.Logger; /** *************** *** 51,55 **** private SessionFactory sessionFactory = null; ! public PersistenceService getPersistenceService() { if (persistenceService == null) { persistenceService = new PersistenceService(); --- 52,56 ---- private SessionFactory sessionFactory = null; ! public synchronized PersistenceService getPersistenceService() { if (persistenceService == null) { persistenceService = new PersistenceService(); *************** *** 59,63 **** } ! boolean getHibernateSessionFactory() { if (sessionFactory != null) { return true; --- 60,64 ---- } ! private synchronized boolean getHibernateSessionFactory() { if (sessionFactory != null) { return true; |
From: Vlad S. <vl...@us...> - 2005-02-20 03:25:28
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14991/basewebapp/src/webapp/images Added Files: .cvsignore Log Message: ignore Thumbs.db --- NEW FILE: .cvsignore --- Thumbs.db |
From: Vlad S. <vl...@us...> - 2005-02-20 03:14:43
|
Update of /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/domain In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/basewebapp/src/java/net/baseapp/web/domain Modified Files: AbstractEntity.java UserAccount.java Log Message: Ability to add, edit and list new users. Model to be used in other domains Base on AbstractEntity and AbstractEntityListPage Index: UserAccount.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/domain/UserAccount.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UserAccount.java 19 Feb 2005 23:09:25 -0000 1.3 --- UserAccount.java 20 Feb 2005 03:14:02 -0000 1.4 *************** *** 22,26 **** import java.io.Serializable; ! /** * Jour web users persistance. --- 22,26 ---- import java.io.Serializable; ! import java.util.Date; /** * Jour web users persistance. *************** *** 51,55 **** private boolean admin; ! private long lastAccess; /** --- 51,55 ---- private boolean admin; ! private Date lastAccess; /** *************** *** 84,94 **** * @hibernate.property */ ! public long getLastAccess() { ! return lastAccess; } /** * @param lastAccess The lastAccess to set. */ ! public void setLastAccess(long lastAccess) { this.lastAccess = lastAccess; } --- 84,94 ---- * @hibernate.property */ ! public Date getLastAccess() { ! return this.lastAccess; } /** * @param lastAccess The lastAccess to set. */ ! public void setLastAccess(Date lastAccess) { this.lastAccess = lastAccess; } Index: AbstractEntity.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/domain/AbstractEntity.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractEntity.java 19 Feb 2005 23:09:25 -0000 1.1 --- AbstractEntity.java 20 Feb 2005 03:14:02 -0000 1.2 *************** *** 51,54 **** --- 51,58 ---- private transient List _attributePropertyNames; + public String getEntityPK() { + return "id"; + } + /** * TODO Use ognl. *************** *** 104,107 **** --- 108,120 ---- } + public Object getEntityAttribute(String key) { + try { + return Ognl.getValue(key, this); + } catch (OgnlException e) { + log.error("Ognl error", e); + return null; + } + } + /** * Updates the Entity with property changes from the update {@link Map}. *************** *** 122,125 **** --- 135,139 ---- if (update.containsKey(key)) { Object value = update.get(key); + log.debug("set " + key + " = " + value); try { Ognl.setValue(key, this, value); |
From: Vlad S. <vl...@us...> - 2005-02-20 03:14:42
|
Update of /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/service In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/basewebapp/src/java/net/baseapp/web/service Modified Files: PersistenceService.java Log Message: Ability to add, edit and list new users. Model to be used in other domains Base on AbstractEntity and AbstractEntityListPage Index: PersistenceService.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/service/PersistenceService.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PersistenceService.java 19 Feb 2005 23:09:26 -0000 1.2 --- PersistenceService.java 20 Feb 2005 03:14:03 -0000 1.3 *************** *** 21,33 **** package net.baseapp.web.service; - import net.baseapp.web.Global; - import net.baseapp.web.domain.*; - - import net.sf.hibernate.*; - import net.sf.hibernate.expression.*; - import java.sql.SQLException; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; --- 21,39 ---- package net.baseapp.web.service; import java.sql.SQLException; + import java.util.HashMap; + import java.util.Iterator; import java.util.List; import java.util.Map; + import java.util.Vector; + import java.util.Date; + + import net.baseapp.web.Global; + import net.baseapp.web.domain.AbstractEntity; + import net.baseapp.web.domain.UserAccount; + import net.sf.hibernate.Criteria; + import net.sf.hibernate.HibernateException; + import net.sf.hibernate.Session; + import net.sf.hibernate.expression.Expression; import org.apache.log4j.Logger; *************** *** 71,89 **** result = (UserAccount) list.iterator().next(); log.debug("Got valid user"); } } catch (HibernateException e) { log.error("Error", e); } try { ! session.close(); ! } catch (HibernateException e1) { ! log.error("Error", e1); } - } return result; } ! public Object newEntity(Class entityClass, Map attributes) { AbstractEntity entity = null; try { --- 77,150 ---- result = (UserAccount) list.iterator().next(); log.debug("Got valid user"); + result.setLastAccess(new Date()); + session.save(result); + session.flush(); + session.connection().commit(); } } catch (HibernateException e) { log.error("Error", e); + } catch (SQLException e) { + log.error("SQL Error", e); + } finally { + try { + session.close(); + } catch (HibernateException e1) { + log.error("Error", e1); + } + } + } + return result; + } + + public AbstractEntity loadEntity(Class entityClass, Long id) { + Map params = new HashMap(); + AbstractEntity entity = null; + try { + entity = (AbstractEntity) entityClass.newInstance(); + params.put(entity.getEntityPK(), id); + } catch (Exception e) { + log.error("Error", e); + return null; + } + List list = queryEntity(entityClass, params); + if (!list.isEmpty()) { + return (AbstractEntity)list.iterator().next(); + } else { + return null; + } + } + + public List queryEntity(Class entityClass, Map params) { + List result = new Vector(); + Session session = this.global.openHibernateSession(); + if (session != null) { + Criteria criteria = session.createCriteria(entityClass); + if (params != null) { + for (Iterator i = params.keySet().iterator(); i.hasNext();) { + String key = (String) i.next(); + Object value = params.get(key); + criteria.add(Expression.eq(key, value)); + } } try { ! List list = criteria.list(); ! if (!list.isEmpty()) { ! result = list; ! log.debug("Got dataset"); ! } ! } catch (HibernateException e) { ! log.error("Error", e); ! } finally { ! try { ! session.close(); ! } catch (HibernateException e1) { ! log.error("Error", e1); ! } } } return result; } ! public AbstractEntity newEntity(Class entityClass, Map attributes) { AbstractEntity entity = null; try { *************** *** 100,111 **** session.flush(); session.connection().commit(); ! log.debug("new Entity created:" + entity.getClass().getName()); } catch (HibernateException e) { log.error("Error", e); } catch (SQLException e) { log.error("SQL Error", e); } } - return entity; } } --- 161,201 ---- session.flush(); session.connection().commit(); ! log.debug("Entity created:" + entity.getClass().getName()); ! } catch (HibernateException e) { ! log.error("Error", e); ! } catch (SQLException e) { ! log.error("SQL Error", e); ! } finally { ! try { ! session.close(); ! } catch (HibernateException e1) { ! log.error("Error", e1); ! } ! } ! } ! return entity; ! } ! ! public void updateEntity(AbstractEntity entity, Map attributes) { ! entity.updateEntityAttributes(attributes); ! Session session = this.global.openHibernateSession(); ! if (session != null) { ! try { ! session.update(entity); ! session.flush(); ! session.connection().commit(); ! log.debug("Entity updated:" + entity.getClass().getName()); } catch (HibernateException e) { log.error("Error", e); } catch (SQLException e) { log.error("SQL Error", e); + } finally { + try { + session.close(); + } catch (HibernateException e1) { + log.error("Error", e1); + } } } } } |
Update of /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/basewebapp/src/java/net/baseapp/web Modified Files: ProtectedPage.java Added Files: AbstractEntityEditPage.java AbstractEntityListPage.java IActivate.java IMessageProperty.java Log Message: Ability to add, edit and list new users. Model to be used in other domains Base on AbstractEntity and AbstractEntityListPage Index: ProtectedPage.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/ProtectedPage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ProtectedPage.java 19 Feb 2005 23:09:25 -0000 1.2 --- ProtectedPage.java 20 Feb 2005 03:14:02 -0000 1.3 *************** *** 22,25 **** --- 22,26 ---- import net.baseapp.web.pages.Login; + import net.baseapp.web.service.PersistenceService; import org.apache.log4j.Logger; *************** *** 55,58 **** --- 56,63 ---- } + public PersistenceService getPersistenceService() { + return ((Global) getGlobal()).getPersistenceService(); + } + /** * Checks if the user is logged in. If not, they are sent --- NEW FILE: AbstractEntityEditPage.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web; import java.util.HashMap; import java.util.Map; import net.baseapp.web.domain.AbstractEntity; import org.apache.log4j.Logger; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.event.PageEvent; import org.apache.tapestry.event.PageRenderListener; /** * TODO Add docs * * Created on 19.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/20 03:14:02 $ */ public abstract class AbstractEntityEditPage extends ProtectedPage implements PageRenderListener { private static final Logger log = Logger.getLogger(AbstractEntityEditPage.class); public abstract Map getAttributes(); public abstract void setAttributes(Map attributes); public abstract Long getEntityId(); public abstract void setEntityId(Long id); /** * To be implemented in child */ public abstract Class getAbstractEntityClass(); public abstract void onAfterUpdate(IRequestCycle cycle, AbstractEntity entity); public abstract void onAfterCreate(IRequestCycle cycle, AbstractEntity entity); public void pageBeginRender(PageEvent event) { if (getAttributes() == null) { Map attributes = new HashMap(); setAttributes(attributes); } } /** * Invoked (from EntityList) to begin editting a book. * Gets the attributes from the db * and updates the request cycle to render this page, * **/ public void beginEdit(IRequestCycle cycle, Long id) { log.debug("AbstractEntityEditPage.beginEdit " + id); AbstractEntity entity = getPersistenceService().loadEntity(getAbstractEntityClass(), id); if (entity != null) { setEntityId(id); setAttributes(entity.getEntityAttributes()); } cycle.activate(this); } public void formSubmit(IRequestCycle cycle) { log.debug("AbstractEntityEditPage.formSubmit"); if (getEntityId() == null) { newEntity(cycle); } else { updatedEntity(cycle); } } public void updatedEntity(IRequestCycle cycle) { Map attributes = getAttributes(); AbstractEntity entity = getPersistenceService().loadEntity(getAbstractEntityClass(), getEntityId()); getPersistenceService().updateEntity(entity, attributes); onAfterUpdate(cycle, entity); } public void newEntity(IRequestCycle cycle) { Map attributes = getAttributes(); AbstractEntity entity = getPersistenceService().newEntity(getAbstractEntityClass(), attributes); onAfterCreate(cycle, entity); } } --- NEW FILE: IMessageProperty.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web; import org.apache.tapestry.IPage; /** * String message property, for many pages that can display an informational message. * * Created on 19.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/20 03:14:02 $ */ public interface IMessageProperty extends IPage { public String getMessage(); public void setMessage(String message); } --- NEW FILE: IActivate.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web; import org.apache.tapestry.IPage; import org.apache.tapestry.IRequestCycle; /** * Interface used for pages that may be activated by the Border component. * * Created on 19.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/20 03:14:02 $ */ public interface IActivate extends IPage { public void activate(IRequestCycle cycle); } --- NEW FILE: AbstractEntityListPage.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web; import java.util.List; import org.apache.log4j.Logger; import org.apache.tapestry.IRequestCycle; import org.apache.tapestry.event.PageEvent; import org.apache.tapestry.event.PageRenderListener; /** * TODO Add docs * * Created on 19.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/20 03:14:02 $ */ public abstract class AbstractEntityListPage extends ProtectedPage implements PageRenderListener, IMessageProperty, IActivate { private static final Logger log = Logger.getLogger(AbstractEntityListPage.class); public abstract List getDataItems(); public abstract void setDataItems(List dataItems); /** * To be implemented in child */ public abstract Class getAbstractEntityClass(); public abstract String getAbstractEntityEditPage(); public void pageBeginRender(PageEvent event) { log.debug("AbstractEntityListPage.pageBeginRender"); setDataItems(getPersistenceService().queryEntity(getAbstractEntityClass(), null)); } public void selectIDListener(IRequestCycle cycle) { Object[] parameters = cycle.getServiceParameters(); log.debug("id selected " + parameters[0]); Long id = (Long) parameters[0]; AbstractEntityEditPage page = (AbstractEntityEditPage) cycle.getPage(getAbstractEntityEditPage()); page.beginEdit(cycle, id); } } |
From: Vlad S. <vl...@us...> - 2005-02-20 03:14:41
|
Update of /cvsroot/jour/templates/basewebapp/src/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/basewebapp/src/db Modified Files: init_MySQL.sql Log Message: Ability to add, edit and list new users. Model to be used in other domains Base on AbstractEntity and AbstractEntityListPage Index: init_MySQL.sql =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/db/init_MySQL.sql,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** init_MySQL.sql 19 Feb 2005 03:25:41 -0000 1.5 --- init_MySQL.sql 20 Feb 2005 03:14:02 -0000 1.6 *************** *** 9,13 **** -- then create user USE baseapp; ! insert baseapp.baseapp_user_accounts set id=1, admin=1, lastAccess=0, name='root', password='root'; ! insert baseapp.baseapp_user_accounts set id=2, admin=0, lastAccess=0, name='user', password='user'; commit; \ No newline at end of file --- 9,13 ---- -- then create user USE baseapp; ! insert baseapp.baseapp_user_accounts set id=1, admin=1, name='root', password='root'; ! insert baseapp.baseapp_user_accounts set id=2, admin=0, name='user', password='user'; commit; \ No newline at end of file |
From: Vlad S. <vl...@us...> - 2005-02-20 03:14:14
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/basewebapp/src/webapp Added Files: UserAccountEdit.html UserAccountList.html Removed Files: NewUserAccount.html Log Message: Ability to add, edit and list new users. Model to be used in other domains Base on AbstractEntity and AbstractEntityListPage --- NEW FILE: UserAccountEdit.html --- <!-- $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/20 03:14:05 $ --> <html jwcid="$content$"> <body jwcid="@Border"> <br/> <br/> <span jwcid="@Conditional" condition="ognl:entityId"> Update account </span> <span jwcid="@Conditional" condition="ognl:!entityId"> Create New account </span> <form jwcid="@Form" listener="ognl:listeners.formSubmit" delegate="ognl:validationDelegate" stateful="ognl:false"> <span jwcid="@Hidden" value="ognl:entityId"/> <span jwcid="@ShowError"/> <span jwcid="@ShowValidationError" delegate="ognl:validationDelegate"/> <table class="form"> <tr> <th><span jwcid="@FieldLabel" field="ognl:components.inputUsername">User name</span> </th> <td><input jwcid="inputUsername" type="text" size="30" maxlength="60"/> </td> </tr> <tr> <th><span jwcid="@FieldLabel" field="ognl:components.inputPassword">Password</span> </th> <td valign="bottom"><input jwcid="inputPassword" type="text" size="10" maxlength="20"/> </td> </tr> <tr> <th><span>Admin</span> </th> <td valign="bottom"> <input jwcid="inputLendable@Checkbox" selected="ognl:attributes.admin" type="checkbox"/> </td> </tr> <tr> <td></td> <td> <input type="submit" value="Save"/> </td> </tr> </table> </form> </body> </html> --- NewUserAccount.html DELETED --- --- NEW FILE: UserAccountList.html --- <!-- $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/20 03:14:05 $ --> <html jwcid="$content$"> <body jwcid="@Border"> <span> <a href="#" jwcid="@PageLink" page="UserAccountEdit" stateful="ognl:false" class="rollover1"><span>Create New UserAccount</span></a> </span> <span jwcid="@ShowError"/> <span jwcid="@ShowMessage"/> <br/> <br/> <table class="dataListTable" jwcid="table"> <span jwcid="nameColumnValue@Block"> <span jwcid="IDLink"> <span jwcid="IDText"/> </span> </span> <th>ID</th> <th>Name</th> <th>Admin</th> <th>Last Access</th> <tr> <td>1</td> <td>Bob</td> <td>false</td> <td>2005-02-19 19:18:09.0</td> </tr> </table> </body> </html> |
From: Vlad S. <vl...@us...> - 2005-02-20 03:14:14
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/basewebapp/src/webapp/images Added Files: info-icon.png Log Message: Ability to add, edit and list new users. Model to be used in other domains Base on AbstractEntity and AbstractEntityListPage --- NEW FILE: info-icon.png --- (This appears to be a binary file; contents omitted.) |
From: Vlad S. <vl...@us...> - 2005-02-20 03:14:14
|
Update of /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/pages In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/basewebapp/src/java/net/baseapp/web/pages Added Files: UserAccountEdit.java UserAccountList.java Removed Files: NewUserAccount.java Log Message: Ability to add, edit and list new users. Model to be used in other domains Base on AbstractEntity and AbstractEntityListPage --- NEW FILE: UserAccountList.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web.pages; import net.baseapp.web.AbstractEntityListPage; import net.baseapp.web.domain.UserAccount; import org.apache.log4j.Logger; /** * TODO Add docs * * Created on 19.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/20 03:14:04 $ */ public abstract class UserAccountList extends AbstractEntityListPage { private static final Logger log = Logger.getLogger(UserAccountList.class); public Class getAbstractEntityClass() { return UserAccount.class; } public String getAbstractEntityEditPage() { return "UserAccountEdit"; } } --- NEW FILE: UserAccountEdit.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web.pages; import net.baseapp.web.AbstractEntityEditPage; import net.baseapp.web.AbstractEntityListPage; import net.baseapp.web.domain.AbstractEntity; import net.baseapp.web.domain.UserAccount; import org.apache.log4j.Logger; import org.apache.tapestry.IRequestCycle; /** * TODO Add docs * * Created on 19.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/20 03:14:04 $ */ public abstract class UserAccountEdit extends AbstractEntityEditPage { private static final Logger log = Logger.getLogger(UserAccountEdit.class); public Class getAbstractEntityClass() { return UserAccount.class; } public void onAfterUpdate(IRequestCycle cycle, AbstractEntity entity) { // Success. First, update the message property of the return page. AbstractEntityListPage page = (AbstractEntityListPage) cycle.getPage("UserAccountList"); page.setMessage("User " + entity.getEntityAttribute("name") + " updated."); cycle.activate(page); } public void onAfterCreate(IRequestCycle cycle, AbstractEntity entity) { // Success. First, update the message property of the return page. AbstractEntityListPage page = (AbstractEntityListPage) cycle.getPage("UserAccountList"); page.setMessage("User " + entity.getEntityAttribute("name") + " created."); cycle.activate(page); } } --- NewUserAccount.java DELETED --- |
From: Vlad S. <vl...@us...> - 2005-02-20 03:14:13
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp/WEB-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/basewebapp/src/webapp/WEB-INF Modified Files: Border.html Added Files: Information.html Information.jwc ShowMessage.html ShowMessage.jwc UserAccountEdit.page UserAccountList.page Removed Files: NewUserAccount.page Log Message: Ability to add, edit and list new users. Model to be used in other domains Base on AbstractEntity and AbstractEntityListPage --- NEW FILE: UserAccountEdit.page --- <?xml version="1.0" encoding="ISO-8859-1"?> <!-- $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/20 03:14:04 $ --> <!DOCTYPE page-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <page-specification class="net.baseapp.web.pages.UserAccountEdit"> <property-specification name="error" type="java.lang.String"/> <property-specification name="attributes" type="java.util.Map"/> <property-specification name="entityId" type="java.lang.Long"/> <bean name="required" class="org.apache.tapestry.valid.StringValidator" lifecycle="page"> <set-property name="required" expression="true"/> <set-property name="clientScriptingEnabled" expression="true"/> </bean> <bean name="optional" class="org.apache.tapestry.valid.StringValidator" lifecycle="page"/> <component id="inputUsername" type="ValidField"> <binding name="value" expression="attributes.name"/> <static-binding name="displayName" value="User name"/> <binding name="validator" expression="beans.required"/> </component> <component id="inputPassword" type="ValidField"> <binding name="value" expression="attributes.password"/> <binding name="validator" expression="beans.required"/> <static-binding name="displayName" value="Password"/> </component> </page-specification> --- NEW FILE: UserAccountList.page --- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE page-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <page-specification class="net.baseapp.web.pages.UserAccountList"> <property-specification name="message" type="java.lang.String"/> <property-specification name="error" type="java.lang.String"/> <property-specification name="dataItems" type="java.util.List" persistent="yes"/> <component id="table" type="contrib:Table"> <binding name="source" expression="dataItems"/> <static-binding name="columns" value="id, name, admin, lastAccess"/> <binding name="pageSize" expression="6"/> <static-binding name="initialSortColumn" value="id"/> </component> <!-- * Used to create a link which has a listener and passes in the current * ID as a parameter. --> <component id="IDLink" type="DirectLink"> <binding name="listener" expression="listeners.selectIDListener"/> <binding name="parameters" expression="components.table.tableRow.id"/> </component> <!-- * Used to output the ID value into the row since the IDLink component * creates a link but does not have a way of providing the link text. --> <component id="IDText" type="InsertText"> <binding name="value" expression="components.table.tableRow.name"/> </component> </page-specification> --- NEW FILE: Information.jwc --- <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- $Id: Information.jwc,v 1.1 2005/02/20 03:14:04 vlads Exp $ --> <!DOCTYPE component-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <component-specification allow-body="yes" allow-informal-parameters="no"> </component-specification> --- NewUserAccount.page DELETED --- --- NEW FILE: ShowMessage.jwc --- <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- $Id: ShowMessage.jwc,v 1.1 2005/02/20 03:14:04 vlads Exp $ --> <!DOCTYPE component-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <component-specification allow-informal-parameters="no"/> --- NEW FILE: Information.html --- <!-- $Id: Information.html,v 1.1 2005/02/20 03:14:04 vlads Exp $ --> <span jwcid="$content$"> <div class="message"> <table> <tr> <td> <img src="images/info-icon.png" width="16" height="16" alt="Info" border="0" vspace="10"> </td> <td> <span class="message"> <span jwcid="@RenderBody"> Info Message </span> </span> </td> </tr> </table> </div> </span> Index: Border.html =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/WEB-INF/Border.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Border.html 19 Feb 2005 23:09:27 -0000 1.2 --- Border.html 20 Feb 2005 03:14:04 -0000 1.3 *************** *** 14,18 **** <span jwcid="@Conditional" condition="ognl:admin"> ! <a href="#" jwcid="@PageLink" page="NewUserAccount" stateful="ognl:false" class="rollover1"><span>Admin</span></a> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> </span> --- 14,18 ---- <span jwcid="@Conditional" condition="ognl:admin"> ! <a href="#" jwcid="@PageLink" page="UserAccountList" stateful="ognl:false" class="rollover1"><span>Admin</span></a> <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> </span> *************** *** 27,30 **** --- 27,32 ---- </span> + <br/> + <span> <a jwcid="reset"><img jwcid="resetButton"/></a> --- NEW FILE: ShowMessage.html --- <!-- $Id: ShowMessage.html,v 1.1 2005/02/20 03:14:04 vlads Exp $ --> <span jwcid="$content$"> <span jwcid="@Conditional" condition="ognl:page.message"> <span jwcid="@Information"> <span class="message" jwcid="@Insert" value="ognl:page.message">Info Message</span> </span> </span> </span> |
From: Vlad S. <vl...@us...> - 2005-02-20 03:14:13
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp/styles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/basewebapp/src/webapp/styles Modified Files: baseapp.css Log Message: Ability to add, edit and list new users. Model to be used in other domains Base on AbstractEntity and AbstractEntityListPage Index: baseapp.css =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/styles/baseapp.css,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** baseapp.css 15 Feb 2005 21:49:48 -0000 1.1 --- baseapp.css 20 Feb 2005 03:14:04 -0000 1.2 *************** *** 3,4 **** --- 3,11 ---- font-family: Arial, Helvetica, sans-serif; } + + table.dataListTable { + border-style: solid; + border-color: black; + border-width: 1px; + } + |
From: Vlad S. <vl...@us...> - 2005-02-20 03:14:12
|
Update of /cvsroot/jour/templates/basewebapp/src/resources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/basewebapp/src/resources Modified Files: log4j.xml Log Message: Ability to add, edit and list new users. Model to be used in other domains Base on AbstractEntity and AbstractEntityListPage Index: log4j.xml =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/resources/log4j.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** log4j.xml 19 Feb 2005 23:09:27 -0000 1.3 --- log4j.xml 20 Feb 2005 03:14:03 -0000 1.4 *************** *** 34,38 **** <logger name="net.baseapp"> <level value="debug" /> - <appender-ref ref="FileAppender" /> </logger> --- 34,37 ---- |
From: Vlad S. <vl...@us...> - 2005-02-19 23:10:06
|
Update of /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22044/basewebapp/src/java/net/baseapp/web Modified Files: Global.java JourApplicationEngine.java ProtectedPage.java Visit.java Log Message: Logout and ability to add new users. Index: JourApplicationEngine.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/JourApplicationEngine.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JourApplicationEngine.java 15 Feb 2005 21:49:44 -0000 1.1 --- JourApplicationEngine.java 19 Feb 2005 23:09:25 -0000 1.2 *************** *** 43,47 **** public class JourApplicationEngine extends BaseEngine { ! public static final Logger log = Logger.getLogger(JourApplicationEngine.class); private transient boolean killSession; --- 43,47 ---- public class JourApplicationEngine extends BaseEngine { ! private static final Logger log = Logger.getLogger(JourApplicationEngine.class); private transient boolean killSession; *************** *** 49,53 **** public void logout() { Visit visit = (Visit) getVisit(); ! if (visit != null) { visit.logout(); --- 49,53 ---- public void logout() { Visit visit = (Visit) getVisit(); ! log.debug("JourApplicationEngine.logout"); if (visit != null) { visit.logout(); Index: ProtectedPage.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/ProtectedPage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ProtectedPage.java 15 Feb 2005 21:49:44 -0000 1.1 --- ProtectedPage.java 19 Feb 2005 23:09:25 -0000 1.2 *************** *** 21,34 **** package net.baseapp.web; import org.apache.log4j.Logger; - import org.apache.tapestry.IPage; import org.apache.tapestry.PageRedirectException; - import org.apache.tapestry.html.BasePage; import org.apache.tapestry.callback.PageCallback; import org.apache.tapestry.event.PageEvent; import org.apache.tapestry.event.PageValidateListener; ! ! import net.baseapp.web.pages.Login; ! import net.baseapp.web.Visit; /** * TODO Add docs --- 21,33 ---- package net.baseapp.web; + import net.baseapp.web.pages.Login; + import org.apache.log4j.Logger; import org.apache.tapestry.PageRedirectException; import org.apache.tapestry.callback.PageCallback; import org.apache.tapestry.event.PageEvent; import org.apache.tapestry.event.PageValidateListener; ! import org.apache.tapestry.html.BasePage; ! import org.apache.tapestry.valid.IValidationDelegate; /** * TODO Add docs *************** *** 45,48 **** --- 44,58 ---- public abstract class ProtectedPage extends BasePage implements IErrorProperty, PageValidateListener { + private static final Logger log = Logger.getLogger(ProtectedPage.class); + + private IValidationDelegate _validationDelegate; + + public IValidationDelegate getValidationDelegate() { + if (_validationDelegate == null) { + _validationDelegate = new ValidationDelegate(); + } + return _validationDelegate; + } + /** * Checks if the user is logged in. If not, they are sent *************** *** 53,63 **** public void pageValidate(PageEvent event){ ! Visit visit = (Visit) getVisit(); ! if (visit != null && visit.isUserLoggedIn()) { return; } // User not logged in ... redirect through the Login page. --- 63,76 ---- public void pageValidate(PageEvent event){ ! log.debug("ProtectedPage.pageValidate"); ! Visit visit = (Visit) getVisit(); ! if (visit != null && visit.isUserLoggedIn()) { return; } + log.debug("User not logged in"); + // User not logged in ... redirect through the Login page. Index: Global.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/Global.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Global.java 15 Feb 2005 21:49:44 -0000 1.1 --- Global.java 19 Feb 2005 23:09:25 -0000 1.2 *************** *** 44,48 **** public class Global { ! public static final Logger log = Logger.getLogger(Global.class); private String configFilePath = "/hibernate.cfg.xml"; --- 44,48 ---- public class Global { ! private static final Logger log = Logger.getLogger(Global.class); private String configFilePath = "/hibernate.cfg.xml"; *************** *** 66,69 **** --- 66,70 ---- URL configFileURL = Global.class.getResource(configFilePath); if (configFileURL == null) { + log.error("hibernate.cfg is missing"); return false; } Index: Visit.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/Visit.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Visit.java 15 Feb 2005 21:49:44 -0000 1.1 --- Visit.java 19 Feb 2005 23:09:25 -0000 1.2 *************** *** 41,45 **** public class Visit implements Serializable { ! private static final long serialVersionUID = 2345678943677603655L; private UserAccount userAccount; --- 41,47 ---- public class Visit implements Serializable { ! private static final Logger log = Logger.getLogger(Visit.class); ! ! private static final long serialVersionUID = 2345678943677603656L; private UserAccount userAccount; *************** *** 54,58 **** --- 56,65 ---- } + public boolean isUserAdmin() { + return (this.userAccount != null) && (this.userAccount.isAdmin()); + } + public void logout() { + log.debug("Visit.logout"); this.userAccount = null; } |
From: Vlad S. <vl...@us...> - 2005-02-19 23:10:06
|
Update of /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/domain In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22044/basewebapp/src/java/net/baseapp/web/domain Modified Files: UserAccount.java Added Files: AbstractEntity.java Log Message: Logout and ability to add new users. --- NEW FILE: AbstractEntity.java --- /* * Jour - java profiler and monitoring library * * Copyright (C) 2004 Jour team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ package net.baseapp.web.domain; import java.lang.reflect.Method; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; import ognl.Ognl; import ognl.OgnlException; import org.apache.log4j.Logger; /** * Base for all Entity stored in database. * * Created on 19.02.2005 * Contributing Author(s): * * Misha Lifschitz <mishalifschitz at users.sourceforge.net> (Inital implementation) * Vlad Skarzhevskyy <vlads at users.sourceforge.net> (Inital implementation) * * @author vlads * @version $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/19 23:09:25 $ */ public abstract class AbstractEntity { private static final Logger log = Logger.getLogger(AbstractEntity.class); private transient List _attributePropertyNames; /** * TODO Use ognl. * @return */ public List getEntityAttributePropertyNames() { if (_attributePropertyNames != null) { return _attributePropertyNames; } List properties = new Vector(); Method[] allMethods = this.getClass().getDeclaredMethods(); for (int idx = 0; idx < allMethods.length; idx++) { String mName = allMethods[idx].getName(); if (mName.startsWith("getEntity")) { continue; } if (mName.startsWith("get")) { String cName = String.valueOf(mName.charAt(3)).toLowerCase() + mName.substring(4); properties.add(cName); } else if (mName.startsWith("is")) { String cName = String.valueOf(mName.charAt(2)).toLowerCase() + mName.substring(3); properties.add(cName); } } _attributePropertyNames = properties; return _attributePropertyNames; } /** * Returns a {@link Map} of the properties of the Entity. This Map is * returned to the client, where it can be modified and then used to update * the entity bean in a single method * * <p>The properties included in the Map are defined by the * {@link #getPropertyNames()} method, which is implemented * by concrete subclasses. * **/ public Map getEntityAttributes() { Map result = new HashMap(); getEntityAttributePropertyNames(); for (Iterator i = _attributePropertyNames.iterator(); i.hasNext();) { String key = (String) i.next(); try { Object value = Ognl.getValue(key, this); result.put(key, value); } catch (OgnlException e) { log.error("Ognl error", e); } } return result; } /** * Updates the Entity with property changes from the update {@link Map}. * Only the keys defined by {@link #getAttributePropertyNames()} will be * accessed (keys and values that are not in that list are ignored). * * <p>The corresponding bean property will only be updated * if the key is present ... this means that the update may contain just * the <em>changed</em> keys. Remember that a Map may store null values. * **/ public void updateEntityAttributes(Map update) { getEntityAttributePropertyNames(); for (Iterator i = _attributePropertyNames.iterator(); i.hasNext();) { String key = (String) i.next(); if (update.containsKey(key)) { Object value = update.get(key); try { Ognl.setValue(key, this, value); } catch (OgnlException e) { log.error("Ognl error", e); } } } } } Index: UserAccount.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/domain/UserAccount.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UserAccount.java 16 Feb 2005 00:10:16 -0000 1.2 --- UserAccount.java 19 Feb 2005 23:09:25 -0000 1.3 *************** *** 36,40 **** * @hibernate.class table="baseapp_user_accounts" */ ! public class UserAccount implements Serializable { /** --- 36,40 ---- * @hibernate.class table="baseapp_user_accounts" */ ! public class UserAccount extends AbstractEntity implements Serializable { /** |
From: Vlad S. <vl...@us...> - 2005-02-19 23:10:04
|
Update of /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/components In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22044/basewebapp/src/java/net/baseapp/web/components Modified Files: Border.java Log Message: Logout and ability to add new users. Index: Border.java =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/java/net/baseapp/web/components/Border.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Border.java 15 Feb 2005 21:49:44 -0000 1.1 --- Border.java 19 Feb 2005 23:09:25 -0000 1.2 *************** *** 21,26 **** --- 21,30 ---- package net.baseapp.web.components; + import net.baseapp.web.Visit; + import org.apache.log4j.Logger; import org.apache.tapestry.BaseComponent; + import org.apache.tapestry.event.PageEvent; + import org.apache.tapestry.event.PageRenderListener; /** *************** *** 36,43 **** * @version $Revision$ ($Author$) $Date$ */ ! public abstract class Border extends BaseComponent { public static final String APPLICATION_TITLE = "Jour"; public abstract String getSubtitle(); --- 40,65 ---- * @version $Revision$ ($Author$) $Date$ */ ! public abstract class Border extends BaseComponent implements PageRenderListener { + private static final Logger log = Logger.getLogger(Border.class); + public static final String APPLICATION_TITLE = "Jour"; + public void pageBeginRender(PageEvent event) { + + log.debug("Border.pageBeginRender"); + + Visit visit = (Visit) getPage().getEngine().getVisit(); + if (visit == null) { + log.debug("has visit = false"); + setLoggedIn(false); + setAdmin(false); + } else { + log.debug("has visit"); + setLoggedIn(visit.isUserLoggedIn()); + setAdmin(visit.isUserAdmin()); + } + } + public abstract String getSubtitle(); *************** *** 51,53 **** --- 73,84 ---- return APPLICATION_TITLE + ": " + subtitle; } + + public abstract boolean getLoggedIn(); + + public abstract void setLoggedIn(boolean b); + + public abstract boolean getAdmin(); + + public abstract void setAdmin(boolean b); + } |
From: Vlad S. <vl...@us...> - 2005-02-19 23:09:37
|
Update of /cvsroot/jour/templates/basewebapp/src/resources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22044/basewebapp/src/resources Modified Files: log4j.xml Added Files: system.properties Log Message: Logout and ability to add new users. Index: log4j.xml =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/resources/log4j.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** log4j.xml 15 Feb 2005 23:03:10 -0000 1.2 --- log4j.xml 19 Feb 2005 23:09:27 -0000 1.3 *************** *** 11,15 **** <appender name="FileAppender" class="org.apache.log4j.RollingFileAppender"> <param name="File" value="${baseapp.log4j.dir}/baseapp.log"/> ! <param name="Append" value="false"/> <layout class="org.apache.log4j.PatternLayout"> <!-- --- 11,15 ---- <appender name="FileAppender" class="org.apache.log4j.RollingFileAppender"> <param name="File" value="${baseapp.log4j.dir}/baseapp.log"/> ! <param name="Append" value="true"/> <layout class="org.apache.log4j.PatternLayout"> <!-- *************** *** 28,58 **** %X MDC --> ! <param name="ConversionPattern" value="%-5p %d \t [%c{1}][%t]\t %l\n \t %m \n" /> </layout> </appender> <logger name="net.baseapp"> ! <priority value="debug" /> <appender-ref ref="FileAppender" /> </logger> <logger name="org.apache.tapestry"> ! <priority value="info" /> </logger> <logger name="org.apache.cactus"> ! <priority value="info" /> </logger> <logger name="org.apache.commons"> ! <priority value="info" /> </logger> <logger name="httpclient.wire"> ! <priority value="info" /> </logger> <root> ! <priority value="info" /> <appender-ref ref="FileAppender" /> </root> --- 28,58 ---- %X MDC --> ! <param name="ConversionPattern" value="%-5p %d \t [%c{1}]\t %l [%t]\n \t %m\n" /> </layout> </appender> <logger name="net.baseapp"> ! <level value="debug" /> <appender-ref ref="FileAppender" /> </logger> <logger name="org.apache.tapestry"> ! <level value="info" /> </logger> <logger name="org.apache.cactus"> ! <level value="info" /> </logger> <logger name="org.apache.commons"> ! <level value="info" /> </logger> <logger name="httpclient.wire"> ! <level value="info" /> </logger> <root> ! <level value="info" /> <appender-ref ref="FileAppender" /> </root> --- NEW FILE: system.properties --- -Dbaseapp.log4j.dir=C:\work\java\templates -Dorg.apache.tapestry.enable-reset-service=true -Dorg.apache.tapestry.disable-caching=true |
From: Vlad S. <vl...@us...> - 2005-02-19 23:09:37
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp/WEB-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22044/basewebapp/src/webapp/WEB-INF Modified Files: Border.html Border.jwc Login.page Added Files: Logout.page NewUserAccount.page ShowError.html ShowError.jwc ShowValidationError.html ShowValidationError.jwc Log Message: Logout and ability to add new users. Index: Login.page =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/WEB-INF/Login.page,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Login.page 15 Feb 2005 21:49:48 -0000 1.1 --- Login.page 19 Feb 2005 23:09:27 -0000 1.2 *************** *** 1,22 **** <?xml version="1.0" encoding="ISO-8859-1"?> <!-- $Revision$ ($Author$) $Date$ --> ! <!DOCTYPE page-specification PUBLIC ! "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> ! <page-specification class="net.baseapp.web.pages.Login"> <property-specification name="username" type="java.lang.String"/> <property-specification name="password" type="java.lang.String"/> <property-specification name="error" type="java.lang.String"/> <property-specification name="callback" type="org.apache.tapestry.callback.ICallback" persistent="yes"/> ! <bean name="delegate" class="net.baseapp.web.ValidationDelegate"/> ! <bean name="validator" class="org.apache.tapestry.valid.StringValidator" lifecycle="page"> <set-property name="required" expression="true"/> <set-property name="clientScriptingEnabled" expression="true"/> </bean> ! <component id="inputUsername" type="ValidField"> <binding name="value" expression="username"/> --- 1,23 ---- <?xml version="1.0" encoding="ISO-8859-1"?> <!-- $Revision$ ($Author$) $Date$ --> ! <!DOCTYPE page-specification PUBLIC ! "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> ! <page-specification class="net.baseapp.web.pages.Login"> <property-specification name="username" type="java.lang.String"/> <property-specification name="password" type="java.lang.String"/> + <property-specification name="loginError" type="boolean"/> <property-specification name="error" type="java.lang.String"/> <property-specification name="callback" type="org.apache.tapestry.callback.ICallback" persistent="yes"/> ! <bean name="delegate" class="net.baseapp.web.ValidationDelegate"/> ! <bean name="validator" class="org.apache.tapestry.valid.StringValidator" lifecycle="page"> <set-property name="required" expression="true"/> <set-property name="clientScriptingEnabled" expression="true"/> </bean> ! <component id="inputUsername" type="ValidField"> <binding name="value" expression="username"/> *************** *** 24,28 **** <binding name="validator" expression="beans.validator"/> </component> ! <component id="inputPassword" type="ValidField"> <binding name="value" expression="password"/> --- 25,29 ---- <binding name="validator" expression="beans.validator"/> </component> ! <component id="inputPassword" type="ValidField"> <binding name="value" expression="password"/> *************** *** 31,34 **** <binding name="validator" expression="beans.validator"/> </component> ! </page-specification> \ No newline at end of file --- 32,35 ---- <binding name="validator" expression="beans.validator"/> </component> ! </page-specification> \ No newline at end of file Index: Border.jwc =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/WEB-INF/Border.jwc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Border.jwc 15 Feb 2005 21:49:48 -0000 1.1 --- Border.jwc 19 Feb 2005 23:09:27 -0000 1.2 *************** *** 10,15 **** --- 10,32 ---- <parameter name="subtitle" type="java.lang.String" direction="in"/> + <property-specification name="loggedIn" type="boolean"/> + <property-specification name="admin" type="boolean"/> + + <component id="reset" type="ServiceLink"> + <binding name="service" expression="@org.apache.tapestry.Tapestry@RESET_SERVICE"/> + <binding name="disabled" expression="! page.engine.resetServiceEnabled"/> + </component> + + <component id="resetButton" type="Rollover"> + <binding name="image" expression="assets.reset"/> + <binding name="focus" expression="assets.resetFocus"/> + <binding name="disabled" expression="assets.resetDisabled"/> + </component> <context-asset name="stylesheet" path="styles/baseapp.css"/> + <context-asset name="reset" path="images/Reset.gif"/> + <context-asset name="resetFocus" path="images/Reset_focus.gif"/> + <context-asset name="resetDisabled" path="images/Reset_disabled.gif"/> + </component-specification> --- NEW FILE: ShowError.jwc --- <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- $Id: ShowError.jwc,v 1.1 2005/02/19 23:09:28 vlads Exp $ --> <!DOCTYPE component-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <component-specification allow-informal-parameters="no"/> --- NEW FILE: Logout.page --- <?xml version="1.0"?> <!DOCTYPE page-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <page-specification class="net.baseapp.web.pages.Logout" /> --- NEW FILE: NewUserAccount.page --- <?xml version="1.0" encoding="ISO-8859-1"?> <!-- $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/19 23:09:27 $ --> <!DOCTYPE page-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <page-specification class="net.baseapp.web.pages.NewUserAccount"> <property-specification name="error" type="java.lang.String"/> <property-specification name="attributes" type="java.util.Map"/> <bean name="required" class="org.apache.tapestry.valid.StringValidator" lifecycle="page"> <set-property name="required" expression="true"/> <set-property name="clientScriptingEnabled" expression="true"/> </bean> <bean name="optional" class="org.apache.tapestry.valid.StringValidator" lifecycle="page"/> <component id="inputUsername" type="ValidField"> <binding name="value" expression="attributes.name"/> <static-binding name="displayName" value="Use name"/> <binding name="validator" expression="beans.required"/> </component> <component id="inputPassword" type="ValidField"> <binding name="value" expression="attributes.password"/> <binding name="validator" expression="beans.required"/> <static-binding name="displayName" value="Password"/> </component> </page-specification> --- NEW FILE: ShowValidationError.jwc --- <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- $Id: ShowValidationError.jwc,v 1.1 2005/02/19 23:09:28 vlads Exp $ --> <!DOCTYPE component-specification PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> <component-specification class="org.apache.tapestry.BaseComponent" allow-informal-parameters="no"> <parameter name="delegate" type="org.apache.tapestry.valid.IValidationDelegate" required="yes" direction="in"/> </component-specification> --- NEW FILE: ShowError.html --- <!-- $Id: ShowError.html,v 1.1 2005/02/19 23:09:27 vlads Exp $ --> <span jwcid="$content$"> <span jwcid="@Conditional" condition="ognl:page.error"> <div class="error"> <table> <tr> <td> <img src="images/error-icon.png" width="50" height="50" alt="Error" border="0" vspace="10" align="absmiddle"/> </td> <td> <span class="error" jwcid="@Insert" value="ognl:page.error">Error Message</span> </td> </tr> </table> </div> </span> </span> Index: Border.html =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/WEB-INF/Border.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Border.html 15 Feb 2005 21:49:47 -0000 1.1 --- Border.html 19 Feb 2005 23:09:27 -0000 1.2 *************** *** 3,10 **** <body jwcid="@Body" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <span jwcid="@RenderBody"> Body content goes here. </span> ! </body> </html> --- 3,37 ---- <body jwcid="@Body" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> + <span jwcid="@Conditional" condition="ognl:!loggedIn"> + <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> + <span>Welcome to Jour</span> + <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> + </span> + <span jwcid="@Conditional" condition="ognl:loggedIn"> + <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> + <a href="#" jwcid="@PageLink" page="Home" stateful="ognl:false" class="rollover1"><span>Home</span></a> + <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> + + <span jwcid="@Conditional" condition="ognl:admin"> + <a href="#" jwcid="@PageLink" page="NewUserAccount" stateful="ognl:false" class="rollover1"><span>Admin</span></a> + <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> + </span> + + <a href="#" jwcid="@PageLink" page="Logout" stateful="ognl:false" class="rollover1"><span>Logout</span></a> + <span style="padding:2px;color:#9999FF;font-weight:bold;">|</span> + </span> + + <span jwcid="@RenderBody"> Body content goes here. </span> ! ! <span> ! <a jwcid="reset"><img jwcid="resetButton"/></a> ! <!-- span jwcid="@ServiceLink" service="ognl:@org.apache.tapestry.Tapestry@RESET_SERVICE">Reset</span --> ! <!-- span jwcid="@ServiceLink" service="ognl:@org.apache.tapestry.Tapestry@RESTART_SERVICE">Restart</span --> ! <a href="http://jakarta.apache.org/tapestry/">Powered by Tapestry</a> ! </span> ! </body> </html> --- NEW FILE: ShowValidationError.html --- <!-- $Id: ShowValidationError.html,v 1.1 2005/02/19 23:09:28 vlads Exp $ --> <span jwcid="$content$"> <span jwcid="@Conditional" condition="ognl:delegate.hasErrors"> <div class="error"> <table> <tr> <td> <img src="images/error-icon.png" width="50" height="50" alt="Error" border="0" vspace="10"/> </td> <td> <span class="error"> <span jwcid="@Delegator" delegate="ognl:delegate.firstError">Error Message</span> </span> </td> </tr> </table> </div> </span> </span> |
From: Vlad S. <vl...@us...> - 2005-02-19 23:09:37
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22044/basewebapp/src/webapp/images Added Files: Reset.gif Reset_disabled.gif Reset_focus.gif Log Message: Logout and ability to add new users. --- NEW FILE: Reset.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Reset_focus.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: Reset_disabled.gif --- (This appears to be a binary file; contents omitted.) |
From: Vlad S. <vl...@us...> - 2005-02-19 23:09:36
|
Update of /cvsroot/jour/templates/basewebapp/src/webapp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22044/basewebapp/src/webapp Modified Files: Login.html Added Files: Logout.html NewUserAccount.html Log Message: Logout and ability to add new users. --- NEW FILE: Logout.html --- <span jwcid="@Border"> <table> <tr> <td valign="top" style="text-align:justify;"> <p><span>You are logged out.</span></p> <p class="txt"><span>You may</span> <a href="#" jwcid="@PageLink" page="Login" stateful="ognl:false" class="link1"> <span>Login in again</span></a></p> </td> </tr> </table> </span> Index: Login.html =================================================================== RCS file: /cvsroot/jour/templates/basewebapp/src/webapp/Login.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Login.html 15 Feb 2005 21:49:47 -0000 1.1 --- Login.html 19 Feb 2005 23:09:27 -0000 1.2 *************** *** 25,28 **** --- 25,33 ---- </tr> </table> + <span jwcid="@Conditional" condition="ognl:loginError"> + <p class="darkRed"> + Login in failed. Please check your user name and password and try again. + </p> + </span> </form> --- NEW FILE: NewUserAccount.html --- <!-- $Revision: 1.1 $ ($Author: vlads $) $Date: 2005/02/19 23:09:27 $ --> <html jwcid="$content$"> <body jwcid="@Border"> <form jwcid="@Form" listener="ognl:listeners.newEntity" delegate="ognl:validationDelegate" stateful="ognl:false"> <span jwcid="@ShowError"/> <span jwcid="@ShowValidationError" delegate="ognl:validationDelegate"/> <table class="form"> <tr> <th><span jwcid="@FieldLabel" field="ognl:components.inputUsername">User name</span> </th> <td><input jwcid="inputUsername" type="text" size="30" maxlength="60"/> </td> </tr> <tr> <th><span jwcid="@FieldLabel" field="ognl:components.inputPassword">Password</span> </th> <td valign="bottom"><input jwcid="inputPassword" type="text" size="10" maxlength="20"/> </td> </tr> <tr> <th><span>Admin</span> </th> <td valign="bottom"> <input jwcid="inputLendable@Checkbox" selected="ognl:attributes.admin" type="checkbox"/> </td> </tr> <tr> <td></td> <td> <input type="submit" value="Add"/> </td> </tr> </table> </form> </body> </html> |