From: Greg Farnum Date: Fri, 11 Sep 2009 00:36:05 +0000 (-0700) Subject: Hadoop: Final submission prep. X-Git-Tag: v0.15~67 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=af1c653443db31181e62db24f9e7aab8fae1298a;p=ceph.git Hadoop: Final submission prep. IO classes should be public, updated Javadoc, and added license grants. --- diff --git a/src/client/hadoop/ceph/CephFileSystem.java b/src/client/hadoop/ceph/CephFileSystem.java index 2f1b1b5c66d9..ae6c43f794a7 100644 --- a/src/client/hadoop/ceph/CephFileSystem.java +++ b/src/client/hadoop/ceph/CephFileSystem.java @@ -1,4 +1,22 @@ // -*- mode:Java; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +/** + * + * Licensed under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * + * Implements the Hadoop FS interfaces to allow applications to store + * files in Ceph. + */ package org.apache.hadoop.fs.ceph; import java.io.IOException; diff --git a/src/client/hadoop/ceph/CephInputStream.java b/src/client/hadoop/ceph/CephInputStream.java index 0f887b12abc8..24d088877771 100644 --- a/src/client/hadoop/ceph/CephInputStream.java +++ b/src/client/hadoop/ceph/CephInputStream.java @@ -1,4 +1,22 @@ // -*- mode:Java; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +/** + * + * Licensed under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * + * Implements the Hadoop FS interfaces to allow applications to store + * files in Ceph. + */ package org.apache.hadoop.fs.ceph; import java.io.BufferedOutputStream; @@ -20,7 +38,7 @@ import org.apache.hadoop.fs.FSInputStream; * An {@link FSInputStream} for a CephFileSystem and corresponding * Ceph instance. */ -class CephInputStream extends FSInputStream { +public class CephInputStream extends FSInputStream { private int bufferSize; @@ -57,8 +75,9 @@ class CephInputStream extends FSInputStream { + fh + " and file length " + flength); } - //Ceph likes things to be closed before it shuts down, - //so closing the IOStream stuff voluntarily is good + /** Ceph likes things to be closed before it shuts down, + * so closing the IOStream stuff voluntarily in a finalizer is good + */ public void finalize () throws Throwable { try { if (!closed) close(); @@ -69,7 +88,9 @@ class CephInputStream extends FSInputStream { public synchronized long getPos() throws IOException { return ceph_getpos(fileHandle); } - + /** + * Find the number of bytes remaining in the file. + */ @Override public synchronized int available() throws IOException { return (int) (fileLength - getPos()); @@ -114,7 +135,7 @@ class CephInputStream extends FSInputStream { /** * Read a specified number of bytes into a byte[] from the file. - * @param buf[] the byte array to read into. + * @param buf the byte array to read into. * @param off the offset to start at in the file * @param len the number of bytes to read * @return 0 if successful, otherwise an error code. diff --git a/src/client/hadoop/ceph/CephOutputStream.java b/src/client/hadoop/ceph/CephOutputStream.java index 49707f305c0f..fdcc4e000ad4 100644 --- a/src/client/hadoop/ceph/CephOutputStream.java +++ b/src/client/hadoop/ceph/CephOutputStream.java @@ -1,4 +1,23 @@ // -*- mode:Java; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +/** + * + * Licensed under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * + * Implements the Hadoop FS interfaces to allow applications to store + * files in Ceph. + */ + package org.apache.hadoop.fs.ceph; import java.io.File; @@ -15,7 +34,12 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.util.Progressable; -class CephOutputStream extends OutputStream { +/** + *

+ * An {@link OutputStream} for a CephFileSystem and corresponding + * Ceph instance. + */ +public class CephOutputStream extends OutputStream { private int bufferSize; @@ -45,8 +69,9 @@ class CephOutputStream extends OutputStream { debug = ("true".equals(conf.get("fs.ceph.debug", "false"))); } - //Ceph likes things to be closed before it shuts down, - //so closing the IOStream stuff voluntarily is good + /**Ceph likes things to be closed before it shuts down, + *so closing the IOStream stuff voluntarily is good + */ public void finalize () throws Throwable { try { if (!closed) close(); @@ -88,7 +113,7 @@ class CephOutputStream extends OutputStream { /** * Write a byte buffer into the Ceph file. - * @param buf[] the byte array to write from + * @param buf the byte array to write from * @param off the position in the file to start writing at. * @param len The number of bytes to actually write. * @throws IOException if you have closed the CephOutputStream, or