summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGeir Magnusson Jr <geir@geir-magnusson-jrs-mac-pro.local>2008-06-06 08:39:04 -0400
committerGeir Magnusson Jr <geir@geir-magnusson-jrs-mac-pro.local>2008-06-06 08:39:04 -0400
commit68fc2216b0034b01d12c5fcb0603430f3c351d1a (patch)
tree1a7e817bf1bb8edcfca2f3218361c14dcbe8ad6e /db
parent4cd64845186ceecdd196a38ee1778b3f99f4e5ea (diff)
downloadmongo-68fc2216b0034b01d12c5fcb0603430f3c351d1a.tar.gz
db.cpp, javajs.cpp : allow user to specify directory for appserver, rather than regular search
Diffstat (limited to 'db')
-rw-r--r--db/db.cpp13
-rw-r--r--db/javajs.cpp40
-rw-r--r--db/javajs.h2
3 files changed, 48 insertions, 7 deletions
diff --git a/db/db.cpp b/db/db.cpp
index eed9958981c..ebdedc8ce50 100644
--- a/db/db.cpp
+++ b/db/db.cpp
@@ -605,7 +605,7 @@ void setupSignals() {
void setupSignals() {}
#endif
-void initAndListen(int listenPort, const char *dbPath) {
+void initAndListen(int listenPort, const char *dbPath, const char *appserverLoc = null) {
setupSignals();
@@ -634,7 +634,7 @@ void initAndListen(int listenPort, const char *dbPath) {
cout << "10Gen DB : starting : pid = " << pid << " port = " << port << " dbpath = " << dbpath << endl;
problem() << "10Gen DB : starting : pid = " << pid << " port = " << port << " dbpath = " << dbpath << endl;
- JavaJS = new JavaJSImpl();
+ JavaJS = new JavaJSImpl(appserverLoc);
javajstest();
listen(listenPort);
@@ -712,6 +712,8 @@ int main(int argc, char* argv[], char *envp[] )
* slightly different mode where "run" is assumed and we can set values
*/
+ char *appsrvPath = null;
+
for (int i = 1; i < argc; i++) {
char *s = argv[i];
@@ -722,9 +724,12 @@ int main(int argc, char* argv[], char *envp[] )
else if (s && strcmp(s, "--dbpath") == 0) {
dbpath = argv[++i];
}
+ else if (s && strcmp(s, "--appsrvpath") == 0) {
+ appsrvPath = argv[++i];
+ }
}
- initAndListen(port, dbpath);
+ initAndListen(port, dbpath, appsrvPath);
goingAway = true;
return 0;
@@ -739,7 +744,7 @@ int main(int argc, char* argv[], char *envp[] )
cout << " longmsg send a long test message to the db server" << endl;
cout << " msglots send a bunch of test messages, and then wait for answer on the last one" << endl;
cout << endl << "Alternate Usage :" << endl;
- cout << " --port <portno> --dbpath <root>" << endl << endl;
+ cout << " --port <portno> --dbpath <root> --appsrvpath <root of appsrv>" << endl << endl;
goingAway = true;
return 0;
diff --git a/db/javajs.cpp b/db/javajs.cpp
index 0922bfec38f..d72e31b5f13 100644
--- a/db/javajs.cpp
+++ b/db/javajs.cpp
@@ -54,12 +54,16 @@ void myJNIClean( JNIEnv * env ){
JavaJS->detach( env );
}
-JavaJSImpl::JavaJSImpl(){
+JavaJSImpl::JavaJSImpl() {
+ JavaJSImpl(null);
+}
+
+JavaJSImpl::JavaJSImpl(const char *appserverPath){
_jvm = 0;
_mainEnv = 0;
_dbhook = 0;
- const char * ed = findEd();
+ const char * ed = findEd(appserverPath);
stringstream ss;
#if defined(_WIN32)
@@ -345,9 +349,38 @@ void jasserted(const char *msg, const char *file, unsigned line) {
}
+const char* findEd(const char *path) {
+
+ if (!path) {
+ return findEd();
+ }
+
+ cout << "Appserver location specified : " << path << endl;
+
+ if (!path) {
+ cout << " invalid appserver location : " << path << " : terminating - prepare for bus error" << endl;
+ return 0;
+ }
+
+ DIR *testDir = opendir(path);
+
+ if (testDir) {
+ cout << " found directory for appserver : " << path << endl;
+ closedir(testDir);
+ return path;
+ }
+ else {
+ cout << " ERROR : not a directory for specified appserver location : " << path << " - prepare for bus error" << endl;
+ return null;
+ }
+}
+
const char * findEd(){
+ cout << "Appserver location not specified. Searching.... " << endl;
+
#if defined(_WIN32)
+ cout << " WIN32 default : c:/l/ed/" << endl;
return "c:/l/ed";
#else
@@ -365,10 +398,11 @@ const char * findEd(){
continue;
closedir( test );
- cout << "found ed at : " << temp << endl;
+ cout << " found directory for appserver : " << temp << endl;
return temp;
}
+ cout << " ERROR : can't find directory for appserver - prepare for bus error" << endl;
return 0;
#endif
};
diff --git a/db/javajs.h b/db/javajs.h
index e78158d756c..104b977a013 100644
--- a/db/javajs.h
+++ b/db/javajs.h
@@ -23,12 +23,14 @@ void jasserted(const char *msg, const char *file, unsigned line);
int javajstest();
const char * findEd();
+const char * findEd(const char *);
class JSObj;
class JavaJSImpl {
public:
JavaJSImpl();
+ JavaJSImpl(const char *);
~JavaJSImpl();
jlong scopeCreate();