#include <sys/stat.h>
using namespace std;
-
/*
* Class: org_apache_hadoop_fs_ceph_CephFileSystem
* Method: ceph_initializeClient
* Signature: (Ljava/lang/String;)Z
*/
+
+/*
+ * Class: org_apache_hadoop_fs_ceph_CephFileSystem
+ * Method: ceph_initializeClient
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
+ */
JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
- (JNIEnv * env, jobject obj, jstring j_debug_level)
+ (JNIEnv * env, jobject obj, jstring j_debug_level, jstring j_mon_addr)
{
dout(3) << "CephFSInterface: Initializing Ceph client:" << dendl;
const char* c_debug_level = env->GetStringUTFChars(j_debug_level, 0);
+ const char* c_mon_addr = env->GetStringUTFChars(j_mon_addr, 0);
//construct an arguments array
const char *argv[10];
int argc = 0;
argv[argc++] = "CephFSInterface";
argv[argc++] = "-m";
- argv[argc++] = "10.0.1.247:6789";
+ argv[argc++] = c_mon_addr;
argv[argc++] = "--debug_client";
argv[argc++] = c_debug_level;
#define org_apache_hadoop_fs_ceph_CephFileSystem_DEFAULT_BLOCK_SIZE 8388608LL
#undef org_apache_hadoop_fs_ceph_CephInputStream_SKIP_BUFFER_SIZE
#define org_apache_hadoop_fs_ceph_CephInputStream_SKIP_BUFFER_SIZE 2048L
-
/*
* Class: org_apache_hadoop_fs_ceph_CephFileSystem
* Method: ceph_initializeClient
- * Signature: (Ljava/lang/String;)Z
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
- (JNIEnv *, jobject, jstring);
+ (JNIEnv *, jobject, jstring, jstring);
+
/*
* Class: org_apache_hadoop_fs_ceph_CephFileSystem
* Method: ceph_copyFromLocalFile
private URI uri;
private FileSystem localFs;
-
private Path root;
-
private Path parent;
- private static boolean debug = false;
- private static String cephDebugLevel = "0";
+ private static boolean debug;
+ private static String cephDebugLevel;
+ private static String monAddr;
- private native boolean ceph_initializeClient(String debugLevel);
+ private native boolean ceph_initializeClient(String debugLevel, String mon);
private native boolean ceph_copyFromLocalFile(String localPath, String cephPath);
private native boolean ceph_copyToLocalFile(String cephPath, String localPath);
private native String ceph_getcwd();
// TODO: local filesystem? we really need to figure out this conf thingy
this.localFs = get(URI.create("file:///"), conf);
+ monAddr = conf.get("fs.ceph.monAddr");
+ cephDebugLevel = conf.get("fs.ceph.debugLevel");
+ debug = ("true".equals(conf.get("fs.ceph.debug")));
// Initializes the client
- if (!ceph_initializeClient(cephDebugLevel)) {
+ if (!ceph_initializeClient(cephDebugLevel, monAddr)) {
throw new IOException("Ceph initialization failed!");
}
debug("Initialized client. Setting cwd to /");
/*
* Class: org_apache_hadoop_fs_ceph_CephFileSystem
* Method: ceph_initializeClient
- * Signature: (Ljava/lang/String;)Z
+ * Signature: (Ljava/lang/String;Ljava/lang/String;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
- (JNIEnv *, jobject, jstring);
+ (JNIEnv *, jobject, jstring, jstring);
/*
* Class: org_apache_hadoop_fs_ceph_CephFileSystem