From 71a39f4652cd51df814c930dd268f3c9ad2aee86 Mon Sep 17 00:00:00 2001 From: "Roberto C. Sanchez" Date: Sat, 29 Mar 2014 10:54:01 -0400 Subject: Imported Upstream version 1.6.0+dfsg --- .../java/src/org/crosswire/sword/orb/SwordOrb.java | 25 ++++++- .../corba/java/src/org/crosswire/util/Base64.java | 22 +++--- .../crosswire/web/i18n/ContextStart.java.notyet | 10 --- .../src/org/crosswire/web/i18n/TranslateTag.java | 87 ---------------------- 4 files changed, 35 insertions(+), 109 deletions(-) delete mode 100644 bindings/corba/java/src/org/crosswire/web/i18n/ContextStart.java.notyet delete mode 100644 bindings/corba/java/src/org/crosswire/web/i18n/TranslateTag.java (limited to 'bindings/corba/java/src/org/crosswire') diff --git a/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java b/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java index 3597b4b..d6987e9 100644 --- a/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java +++ b/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java @@ -1,3 +1,20 @@ +/* + * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) + * CrossWire Bible Society + * P. O. Box 2528 + * Tempe, AZ 85280-2528 + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2. + * + * 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 for more details. + * + */ + package org.crosswire.sword.orb; import java.io.File; @@ -28,7 +45,13 @@ public class SwordOrb extends Object implements HttpSessionBindingListener { public static final String GENBOOKS = "Generic Books"; public static final String DAILYDEVOS = "Daily Devotional"; - static org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(new String[]{}, null); + static java.util.Properties p = new java.util.Properties(); + static { + p.setProperty("com.sun.CORBA.codeset.charsets", "0x05010001, 0x00010109"); // UTF-8, UTF-16 + p.setProperty("com.sun.CORBA.codeset.wcharsets", "0x00010109, 0x05010001"); // UTF-16, UTF-8 + } + + static org.omg.CORBA.ORB orb = org.omg.CORBA_2_3.ORB.init(new String[]{}, p); static Hashtable clients = new Hashtable(); String ior = null; String remoteAddr = null; diff --git a/bindings/corba/java/src/org/crosswire/util/Base64.java b/bindings/corba/java/src/org/crosswire/util/Base64.java index 984dc7b..a34401e 100644 --- a/bindings/corba/java/src/org/crosswire/util/Base64.java +++ b/bindings/corba/java/src/org/crosswire/util/Base64.java @@ -1,6 +1,17 @@ package org.crosswire.util; /** + *

+ * I am placing this code in the Public Domain. Do with it as you will. + * This software comes with no guarantees or warranties but with + * plenty of well-wishing instead! + * Please visit http://iharder.net/xmlizable + * periodically to check for updates or to contribute improvements. + *

+ * + * @author Robert Harder + * @author rob@iharder.net + * @version 1.3.4 * Changed last char from '/' to '-' because cookies can't use '/' so we're not really a BASE64 * standard encoder anymore * Changed package name. --crosswire. @@ -18,17 +29,6 @@ package org.crosswire.util; *
  • v1.3.3 - Fixed I/O streams which were totally messed up.
  • * * - *

    - * I am placing this code in the Public Domain. Do with it as you will. - * This software comes with no guarantees or warranties but with - * plenty of well-wishing instead! - * Please visit http://iharder.net/xmlizable - * periodically to check for updates or to contribute improvements. - *

    - * - * @author Robert Harder - * @author rob@iharder.net - * @version 1.3.4 */ public class Base64 { diff --git a/bindings/corba/java/src/org/crosswire/web/i18n/ContextStart.java.notyet b/bindings/corba/java/src/org/crosswire/web/i18n/ContextStart.java.notyet deleted file mode 100644 index f6823e2..0000000 --- a/bindings/corba/java/src/org/crosswire/web/i18n/ContextStart.java.notyet +++ /dev/null @@ -1,10 +0,0 @@ -package org.crosswire.web.i18n; - -import javax.servlet.jsp.tagext.*; - -public class ContextStart extends TagSupport { - - public ContextStart() { - } - -} diff --git a/bindings/corba/java/src/org/crosswire/web/i18n/TranslateTag.java b/bindings/corba/java/src/org/crosswire/web/i18n/TranslateTag.java deleted file mode 100644 index 1ed20a5..0000000 --- a/bindings/corba/java/src/org/crosswire/web/i18n/TranslateTag.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.crosswire.web.i18n; - -import javax.servlet.jsp.tagext.BodyTagSupport; -import javax.servlet.jsp.tagext.BodyContent; -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.JspTagException; -//import javax.servlet.jsp.JspWriter; -import javax.servlet.http.HttpSession; -//import java.util.HashMap; -//import java.io.StringWriter; -import java.util.Locale; -import java.util.ResourceBundle; -import java.util.MissingResourceException; -import java.util.Properties; -import java.io.FileInputStream; -import java.io.FileOutputStream; - - -public class TranslateTag extends BodyTagSupport { - - private String _key=null; - private ResourceBundle _bundle=null; - private String _lang=null; - - /* Uses code from GNU gettext for translation */ - /* which is covered by the LGPL */ - public String doTranslate(ResourceBundle catalog, String msgid) throws JspTagException { - String hashkey = "" + msgid.hashCode(); - try { - if (catalog != null) { - String result = (String)catalog.getObject(hashkey); - if (result != null) - return result; - } - } catch (MissingResourceException e) { - // want to add the msgid to the properties file - Properties props = new Properties(); - - try { - FileInputStream tbtin = new FileInputStream(pageContext.getServletContext().getRealPath("/WEB-INF/classes/tbt.properties")); - props.load(tbtin); - tbtin.close(); - - props.put(hashkey, msgid); - - FileOutputStream tbtout = new FileOutputStream(pageContext.getServletContext().getRealPath("/WEB-INF/classes/tbt.properties")); - props.store(tbtout, null); - tbtout.close(); - - } - catch(java.io.IOException e2) - { - throw new JspTagException("IO Error: " + e2.getMessage()); - } - - } - return msgid; - } - - public int doAfterBody() throws JspTagException { - BodyContent bc = getBodyContent(); - _key = bc.getString(); - HttpSession session = pageContext.getSession(); - Locale locale = (Locale) session.getAttribute("TranslateLocale"); - - if ((_bundle == null) || (_lang != locale.toString())) { - _lang = locale.toString(); - _bundle = ResourceBundle.getBundle("tbt", locale); - } - - return 0; - } - - public int doEndTag() throws JspException { - try - { - pageContext.getOut().write(doTranslate(_bundle, _key)); - } - catch(java.io.IOException e) - { - throw new JspTagException("IO Error: " + e.getMessage()); - } - return EVAL_PAGE; - } - - -} -- cgit v1.2.3