/*
* Class: org_apache_hadoop_fs_ceph_CephFileSystem
* Method: ceph_initializeClient
- * Signature: ()J
+ * Signature: ()Z
* Initializes a ceph client.
*/
-JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
+JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
(JNIEnv *env, jobject, jstring j_mon_host)
{
dout(3) << "CephFSInterface: Initializing Ceph client:" << dendl;
ceph_initialize(argc, argv);
ceph_mount();
+ return true;
}
struct stat stbuf;
const char* c_path = env->GetStringUTFChars(j_path, 0);
- dout(10) << "Attempting lstat with file " << c_path << ":" ;
+ dout(10) << "Attempting lstat with file " << c_path << ":" << dendl;
int result = ceph_lstat(c_path, &stbuf);
dout(10) << "result is " << result << dendl;
env->ReleaseStringUTFChars(j_path, c_path);
/*
* Class: org_apache_hadoop_fs_ceph_CephFileSystem
* Method: ceph_initializeClient
- * Signature: ()J
+ * Signature: ()Z
*/
-JNIEXPORT jlong JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
+JNIEXPORT jboolean JNICALL Java_org_apache_hadoop_fs_ceph_CephFileSystem_ceph_1initializeClient
(JNIEnv *, jobject);
/*
* include wrapper functions to automatically add the parameter.
*/
- private native long ceph_initializeClient();
+ private native boolean ceph_initializeClient();
private native boolean ceph_copyFromLocalFile(String localPath, String cephPath);
private native boolean ceph_copyToLocalFile(String cephPath, String localPath);
private native String ceph_getcwd();
this.localFs = get(URI.create("file:///"), conf);
// Initializes the client
- this.clientPointer = ceph_initializeClient();
- System.out.println("Initialized client with pointer " + clientPointer
- + ". Setting cwd to /");
+ if (!ceph_initializeClient()) {
+ throw new IOException("Ceph initialization failed!");
+ }
+ System.out.println("Initialized client. Setting cwd to /");
ceph_setcwd("/");
// DEBUG
// attempt to do three exists operations on root