You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bh...@apache.org on 2013/06/27 23:13:47 UTC

git commit: [CB-3720] [BlackBerry10] Add BB10 File implementation

Updated Branches:
  refs/heads/bb10 [created] d0170d0d9


[CB-3720] [BlackBerry10] Add BB10 File implementation


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/d0170d0d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/d0170d0d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/d0170d0d

Branch: refs/heads/bb10
Commit: d0170d0d9a192e1c51149787b9503a3b849467bb
Parents: d673737
Author: Bryan Higgins <bh...@blackberry.com>
Authored: Thu Jun 27 17:07:59 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Thu Jun 27 17:07:59 2013 -0400

----------------------------------------------------------------------
 plugin.xml                                    |  34 ++++++
 www/blackberry10/DirectoryEntry.js            |  57 ++++++++++
 www/blackberry10/DirectoryReader.js           |  47 ++++++++
 www/blackberry10/Entry.js                     | 112 +++++++++++++++++++
 www/blackberry10/FileEntry.js                 |  47 ++++++++
 www/blackberry10/FileReader.js                |  90 ++++++++++++++++
 www/blackberry10/FileSystem.js                |  27 +++++
 www/blackberry10/FileWriter.js                | 120 +++++++++++++++++++++
 www/blackberry10/requestFileSystem.js         |  38 +++++++
 www/blackberry10/resolveLocalFileSystemURI.js |  55 ++++++++++
 10 files changed, 627 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d0170d0d/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 86bbb1f..1916dda 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -138,4 +138,38 @@ id="org.apache.cordova.core.FileUtils" version="0.1.0">
 
     </platform>
 
+    <!-- blackberry10 -->
+    <platform name="blackberry10">
+        <config-file target="www/config.xml" parent="/widget">
+            <feature name="File" value="File" />
+        </config-file>
+        <js-module src="www/blackberry10/DirectoryEntry.js" name="BB10DirectoryEntry">
+            <clobbers target="window.DirectoryEntry" />
+        </js-module>
+        <js-module src="www/blackberry10/DirectoryReader.js" name="BB10DirectoryReader">
+            <clobbers target="window.DirectoryReader" />
+        </js-module>
+        <js-module src="www/blackberry10/Entry.js" name="BB10Entry">
+            <clobbers target="window.Entry" />
+        </js-module>       
+        <js-module src="www/blackberry10/FileEntry.js" name="BB10FileEntry">
+            <clobbers target="window.FileEntry" />
+        </js-module>
+        <js-module src="www/blackberry10/FileReader.js" name="BB10FileReader">
+            <clobbers target="window.FileReader" />
+        </js-module>
+        <js-module src="www/blackberry10/FileSystem.js" name="BB10FileSystem">
+            <clobbers target="window.FileSystem" />
+        </js-module>
+        <js-module src="www/blackberry10/FileWriter.js" name="BB10FileWriter">
+            <clobbers target="window.FileWriter" />
+        </js-module>
+        <js-module src="www/blackberry10/requestFileSystem.js" name="BB10requestFileSystem">
+            <clobbers target="window.requestFileSystem" />
+        </js-module>
+        <js-module src="www/blackberry10/resolveLocalFileSystemURI.js" name="BB10resolveLocalFileSystemURI">
+            <clobbers target="window.resolveLocalFileSystemURI" />
+        </js-module>
+    </platform>
+
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d0170d0d/www/blackberry10/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/DirectoryEntry.js b/www/blackberry10/DirectoryEntry.js
new file mode 100644
index 0000000..259a79e
--- /dev/null
+++ b/www/blackberry10/DirectoryEntry.js
@@ -0,0 +1,57 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var argscheck = require('cordova/argscheck'),
+    utils = require('cordova/utils'),
+    Entry = require('cordova/plugin/Entry'),
+    FileError = require('cordova/plugin/FileError'),
+    DirectoryReader = require('cordova/plugin/DirectoryReader'),
+    fileUtils = require('cordova/plugin/blackberry10/fileUtils'),
+    DirectoryEntry = function (name, fullPath) {
+        DirectoryEntry.__super__.constructor.call(this, false, true, name, fullPath);
+    };
+
+utils.extend(DirectoryEntry, Entry);
+
+DirectoryEntry.prototype.createReader = function () {
+    return new DirectoryReader(this.fullPath);
+};
+
+DirectoryEntry.prototype.getDirectory = function (path, options, successCallback, errorCallback) {
+    argscheck.checkArgs('sOFF', 'DirectoryEntry.getDirectory', arguments);
+    this.nativeEntry.getDirectory(path, options, function (entry) {
+        successCallback(fileUtils.createEntry(entry));
+    }, errorCallback);
+};
+
+DirectoryEntry.prototype.removeRecursively = function (successCallback, errorCallback) {
+    argscheck.checkArgs('FF', 'DirectoryEntry.removeRecursively', arguments);
+    this.nativeEntry.removeRecursively(successCallback, errorCallback);
+};
+
+DirectoryEntry.prototype.getFile = function (path, options, successCallback, errorCallback) {
+    argscheck.checkArgs('sOFF', 'DirectoryEntry.getFile', arguments);
+    this.nativeEntry.getFile(path, options, function (entry) {
+        successCallback(fileUtils.createEntry(entry));
+    }, errorCallback);
+};
+
+module.exports = DirectoryEntry;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d0170d0d/www/blackberry10/DirectoryReader.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/DirectoryReader.js b/www/blackberry10/DirectoryReader.js
new file mode 100644
index 0000000..8bb9968
--- /dev/null
+++ b/www/blackberry10/DirectoryReader.js
@@ -0,0 +1,47 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var FileError = require('cordova/plugin/FileError'),
+    fileUtils = require('cordova/plugin/blackberry10/fileUtils');
+
+function DirectoryReader(path) {
+    this.path = path;
+}
+
+DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) {
+    var win = typeof successCallback !== 'function' ? null : function(result) {
+            var retVal = [];
+            for (var i=0; i<result.length; i++) {
+                retVal.push(fileUtils.createEntry(result[i]));
+            }
+            successCallback(retVal);
+        },
+        fail = typeof errorCallback !== 'function' ? null : function(code) {
+            errorCallback(new FileError(code));
+        };
+    fileUtils.getEntryForURI(this.path, function (entry) {
+        entry.nativeEntry.createReader().readEntries(win, fail);
+    }, function () {
+        fail(FileError.NOT_FOUND_ERR);
+    });
+};
+
+module.exports = DirectoryReader;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d0170d0d/www/blackberry10/Entry.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/Entry.js b/www/blackberry10/Entry.js
new file mode 100644
index 0000000..cf971fe
--- /dev/null
+++ b/www/blackberry10/Entry.js
@@ -0,0 +1,112 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var argscheck = require('cordova/argscheck'),
+    FileError = require('cordova/plugin/FileError'),
+    Metadata = require('cordova/plugin/Metadata'),
+    fileUtils = require('cordova/plugin/blackberry10/fileUtils');
+
+function Entry(isFile, isDirectory, name, fullPath, fileSystem) {
+    this.isFile = !!isFile;
+    this.isDirectory = !!isDirectory;
+    this.name = name || '';
+    this.fullPath = fullPath || '';
+    this.filesystem = fileSystem || null;
+}
+
+Entry.prototype.getMetadata = function(successCallback, errorCallback) {
+    argscheck.checkArgs('FF', 'Entry.getMetadata', arguments);
+    var success = function(lastModified) {
+        var metadata = new Metadata(lastModified);
+        if (typeof successCallback === 'function') {
+            successCallback(metadata);
+        }
+    };
+    this.nativeEntry.getMetadata(success, errorCallback);
+};
+
+Entry.prototype.setMetadata = function(successCallback, errorCallback, metadataObject) {
+    argscheck.checkArgs('FFO', 'Entry.setMetadata', arguments);
+    errorCallback("Not supported by platform");
+};
+
+Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallback) {
+    argscheck.checkArgs('oSFF', 'Entry.moveTo', arguments);
+    var srcPath = this.fullPath,
+        name = newName || this.name,
+        success = function(entry) {
+            if (entry) {
+                if (typeof successCallback === 'function') {
+                    successCallback(fileUtils.createEntry(entry));
+                }
+            }
+            else {
+                if (typeof errorCallback === 'function') {
+                    errorCallback(new FileError(FileError.NOT_FOUND_ERR));
+                }
+            }
+        };
+    this.nativeEntry.moveTo(parent.nativeEntry, newName, success, errorCallback);
+};
+
+
+Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallback) {
+    argscheck.checkArgs('oSFF', 'Entry.copyTo', arguments);
+    var srcPath = this.fullPath,
+        name = newName || this.name,
+        success = function(entry) {
+            if (entry) {
+                if (typeof successCallback === 'function') {
+                    successCallback(fileUtils.createEntry(entry));
+                }
+            }
+            else {
+                if (typeof errorCallback === 'function') {
+                    errorCallback(new FileError(FileError.NOT_FOUND_ERR));
+                }
+            }
+        };
+    this.nativeEntry.copyTo(parent.nativeEntry, newName, success, errorCallback);
+};
+
+Entry.prototype.toURL = function() {
+    return this.fullPath;
+};
+
+Entry.prototype.toURI = function(mimeType) {
+    console.log("DEPRECATED: Update your code to use 'toURL'");
+    return this.toURL();
+};
+
+Entry.prototype.remove = function(successCallback, errorCallback) {
+    argscheck.checkArgs('FF', 'Entry.remove', arguments);
+    this.nativeEntry.remove(successCallback, errorCallback);
+};
+
+Entry.prototype.getParent = function(successCallback, errorCallback) {
+    argscheck.checkArgs('FF', 'Entry.getParent', arguments);
+    var win = successCallback && function(result) {
+        successCallback(fileUtils.createEntry(result));
+    };
+    this.nativeEntry.getParent(win, errorCallback);
+};
+
+module.exports = Entry;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d0170d0d/www/blackberry10/FileEntry.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileEntry.js b/www/blackberry10/FileEntry.js
new file mode 100644
index 0000000..17f9393
--- /dev/null
+++ b/www/blackberry10/FileEntry.js
@@ -0,0 +1,47 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var utils = require('cordova/utils'),
+    Entry = require('cordova/plugin/Entry'),
+    FileWriter = require('cordova/plugin/FileWriter'),
+    File = require('cordova/plugin/File'),
+    FileError = require('cordova/plugin/FileError'),
+    FileEntry = function (name, fullPath) {
+        FileEntry.__super__.constructor.apply(this, [true, false, name, fullPath]);
+    };
+
+utils.extend(FileEntry, Entry);
+
+FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
+    this.file(function (file) {
+        successCallback(new FileWriter(file));
+    }, errorCallback);
+};
+
+FileEntry.prototype.file = function(successCallback, errorCallback) {
+    var fullPath = this.fullPath,
+        success = function (file) {
+            successCallback(new File(file.name, fullPath, file.type, file.lastModifiedDate, file.size));
+        };
+    this.nativeEntry.file(success, errorCallback);
+};
+
+module.exports = FileEntry;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d0170d0d/www/blackberry10/FileReader.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileReader.js b/www/blackberry10/FileReader.js
new file mode 100644
index 0000000..17214ef
--- /dev/null
+++ b/www/blackberry10/FileReader.js
@@ -0,0 +1,90 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var origFileReader = window.FileReader,
+    fileUtils = require('cordova/plugin/blackberry10/fileUtils'),
+    utils = require('cordova/utils');
+
+var FileReader = function() {
+    this.nativeReader = new origFileReader();
+};
+
+utils.defineGetter(FileReader.prototype, 'readyState', function() {
+    return this.nativeReader.readyState;
+});
+
+utils.defineGetter(FileReader.prototype, 'error', function() {
+    return this.nativeReader.error;
+});
+
+utils.defineGetter(FileReader.prototype, 'result', function() {
+    return this.nativeReader.result;
+});
+
+function defineEvent(eventName) {
+    utils.defineGetterSetter(FileReader.prototype, eventName, function() {
+        return this.nativeReader[eventName] || null;
+    }, function(value) {
+        this.nativeReader[eventName] = value;
+    });
+}
+
+defineEvent('onabort');
+defineEvent('onerror');
+defineEvent('onload');
+defineEvent('onloadend');
+defineEvent('onloadstart');
+defineEvent('onprogress');
+
+FileReader.prototype.abort = function() {
+    return this.nativeReader.abort();
+};
+
+function read(method, context, file, encoding) {
+    if (file.fullPath) {
+         fileUtils.getEntryForURI(file.fullPath, function (entry) {
+            entry.nativeEntry.file(function (nativeFile) {
+                context.nativeReader[method].call(context.nativeReader, nativeFile, encoding);
+            }, context.onerror);
+        }, context.onerror);
+    } else {
+        context.nativeReader[method](file, encoding);
+    }
+}
+
+FileReader.prototype.readAsText = function(file, encoding) {
+    read("readAsText", this, file, encoding);
+};
+
+FileReader.prototype.readAsDataURL = function(file) {
+    read("readAsDataURL", this, file);
+};
+
+FileReader.prototype.readAsBinaryString = function(file) {
+    read("readAsBinaryString", this, file);
+};
+
+FileReader.prototype.readAsArrayBuffer = function(file) {
+    read("readAsArrayBuffer", this, file);
+};
+
+window.FileReader = FileReader;
+module.exports = FileReader;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d0170d0d/www/blackberry10/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileSystem.js b/www/blackberry10/FileSystem.js
new file mode 100644
index 0000000..d1432d6
--- /dev/null
+++ b/www/blackberry10/FileSystem.js
@@ -0,0 +1,27 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+module.exports = function(name, root) {
+    this.name = name || null;
+    if (root) {
+        this.root = root;
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d0170d0d/www/blackberry10/FileWriter.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileWriter.js b/www/blackberry10/FileWriter.js
new file mode 100644
index 0000000..0f71d6a
--- /dev/null
+++ b/www/blackberry10/FileWriter.js
@@ -0,0 +1,120 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var FileError = require('cordova/plugin/FileError'),
+    ProgressEvent = require('cordova/plugin/ProgressEvent'),
+    fileUtils = require('cordova/plugin/blackberry10/fileUtils'),
+    utils = require('cordova/utils');
+
+function FileWriter (file) {
+    var that = this;
+    this.file = file;
+    this.events = {};
+    this.pending = [];
+    fileUtils.getEntryForURI(file.fullPath, function (entry) {
+        entry.nativeEntry.createWriter(function (writer) {
+            var i,
+                event;
+            that.nativeWriter = writer;
+            for (event in that.events) {
+                if (that.events.hasOwnProperty(event)) {
+                    that.nativeWriter[event] = that.events[event];
+                }
+            }
+            for (i = 0; i < that.pending.length; i++) {
+                that.pending[i]();
+            }
+        });
+    });
+    this.events = {};
+    this.pending = [];
+}
+
+utils.defineGetter(FileWriter.prototype, 'error', function() {
+    return this.nativeWriter ? this.nativeWriter.error : null;
+});
+
+utils.defineGetter(FileWriter.prototype, 'fileName', function() {
+    return this.nativeWriter ? this.nativeWriter.fileName : this.file.name;
+});
+
+utils.defineGetter(FileWriter.prototype, 'length', function() {
+    return this.nativeWriter ? this.nativeWriter.length : this.file.size;
+});
+
+utils.defineGetter(FileWriter.prototype, 'position', function() {
+    return this.nativeWriter ? this.nativeWriter.position : 0;
+});
+
+utils.defineGetter(FileWriter.prototype, 'readyState', function() {
+    return this.nativeWriter ? this.nativeWriter.readyState : 0;
+});
+
+function defineEvent(eventName) {
+    utils.defineGetterSetter(FileWriter.prototype, eventName, function() {
+        return this.nativeWriter ? this.nativeWriter[eventName] || null : this.events[eventName] || null;
+    }, function(value) {
+        if (this.nativeWriter) {
+            this.nativeWriter[eventName] = value;
+        }
+        else {
+            this.events[eventName] = value;
+        }
+    });
+}
+
+defineEvent('onabort');
+defineEvent('onerror');
+defineEvent('onprogress');
+defineEvent('onwrite');
+defineEvent('onwriteend');
+defineEvent('onwritestart');
+
+FileWriter.prototype.abort = function() {
+    this.nativeWriter.abort();
+};
+
+FileWriter.prototype.write = function(text) {
+    var that = this,
+        op = function () {
+            that.nativeWriter.write(new Blob([text]));
+        };
+    this.nativeWriter ? op() : this.pending.push(op);
+
+};
+
+FileWriter.prototype.seek = function(offset) {
+    var that = this,
+        op = function () {
+            that.nativeWriter.seek(offset);
+        };
+    this.nativeWriter ? op() : this.pending.push(op);
+};
+
+FileWriter.prototype.truncate = function(size) {
+    var that = this,
+        op = function () {
+            that.nativeWriter.truncate(size);
+        };
+    this.nativeWriter ? op() : this.pending.push(op);
+};
+
+module.exports = FileWriter;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d0170d0d/www/blackberry10/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/requestFileSystem.js b/www/blackberry10/requestFileSystem.js
new file mode 100644
index 0000000..62e1753
--- /dev/null
+++ b/www/blackberry10/requestFileSystem.js
@@ -0,0 +1,38 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var fileUtils = require('cordova/plugin/blackberry10/fileUtils'),
+    FileError = require('cordova/plugin/FileError'),
+    FileSystem = require('cordova/plugin/FileSystem');
+
+module.exports = function (type, size, success, fail) {
+    if (size >= 1000000000000000) {
+        fail(new FileError(FileError.QUOTA_EXCEEDED_ERR));
+    } else if (type !== 1 && type !== 0) {
+        fail(new FileError(FileError.SYNTAX_ERR));
+    } else {
+        window.webkitRequestFileSystem(type, size, function (fs) {
+            success((new FileSystem(fileUtils.getFileSystemName(fs), fileUtils.createEntry(fs.root))));
+        }, function (error) {
+            fail(new FileError(error));
+        });
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d0170d0d/www/blackberry10/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/resolveLocalFileSystemURI.js b/www/blackberry10/resolveLocalFileSystemURI.js
new file mode 100644
index 0000000..d11b0ca
--- /dev/null
+++ b/www/blackberry10/resolveLocalFileSystemURI.js
@@ -0,0 +1,55 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+var fileUtils = require('cordova/plugin/blackberry10/fileUtils'),
+    FileError = require('cordova/plugin/FileError');
+
+module.exports = function (uri, success, fail) {
+    var type,
+        path,
+        paramPath;
+    if (!uri || uri.indexOf("/") === 0) {
+        fail(new FileError(FileError.ENCODING_ERR));
+    } else {
+        type = uri.indexOf("persistent") === -1 ? 0 : 1;
+        path = uri.substring(type === 1 ? uri.indexOf("persistent") + 11 : uri.indexOf("temporary") + 10);
+        if (path.substring(0,1) == "/") {
+            path = path.substring(1);
+        }
+        paramPath = path.indexOf("?");
+        if (paramPath > -1) {
+            path = path.substring(0, paramPath);
+        }
+        window.webkitRequestFileSystem(type, 25*1024*1024, function (fs) {
+            if (path === "") {
+                success(fileUtils.createEntry(fs.root));
+            } else {
+                fs.root.getDirectory(path, {}, function (entry) {
+                    success(fileUtils.createEntry(entry));
+                }, function () {
+                    fs.root.getFile(path, {}, function (entry) {
+                        success(fileUtils.createEntry(entry));
+                    }, fail);
+                });
+            }
+        }, fail);
+    }
+};