diff options
Diffstat (limited to 'bindings/corba')
-rw-r--r-- | bindings/corba/Makefile.am | 3 | ||||
-rw-r--r-- | bindings/corba/java/Makefile | 7 | ||||
-rw-r--r-- | bindings/corba/java/Makefile.in | 43 | ||||
-rw-r--r-- | bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java | 23 | ||||
-rw-r--r-- | bindings/corba/omniorbcpp/Makefile | 6 | ||||
-rw-r--r-- | bindings/corba/omniorbcpp/server.cpp | 9 | ||||
-rw-r--r-- | bindings/corba/omniorbcpp/swordorb-impl.cpp | 125 | ||||
-rw-r--r-- | bindings/corba/omniorbcpp/swordorb-impl.hpp | 14 | ||||
-rw-r--r-- | bindings/corba/omniorbcpp/testclient.cpp | 13 | ||||
-rw-r--r-- | bindings/corba/orbitcpp/server.cpp | 11 | ||||
-rw-r--r-- | bindings/corba/orbitcpp/swordorb-impl.cpp | 62 | ||||
-rw-r--r-- | bindings/corba/orbitcpp/swordorb-impl.hpp | 15 | ||||
-rw-r--r-- | bindings/corba/orbitcpp/testclient.cpp | 13 | ||||
-rw-r--r-- | bindings/corba/orbitcpp/webmgr.hpp | 23 | ||||
-rw-r--r-- | bindings/corba/swordorb.idl | 7 |
15 files changed, 224 insertions, 150 deletions
diff --git a/bindings/corba/Makefile.am b/bindings/corba/Makefile.am deleted file mode 100644 index b2dff05..0000000 --- a/bindings/corba/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -EXTRA_DIST = swordorb.idl - -SUBDIRS = orbitcpp omniorbcpp java diff --git a/bindings/corba/java/Makefile b/bindings/corba/java/Makefile index c4ae46c..8b32da1 100644 --- a/bindings/corba/java/Makefile +++ b/bindings/corba/java/Makefile @@ -1,9 +1,10 @@ #CHANGE THESE TO MATCH YOUR SYSTEM TOMCAT_HOME=/opt/tomcat -instdir=${TOMCAT_HOME}/webapps/swordweb +#instdir=${TOMCAT_HOME}/webapps/swordweb # Typically you'll point this to your home directory, e.g. -#instdir=/home/swordweb/livehtml/webapp +instdir=/home/swordweb/livehtml/webapp +#instdir=/home/sword/html #instdir=/home/scribe/src/swordweb/webapp SERVLET_LIB=${TOMCAT_HOME}/lib/servlet-api.jar @@ -30,4 +31,4 @@ clean: rm -rf classes/* install: - cp -a classes/org/ ${instdir}/WEB-INF/classes/ + cp -r classes/org/ ${instdir}/WEB-INF/classes/ diff --git a/bindings/corba/java/Makefile.in b/bindings/corba/java/Makefile.in deleted file mode 100644 index 320afcc..0000000 --- a/bindings/corba/java/Makefile.in +++ /dev/null @@ -1,43 +0,0 @@ - -TOMCAT_HOME = @TOMCAT_HOME@ -VERSION = @VERSION@ -JAVAC = @JAVAC@ -top_srcdir = @top_srcdir@ -top_builddir = @top_builddir@ -INSTALL = @INSTALL@ -JAR = @JAR@ - -#SWORDORBJAR=sword-orb-$(VERSION).jar -SWORDORBJAR=sword-orb.jar - -all: $(SWORDORBJAR) - -src/org/crosswire/sword/orb/SWMgr.java: $(top_builddir)/corba/java/src/org/crosswire/util/Base64.java - idlj -pkgTranslate swordorb org.crosswire.sword.orb -td src $(top_srcdir)/corba/swordorb.idl - -classes/org/crosswire/sword/orb/SwordOrb.class: src/org/crosswire/sword/orb/SWMgr.java - mkdir -p $(top_builddir)/corba/java/classes - $(JAVAC) -classpath ${TOMCAT_HOME}/common/lib/servlet-api.jar -d $(top_builddir)/corba/java/classes -sourcepath src src/org/crosswire/sword/orb/*.java src/org/crosswire/util/*.java - -$(top_builddir)/corba/java/src/org/crosswire/util/Base64.java: - cp -a $(top_srcdir)/corba/java/src . - find . -name .svn|xargs rm -r - -clean: - -rm src/org/crosswire/sword/orb/SW*.java - -rm src/org/crosswire/sword/orb/_SW*.java - -rm src/org/crosswire/sword/orb/Mod*.java - -rm src/org/crosswire/sword/orb/Search*.java - -rm src/org/crosswire/sword/orb/String*.java - -rm -rf classes/* - -rmdir -p src/org/crosswire/sword/orb - -rm $(SWORDORBJAR) - -$(SWORDORBJAR): classes/org/crosswire/sword/orb/SwordOrb.class - $(JAR) cf $(SWORDORBJAR) -C $(top_builddir)/corba/java/classes org - -install: - @INSTALL@ $(SWORDORBJAR) $(TOMCAT_HOME)/common/lib - -uninstall: - -rm $(TOMCAT_HOME)/common/lib/$(SWORDORBJAR) 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 bde7478..aab6001 100644 --- a/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java +++ b/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java @@ -1,5 +1,10 @@ -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * SwordOrb.java - + * + * $Id: SwordOrb.java 2833 2013-06-29 06:40:28Z chrislit $ + * + * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -35,9 +40,9 @@ import java.util.Properties; public class SwordOrb extends Object implements HttpSessionBindingListener { public static Properties config = null; public static String ORBEXE = "swordorbserver"; - public static final int MAX_REMOTE_ADDR_CONNECTIONS = 20; - public static final int MAX_ACCESS_COUNT_PER_INTERVAL = 10; - public static final long MAX_ACCESS_COUNT_INTERVAL = 10 * 1000; // milliseconds + public static final int MAX_REMOTE_ADDR_CONNECTIONS = 10; + public static final int MAX_ACCESS_COUNT_PER_INTERVAL = 50; + public static final long MAX_ACCESS_COUNT_INTERVAL = 50 * 1000; // milliseconds public static final long BLACKLIST_DURATION = 10 * 60 * 1000; // milliseconds public static final String BIBLES = "Biblical Texts"; public static final String COMMENTARIES = "Commentaries"; @@ -53,7 +58,7 @@ public class SwordOrb extends Object implements HttpSessionBindingListener { public static final int NONE = 0; // set this to your desired debug output level - public static int debugLevel = INFO; + public static int debugLevel = WARN; static void log(int level, String message, Throwable e) { @@ -256,7 +261,11 @@ log(INFO, "No ORB found in session; constructing a new instance", null); session.setAttribute("SwordOrb", orb); } - else throw new Exception("Max Remote Addr Connections from: ["+remoteAddr+"]"); + else { + // recycle oldest orb + orb = orbs.remove(0); + orbs.add(orb); + } } else { log(INFO, "ORB found in session", null); diff --git a/bindings/corba/omniorbcpp/Makefile b/bindings/corba/omniorbcpp/Makefile index 021f0dd..5385fb5 100644 --- a/bindings/corba/omniorbcpp/Makefile +++ b/bindings/corba/omniorbcpp/Makefile @@ -16,9 +16,9 @@ LIBS += $(shell PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig pkg-config --libs omniOR LIBS += -L/usr/lib64 #comment out for release -CXXFLAGS += -g -O0 -CFLAGS += -g -O0 -LDFLAGS += -g -O0 +#CXXFLAGS += -g -O0 +#CFLAGS += -g -O0 +#LDFLAGS += -g -O0 #----------------------------------------------------------------------------- diff --git a/bindings/corba/omniorbcpp/server.cpp b/bindings/corba/omniorbcpp/server.cpp index 8f33d23..b6f0ff5 100644 --- a/bindings/corba/omniorbcpp/server.cpp +++ b/bindings/corba/omniorbcpp/server.cpp @@ -1,5 +1,10 @@ -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * server.cpp - + * + * $Id: server.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * + * Copyright 2009-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 diff --git a/bindings/corba/omniorbcpp/swordorb-impl.cpp b/bindings/corba/omniorbcpp/swordorb-impl.cpp index d36c6a8..a6572ac 100644 --- a/bindings/corba/omniorbcpp/swordorb-impl.cpp +++ b/bindings/corba/omniorbcpp/swordorb-impl.cpp @@ -1,5 +1,10 @@ -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * swordorb-impl.cpp - omniorb bindings + * + * $Id: swordorb-impl.cpp 2967 2013-08-18 16:15:46Z scribe $ + * + * Copyright 2009-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -21,6 +26,7 @@ #include <swordorb-impl.hpp> #include <swmgr.h> +#include <installmgr.h> #include <versekey.h> #include <treekeyidx.h> #include <swbuf.h> @@ -58,22 +64,22 @@ swordorb::SearchHitList* swordorb_SWModule_i::search(const char* istr, swordorb: sword::ListKey result; if ((scope) && (strlen(scope)) > 0) { - sword::SWKey *p = delegate->CreateKey(); + sword::SWKey *p = delegate->createKey(); sword::VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p); if (!parser) { delete p; parser = new VerseKey(); } *parser = delegate->getKeyText(); - lscope = parser->ParseVerseList(scope, *parser, true); - result = delegate->Search(istr, stype, flags, &lscope); + lscope = parser->parseVerseList(scope, *parser, true); + result = delegate->search(istr, stype, flags, &lscope); delete parser; } - else result = delegate->Search(istr, stype, flags); + else result = delegate->search(istr, stype, flags); swordorb::SearchHitList *retVal = new swordorb::SearchHitList; int count = 0; - for (result = sword::TOP; !result.Error(); result++) count++; + for (result = sword::TOP; !result.popError(); result++) count++; retVal->length(count); int i = 0; @@ -82,8 +88,8 @@ swordorb::SearchHitList* swordorb_SWModule_i::search(const char* istr, swordorb: if ((count) && (long)result.getElement()->userData) result.sort(); - for (result = sword::TOP; !result.Error(); result++) { - (*retVal)[i].modName = CORBA::string_dup(assureValidUTF8(delegate->Name())); + for (result = sword::TOP; !result.popError(); result++) { + (*retVal)[i].modName = CORBA::string_dup(assureValidUTF8(delegate->getName())); (*retVal)[i].key = CORBA::string_dup(assureValidUTF8((const char *)result)); (*retVal)[i++].score = (long)result.getElement()->userData; } @@ -92,7 +98,7 @@ swordorb::SearchHitList* swordorb_SWModule_i::search(const char* istr, swordorb: } ::CORBA::Char swordorb_SWModule_i::error() { - return delegate->Error(); + return delegate->popError(); } ::CORBA::Long swordorb_SWModule_i::getEntrySize(){ @@ -100,7 +106,7 @@ swordorb::SearchHitList* swordorb_SWModule_i::search(const char* istr, swordorb: } swordorb::StringList* swordorb_SWModule_i::getEntryAttribute(const char* level1, const char* level2, const char* level3, ::CORBA::Boolean filtered){ - delegate->RenderText(); // force parse + delegate->renderText(); // force parse std::vector<SWBuf> results; swordorb::StringList *retVal = new swordorb::StringList; @@ -113,35 +119,35 @@ swordorb::StringList* swordorb_SWModule_i::getEntryAttribute(const char* level1, i1Start = entryAttribs.find(level1); i1End = i1Start; if (i1End != entryAttribs.end()) - i1End++; + ++i1End; } else { i1Start = entryAttribs.begin(); i1End = entryAttribs.end(); } - for (;i1Start != i1End; i1Start++) { + for (;i1Start != i1End; ++i1Start) { if ((level2) && (*level2)) { i2Start = i1Start->second.find(level2); i2End = i2Start; if (i2End != i1Start->second.end()) - i2End++; + ++i2End; } else { i2Start = i1Start->second.begin(); i2End = i1Start->second.end(); } - for (;i2Start != i2End; i2Start++) { + for (;i2Start != i2End; ++i2Start) { if ((level3) && (*level3)) { i3Start = i2Start->second.find(level3); i3End = i3Start; if (i3End != i2Start->second.end()) - i3End++; + ++i3End; } else { i3Start = i2Start->second.begin(); i3End = i2Start->second.end(); } - for (;i3Start != i3End; i3Start++) { + for (;i3Start != i3End; ++i3Start) { results.push_back(i3Start->second); } if (i3Start != i3End) @@ -154,7 +160,7 @@ swordorb::StringList* swordorb_SWModule_i::getEntryAttribute(const char* level1, retVal->length(results.size()); for (int i = 0; i < results.size(); i++) { if (filtered) { - (*retVal)[i] = CORBA::string_dup(assureValidUTF8(delegate->RenderText(results[i].c_str()))); + (*retVal)[i] = CORBA::string_dup(assureValidUTF8(delegate->renderText(results[i].c_str()))); } else { (*retVal)[i] = CORBA::string_dup(assureValidUTF8(results[i].c_str())); @@ -169,15 +175,15 @@ swordorb::StringList* swordorb_SWModule_i::parseKeyList(const char* keyText){ swordorb::StringList *retVal = new swordorb::StringList; if (parser) { sword::ListKey result; - result = parser->ParseVerseList(keyText, *parser, true); + result = parser->parseVerseList(keyText, *parser, true); int count = 0; - for (result = sword::TOP; !result.Error(); result++) { + for (result = sword::TOP; !result.popError(); result++) { count++; } retVal->length(count); count = 0; - for (result = sword::TOP; !result.Error(); result++) { - (*retVal)[count++] = CORBA::string_dup(assureValidUTF8((const char *)result)); + for (result = sword::TOP; !result.popError(); result++) { + (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(VerseKey(result).getOSISRef())); } } else { @@ -203,18 +209,18 @@ void swordorb_SWModule_i::setKeyText(const char* keyText) { } } else if (*keyText=='=') { - vkey->Headings(true); - vkey->AutoNormalize(false); + vkey->setIntros(true); + vkey->setAutoNormalize(false); vkey->setText(keyText+1); return; } } - delegate->KeyText(keyText); + delegate->setKey(keyText); } char* swordorb_SWModule_i::getKeyText(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->KeyText())); + return CORBA::string_dup(assureValidUTF8((char *)delegate->getKeyText())); } ::CORBA::Boolean swordorb_SWModule_i::hasKeyChildren(){ @@ -236,7 +242,7 @@ swordorb::StringList* swordorb_SWModule_i::getKeyChildren(){ sword::VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key); if (vkey) { - retVal->length(7); + retVal->length(8); SWBuf num; num.appendFormatted("%d", vkey->getTestament()); (*retVal)[0] = CORBA::string_dup(num.c_str()); @@ -256,6 +262,7 @@ swordorb::StringList* swordorb_SWModule_i::getKeyChildren(){ num.appendFormatted("%d", vkey->getVerseMax()); (*retVal)[5] = CORBA::string_dup(num.c_str()); (*retVal)[6] = CORBA::string_dup(vkey->getBookName()); + (*retVal)[7] = CORBA::string_dup(vkey->getOSISRef()); } else { TreeKeyIdx *tkey = SWDYNAMIC_CAST(TreeKeyIdx, key); @@ -295,15 +302,15 @@ char* swordorb_SWModule_i::getKeyParent(){ } char* swordorb_SWModule_i::getName(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->Name())); + return CORBA::string_dup(assureValidUTF8((char *)delegate->getName())); } char* swordorb_SWModule_i::getDescription(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->Description())); + return CORBA::string_dup(assureValidUTF8((char *)delegate->getDescription())); } char* swordorb_SWModule_i::getCategory(){ - SWBuf type = delegate->Type(); + SWBuf type = delegate->getType(); SWBuf cat = delegate->getConfigEntry("Category"); if (cat.length() > 0) type = cat; @@ -323,15 +330,19 @@ void swordorb_SWModule_i::begin(){ } char* swordorb_SWModule_i::getStripText(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->StripText())); + return CORBA::string_dup(assureValidUTF8((const char *)delegate->stripText())); } char* swordorb_SWModule_i::getRenderText(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->RenderText())); + return CORBA::string_dup(assureValidUTF8((const char *)delegate->renderText())); +} + +char* swordorb_SWModule_i::getRenderHeader(){ + return CORBA::string_dup(assureValidUTF8(((const char *)(delegate->getRenderHeader() ? delegate->getRenderHeader():"")))); } char* swordorb_SWModule_i::getRawEntry(){ - return CORBA::string_dup(assureValidUTF8((char *)delegate->getRawEntry())); + return CORBA::string_dup(assureValidUTF8((const char *)delegate->getRawEntry())); } void swordorb_SWModule_i::setRawEntry(const char* entryBuffer){ @@ -366,7 +377,7 @@ swordorb::ModInfoList* swordorb_SWMgr_i::getModInfoList() { sword::SWModule *module = 0; int size = 0; - for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); it++) { + for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); ++it) { if ((!(it->second->getConfigEntry("CipherKey"))) || (*(it->second->getConfigEntry("CipherKey")))) size++; } @@ -374,17 +385,17 @@ swordorb::ModInfoList* swordorb_SWMgr_i::getModInfoList() { // if (size > 183) size = 183; milist->length(size); int i = 0; - for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); it++) { + for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); ++it) { module = it->second; if ((!(module->getConfigEntry("CipherKey"))) || (*(module->getConfigEntry("CipherKey")))) { - SWBuf type = module->Type(); + SWBuf type = module->getType(); SWBuf cat = module->getConfigEntry("Category"); if (cat.length() > 0) type = cat; - (*milist)[i].name = CORBA::string_dup(assureValidUTF8(module->Name())); - (*milist)[i].description = CORBA::string_dup(assureValidUTF8(module->Description())); + (*milist)[i].name = CORBA::string_dup(assureValidUTF8(module->getName())); + (*milist)[i].description = CORBA::string_dup(assureValidUTF8(module->getDescription())); (*milist)[i].category = CORBA::string_dup(assureValidUTF8(type.c_str())); - (*milist)[i++].language = CORBA::string_dup(assureValidUTF8(module->Lang())); + (*milist)[i++].language = CORBA::string_dup(assureValidUTF8(module->getLanguage())); if (i >= size) break; } } @@ -437,12 +448,12 @@ swordorb::StringList* swordorb_SWMgr_i::getGlobalOptions(){ sword::StringList options = delegate->getGlobalOptions(); swordorb::StringList *retVal = new swordorb::StringList; int count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { count++; } retVal->length(count); count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(it->c_str())); } return retVal; @@ -452,12 +463,12 @@ swordorb::StringList* swordorb_SWMgr_i::getGlobalOptionValues(const char* option sword::StringList options = delegate->getGlobalOptionValues(option); swordorb::StringList *retVal = new swordorb::StringList; int count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { count++; } retVal->length(count); count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(it->c_str())); } return retVal; @@ -483,12 +494,12 @@ swordorb::StringList* swordorb_SWMgr_i::getAvailableLocales(){ sword::StringList localeNames = LocaleMgr::getSystemLocaleMgr()->getAvailableLocales(); swordorb::StringList *retVal = new swordorb::StringList; int count = 0; - for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); it++) { + for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); ++it) { count++; } retVal->length(count); count = 0; - for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); it++) { + for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); ++it) { (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(it->c_str())); } return retVal; @@ -499,3 +510,27 @@ void swordorb_SWMgr_i::setDefaultLocale(const char* name){ } +char* swordorb_SWMgr_i::translate(const char* text, const char* localeName) { + return CORBA::string_dup(LocaleMgr::getSystemLocaleMgr()->translate(text, localeName)); +} + +swordorb::StringList* swordorb_SWMgr_i::getRepos() { + swordorb::StringList *retVal = new swordorb::StringList; + int count = 0; + sword::InstallMgr *installMgr = new sword::InstallMgr(); + for (InstallSourceMap::iterator it = installMgr->sources.begin(); it != installMgr->sources.end(); ++it) { + count++; + } + retVal->length(count); + count = 0; + for (InstallSourceMap::iterator it = installMgr->sources.begin(); it != installMgr->sources.end(); ++it) { + (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(it->second->caption.c_str())); + } + delete installMgr; + return retVal; +} + +// Don't call me yet +swordorb::_objref_SWMgr* swordorb_SWMgr_i::getShadowMgr(const char*) { + return 0; +} diff --git a/bindings/corba/omniorbcpp/swordorb-impl.hpp b/bindings/corba/omniorbcpp/swordorb-impl.hpp index 400bcc3..fc9468a 100644 --- a/bindings/corba/omniorbcpp/swordorb-impl.hpp +++ b/bindings/corba/omniorbcpp/swordorb-impl.hpp @@ -1,5 +1,10 @@ -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * swordorb-impl.hpp - + * + * $Id: swordorb-impl.hpp 2833 2013-06-29 06:40:28Z chrislit $ + * + * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -62,9 +67,11 @@ public: void begin(); char* getStripText(); char* getRenderText(); + char* getRenderHeader(); char* getRawEntry(); void setRawEntry(const char* entryBuffer); char* getConfigEntry(const char* key); + char* translate(const char* text, const char* localeName); void deleteSearchFramework(); ::CORBA::Boolean hasSearchFramework(); @@ -107,6 +114,9 @@ public: void setJavascript(::CORBA::Boolean val); swordorb::StringList* getAvailableLocales(); void setDefaultLocale(const char* name); + char* translate(const char* text, const char* localeName); + swordorb::StringList* getRepos(); + swordorb::_objref_SWMgr* getShadowMgr(const char*); }; diff --git a/bindings/corba/omniorbcpp/testclient.cpp b/bindings/corba/omniorbcpp/testclient.cpp index ad7345d..4adff99 100644 --- a/bindings/corba/omniorbcpp/testclient.cpp +++ b/bindings/corba/omniorbcpp/testclient.cpp @@ -1,7 +1,10 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: f; c-basic-offset: 4 -*- */ - -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * testclient.cpp - + * + * $Id: testclient.cpp 2973 2013-09-10 11:53:43Z scribe $ + * + * Copyright 2009-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -75,6 +78,7 @@ int main (int argc, char *argv[]) std::cout << (*localeNames)[i] << "\n"; } */ + std::cout << "filterText: " << mgr->filterText("OSISPlain", "this should be <abbr type=\"nomSac\"><hi rend=\"ol\">overlined</hi></abbr>") << "\n"; mgr->setDefaultLocale("de"); mgr->setJavascript(true); mgr->setGlobalOption("Textual Variants", "Secondary Reading"); @@ -93,6 +97,7 @@ int main (int argc, char *argv[]) std::cout << "KeyText: " << module->getKeyText() << "\n"; std::cout << "Text: " << module->getRenderText() << "\n"; } + std::cout << "RenderHeader:\n" << module->getRenderHeader() << "\n"; /* swordorb::SearchHitList *searchResults; bool lucene = module->hasSearchFramework(); diff --git a/bindings/corba/orbitcpp/server.cpp b/bindings/corba/orbitcpp/server.cpp index b7df734..4f86500 100644 --- a/bindings/corba/orbitcpp/server.cpp +++ b/bindings/corba/orbitcpp/server.cpp @@ -1,7 +1,10 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ - -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * server.cpp - + * + * $Id: server.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * + * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 diff --git a/bindings/corba/orbitcpp/swordorb-impl.cpp b/bindings/corba/orbitcpp/swordorb-impl.cpp index d45832a..4d40727 100644 --- a/bindings/corba/orbitcpp/swordorb-impl.cpp +++ b/bindings/corba/orbitcpp/swordorb-impl.cpp @@ -1,5 +1,10 @@ -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * swordorb-impl.cpp - + * + * $Id: swordorb-impl.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * + * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -18,6 +23,7 @@ #include "swordorb-impl.hpp" #include <iostream> #include <swmgr.h> +#include <installmgr.h> #include <versekey.h> #include <treekeyidx.h> #include <swbuf.h> @@ -44,13 +50,13 @@ ModInfoList *SWMgr_impl::getModInfoList() throw(CORBA::SystemException) { ModInfoList *milist = new ModInfoList; sword::SWModule *module = 0; int size = 0; - for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); it++) { + for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); ++it) { if ((!(it->second->getConfigEntry("CipherKey"))) || (*(it->second->getConfigEntry("CipherKey")))) size++; } milist->length(size); int i = 0; - for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); it++) { + for (sword::ModMap::iterator it = delegate->Modules.begin(); it != delegate->Modules.end(); ++it) { module = it->second; if ((!(module->getConfigEntry("CipherKey"))) || (*(module->getConfigEntry("CipherKey")))) { SWBuf type = module->Type(); @@ -88,12 +94,12 @@ StringList *SWMgr_impl::getGlobalOptions() throw(CORBA::SystemException) { sword::StringList options = delegate->getGlobalOptions(); StringList *retVal = new StringList; int count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { count++; } retVal->length(count); count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { (*retVal)[count++] = CORBA::string_dup(it->c_str()); } return retVal; @@ -104,12 +110,12 @@ StringList *SWMgr_impl::getGlobalOptionValues(const char *option) throw(CORBA::S sword::StringList options = delegate->getGlobalOptionValues(option); StringList *retVal = new StringList; int count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { count++; } retVal->length(count); count = 0; - for (sword::StringList::iterator it = options.begin(); it != options.end(); it++) { + for (sword::StringList::iterator it = options.begin(); it != options.end(); ++it) { (*retVal)[count++] = CORBA::string_dup(it->c_str()); } return retVal; @@ -236,35 +242,35 @@ StringList *SWModule_impl::getEntryAttribute(const char *level1, const char *lev i1Start = entryAttribs.find(level1); i1End = i1Start; if (i1End != entryAttribs.end()) - i1End++; + ++i1End; } else { i1Start = entryAttribs.begin(); i1End = entryAttribs.end(); } - for (;i1Start != i1End; i1Start++) { + for (;i1Start != i1End; ++i1Start) { if ((level2) && (*level2)) { i2Start = i1Start->second.find(level2); i2End = i2Start; if (i2End != i1Start->second.end()) - i2End++; + ++i2End; } else { i2Start = i1Start->second.begin(); i2End = i1Start->second.end(); } - for (;i2Start != i2End; i2Start++) { + for (;i2Start != i2End; ++i2Start) { if ((level3) && (*level3)) { i3Start = i2Start->second.find(level3); i3End = i3Start; if (i3End != i2Start->second.end()) - i3End++; + ++i3End; } else { i3Start = i2Start->second.begin(); i3End = i2Start->second.end(); } - for (;i3Start != i3End; i3Start++) { + for (;i3Start != i3End; ++i3Start) { results.push_back(i3Start->second); } if (i3Start != i3End) @@ -394,12 +400,12 @@ StringList *SWMgr_impl::getAvailableLocales() throw(CORBA::SystemException) { sword::StringList localeNames = LocaleMgr::getSystemLocaleMgr()->getAvailableLocales(); StringList *retVal = new StringList; int count = 0; - for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); it++) { + for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); ++it) { count++; } retVal->length(count); count = 0; - for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); it++) { + for (sword::StringList::iterator it = localeNames.begin(); it != localeNames.end(); ++it) { (*retVal)[count++] = CORBA::string_dup(it->c_str()); } return retVal; @@ -410,4 +416,28 @@ void SWMgr_impl::setDefaultLocale(const char *name) throw(CORBA::SystemException LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(name); } +char* SWMgr_impl::translate(const char* text, const char* localeName) throw(CORBA::SystemException) { + return CORBA::string_dup(LocaleMgr::getSystemLocaleMgr()->translate(text, localeName)); +} + +swordorb::StringList *SWMgr_impl::getRepos() throw(CORBA::SystemException) { + swordorb::StringList *retVal = new swordorb::StringList; + int count = 0; + sword::InstallMgr *installMgr = new sword::InstallMgr(); + for (InstallSourceMap::iterator it = installMgr->sources.begin(); it != installMgr->sources.end(); ++it) { + count++; + } + retVal->length(count); + count = 0; + for (InstallSourceMap::iterator it = installMgr->sources.begin(); it != installMgr->sources.end(); ++it) { + (*retVal)[count++] = CORBA::string_dup(assureValidUTF8(it->second->caption.c_str())); + } + delete installMgr; + return retVal; +} + +// Don't call me yet +swordorb::SWMgr_ptr SWMgr_impl::getShadowMgr (CORBA_char const *repoName) throw (CORBA::SystemException) { + return 0; +} } diff --git a/bindings/corba/orbitcpp/swordorb-impl.hpp b/bindings/corba/orbitcpp/swordorb-impl.hpp index 3acc1b8..4960f9a 100644 --- a/bindings/corba/orbitcpp/swordorb-impl.hpp +++ b/bindings/corba/orbitcpp/swordorb-impl.hpp @@ -1,5 +1,10 @@ -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * swordorb-impl.hpp - + * + * $Id: swordorb-impl.hpp 2833 2013-06-29 06:40:28Z chrislit $ + * + * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -43,7 +48,7 @@ public: void terminateSearch() throw(CORBA::SystemException) { delegate->terminateSearch = true; } char error() throw(CORBA::SystemException) { return delegate->Error(); } CORBA::Long getEntrySize() throw(CORBA::SystemException) { return delegate->getEntrySize(); } - void setKeyText(const char *key) throw(CORBA::SystemException) { delegate->KeyText(key); } + void setKeyText(const char *key) throw(CORBA::SystemException); char *getKeyText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->KeyText()); } StringList *getKeyChildren() throw(CORBA::SystemException); char *getKeyParent() throw(CORBA::SystemException); @@ -57,6 +62,7 @@ public: char *getStripText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->StripText()); } StringList *getEntryAttribute(const char *level1, const char *level2, const char *level3, CORBA::Boolean filtered) throw(CORBA::SystemException); char *getRenderText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->RenderText()); } + char *getRenderHeader() throw(CORBA::SystemException) { return CORBA::string_dup((char *)((delegate->getRenderHeader()?delegate->getRenderHeader():""))); } char *getRawEntry() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->getRawEntry()); } void setRawEntry(const char *entryBuffer) throw(CORBA::SystemException) { delegate->setEntry(entryBuffer); } char *getConfigEntry(const char *key) throw(CORBA::SystemException) { return CORBA::string_dup(((char *)delegate->getConfigEntry(key)) ? (char *)delegate->getConfigEntry(key):SWNULL); } @@ -93,6 +99,9 @@ public: void setJavascript(CORBA::Boolean) throw(CORBA::SystemException); StringList *getAvailableLocales() throw(CORBA::SystemException); void setDefaultLocale(const char *name) throw(CORBA::SystemException); + char *translate(const char *text, const char *locale) throw(CORBA::SystemException); + StringList *getRepos() throw(CORBA::SystemException); + swordorb::SWMgr_ptr getShadowMgr (CORBA_char const *repoName) throw (CORBA::SystemException); }; }; diff --git a/bindings/corba/orbitcpp/testclient.cpp b/bindings/corba/orbitcpp/testclient.cpp index 340ea73..c1b358a 100644 --- a/bindings/corba/orbitcpp/testclient.cpp +++ b/bindings/corba/orbitcpp/testclient.cpp @@ -1,8 +1,11 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: f; c-basic-offset: 4 -*- */ - -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) - * CrossWire Bible Society +/****************************************************************************** + * + * testclient.cpp - + * + * $Id: testclient.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * + * Copyright 2003-2013 CrossWire Bible Society (http://www.crosswire.org) + * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 * diff --git a/bindings/corba/orbitcpp/webmgr.hpp b/bindings/corba/orbitcpp/webmgr.hpp index c5c6207..048882c 100644 --- a/bindings/corba/orbitcpp/webmgr.hpp +++ b/bindings/corba/orbitcpp/webmgr.hpp @@ -1,5 +1,10 @@ -/* - * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) +/****************************************************************************** + * + * webmgr.cpp - + * + * $Id: webmgr.hpp 2833 2013-06-29 06:40:28Z chrislit $ + * + * Copyright 2005-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society * P. O. Box 2528 * Tempe, AZ 85280-2528 @@ -67,12 +72,12 @@ public: void AddGlobalOptions(SWModule *module, ConfigEntMap §ion, ConfigEntMap::iterator start, ConfigEntMap::iterator end) { // ThML word stuff needs to process before strongs strip - if (module->Markup() == FMT_THML) { - module->AddOptionFilter(thmlWordJS); + if (module->getMarkup() == FMT_THML) { + module->addOptionFilter(thmlWordJS); } - if (module->Markup() == FMT_GBF) { - module->AddOptionFilter(gbfWordJS); + if (module->getMarkup() == FMT_GBF) { + module->addOptionFilter(gbfWordJS); } // add other module filters @@ -94,12 +99,12 @@ public: if (module->getConfig().has("GlobalOptionFilter", "ThMLVariants")) { OptionFilterMap::iterator it = optionFilters.find("ThMLVariants"); if (it != optionFilters.end()) { - module->AddOptionFilter((*it).second); // add filter to module and option as a valid option + module->addOptionFilter((*it).second); // add filter to module and option as a valid option } } - if (module->Markup() == FMT_OSIS) { - module->AddOptionFilter(osisWordJS); + if (module->getMarkup() == FMT_OSIS) { + module->addOptionFilter(osisWordJS); } } diff --git a/bindings/corba/swordorb.idl b/bindings/corba/swordorb.idl index 9d34bec..e72bf56 100644 --- a/bindings/corba/swordorb.idl +++ b/bindings/corba/swordorb.idl @@ -75,7 +75,7 @@ interface SWModule { // This method returns child nodes for a genbook, // but has special handling if called on a VerseKey module: - // [0..6] [testament, book, chapter, verse, chapterMax, verseMax, bookName] + // [0..7] [testament, book, chapter, verse, chapterMax, verseMax, bookName, osisRef] StringList getKeyChildren(); string getKeyParent(); @@ -87,6 +87,8 @@ interface SWModule { void begin(); string getStripText(); string getRenderText(); + // CSS styles associated with this text + string getRenderHeader(); string getRawEntry(); void setRawEntry(in string entryBuffer); string getConfigEntry(in string key); @@ -115,6 +117,9 @@ interface SWMgr { void setJavascript(in boolean val); StringList getAvailableLocales(); void setDefaultLocale(in string name); + string translate(in string text, in string localeName); + StringList getRepos(); + SWMgr getShadowMgr(in string repoName); }; }; |