generator-rt-devel Mailing List for Generator Runtime Webapp Framework
Brought to you by:
rickknowles
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
(114) |
Mar
(57) |
Apr
(59) |
May
(76) |
Jun
(54) |
Jul
(137) |
Aug
(50) |
Sep
(182) |
Oct
(70) |
Nov
(90) |
Dec
(54) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(133) |
Feb
(61) |
Mar
(33) |
Apr
(38) |
May
(19) |
Jun
(17) |
Jul
(3) |
Aug
(14) |
Sep
(91) |
Oct
(13) |
Nov
(161) |
Dec
(5) |
| 2007 |
Jan
(2) |
Feb
(6) |
Mar
(8) |
Apr
(12) |
May
(10) |
Jun
(47) |
Jul
(38) |
Aug
(3) |
Sep
(3) |
Oct
(22) |
Nov
(15) |
Dec
(1) |
| 2008 |
Jan
(13) |
Feb
(6) |
Mar
(6) |
Apr
(26) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(36) |
Nov
(5) |
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
|
Feb
(13) |
Mar
(12) |
Apr
(14) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Rick K. <ric...@us...> - 2010-07-30 04:01:11
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/db In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31528/src/java/generator/runtime/db Modified Files: EntityPeerActionListenerSet.java Log Message: fixed bad expansion of listener array Index: EntityPeerActionListenerSet.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/db/EntityPeerActionListenerSet.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** EntityPeerActionListenerSet.java 21 Oct 2008 10:52:47 -0000 1.18 --- EntityPeerActionListenerSet.java 30 Jul 2010 04:01:00 -0000 1.19 *************** *** 105,109 **** synchronized (this) { if (executeOnLocalEvent) { ! if (this.localForegroundListeners.length <= (this.localForegroundListenerCount - 1)) { EntityPeerActionListener temp[] = this.localForegroundListeners; this.localForegroundListeners = new EntityPeerActionListener[(int) (temp.length * 1.75f)]; --- 105,109 ---- synchronized (this) { if (executeOnLocalEvent) { ! if (this.localForegroundListenerCount >= this.localForegroundListeners.length) { EntityPeerActionListener temp[] = this.localForegroundListeners; this.localForegroundListeners = new EntityPeerActionListener[(int) (temp.length * 1.75f)]; *************** *** 124,128 **** synchronized (this) { if (executeOnLocalEvent) { ! if (this.localBackgroundListeners.length <= (this.localBackgroundListenerCount - 1)) { EntityPeerActionListener temp[] = this.localBackgroundListeners; this.localBackgroundListeners = new EntityPeerActionListener[(int) (temp.length * 1.75f)]; --- 124,128 ---- synchronized (this) { if (executeOnLocalEvent) { ! if (this.localBackgroundListenerCount >= this.localBackgroundListeners.length) { EntityPeerActionListener temp[] = this.localBackgroundListeners; this.localBackgroundListeners = new EntityPeerActionListener[(int) (temp.length * 1.75f)]; *************** *** 138,142 **** private void addRemoteListener(EntityPeerActionListener listener) { ! if (this.remoteListeners.length <= (this.remoteListenerCount - 1)) { EntityPeerActionListener temp[] = this.remoteListeners; this.remoteListeners = new EntityPeerActionListener[(int) (temp.length * 1.75f)]; --- 138,142 ---- private void addRemoteListener(EntityPeerActionListener listener) { ! if (this.remoteListenerCount >= this.remoteListeners.length) { EntityPeerActionListener temp[] = this.remoteListeners; this.remoteListeners = new EntityPeerActionListener[(int) (temp.length * 1.75f)]; |
|
From: Rick K. <ric...@us...> - 2010-04-23 01:32:39
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/fileupload/transform In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv20904/src/java/generator/runtime/fileupload/transform Modified Files: LoggingStreamConsumer.java Log Message: fix the logging of system process output to line wrap properly Index: LoggingStreamConsumer.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/fileupload/transform/LoggingStreamConsumer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LoggingStreamConsumer.java 19 Apr 2010 06:34:45 -0000 1.2 --- LoggingStreamConsumer.java 23 Apr 2010 01:32:31 -0000 1.3 *************** *** 21,26 **** --- 21,28 ---- import generator.runtime.log.LogManager; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; + import java.io.InputStreamReader; /** *************** *** 44,61 **** public void run() { ! byte buffer[] = new byte[4096]; ! int read = 0; ! try { ! while ((read = in.read(buffer)) != -1) { ! log.debug(new String(buffer, 0, read, encoding)); } ! } catch (IOException err) { log.error("Error in stream consumer (" + id + ")", err); ! } ! log.fullDebug("Stream consumer finished (" + id + ")"); ! try { ! in.close(); ! } catch (IOException err) { ! log.error("Error closing stream (" + id + ")", err); } } --- 46,73 ---- public void run() { ! BufferedReader lineReader = null; ! String line = null; ! try { ! lineReader = new BufferedReader(new InputStreamReader(this.in, this.encoding)); ! while ((line = lineReader.readLine()) != null) { ! log.debug(line); } ! } catch (Throwable err) { log.error("Error in stream consumer (" + id + ")", err); ! } finally { ! if (lineReader != null) { ! try { ! lineReader.close(); ! } catch (IOException err) { ! log.error("Error closing stream (" + id + ")", err); ! } ! lineReader = null; ! } ! try { ! in.close(); ! } catch (IOException err) { ! log.error("Error closing stream (" + id + ")", err); ! } ! log.fullDebug("Stream consumer finished (" + id + ")"); } } |
|
From: Rick K. <ric...@us...> - 2010-04-20 05:37:32
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/formobject/population In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11369/src/java/generator/runtime/formobject/population Modified Files: TrimWhitespaceFilter.java Log Message: trim japanese spaces as well as ascii spaces Index: TrimWhitespaceFilter.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/formobject/population/TrimWhitespaceFilter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TrimWhitespaceFilter.java 13 Sep 2005 00:52:26 -0000 1.3 --- TrimWhitespaceFilter.java 20 Apr 2010 05:37:24 -0000 1.4 *************** *** 28,38 **** */ public class TrimWhitespaceFilter implements FormPopulationFilter { ! public static String replace(String input) { ! if (input == null) { ! return null; ! } else { ! return input.trim(); } } --- 28,60 ---- */ public class TrimWhitespaceFilter implements FormPopulationFilter { + static final char SPACE = 0x3000; ! private boolean trimJapaneseSpace; ! ! public TrimWhitespaceFilter() { ! this(true); ! } ! ! public TrimWhitespaceFilter(boolean trimJapaneseSpace) { ! this.trimJapaneseSpace = trimJapaneseSpace; ! } ! ! public String replace(String input) { ! if (input != null && !input.equals("")){ ! int length; ! do { ! length = input.length(); ! if (trimJapaneseSpace) { ! if (input.charAt(input.length() - 1) == SPACE) { ! input = input.substring(0, input.length() - 1); ! } ! if (input.length() > 0 && input.charAt(0) == SPACE) { ! input = input.substring(1); ! } ! } ! input = input.trim(); ! } while (input.length() > 0 && input.length() != length); } + return input; } |
|
From: Rick K. <ric...@us...> - 2010-04-19 06:34:55
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/fileupload/transform In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv30108/src/java/generator/runtime/fileupload/transform Modified Files: LoggingStreamConsumer.java Log Message: fix logger class name Index: LoggingStreamConsumer.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/fileupload/transform/LoggingStreamConsumer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LoggingStreamConsumer.java 5 Apr 2010 02:31:41 -0000 1.1 --- LoggingStreamConsumer.java 19 Apr 2010 06:34:45 -0000 1.2 *************** *** 31,35 **** */ public class LoggingStreamConsumer implements Runnable { ! private final Log log = LogManager.getLog(ImageMagickImageResizer.class); private String id; --- 31,35 ---- */ public class LoggingStreamConsumer implements Runnable { ! private final Log log = LogManager.getLog(LoggingStreamConsumer.class); private String id; |
|
From: Rick K. <ric...@us...> - 2010-04-09 10:37:20
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/authentication In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28125/src/java/generator/runtime/authentication Modified Files: ChangePasswordController.java Log Message: trim passwords before changing and support flow parameter "allowOldPasswordAsNewPassword" Index: ChangePasswordController.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/authentication/ChangePasswordController.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ChangePasswordController.java 21 Oct 2008 10:52:48 -0000 1.3 --- ChangePasswordController.java 9 Apr 2010 10:37:10 -0000 1.4 *************** *** 106,112 **** String userType = getFlowParameter("userType", ""); ! String oldPassword = ParamUtils.getParameter(attributes, oldPasswordParam, ""); ! String newPassword1 = ParamUtils.getParameter(attributes, newPassword1Param, ""); ! String newPassword2 = ParamUtils.getParameter(attributes, newPassword2Param, ""); LoginUser user = LoginController.getLoggedInUser(getServerSideUserState(), userType); --- 106,112 ---- String userType = getFlowParameter("userType", ""); ! String oldPassword = ParamUtils.getParameter(attributes, oldPasswordParam, "").trim(); ! String newPassword1 = ParamUtils.getParameter(attributes, newPassword1Param, "").trim(); ! String newPassword2 = ParamUtils.getParameter(attributes, newPassword2Param, "").trim(); LoginUser user = LoginController.getLoggedInUser(getServerSideUserState(), userType); *************** *** 161,164 **** --- 161,165 ---- boolean allowNonAlphanumeric = getFlowParameter("allowNonAlphanumeric", true); boolean allowSameLoginIdAndPassword = getFlowParameter("allowSameLoginIdAndPassword", true); + boolean allowOldPasswordAsNewPassword = getFlowParameter("allowOldPasswordAsNewPassword", true); int minPasswordStrength = getFlowParameter("minPasswordStrength", 0); int passwordMinLength = getFlowParameter("passwordMinLength", 1); *************** *** 196,202 **** } boolean noErrors = valLength.validate(errors); ! if (noErrors && !allowSameLoginIdAndPassword && ! newPassword1.equals(ParamUtils.nvl(user.getLoginId(), ""))) { ! errors.add(new ValidationFailure(newPassword1Param, "passwordMatchesLoginId", newPassword1)); } } --- 197,208 ---- } boolean noErrors = valLength.validate(errors); ! if (noErrors) { ! if (!allowSameLoginIdAndPassword && newPassword1.equals(ParamUtils.nvl(user.getLoginId(), ""))) { ! errors.add(new ValidationFailure(newPassword1Param, "passwordMatchesLoginId", newPassword1)); ! } ! if (!allowOldPasswordAsNewPassword && ! LoginController.encryptPassword(newPassword1, getProperties(), null, null).equals(user.getEncryptedPassword())) { ! errors.add(new ValidationFailure(newPassword1Param, "passwordIsOldPassword", newPassword1)); ! } } } |
|
From: Rick K. <ric...@us...> - 2010-04-09 08:21:13
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/authentication In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28966/src/java/generator/runtime/authentication Modified Files: LoginController.java Log Message: trim trailing spaces from passwords if supplied Index: LoginController.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/authentication/LoginController.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** LoginController.java 21 Oct 2008 10:52:48 -0000 1.25 --- LoginController.java 9 Apr 2010 08:21:01 -0000 1.26 *************** *** 85,90 **** boolean setAutoLogin = (attributes.get(autoLoginParam) != null); if (loginId != null) { ! loginId = convertDoubleByteChars(loginId); if (!isValidateOnly()) { getClientSideUserStateMap().put("loginIdCookie", --- 85,97 ---- boolean setAutoLogin = (attributes.get(autoLoginParam) != null); + if (plainPassword != null) { + plainPassword = plainPassword.trim(); + } + if (encPassword != null) { + encPassword = encPassword.trim(); + } + if (loginId != null) { ! loginId = convertDoubleByteChars(loginId.trim()); if (!isValidateOnly()) { getClientSideUserStateMap().put("loginIdCookie", |
|
From: Rick K. <ric...@us...> - 2010-04-06 06:21:49
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/translation In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9815/src/java/generator/runtime/translation Modified Files: TranslationBean.java Log Message: added missing no params method for velocity Index: TranslationBean.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/translation/TranslationBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TranslationBean.java 5 Apr 2010 02:31:41 -0000 1.1 --- TranslationBean.java 6 Apr 2010 06:21:40 -0000 1.2 *************** *** 78,81 **** --- 78,85 ---- return ParamUtils.getParameter(attributes, RouterConstants.PREFERRED_LANGUAGE_PARAM, sessionDefault); } + + public String translate(String template) { + return translate(template, null); + } public String translate(String template, Object params[]) { |
|
From: Rick K. <ric...@us...> - 2010-04-05 02:31:50
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/filter In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11801/src/java/generator/runtime/filter Modified Files: MultipartRequestWrapper.java Log Message: A bunch of translation tag changes and addons to the velocity mail rendering. A fix to the DBConnectionPool keep alive process also included. Index: MultipartRequestWrapper.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/filter/MultipartRequestWrapper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MultipartRequestWrapper.java 29 Mar 2007 00:56:05 -0000 1.2 --- MultipartRequestWrapper.java 5 Apr 2010 02:31:41 -0000 1.3 *************** *** 154,158 **** inRaw.close(); outStream.close(); ! this.tempFileNames.put(nameField, tempFile.getAbsoluteFile()); } else { byte[] stash = new byte[inRaw.available()]; --- 154,158 ---- inRaw.close(); outStream.close(); ! tempFileNames.put(nameField, tempFile.getAbsoluteFile()); } else { byte[] stash = new byte[inRaw.available()]; |
|
From: Rick K. <ric...@us...> - 2010-04-05 02:31:50
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/controller In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11801/src/java/generator/runtime/controller Modified Files: GetSingleFieldFromSessionController.java UpdateController.java Log Message: A bunch of translation tag changes and addons to the velocity mail rendering. A fix to the DBConnectionPool keep alive process also included. Index: GetSingleFieldFromSessionController.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/controller/GetSingleFieldFromSessionController.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GetSingleFieldFromSessionController.java 21 Oct 2008 10:52:47 -0000 1.8 --- GetSingleFieldFromSessionController.java 5 Apr 2010 02:31:41 -0000 1.9 *************** *** 45,51 **** * session-like object gets the stored item</td></tr> * - * <tr><td>isRemove</td><td>false</td><td>boolean</td> - * <td>True if we want to remove this cookie/session/context item</td></tr> - * * <tr><td>attributeName</td><td>null</td><td>String</td> * <td>The name of the attribute to copy into the session/context/cookie</td></tr> --- 45,48 ---- Index: UpdateController.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/controller/UpdateController.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** UpdateController.java 21 Oct 2008 10:52:47 -0000 1.19 --- UpdateController.java 5 Apr 2010 02:31:41 -0000 1.20 *************** *** 100,105 **** clsVOArray[n] = Class.forName(valueObjectClassArray[n]); ! String primaryKeyStr = (String) ReflectionUtils.getAttributeUsingGetter( ! formPKFieldArray[n], form); if (!ParamUtils.nvl(primaryKeyStr, "").equals("")) { --- 100,108 ---- clsVOArray[n] = Class.forName(valueObjectClassArray[n]); ! String primaryKeyStr = null; ! if ( (n < formPKFieldArray.length) && formPKFieldArray[n] != null) { ! primaryKeyStr = (String) ReflectionUtils.getAttributeUsingGetter( ! formPKFieldArray[n], form); ! } if (!ParamUtils.nvl(primaryKeyStr, "").equals("")) { *************** *** 167,173 **** } ! insertOneVO(peerNameArray[n], transferArgs[n]); } else if ((n >= insertOnlyArray.length) || !insertOnlyArray[n].equals("true")) { ! updateOneVO(peerNameArray[n], transferArgs[n]); } else { log.warning("Skipping insert of " + clsVOArray[n] + --- 170,176 ---- } ! insertOneVO(peerNameArray[n], transferArgs[n], attributes); } else if ((n >= insertOnlyArray.length) || !insertOnlyArray[n].equals("true")) { ! updateOneVO(peerNameArray[n], transferArgs[n], attributes); } else { log.warning("Skipping insert of " + clsVOArray[n] + *************** *** 225,229 **** } ! deleteOneVO(peerNameArray[n], deleteObject); log.debug("Delete successful: peer=" + peerNameArray[n] + ",pk=" + fieldValue); } --- 228,232 ---- } ! deleteOneVO(peerNameArray[n], deleteObject, attributes); log.debug("Delete successful: peer=" + peerNameArray[n] + ",pk=" + fieldValue); } *************** *** 236,240 **** * Override to perform specific actions on insert of each VO */ ! protected void insertOneVO(String peerName, Object vo) { dbInsert(peerName, vo); } --- 239,243 ---- * Override to perform specific actions on insert of each VO */ ! protected void insertOneVO(String peerName, Object vo, Map attributes) { dbInsert(peerName, vo); } *************** *** 242,246 **** * Override to perform specific actions on update of each VO */ ! protected void updateOneVO(String peerName, Object vo) { dbUpdate(peerName, vo); } --- 245,249 ---- * Override to perform specific actions on update of each VO */ ! protected void updateOneVO(String peerName, Object vo, Map attributes) { dbUpdate(peerName, vo); } *************** *** 248,252 **** * Override to perform specific actions on delete of each VO */ ! protected void deleteOneVO(String peerName, Object vo) { dbDelete(peerName, vo); } --- 251,255 ---- * Override to perform specific actions on delete of each VO */ ! protected void deleteOneVO(String peerName, Object vo, Map attributes) { dbDelete(peerName, vo); } |
|
From: Rick K. <ric...@us...> - 2010-04-05 02:31:50
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/velocity In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11801/src/java/generator/runtime/velocity Modified Files: VelocityProcessor.java Log Message: A bunch of translation tag changes and addons to the velocity mail rendering. A fix to the DBConnectionPool keep alive process also included. Index: VelocityProcessor.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/velocity/VelocityProcessor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** VelocityProcessor.java 21 Oct 2008 10:52:47 -0000 1.10 --- VelocityProcessor.java 5 Apr 2010 02:31:41 -0000 1.11 *************** *** 27,30 **** --- 27,31 ---- import java.io.Writer; import java.util.Map; + import java.util.Properties; import org.apache.velocity.Template; *************** *** 47,51 **** private final Log log = LogManager.getLog(VelocityProcessor.class); ! private static final String DEFAULT_BASE = "${application/@webroot}/WEB-INF/xsl/"; private VelocityEngine velocityEngine; --- 48,52 ---- private final Log log = LogManager.getLog(VelocityProcessor.class); ! private static final String DEFAULT_BASE = "${application/@webroot}/WEB-INF/velocity/"; private VelocityEngine velocityEngine; *************** *** 69,74 **** } ! public void initialize(ApplicationProperties props) { ! super.initialize(props); } --- 70,89 ---- } ! public void initialize(ApplicationProperties appProps) { ! super.initialize(appProps); ! this.velocityEngine = new VelocityEngine(); ! Properties props = new Properties(); ! String defaultEncoding = appProps.stringProperty("velocity/@encoding", ! appProps.stringProperty("application/@encoding", "")); ! if (defaultEncoding != null) { ! props.put(VelocityEngine.INPUT_ENCODING, defaultEncoding); ! } ! String basePath = appProps.stringProperty("velocity/@base", DEFAULT_BASE); ! props.put("file.resource.loader.path", basePath); ! try { ! this.velocityEngine.init(props); ! } catch (Exception err) { ! log.error("Error during velocity initialization", err); ! } } *************** *** 82,86 **** * @param stylesheetName The name of the stylesheet we need */ ! public void processTemplate(Writer out, Map attributes, String stylesheetName, String subTemplateName, String encoding, String forceOutputMethod) throws IOException { long startTime = System.currentTimeMillis(); --- 97,101 ---- * @param stylesheetName The name of the stylesheet we need */ ! public void processTemplate(Writer out, Map attributes, String stylesheetName, String subTemplateName, String encoding, String forceOutputMethod) throws IOException { long startTime = System.currentTimeMillis(); |
|
From: Rick K. <ric...@us...> - 2010-04-05 02:31:50
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/translation In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11801/src/java/generator/runtime/translation Added Files: TranslationBean.java TranslatingVelocityMailRenderController.java Log Message: A bunch of translation tag changes and addons to the velocity mail rendering. A fix to the DBConnectionPool keep alive process also included. --- NEW FILE: TranslatingVelocityMailRenderController.java --- /* * Keystone Development Framework * Copyright (C) 2004-2009 Rick Knowles * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public License * Version 2 as published by the Free Software Foundation. * * This program 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 General Public License Version 2 for more details. * * You should have received a copy of the GNU Library General Public License * Version 2 along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package generator.runtime.translation; import generator.runtime.automailer.VelocityMailRenderController; import java.util.Map; /** * Controller to render mail messages using the velocity templates in our /WEB-INF/velocity/mail/* * folder. Additionally includes an instance of the translation bean to support translation inside the template. */ public class TranslatingVelocityMailRenderController extends VelocityMailRenderController { protected Map buildVelocityContext(Map attributes) { Map velocityAtts = super.buildVelocityContext(attributes); String language = TranslationBean.getLanguage(getServerSideUserState(), attributes); velocityAtts.put(getTranslationParamName(), new TranslationBean(getServerSideApplicationState(), language)); return velocityAtts; } protected String getTranslationParamName() { return getFlowParameter("translationParamName", "translation"); } } --- NEW FILE: TranslationBean.java --- /* * Generator Runtime Servlet Framework * Copyright (C) 2004 Rick Knowles * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * Version 2 as published by the Free Software Foundation. * * This program 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 General Public License Version 2 for more details. * * You should have received a copy of the GNU General Public License * Version 2 along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package generator.runtime.translation; import generator.runtime.log.Log; import generator.runtime.log.LogManager; import generator.runtime.router.RouterConstants; import generator.runtime.servlet.ContextInitializer; import generator.runtime.session.ServerSideApplicationState; import generator.runtime.session.ServerSideUserState; import generator.runtime.utils.ApplicationProperties; import generator.runtime.utils.ParamUtils; import generator.runtime.utils.StringUtils; import generator.runtime.xml.XMLUtils; import java.io.File; import java.util.Hashtable; import java.util.Map; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class TranslationBean { private final Log log = LogManager.getLog(TranslationBean.class); private Map translations; public TranslationBean(ServerSideApplicationState context, String language) { String contextKey = "translationMap." + language; synchronized (context.getSemaphore(contextKey)) { this.translations = (Map) context.getAttribute(contextKey); if (this.translations == null) { ApplicationProperties props = (ApplicationProperties) context.getAttribute(ContextInitializer.ATTR_PROPS); String translationSheet = props.stringProperty("translationSheet/@" + language, "${application/@webroot}/WEB-INF/translations/" + language + ".xml"); File file = new File(translationSheet); if (!file.isFile()) { log.warning("Translation file not found: " + translationSheet); } Document doc = XMLUtils.parseFileToXML(file); NodeList items = doc.getDocumentElement().getChildNodes(); this.translations = new Hashtable(); for (int n = 0; n < items.getLength(); n++) { Node node = items.item(n); if (node.getNodeType() == Node.ELEMENT_NODE) { String key = XMLUtils.getAttributeByName(node, "key"); String text = XMLUtils.extractStringFromElement(node); if ((key != null) && (text != null)) { translations.put(key, text); } } } log.info("Loaded " + this.translations.size() + " translations for " + language + " from " + translationSheet); context.setAttribute(contextKey, this.translations); } } } public static String getLanguage(ServerSideUserState session, Map attributes) { String sessionDefault = (String) ParamUtils.nvl(session.getAttribute( RouterConstants.PREFERRED_LANGUAGE_PARAM), "english"); return ParamUtils.getParameter(attributes, RouterConstants.PREFERRED_LANGUAGE_PARAM, sessionDefault); } public String translate(String template, Object params[]) { String translated = null; if (translations != null) { // no sync required, read only translated = (String) translations.get(template); } if (translated == null) { translated = template; } if (params != null) { String tokens[][] = new String[params.length][2]; for (int n = 0; n < params.length; n++) { tokens[n][0] = "[#" + (n + 1) + "]"; tokens[n][1] = ParamUtils.nvl(params[n], "").toString(); } translated = StringUtils.stringReplace(translated, tokens); } return translated; } } |
|
From: Rick K. <ric...@us...> - 2010-04-05 02:31:50
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/db/pool In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11801/src/java/generator/runtime/db/pool Modified Files: DBConnectionPool.java Log Message: A bunch of translation tag changes and addons to the velocity mail rendering. A fix to the DBConnectionPool keep alive process also included. Index: DBConnectionPool.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/db/pool/DBConnectionPool.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** DBConnectionPool.java 21 Oct 2008 10:52:48 -0000 1.27 --- DBConnectionPool.java 5 Apr 2010 02:31:41 -0000 1.28 *************** *** 579,582 **** --- 579,583 ---- try { executeKeepAliveSingle(conn, keepAliveSQL); + conn.rollback(); } catch (Throwable errSQL) { log.warning(prefix + ": Keep alive failed - adding connection to drop list", errSQL); |
|
From: Rick K. <ric...@us...> - 2010-04-05 02:31:50
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/automailer In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11801/src/java/generator/runtime/automailer Modified Files: VelocityMailRenderController.java Log Message: A bunch of translation tag changes and addons to the velocity mail rendering. A fix to the DBConnectionPool keep alive process also included. Index: VelocityMailRenderController.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/automailer/VelocityMailRenderController.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VelocityMailRenderController.java 30 Mar 2010 02:46:36 -0000 1.1 --- VelocityMailRenderController.java 5 Apr 2010 02:31:42 -0000 1.2 *************** *** 44,52 **** */ public class VelocityMailRenderController extends Controller { ! private final Log log = LogManager.getLog(MailRenderController.class); public String execute(Map attributes) { String mailTemplateName = getFlowParameter("mailTemplate", null); - String dateFormat = getFlowParameter("dateFormat", "yyyy-MM-dd HH:mm:ss"); if (mailTemplateName == null) { --- 44,51 ---- */ public class VelocityMailRenderController extends Controller { ! private final Log log = LogManager.getLog(VelocityMailRenderController.class); public String execute(Map attributes) { String mailTemplateName = getFlowParameter("mailTemplate", null); if (mailTemplateName == null) { *************** *** 56,63 **** // Build the input context ! Map velocityAtts = new HashMap(attributes); ! velocityAtts.put("properties", getProperties()); ! velocityAtts.put("dateFormatter", new SimpleDateFormat(dateFormat)); ! velocityAtts.put("now", new Date()); log.debug("Rendering email contents with velocity"); --- 55,59 ---- // Build the input context ! Map velocityAtts = buildVelocityContext(attributes); log.debug("Rendering email contents with velocity"); *************** *** 73,76 **** --- 69,82 ---- } + protected Map buildVelocityContext(Map attributes) { + String dateFormat = getFlowParameter("dateFormat", "yyyy-MM-dd HH:mm:ss"); + + Map velocityAtts = new HashMap(attributes); + velocityAtts.put("properties", getProperties()); + velocityAtts.put("dateFormatter", new SimpleDateFormat(dateFormat)); + velocityAtts.put("now", new Date()); + return velocityAtts; + } + protected CachingTextProcessor getTextProcessor() { String textProcessorName = getFlowParameter("textProcessor", VelocityContextInitializer.ATTR_VELOCITY_ENGINE); |
|
From: Rick K. <ric...@us...> - 2010-04-05 02:31:50
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/jsp In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11801/src/java/generator/runtime/jsp Modified Files: TranslateTag.java Log Message: A bunch of translation tag changes and addons to the velocity mail rendering. A fix to the DBConnectionPool keep alive process also included. Index: TranslateTag.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/jsp/TranslateTag.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TranslateTag.java 30 Mar 2010 02:46:36 -0000 1.2 --- TranslateTag.java 5 Apr 2010 02:31:41 -0000 1.3 *************** *** 19,42 **** import generator.runtime.exception.ApplicationException; - import generator.runtime.log.Log; - import generator.runtime.log.LogManager; import generator.runtime.router.AttributesMap; - import generator.runtime.router.RouterConstants; - import generator.runtime.servlet.ContextInitializer; import generator.runtime.session.HttpSessionWrapper; - import generator.runtime.session.ServerSideApplicationState; - import generator.runtime.session.ServerSideUserState; import generator.runtime.session.ServletContextWrapper; ! import generator.runtime.utils.ApplicationProperties; ! import generator.runtime.utils.ParamUtils; ! import generator.runtime.utils.StringUtils; ! import generator.runtime.xml.XMLUtils; - import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; - import java.util.Hashtable; - import java.util.Map; import javax.servlet.http.HttpServletRequest; --- 19,30 ---- import generator.runtime.exception.ApplicationException; import generator.runtime.router.AttributesMap; import generator.runtime.session.HttpSessionWrapper; import generator.runtime.session.ServletContextWrapper; ! import generator.runtime.translation.TranslationBean; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import javax.servlet.http.HttpServletRequest; *************** *** 46,58 **** import javax.servlet.jsp.tagext.BodyTagSupport; - import org.w3c.dom.Document; - import org.w3c.dom.Node; - import org.w3c.dom.NodeList; - /** * Special tag to translate the contents using the translations cache for the selected language */ public class TranslateTag extends BodyTagSupport { - private final Log log = LogManager.getLog(TranslateTag.class); private Object[] parameters = new Object[5]; --- 34,41 ---- *************** *** 92,162 **** JspWriter out = bodyContent.getEnclosingWriter(); ! String language = getLanguage((HttpServletRequest) pageContext.getRequest()); ! Map translations = getTranslations(language, new ServletContextWrapper(pageContext.getServletContext())); ! out.print(translate(bodyString, this.parameters, translations)); bodyContent.clear(); // empty buffer return SKIP_BODY; } catch (IOException e) { throw new ApplicationException("Error during translate tag", e); - } // end of catch - - } - protected String getLanguage(HttpServletRequest req) { - ServerSideUserState ssus = new HttpSessionWrapper(req); - String sessionDefault = (String) ParamUtils.nvl(ssus.getAttribute( - RouterConstants.PREFERRED_LANGUAGE_PARAM), "english"); - return ParamUtils.getParameter(new AttributesMap(req), RouterConstants.PREFERRED_LANGUAGE_PARAM, sessionDefault); - } - - protected String translate(String template, Object params[], Map translations) { - String translated = null; - if (translations != null) { - translated = (String) translations.get(template); - } - if (translated == null) { - translated = template; - } - if (params != null) { - String tokens[][] = new String[params.length][2]; - for (int n = 0; n < params.length; n++) { - tokens[n][0] = "[#" + (n + 1) + "]"; - tokens[n][1] = ParamUtils.nvl(params[n], "").toString(); - } - translated = StringUtils.stringReplace(translated, tokens); - } - return translated; - } - - protected Map getTranslations(String language, ServerSideApplicationState ssas) { - String contextKey = "translationMap." + language; - synchronized (ssas.getSemaphore(contextKey)) { - Map translations = (Map) ssas.getAttribute(contextKey); - if (translations == null) { - ApplicationProperties props = (ApplicationProperties) ssas.getAttribute(ContextInitializer.ATTR_PROPS); - String translationSheet = props.stringProperty("translationSheet/@" + language, - "${application/@webroot}/WEB-INF/translations/" + language + ".xml"); - File file = new File(translationSheet); - if (!file.isFile()) { - log.warning("Translation file not found: " + translationSheet); - return null; - } - Document doc = XMLUtils.parseFileToXML(file); - NodeList items = doc.getDocumentElement().getChildNodes(); - translations = new Hashtable(); - for (int n = 0; n < items.getLength(); n++) { - Node node = items.item(n); - if (node.getNodeType() == Node.ELEMENT_NODE) { - String key = XMLUtils.getAttributeByName(node, "key"); - String text = XMLUtils.extractStringFromElement(node); - if ((key != null) && (text != null)) { - translations.put(key, text); - } - } - } - log.info("Loaded " + translations.size() + " translations for " + language + " from " + translationSheet); - ssas.setAttribute(contextKey, translations); - } - return translations; } } --- 75,87 ---- JspWriter out = bodyContent.getEnclosingWriter(); ! HttpServletRequest req = (HttpServletRequest) pageContext.getRequest(); ! String language = TranslationBean.getLanguage(new HttpSessionWrapper(req), new AttributesMap(req)); ! TranslationBean translation = new TranslationBean(new ServletContextWrapper(pageContext.getServletContext()), language); ! out.print(translation.translate(bodyString, this.parameters)); bodyContent.clear(); // empty buffer return SKIP_BODY; } catch (IOException e) { throw new ApplicationException("Error during translate tag", e); } } |
|
From: Rick K. <ric...@us...> - 2010-04-05 02:31:50
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/fileupload/transform In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11801/src/java/generator/runtime/fileupload/transform Modified Files: ImageMagickImageResizer.java Added Files: LoggingStreamConsumer.java Log Message: A bunch of translation tag changes and addons to the velocity mail rendering. A fix to the DBConnectionPool keep alive process also included. --- NEW FILE: LoggingStreamConsumer.java --- /* * Generator Runtime Servlet Framework * Copyright (C) 2004 Rick Knowles * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public License * Version 2 as published by the Free Software Foundation. * * This program 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 General Public License Version 2 for more details. * * You should have received a copy of the GNU Library General Public License * Version 2 along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package generator.runtime.fileupload.transform; import generator.runtime.log.Log; import generator.runtime.log.LogManager; import java.io.IOException; import java.io.InputStream; /** * Logs the output of an stream, used primarily to track the output of jvm spawned system processes * * @author <a href="mailto:ric...@ho...">Rick Knowles</a> * @version $Id: LoggingStreamConsumer.java,v 1.1 2010/04/05 02:31:41 rickknowles Exp $ */ public class LoggingStreamConsumer implements Runnable { private final Log log = LogManager.getLog(ImageMagickImageResizer.class); private String id; private InputStream in; private String encoding; public LoggingStreamConsumer(String id, InputStream in, String encoding) { this.id = id; this.in = in; this.encoding = encoding; } public void run() { byte buffer[] = new byte[4096]; int read = 0; try { while ((read = in.read(buffer)) != -1) { log.debug(new String(buffer, 0, read, encoding)); } } catch (IOException err) { log.error("Error in stream consumer (" + id + ")", err); } log.fullDebug("Stream consumer finished (" + id + ")"); try { in.close(); } catch (IOException err) { log.error("Error closing stream (" + id + ")", err); } } } Index: ImageMagickImageResizer.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/fileupload/transform/ImageMagickImageResizer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ImageMagickImageResizer.java 21 Oct 2008 10:52:47 -0000 1.2 --- ImageMagickImageResizer.java 5 Apr 2010 02:31:41 -0000 1.3 *************** *** 26,30 **** import java.io.File; import java.io.IOException; - import java.io.InputStream; import java.util.Arrays; --- 26,29 ---- *************** *** 78,83 **** log.debug("Launching image resize process (" + this.id + "): " + Arrays.asList(resizeCmdArgs)); //comment out Process p = Runtime.getRuntime().exec(resizeCmdArgs); ! Thread thStdOut = new Thread(new LoggingStreamConsumer(p.getInputStream(), logEncoding)); ! Thread thStdErr = new Thread(new LoggingStreamConsumer(p.getErrorStream(), logEncoding)); thStdOut.setDaemon(true); thStdOut.start(); --- 77,82 ---- log.debug("Launching image resize process (" + this.id + "): " + Arrays.asList(resizeCmdArgs)); //comment out Process p = Runtime.getRuntime().exec(resizeCmdArgs); ! Thread thStdOut = new Thread(new LoggingStreamConsumer(this.id + ":stdout", p.getInputStream(), logEncoding)); ! Thread thStdErr = new Thread(new LoggingStreamConsumer(this.id + ":stderr", p.getErrorStream(), logEncoding)); thStdOut.setDaemon(true); thStdOut.start(); *************** *** 91,121 **** } } - - class LoggingStreamConsumer implements Runnable { - private InputStream in; - private String encoding; - - LoggingStreamConsumer(InputStream in, String encoding) { - this.in = in; - this.encoding = encoding; - } - - public void run() { - byte buffer[] = new byte[4096]; - int read = 0; - try { - while ((read = in.read(buffer)) != -1) { - log.debug(new String(buffer, 0, read, encoding)); - } - } catch (IOException err) { - log.error("Error in stream consumer (" + id + ")", err); - } - log.fullDebug("Stream consumer finished (" + id + ")"); - try { - in.close(); - } catch (IOException err) { - log.error("Error closing stream (" + id + ")", err); - } - } - } } --- 90,92 ---- |
|
From: Rick K. <ric...@us...> - 2010-03-30 02:46:45
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/jsp In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv15375/src/java/generator/runtime/jsp Modified Files: TranslateTag.java Log Message: velocity mail transformer and the translate tag easy parameters method Index: TranslateTag.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/jsp/TranslateTag.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TranslateTag.java 26 Mar 2010 01:21:44 -0000 1.1 --- TranslateTag.java 30 Mar 2010 02:46:36 -0000 1.2 *************** *** 56,60 **** private final Log log = LogManager.getLog(TranslateTag.class); ! private Object[] parameters; public void setParameters(Object[] parameters) { --- 56,60 ---- private final Log log = LogManager.getLog(TranslateTag.class); ! private Object[] parameters = new Object[5]; public void setParameters(Object[] parameters) { *************** *** 63,67 **** public void setParameterList(Collection parameters) { ! this.parameters = new ArrayList(parameters).toArray(); } --- 63,87 ---- public void setParameterList(Collection parameters) { ! setParameters(new ArrayList(parameters).toArray()); ! } ! ! public void setParam1(Object p) { ! this.parameters[0] = p; ! } ! ! public void setParam2(Object p) { ! this.parameters[1] = p; ! } ! ! public void setParam3(Object p) { ! this.parameters[2] = p; ! } ! ! public void setParam4(Object p) { ! this.parameters[3] = p; ! } ! ! public void setParam5(Object p) { ! this.parameters[4] = p; } |
|
From: Rick K. <ric...@us...> - 2010-03-30 02:46:44
|
Update of /cvsroot/generator-rt/generator_runtime/src/tld In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv15375/src/tld Modified Files: gen.tld Log Message: velocity mail transformer and the translate tag easy parameters method Index: gen.tld =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/tld/gen.tld,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gen.tld 26 Mar 2010 01:21:44 -0000 1.2 --- gen.tld 30 Mar 2010 02:46:36 -0000 1.3 *************** *** 28,31 **** --- 28,61 ---- <type>java.util.Collection</type> </attribute> + <attribute> + <name>param1</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.Object</type> + </attribute> + <attribute> + <name>param2</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.Object</type> + </attribute> + <attribute> + <name>param3</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.Object</type> + </attribute> + <attribute> + <name>param4</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.Object</type> + </attribute> + <attribute> + <name>param5</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.Object</type> + </attribute> </tag> |
|
From: Rick K. <ric...@us...> - 2010-03-30 02:46:44
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/automailer In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv15375/src/java/generator/runtime/automailer Added Files: VelocityMailRenderController.java Log Message: velocity mail transformer and the translate tag easy parameters method --- NEW FILE: VelocityMailRenderController.java --- /* * Keystone Development Framework * Copyright (C) 2004-2009 Rick Knowles * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public License * Version 2 as published by the Free Software Foundation. * * This program 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 General Public License Version 2 for more details. * * You should have received a copy of the GNU Library General Public License * Version 2 along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package generator.runtime.automailer; import generator.runtime.controller.Controller; import generator.runtime.exception.ApplicationException; import generator.runtime.log.Log; import generator.runtime.log.LogManager; import generator.runtime.utils.CachingTextProcessor; import generator.runtime.utils.ParamUtils; import generator.runtime.velocity.VelocityContextInitializer; import generator.runtime.xml.XMLUtils; import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Controller to render mail messages using the velocity templates in our /WEB-INF/velocity/mail/* * folder. */ public class VelocityMailRenderController extends Controller { private final Log log = LogManager.getLog(MailRenderController.class); public String execute(Map attributes) { String mailTemplateName = getFlowParameter("mailTemplate", null); String dateFormat = getFlowParameter("dateFormat", "yyyy-MM-dd HH:mm:ss"); if (mailTemplateName == null) { throw new ApplicationException("No mail template specified"); } CachingTextProcessor textProcessor = getTextProcessor(); // Build the input context Map velocityAtts = new HashMap(attributes); velocityAtts.put("properties", getProperties()); velocityAtts.put("dateFormatter", new SimpleDateFormat(dateFormat)); velocityAtts.put("now", new Date()); log.debug("Rendering email contents with velocity"); try { StringWriter xml = new StringWriter(); textProcessor.processTemplate(xml, velocityAtts, mailTemplateName, null, null, null); log.debug("Rendered mail xml: " + xml); parseMessageXML(xml.toString(), attributes); return "OK"; } catch (IOException err) { throw new ApplicationException("Error processing mail template", err); } } protected CachingTextProcessor getTextProcessor() { String textProcessorName = getFlowParameter("textProcessor", VelocityContextInitializer.ATTR_VELOCITY_ENGINE); return (CachingTextProcessor) getServerSideApplicationState().getAttribute(textProcessorName); } protected void parseMessageXML(String xml, Map attributes) { String toAddressFieldParam = getFlowParameter("toAddressFieldParam", "toAddress"); String ccAddressFieldParam = getFlowParameter("ccAddressFieldParam", "ccAddress"); String bccAddressFieldParam = getFlowParameter("bccAddressFieldParam", "bccAddress"); String replyToAddressFieldParam = getFlowParameter("replyToAddressFieldParam", "replyToAddress"); String smtpMessageIdParam = getFlowParameter("smtpMessageIdParam", "smtpMessageId"); String inReplyToParam = getFlowParameter("inReplyToParam", "inReplyTo"); String subjectParam = getFlowParameter("subjectParam", "subject"); String bodyTextParam = getFlowParameter("bodyTextParam", "bodyText"); String bodyHtmlParam = getFlowParameter("bodyHtmlParam", "bodyHtml"); String senderParam = getFlowParameter("senderParam", "sender"); Document doc = XMLUtils.parseStreamToXML(new StringReader(xml)); Node root = doc.getDocumentElement(); NodeList children = root.getChildNodes(); for (int n = 0; n < children.getLength(); n++) { Node node = children.item(n); if (node.getNodeType() != Node.ELEMENT_NODE) { continue; } else if (node.getNodeName().equals("subject")) { attributes.put(subjectParam, XMLUtils.extractStringFromElement(node)); } else if (node.getNodeName().equals("bodyText")) { attributes.put(bodyTextParam, XMLUtils.extractStringFromElement(node)); } else if (node.getNodeName().equals("bodyHtml")) { attributes.put(bodyHtmlParam, XMLUtils.extractStringFromElement(node)); } else if (node.getNodeName().equals("address")) { NodeList grandchildren = node.getChildNodes(); for (int k = 0; k < grandchildren.getLength(); k++) { Node grandchild = grandchildren.item(k); if (grandchild.getNodeType() != Node.ELEMENT_NODE) { continue; } else if (grandchild.getNodeName().equals("to")) { String name = XMLUtils.getAttributeByName(grandchild, "name"); String email = XMLUtils.getAttributeByName(grandchild, "email"); addAddress(attributes, toAddressFieldParam, formatAddress(name, email)); } else if (grandchild.getNodeName().equals("cc")) { String name = XMLUtils.getAttributeByName(grandchild, "name"); String email = XMLUtils.getAttributeByName(grandchild, "email"); addAddress(attributes, ccAddressFieldParam, formatAddress(name, email)); } else if (grandchild.getNodeName().equals("bcc")) { String name = XMLUtils.getAttributeByName(grandchild, "name"); String email = XMLUtils.getAttributeByName(grandchild, "email"); addAddress(attributes, bccAddressFieldParam, formatAddress(name, email)); } else if (grandchild.getNodeName().equals("sender")) { String name = XMLUtils.getAttributeByName(grandchild, "name"); String email = XMLUtils.getAttributeByName(grandchild, "email"); attributes.put(senderParam, formatAddress(name, email)); } else if (grandchild.getNodeName().equals("replyTo")) { String name = XMLUtils.getAttributeByName(grandchild, "name"); String email = XMLUtils.getAttributeByName(grandchild, "email"); attributes.put(replyToAddressFieldParam, formatAddress(name, email)); } } } else if (node.getNodeName().equals("smtp")) { NodeList grandchildren = node.getChildNodes(); for (int k = 0; k < grandchildren.getLength(); k++) { Node grandchild = grandchildren.item(n); if (grandchild.getNodeType() != Node.ELEMENT_NODE) { continue; } else if (node.getNodeName().equals("messageId")) { attributes.put(smtpMessageIdParam, XMLUtils.extractStringFromElement(node)); } else if (node.getNodeName().equals("inReplyToId")) { attributes.put(inReplyToParam, XMLUtils.extractStringFromElement(node)); } } } } } public static String formatAddress(String name, String email) { if ((name != null) && !name.equals("")) { return name + "<" + email + ">"; } else { return email; } } public static void addAddress(Map attributes, String key, String newAddress) { String address = ParamUtils.getParameter(attributes, key, ""); if (address.equals("")) { attributes.put(key, newAddress); } else { attributes.put(key, address + "," + newAddress); } } } |
|
From: Rick K. <ric...@us...> - 2010-03-26 01:21:52
|
Update of /cvsroot/generator-rt/generator_runtime/src/tld In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28711/src/tld Modified Files: gen.tld Log Message: added <gen:translate> tag support Index: gen.tld =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/tld/gen.tld,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gen.tld 23 Nov 2006 16:23:25 -0000 1.1 --- gen.tld 26 Mar 2010 01:21:44 -0000 1.2 *************** *** 12,15 **** --- 12,34 ---- <tag> + <name>translate</name> + <tag-class>generator.runtime.jsp.TranslateTag</tag-class> + <body-content>JSP</body-content> + <description>Translates the body content with the generator's language translation functions</description> + <attribute> + <name>parameters</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>java.lang.Object[]</type> + </attribute> + <attribute> + <name>parameterList</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + <type>java.util.Collection</type> + </attribute> + </tag> + + <tag> <name>forEach</name> <tag-class>generator.runtime.jsp.ForEachTag</tag-class> *************** *** 20,39 **** <name>items</name> <required>false</required> ! <rtexprvalue>false</rtexprvalue> </attribute> <attribute> <name>begin</name> <required>false</required> ! <rtexprvalue>false</rtexprvalue> </attribute> <attribute> <name>end</name> <required>false</required> ! <rtexprvalue>false</rtexprvalue> </attribute> <attribute> <name>step</name> <required>false</required> ! <rtexprvalue>false</rtexprvalue> </attribute> <attribute> --- 39,62 ---- <name>items</name> <required>false</required> ! <rtexprvalue>true</rtexprvalue> ! <type>java.lang.Object</type> </attribute> <attribute> <name>begin</name> <required>false</required> ! <rtexprvalue>true</rtexprvalue> ! <type>int</type> </attribute> <attribute> <name>end</name> <required>false</required> ! <rtexprvalue>true</rtexprvalue> ! <type>int</type> </attribute> <attribute> <name>step</name> <required>false</required> ! <rtexprvalue>true</rtexprvalue> ! <type>int</type> </attribute> <attribute> |
|
From: Rick K. <ric...@us...> - 2010-03-26 01:21:52
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/db In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28711/src/java/generator/runtime/db Modified Files: DBPeer.java Log Message: added <gen:translate> tag support Index: DBPeer.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/db/DBPeer.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** DBPeer.java 21 Oct 2008 10:52:47 -0000 1.14 --- DBPeer.java 26 Mar 2010 01:21:44 -0000 1.15 *************** *** 177,180 **** --- 177,183 ---- float result = attributes.getFloat(retrievalFieldName); return attributes.wasNull() ? null : new Float(result); + } else if (fieldType.isAssignableFrom(Double.class)) { + double result = attributes.getDouble(retrievalFieldName); + return attributes.wasNull() ? null : new Double(result); } else { // Get the clob contents, and read it into a string |
|
From: Rick K. <ric...@us...> - 2010-03-26 01:21:52
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/translation In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28711/src/java/generator/runtime/translation Added Files: BuildTranslationFileFromXSLController.java Log Message: added <gen:translate> tag support --- NEW FILE: BuildTranslationFileFromXSLController.java --- /* * Generator Runtime Servlet Framework * Copyright (C) 2004 Rick Knowles * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * Version 2 as published by the Free Software Foundation. * * This program 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 General Public License Version 2 for more details. * * You should have received a copy of the GNU General Public License * Version 2 along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package generator.runtime.translation; import generator.runtime.controller.Controller; import generator.runtime.log.Log; import generator.runtime.log.LogManager; import generator.runtime.utils.ParamUtils; import generator.runtime.xml.XMLUtils; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class BuildTranslationFileFromXSLController extends Controller { private final Log log = LogManager.getLog(BuildTranslationFileFromXSLController.class); public String execute(Map attributes) { // Scan all xsl sheets under folder, and resolve unique translateables File parentFolder = getParentFolder(); Set translateablePhrases = new HashSet(); Map exceptionsAndFile = new HashMap(); parseChildXSLSheetsForTranslateables(parentFolder, translateablePhrases, exceptionsAndFile); addExtraTranslations(translateablePhrases); log.info("Loaded " + translateablePhrases.size() + " translations from XSL sheets in " + parentFolder.getPath()); // Load the supplied translations sheet File translationsFile = getTranslationsFile(attributes); Map translations = loadTranslations(translationsFile); // Write out the new translation sheet String out = formatTranslationSheet(translateablePhrases, translations, exceptionsAndFile); attributes.put("translationOutput", out); return "OK"; } protected void addExtraTranslations(Set translateablePhrases) {} protected File getParentFolder() { return new File(getProperties().stringProperty("application/@webroot", "."), "WEB-INF/xsl"); } protected File getTranslationsFile(Map attributes) { String language = ParamUtils.getParameter(attributes, "language", "japanese"); return new File(getProperties().stringProperty("application/@webroot", "."), "WEB-INF/translations/" + language + ".xml"); } protected void parseChildXSLSheetsForTranslateables(File parentFolder, Set translateablePhrases, Map exceptionsAndFile) { log.info("Scanning folder for translateable XSL sheets: " + parentFolder.getPath()); File children[] = parentFolder.listFiles(); if (children != null) { for (int n = 0; n < children.length; n++) { if (children[n].isDirectory()) { parseChildXSLSheetsForTranslateables(children[n], translateablePhrases, exceptionsAndFile); } else if (children[n].isFile() && children[n].getName().endsWith(".xsl")) { log.info("Scanning file for translateable XSL sheets: " + children[n].getName()); Document doc = XMLUtils.parseFileToXML(children[n]); scanForTranslateTemplateCall(children[n], doc.getDocumentElement(), translateablePhrases, exceptionsAndFile); } else { log.debug("Skipping non-XSL sheet: " + children[n].getName()); } } } } protected void scanForTranslateTemplateCall(File file, Node node, Set translateablePhrases, Map exceptionsAndFile) { NodeList children = node.getChildNodes(); for (int n = 0; n < children.getLength(); n++) { Node child = children.item(n); if (child.getNodeType() != Node.ELEMENT_NODE) { scanForTranslateTemplateCall(file, child, translateablePhrases, exceptionsAndFile); } else if (child.getNodeName().indexOf("call-template") == -1) { scanForTranslateTemplateCall(file, child, translateablePhrases, exceptionsAndFile); } else { String templateName = XMLUtils.getAttributeByName(child, "name"); if (!templateName.equals("translate")) { scanForTranslateTemplateCall(file, child, translateablePhrases, exceptionsAndFile); } else { // Get the <xsl:with-param name="template"/> element NodeList translateChildren = child.getChildNodes(); for (int k = 0; k < translateChildren.getLength(); k++) { Node translateChild = translateChildren.item(k); if ((translateChild.getNodeType() == Node.ELEMENT_NODE) && (translateChild.getNodeName().indexOf("with-param") != -1)) { String paramName = XMLUtils.getAttributeByName(translateChild, "name"); if (paramName.equals("template")) { String template = XMLUtils.xmlToString("none", translateChild, false, false, null); if (template.equals("<none/>")) { template = XMLUtils.xmlToString("none", child, true, false, null); template = template.substring(6); template = template.substring(0, template.length() - 7); exceptionsAndFile.put(template, file); } else { template = template.substring(6); template = template.substring(0, template.length() - 7); translateablePhrases.add(template); } } else { scanForTranslateTemplateCall(file, translateChild, translateablePhrases, exceptionsAndFile); } } else { scanForTranslateTemplateCall(file, translateChild, translateablePhrases, exceptionsAndFile); } } } } } } protected Map loadTranslations(File translationFile) { Map out = new HashMap(); Document doc = XMLUtils.parseFileToXML(translationFile); Node top = doc.getDocumentElement(); NodeList translations = top.getChildNodes(); for (int n = 0; n < translations.getLength(); n++) { Node child = translations.item(n); if ((child.getNodeType() == Node.ELEMENT_NODE) && (child.getNodeName().equalsIgnoreCase("translation"))) { String key = XMLUtils.getAttributeByName(child, "key"); String translation = XMLUtils.extractStringFromElement(child); out.put(key, translation); } } log.info("Loaded " + out.size() + " translations from " + translationFile.getPath()); return out; } private static final String CR_LF = System.getProperty("line.separator"); protected String formatTranslationSheet(Set translateablePhrases, Map translations, Map exceptionsAndFile) { String keys[] = (String[]) translateablePhrases.toArray(new String[translateablePhrases.size()]); Arrays.sort(keys); List notFound = new ArrayList(); List found = new ArrayList(); // Build case-insensitive lookup Map lcTranslationKeys = new HashMap(); for (Iterator i = translations.keySet().iterator(); i.hasNext(); ) { String key = (String) i.next(); lcTranslationKeys.put(key.toLowerCase(), key); } StringBuffer out = new StringBuffer(); out.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append(CR_LF); out.append("<translations>").append(CR_LF); out.append(" <!-- found in translation sheet and in XSL -->").append(CR_LF); for (int n = 0; n < keys.length; n++) { // For this xsl entry, get the translations file matched case-insensitive String translationKey = (String) lcTranslationKeys.get(keys[n].toLowerCase()); if (translationKey == null) { notFound.add(keys[n]); continue; } String translation = (String) translations.get(translationKey); if (translation != null) { out.append(" <translation key=\"").append(XMLUtils.attValue(keys[n])).append("\">"); out.append(XMLUtils.tagValue(translation)).append("</translation>").append(CR_LF); found.add(keys[n].toLowerCase()); } else { notFound.add(keys[n]); } } out.append(CR_LF); out.append(" <!-- found in translation sheet, but not found in XSL (dont delete, might be used in Java code) -->").append(CR_LF); String extraKeys[] = (String []) translations.keySet().toArray(new String[translations.size()]); Arrays.sort(extraKeys); for (int n = 0; n < extraKeys.length; n++) { if (found.contains(extraKeys[n].toLowerCase())) { continue; } String translation = (String) translations.remove(extraKeys[n]); if (translation != null) { out.append(" <translation key=\"").append(XMLUtils.attValue(extraKeys[n])).append("\">"); out.append(XMLUtils.tagValue(translation)).append("</translation>").append(CR_LF); } } out.append(CR_LF); out.append(" <!-- not found in translation sheet, but found in XSL (NEED TRANSLATIONS FOR THESE) -->").append(CR_LF); out.append(" <!--").append(CR_LF); String notFoundKeys[] = (String[]) notFound.toArray(new String[notFound.size()]); Arrays.sort(notFoundKeys); for (int n = 0; n < notFoundKeys.length; n++) { out.append(" <translation key=\"").append(XMLUtils.attValue(notFoundKeys[n])).append("\">"); out.append("</translation>").append(CR_LF); } out.append(" -->").append(CR_LF); out.append(" <!-- exceptions found in XSL (NEED TRANSLATIONS FOR THESE) -->").append(CR_LF); String exceptionKeys[] = (String[]) exceptionsAndFile.keySet().toArray(new String[exceptionsAndFile.size()]); Arrays.sort(exceptionKeys); for (int n = 0; n < exceptionKeys.length; n++) { File fromFile = (File) exceptionsAndFile.get(exceptionKeys[n]); out.append(" <!-- File: ").append(fromFile.getName()).append(CR_LF); out.append(" ").append(exceptionKeys[n]).append(CR_LF); out.append(" -->").append(CR_LF); } out.append("</translations>").append(CR_LF); return out.toString(); } } |
|
From: Rick K. <ric...@us...> - 2010-03-26 01:21:52
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/jsp In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28711/src/java/generator/runtime/jsp Modified Files: ForEachTag.java Added Files: TranslateTag.java Log Message: added <gen:translate> tag support --- NEW FILE: TranslateTag.java --- /* * Generator Runtime Servlet Framework * Copyright (C) 2004 Rick Knowles * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * Version 2 as published by the Free Software Foundation. * * This program 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 General Public License Version 2 for more details. * * You should have received a copy of the GNU General Public License * Version 2 along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package generator.runtime.jsp; import generator.runtime.exception.ApplicationException; import generator.runtime.log.Log; import generator.runtime.log.LogManager; import generator.runtime.router.AttributesMap; import generator.runtime.router.RouterConstants; import generator.runtime.servlet.ContextInitializer; import generator.runtime.session.HttpSessionWrapper; import generator.runtime.session.ServerSideApplicationState; import generator.runtime.session.ServerSideUserState; import generator.runtime.session.ServletContextWrapper; import generator.runtime.utils.ApplicationProperties; import generator.runtime.utils.ParamUtils; import generator.runtime.utils.StringUtils; import generator.runtime.xml.XMLUtils; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Hashtable; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.JspTagException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.BodyContent; import javax.servlet.jsp.tagext.BodyTagSupport; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; /** * Special tag to translate the contents using the translations cache for the selected language */ public class TranslateTag extends BodyTagSupport { private final Log log = LogManager.getLog(TranslateTag.class); private Object[] parameters; public void setParameters(Object[] parameters) { this.parameters = parameters; } public void setParameterList(Collection parameters) { this.parameters = new ArrayList(parameters).toArray(); } public int doAfterBody() throws JspTagException { try { BodyContent bodyContent = super.getBodyContent(); String bodyString = bodyContent.getString(); JspWriter out = bodyContent.getEnclosingWriter(); String language = getLanguage((HttpServletRequest) pageContext.getRequest()); Map translations = getTranslations(language, new ServletContextWrapper(pageContext.getServletContext())); out.print(translate(bodyString, this.parameters, translations)); bodyContent.clear(); // empty buffer return SKIP_BODY; } catch (IOException e) { throw new ApplicationException("Error during translate tag", e); } // end of catch } protected String getLanguage(HttpServletRequest req) { ServerSideUserState ssus = new HttpSessionWrapper(req); String sessionDefault = (String) ParamUtils.nvl(ssus.getAttribute( RouterConstants.PREFERRED_LANGUAGE_PARAM), "english"); return ParamUtils.getParameter(new AttributesMap(req), RouterConstants.PREFERRED_LANGUAGE_PARAM, sessionDefault); } protected String translate(String template, Object params[], Map translations) { String translated = null; if (translations != null) { translated = (String) translations.get(template); } if (translated == null) { translated = template; } if (params != null) { String tokens[][] = new String[params.length][2]; for (int n = 0; n < params.length; n++) { tokens[n][0] = "[#" + (n + 1) + "]"; tokens[n][1] = ParamUtils.nvl(params[n], "").toString(); } translated = StringUtils.stringReplace(translated, tokens); } return translated; } protected Map getTranslations(String language, ServerSideApplicationState ssas) { String contextKey = "translationMap." + language; synchronized (ssas.getSemaphore(contextKey)) { Map translations = (Map) ssas.getAttribute(contextKey); if (translations == null) { ApplicationProperties props = (ApplicationProperties) ssas.getAttribute(ContextInitializer.ATTR_PROPS); String translationSheet = props.stringProperty("translationSheet/@" + language, "${application/@webroot}/WEB-INF/translations/" + language + ".xml"); File file = new File(translationSheet); if (!file.isFile()) { log.warning("Translation file not found: " + translationSheet); return null; } Document doc = XMLUtils.parseFileToXML(file); NodeList items = doc.getDocumentElement().getChildNodes(); translations = new Hashtable(); for (int n = 0; n < items.getLength(); n++) { Node node = items.item(n); if (node.getNodeType() == Node.ELEMENT_NODE) { String key = XMLUtils.getAttributeByName(node, "key"); String text = XMLUtils.extractStringFromElement(node); if ((key != null) && (text != null)) { translations.put(key, text); } } } log.info("Loaded " + translations.size() + " translations for " + language + " from " + translationSheet); ssas.setAttribute(contextKey, translations); } return translations; } } } Index: ForEachTag.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/jsp/ForEachTag.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ForEachTag.java 23 Dec 2006 06:41:31 -0000 1.3 --- ForEachTag.java 26 Mar 2010 01:21:44 -0000 1.4 *************** *** 26,65 **** import java.util.Iterator; ! import javax.servlet.jsp.JspException; /** * Special tag to extend forEach to allow SearchResult object contents to be iterated over easily */ ! public class ForEachTag extends org.apache.taglibs.standard.tag.el.core.ForEachTag { ! ! public int doStartTag() throws JspException { ! int retCode = super.doStartTag(); ! if ((retCode == EVAL_BODY_INCLUDE) || (retCode == EVAL_BODY_AGAIN)) { ! setExtraLoopVariables(); ! } ! return retCode; ! } ! ! public int doAfterBody() throws JspException { ! int retCode = super.doAfterBody(); ! if ((retCode == EVAL_BODY_INCLUDE) || (retCode == EVAL_BODY_AGAIN)) { ! setExtraLoopVariables(); ! } ! return retCode; ! } ! protected void setExtraLoopVariables() throws JspException { ! Object item = getCurrent(); ! if ((item != null) && (item instanceof SearchResult)) { ! SearchResult sr = (SearchResult) item; DBConnectionWrapper wrapper = DBConnectionWrapperAllocationFilter.getConnectionFromRequest( this.pageContext.getRequest()); DBPeerFactory dbPeerFactory = (DBPeerFactory) pageContext.getServletContext().getAttribute( DBPeerFactoryContextInitializer.ATTR_PEER_FACTORY); ! for (Iterator i = sr.keySet().iterator(); i.hasNext(); ) { ! String key = (String) i.next(); ! this.pageContext.setAttribute(key, sr.get(wrapper, dbPeerFactory, key)); ! } ! } ! } } --- 26,52 ---- import java.util.Iterator; ! import javax.servlet.jsp.JspTagException; /** * Special tag to extend forEach to allow SearchResult object contents to be iterated over easily */ ! public class ForEachTag extends org.apache.taglibs.standard.tag.rt.core.ForEachTag { ! // private final Log log = new Log(ForEachTag.class); ! protected Object next() throws JspTagException { ! Object item = super.next(); ! if ((item != null) && (item instanceof SearchResult)) { ! SearchResult sr = (SearchResult) item; DBConnectionWrapper wrapper = DBConnectionWrapperAllocationFilter.getConnectionFromRequest( this.pageContext.getRequest()); DBPeerFactory dbPeerFactory = (DBPeerFactory) pageContext.getServletContext().getAttribute( DBPeerFactoryContextInitializer.ATTR_PEER_FACTORY); ! for (Iterator i = sr.keySet().iterator(); i.hasNext(); ) { ! String key = (String) i.next(); ! Object value = sr.get(wrapper, dbPeerFactory, key); ! this.pageContext.setAttribute(key, value); ! } ! } ! return item; ! } } |
|
From: Rick K. <ric...@us...> - 2010-03-26 01:21:47
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/translation In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28687/src/java/generator/runtime/translation Log Message: Directory /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/translation added to the repository |
|
From: Rick K. <ric...@us...> - 2010-03-05 07:22:27
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/router In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv10921/src/java/generator/runtime/router Modified Files: RouterUtils.java Log Message: use relative uris for redirects in more places Index: RouterUtils.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/router/RouterUtils.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** RouterUtils.java 16 Nov 2008 15:41:37 -0000 1.40 --- RouterUtils.java 5 Mar 2010 07:22:18 -0000 1.41 *************** *** 463,467 **** cookie.setPath(state.getPath()); } ! cookie.setVersion(0); return cookie; } --- 463,467 ---- cookie.setPath(state.getPath()); } ! cookie.setVersion(1); return cookie; } |
|
From: Rick K. <ric...@us...> - 2010-03-05 07:22:26
|
Update of /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/utils In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv10921/src/java/generator/runtime/utils Modified Files: ServletUtils.java Log Message: use relative uris for redirects in more places Index: ServletUtils.java =================================================================== RCS file: /cvsroot/generator-rt/generator_runtime/src/java/generator/runtime/utils/ServletUtils.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ServletUtils.java 27 Feb 2010 15:37:52 -0000 1.12 --- ServletUtils.java 5 Mar 2010 07:22:18 -0000 1.13 *************** *** 304,306 **** --- 304,324 ---- } } + + public static StringBuffer getRelativeRedirectURI(HttpServletRequest request, String webrootPath, + String prefix, String redirectFromURI) { + File webroot = new File(webrootPath); + String internalWebAppURI = request.getServletPath() + + ((request.getPathInfo() == null) ? "" : request.getPathInfo()); + String canonicalURI = FileUtils.constructOurCanonicalVersion( + new File(webroot, internalWebAppURI), webroot); + + StringBuffer uriBuf = new StringBuffer(); + uriBuf.append(ServletUtils.makeRelativeURI(prefix + redirectFromURI, + prefix + "/" + canonicalURI)); + String qs = request.getQueryString(); + if (!qs.equals("")) { + uriBuf.append("?").append(qs); + } + return uriBuf; + } } |