cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [29/53] merge issues
Date Tue, 30 Apr 2013 21:35:45 GMT
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3b1a8317/framework/src/org/apache/cordova/FileUploadResult.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileUploadResult.java b/framework/src/org/apache/cordova/FileUploadResult.java
deleted file mode 100644
index b556869..0000000
--- a/framework/src/org/apache/cordova/FileUploadResult.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-       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.
-*/
-package org.apache.cordova;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/**
- * Encapsulates the result and/or status of uploading a file to a remote server.
- */
-public class FileUploadResult {
-
-    private long bytesSent = 0;         // bytes sent
-    private int responseCode = -1;      // HTTP response code
-    private String response = null;     // HTTP response
-    private String objectId = null;     // FileTransfer object id
-
-    public long getBytesSent() {
-        return bytesSent;
-    }
-
-    public void setBytesSent(long bytes) {
-        this.bytesSent = bytes;
-    }
-
-    public int getResponseCode() {
-        return responseCode;
-    }
-
-    public void setResponseCode(int responseCode) {
-        this.responseCode = responseCode;
-    }
-
-    public String getResponse() {
-        return response;
-    }
-
-    public void setResponse(String response) {
-        this.response = response;
-    }
-
-    public String getObjectId() {
-        return objectId;
-    }
-
-    public void setObjectId(String objectId) {
-        this.objectId = objectId;
-    }
-
-    public JSONObject toJSONObject() throws JSONException {
-        return new JSONObject(
-                "{bytesSent:" + bytesSent +
-                ",responseCode:" + responseCode +
-                ",response:" + JSONObject.quote(response) +
-                ",objectId:" + JSONObject.quote(objectId) + "}");
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3b1a8317/framework/src/org/apache/cordova/FileUtils.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java
deleted file mode 100755
index 2135be9..0000000
--- a/framework/src/org/apache/cordova/FileUtils.java
+++ /dev/null
@@ -1,1059 +0,0 @@
-/*
-       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.
- */
-package org.apache.cordova;
-
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Environment;
-import android.provider.MediaStore;
-import android.util.Log;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.cordova.api.CallbackContext;
-import org.apache.cordova.api.CordovaPlugin;
-import org.apache.cordova.api.PluginResult;
-import org.apache.cordova.file.EncodingException;
-import org.apache.cordova.file.FileExistsException;
-import org.apache.cordova.file.InvalidModificationException;
-import org.apache.cordova.file.NoModificationAllowedException;
-import org.apache.cordova.file.TypeMismatchException;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.RandomAccessFile;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.nio.channels.FileChannel;
-
-/**
- * This class provides SD card file and directory services to JavaScript.
- * Only files on the SD card can be accessed.
- */
-public class FileUtils extends CordovaPlugin {
-    private static final String LOG_TAG = "FileUtils";
-
-    public static int NOT_FOUND_ERR = 1;
-    public static int SECURITY_ERR = 2;
-    public static int ABORT_ERR = 3;
-
-    public static int NOT_READABLE_ERR = 4;
-    public static int ENCODING_ERR = 5;
-    public static int NO_MODIFICATION_ALLOWED_ERR = 6;
-    public static int INVALID_STATE_ERR = 7;
-    public static int SYNTAX_ERR = 8;
-    public static int INVALID_MODIFICATION_ERR = 9;
-    public static int QUOTA_EXCEEDED_ERR = 10;
-    public static int TYPE_MISMATCH_ERR = 11;
-    public static int PATH_EXISTS_ERR = 12;
-
-    public static int TEMPORARY = 0;
-    public static int PERSISTENT = 1;
-    public static int RESOURCE = 2;
-    public static int APPLICATION = 3;
-
-    /**
-     * Constructor.
-     */
-    public FileUtils() {
-    }
-
-    /**
-     * Executes the request and returns whether the action was valid.
-     *
-     * @param action 		The action to execute.
-     * @param args 		JSONArray of arguments for the plugin.
-     * @param callbackContext	The callback context used when calling back into JavaScript.
-     * @return 			True if the action was valid, false otherwise.
-     */
-    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
-        try {
-            if (action.equals("testSaveLocationExists")) {
-                boolean b = DirectoryManager.testSaveLocationExists();
-                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, b));
-            }
-            else if (action.equals("getFreeDiskSpace")) {
-                long l = DirectoryManager.getFreeDiskSpace(false);
-                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, l));
-            }
-            else if (action.equals("testFileExists")) {
-                boolean b = DirectoryManager.testFileExists(args.getString(0));
-                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, b));
-            }
-            else if (action.equals("testDirectoryExists")) {
-                boolean b = DirectoryManager.testFileExists(args.getString(0));
-                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, b));
-            }
-            else if (action.equals("readAsText")) {
-                String encoding = args.getString(1);
-                int start = args.getInt(2);
-                int end = args.getInt(3);
-
-                this.readFileAs(args.getString(0), start, end, callbackContext, encoding, PluginResult.MESSAGE_TYPE_STRING);
-            }
-            else if (action.equals("readAsDataURL")) {
-                int start = args.getInt(1);
-                int end = args.getInt(2);
-
-                this.readFileAs(args.getString(0), start, end, callbackContext, null, -1);
-            }
-            else if (action.equals("readAsArrayBuffer")) {
-                int start = args.getInt(1);
-                int end = args.getInt(2);
-
-                this.readFileAs(args.getString(0), start, end, callbackContext, null, PluginResult.MESSAGE_TYPE_ARRAYBUFFER);
-            }
-            else if (action.equals("readAsBinaryString")) {
-                int start = args.getInt(1);
-                int end = args.getInt(2);
-
-                this.readFileAs(args.getString(0), start, end, callbackContext, null, PluginResult.MESSAGE_TYPE_BINARYSTRING);
-            }
-            else if (action.equals("write")) {
-                long fileSize = this.write(args.getString(0), args.getString(1), args.getInt(2));
-                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize));
-            }
-            else if (action.equals("truncate")) {
-                long fileSize = this.truncateFile(args.getString(0), args.getLong(1));
-                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, fileSize));
-            }
-            else if (action.equals("requestFileSystem")) {
-                long size = args.optLong(1);
-                if (size != 0 && size > (DirectoryManager.getFreeDiskSpace(true) * 1024)) {
-                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, FileUtils.QUOTA_EXCEEDED_ERR));
-                } else {
-                    JSONObject obj = requestFileSystem(args.getInt(0));
-                    callbackContext.success(obj);
-                }
-            }
-            else if (action.equals("resolveLocalFileSystemURI")) {
-                JSONObject obj = resolveLocalFileSystemURI(args.getString(0));
-                callbackContext.success(obj);
-            }
-            else if (action.equals("getMetadata")) {
-                callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, getMetadata(args.getString(0))));
-            }
-            else if (action.equals("getFileMetadata")) {
-                JSONObject obj = getFileMetadata(args.getString(0));
-                callbackContext.success(obj);
-            }
-            else if (action.equals("getParent")) {
-                JSONObject obj = getParent(args.getString(0));
-                callbackContext.success(obj);
-            }
-            else if (action.equals("getDirectory")) {
-                JSONObject obj = getFile(args.getString(0), args.getString(1), args.optJSONObject(2), true);
-                callbackContext.success(obj);
-            }
-            else if (action.equals("getFile")) {
-                JSONObject obj = getFile(args.getString(0), args.getString(1), args.optJSONObject(2), false);
-                callbackContext.success(obj);
-            }
-            else if (action.equals("remove")) {
-                boolean success;
-
-                success = remove(args.getString(0));
-
-                if (success) {
-                    notifyDelete(args.getString(0));
-                    callbackContext.success();
-                } else {
-                    callbackContext.error(FileUtils.NO_MODIFICATION_ALLOWED_ERR);
-                }
-            }
-            else if (action.equals("removeRecursively")) {
-                boolean success = removeRecursively(args.getString(0));
-                if (success) {
-                    callbackContext.success();
-                } else {
-                    callbackContext.error(FileUtils.NO_MODIFICATION_ALLOWED_ERR);
-                }
-            }
-            else if (action.equals("moveTo")) {
-                JSONObject entry = transferTo(args.getString(0), args.getString(1), args.getString(2), true);
-                callbackContext.success(entry);
-            }
-            else if (action.equals("copyTo")) {
-                JSONObject entry = transferTo(args.getString(0), args.getString(1), args.getString(2), false);
-                callbackContext.success(entry);
-            }
-            else if (action.equals("readEntries")) {
-                JSONArray entries = readEntries(args.getString(0));
-                callbackContext.success(entries);
-            }
-            else {
-                return false;
-            }
-        } catch (FileNotFoundException e) {
-            callbackContext.error(FileUtils.NOT_FOUND_ERR);
-        } catch (FileExistsException e) {
-            callbackContext.error(FileUtils.PATH_EXISTS_ERR);
-        } catch (NoModificationAllowedException e) {
-            callbackContext.error(FileUtils.NO_MODIFICATION_ALLOWED_ERR);
-        } catch (InvalidModificationException e) {
-            callbackContext.error(FileUtils.INVALID_MODIFICATION_ERR);
-        } catch (MalformedURLException e) {
-            callbackContext.error(FileUtils.ENCODING_ERR);
-        } catch (IOException e) {
-            callbackContext.error(FileUtils.INVALID_MODIFICATION_ERR);
-        } catch (EncodingException e) {
-            callbackContext.error(FileUtils.ENCODING_ERR);
-        } catch (TypeMismatchException e) {
-            callbackContext.error(FileUtils.TYPE_MISMATCH_ERR);
-        }
-        return true;
-    }
-
-    /**
-     * Need to check to see if we need to clean up the content store
-     *
-     * @param filePath the path to check
-     */
-    private void notifyDelete(String filePath) {
-        String newFilePath = FileHelper.getRealPath(filePath, cordova);
-        try {
-            this.cordova.getActivity().getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
-                    MediaStore.Images.Media.DATA + " = ?",
-                    new String[] { newFilePath });
-        } catch (UnsupportedOperationException t) {
-            // Was seeing this on the File mobile-spec tests on 4.0.3 x86 emulator.
-            // The ContentResolver applies only when the file was registered in the
-            // first case, which is generally only the case with images.
-        }
-    }
-
-    /**
-     * Allows the user to look up the Entry for a file or directory referred to by a local URI.
-     *
-     * @param url of the file/directory to look up
-     * @return a JSONObject representing a Entry from the filesystem
-     * @throws MalformedURLException if the url is not valid
-     * @throws FileNotFoundException if the file does not exist
-     * @throws IOException if the user can't read the file
-     * @throws JSONException
-     */
-    @SuppressWarnings("deprecation")
-    private JSONObject resolveLocalFileSystemURI(String url) throws IOException, JSONException {
-        String decoded = URLDecoder.decode(url, "UTF-8");
-
-        File fp = null;
-
-        // Handle the special case where you get an Android content:// uri.
-        if (decoded.startsWith("content:")) {
-            Cursor cursor = this.cordova.getActivity().managedQuery(Uri.parse(decoded), new String[] { MediaStore.Images.Media.DATA }, null, null, null);
-            // Note: MediaStore.Images/Audio/Video.Media.DATA is always "_data"
-            int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
-            cursor.moveToFirst();
-            fp = new File(cursor.getString(column_index));
-        } else {
-            // Test to see if this is a valid URL first
-            @SuppressWarnings("unused")
-            URL testUrl = new URL(decoded);
-
-            if (decoded.startsWith("file://")) {
-                int questionMark = decoded.indexOf("?");
-                if (questionMark < 0) {
-                    fp = new File(decoded.substring(7, decoded.length()));
-                } else {
-                    fp = new File(decoded.substring(7, questionMark));
-                }
-            } else {
-                fp = new File(decoded);
-            }
-        }
-
-        if (!fp.exists()) {
-            throw new FileNotFoundException();
-        }
-        if (!fp.canRead()) {
-            throw new IOException();
-        }
-        return getEntry(fp);
-    }
-
-    /**
-     * Read the list of files from this directory.
-     *
-     * @param fileName the directory to read from
-     * @return a JSONArray containing JSONObjects that represent Entry objects.
-     * @throws FileNotFoundException if the directory is not found.
-     * @throws JSONException
-     */
-    private JSONArray readEntries(String fileName) throws FileNotFoundException, JSONException {
-        File fp = createFileObject(fileName);
-
-        if (!fp.exists()) {
-            // The directory we are listing doesn't exist so we should fail.
-            throw new FileNotFoundException();
-        }
-
-        JSONArray entries = new JSONArray();
-
-        if (fp.isDirectory()) {
-            File[] files = fp.listFiles();
-            for (int i = 0; i < files.length; i++) {
-                if (files[i].canRead()) {
-                    entries.put(getEntry(files[i]));
-                }
-            }
-        }
-
-        return entries;
-    }
-
-    /**
-     * A setup method that handles the move/copy of files/directories
-     *
-     * @param fileName to be copied/moved
-     * @param newParent is the location where the file will be copied/moved to
-     * @param newName for the file directory to be called, if null use existing file name
-     * @param move if false do a copy, if true do a move
-     * @return a Entry object
-     * @throws NoModificationAllowedException
-     * @throws IOException
-     * @throws InvalidModificationException
-     * @throws EncodingException
-     * @throws JSONException
-     * @throws FileExistsException
-     */
-    private JSONObject transferTo(String fileName, String newParent, String newName, boolean move) throws JSONException, NoModificationAllowedException, IOException, InvalidModificationException, EncodingException, FileExistsException {
-        String newFileName = FileHelper.getRealPath(fileName, cordova);
-        newParent = FileHelper.getRealPath(newParent, cordova);
-
-        // Check for invalid file name
-        if (newName != null && newName.contains(":")) {
-            throw new EncodingException("Bad file name");
-        }
-
-        File source = new File(newFileName);
-
-        if (!source.exists()) {
-            // The file/directory we are copying doesn't exist so we should fail.
-            throw new FileNotFoundException("The source does not exist");
-        }
-
-        File destinationDir = new File(newParent);
-        if (!destinationDir.exists()) {
-            // The destination does not exist so we should fail.
-            throw new FileNotFoundException("The source does not exist");
-        }
-
-        // Figure out where we should be copying to
-        File destination = createDestination(newName, source, destinationDir);
-
-        //Log.d(LOG_TAG, "Source: " + source.getAbsolutePath());
-        //Log.d(LOG_TAG, "Destin: " + destination.getAbsolutePath());
-
-        // Check to see if source and destination are the same file
-        if (source.getAbsolutePath().equals(destination.getAbsolutePath())) {
-            throw new InvalidModificationException("Can't copy a file onto itself");
-        }
-
-        if (source.isDirectory()) {
-            if (move) {
-                return moveDirectory(source, destination);
-            } else {
-                return copyDirectory(source, destination);
-            }
-        } else {
-            if (move) {
-                JSONObject newFileEntry = moveFile(source, destination);
-
-                // If we've moved a file given its content URI, we need to clean up.
-                if (fileName.startsWith("content://")) {
-                    notifyDelete(fileName);
-                }
-
-                return newFileEntry;
-            } else {
-                return copyFile(source, destination);
-            }
-        }
-    }
-
-    /**
-     * Creates the destination File object based on name passed in
-     *
-     * @param newName for the file directory to be called, if null use existing file name
-     * @param fp represents the source file
-     * @param destination represents the destination file
-     * @return a File object that represents the destination
-     */
-    private File createDestination(String newName, File fp, File destination) {
-        File destFile = null;
-
-        // I know this looks weird but it is to work around a JSON bug.
-        if ("null".equals(newName) || "".equals(newName)) {
-            newName = null;
-        }
-
-        if (newName != null) {
-            destFile = new File(destination.getAbsolutePath() + File.separator + newName);
-        } else {
-            destFile = new File(destination.getAbsolutePath() + File.separator + fp.getName());
-        }
-        return destFile;
-    }
-
-    /**
-     * Copy a file
-     *
-     * @param srcFile file to be copied
-     * @param destFile destination to be copied to
-     * @return a FileEntry object
-     * @throws IOException
-     * @throws InvalidModificationException
-     * @throws JSONException
-     */
-    private JSONObject copyFile(File srcFile, File destFile) throws IOException, InvalidModificationException, JSONException {
-        // Renaming a file to an existing directory should fail
-        if (destFile.exists() && destFile.isDirectory()) {
-            throw new InvalidModificationException("Can't rename a file to a directory");
-        }
-
-        copyAction(srcFile, destFile);
-
-        return getEntry(destFile);
-    }
-
-    /**
-     * Moved this code into it's own method so moveTo could use it when the move is across file systems
-     */
-    private void copyAction(File srcFile, File destFile)
-            throws FileNotFoundException, IOException {
-        FileInputStream istream = new FileInputStream(srcFile);
-        FileOutputStream ostream = new FileOutputStream(destFile);
-        FileChannel input = istream.getChannel();
-        FileChannel output = ostream.getChannel();
-
-        try {
-            input.transferTo(0, input.size(), output);
-        } finally {
-            istream.close();
-            ostream.close();
-            input.close();
-            output.close();
-        }
-    }
-
-    /**
-     * Copy a directory
-     *
-     * @param srcDir directory to be copied
-     * @param destinationDir destination to be copied to
-     * @return a DirectoryEntry object
-     * @throws JSONException
-     * @throws IOException
-     * @throws NoModificationAllowedException
-     * @throws InvalidModificationException
-     */
-    private JSONObject copyDirectory(File srcDir, File destinationDir) throws JSONException, IOException, NoModificationAllowedException, InvalidModificationException {
-        // Renaming a file to an existing directory should fail
-        if (destinationDir.exists() && destinationDir.isFile()) {
-            throw new InvalidModificationException("Can't rename a file to a directory");
-        }
-
-        // Check to make sure we are not copying the directory into itself
-        if (isCopyOnItself(srcDir.getAbsolutePath(), destinationDir.getAbsolutePath())) {
-            throw new InvalidModificationException("Can't copy itself into itself");
-        }
-
-        // See if the destination directory exists. If not create it.
-        if (!destinationDir.exists()) {
-            if (!destinationDir.mkdir()) {
-                // If we can't create the directory then fail
-                throw new NoModificationAllowedException("Couldn't create the destination directory");
-            }
-        }
-
-        for (File file : srcDir.listFiles()) {
-            if (file.isDirectory()) {
-                copyDirectory(file, destinationDir);
-            } else {
-                File destination = new File(destinationDir.getAbsoluteFile() + File.separator + file.getName());
-                copyFile(file, destination);
-            }
-        }
-
-        return getEntry(destinationDir);
-    }
-
-    /**
-     * Check to see if the user attempted to copy an entry into its parent without changing its name,
-     * or attempted to copy a directory into a directory that it contains directly or indirectly.
-     *
-     * @param srcDir
-     * @param destinationDir
-     * @return
-     */
-    private boolean isCopyOnItself(String src, String dest) {
-
-        // This weird test is to determine if we are copying or moving a directory into itself.
-        // Copy /sdcard/myDir to /sdcard/myDir-backup is okay but
-        // Copy /sdcard/myDir to /sdcard/myDir/backup should throw an INVALID_MODIFICATION_ERR
-        if (dest.startsWith(src) && dest.indexOf(File.separator, src.length() - 1) != -1) {
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Move a file
-     *
-     * @param srcFile file to be copied
-     * @param destFile destination to be copied to
-     * @return a FileEntry object
-     * @throws IOException
-     * @throws InvalidModificationException
-     * @throws JSONException
-     */
-    private JSONObject moveFile(File srcFile, File destFile) throws IOException, JSONException, InvalidModificationException {
-        // Renaming a file to an existing directory should fail
-        if (destFile.exists() && destFile.isDirectory()) {
-            throw new InvalidModificationException("Can't rename a file to a directory");
-        }
-
-        // Try to rename the file
-        if (!srcFile.renameTo(destFile)) {
-            // Trying to rename the file failed.  Possibly because we moved across file system on the device.
-            // Now we have to do things the hard way
-            // 1) Copy all the old file
-            // 2) delete the src file
-            copyAction(srcFile, destFile);
-            if (destFile.exists()) {
-                srcFile.delete();
-            } else {
-                throw new IOException("moved failed");
-            }
-        }
-
-        return getEntry(destFile);
-    }
-
-    /**
-     * Move a directory
-     *
-     * @param srcDir directory to be copied
-     * @param destinationDir destination to be copied to
-     * @return a DirectoryEntry object
-     * @throws JSONException
-     * @throws IOException
-     * @throws InvalidModificationException
-     * @throws NoModificationAllowedException
-     * @throws FileExistsException
-     */
-    private JSONObject moveDirectory(File srcDir, File destinationDir) throws IOException, JSONException, InvalidModificationException, NoModificationAllowedException, FileExistsException {
-        // Renaming a file to an existing directory should fail
-        if (destinationDir.exists() && destinationDir.isFile()) {
-            throw new InvalidModificationException("Can't rename a file to a directory");
-        }
-
-        // Check to make sure we are not copying the directory into itself
-        if (isCopyOnItself(srcDir.getAbsolutePath(), destinationDir.getAbsolutePath())) {
-            throw new InvalidModificationException("Can't move itself into itself");
-        }
-
-        // If the destination directory already exists and is empty then delete it.  This is according to spec.
-        if (destinationDir.exists()) {
-            if (destinationDir.list().length > 0) {
-                throw new InvalidModificationException("directory is not empty");
-            }
-        }
-
-        // Try to rename the directory
-        if (!srcDir.renameTo(destinationDir)) {
-            // Trying to rename the directory failed.  Possibly because we moved across file system on the device.
-            // Now we have to do things the hard way
-            // 1) Copy all the old files
-            // 2) delete the src directory
-            copyDirectory(srcDir, destinationDir);
-            if (destinationDir.exists()) {
-                removeDirRecursively(srcDir);
-            } else {
-                throw new IOException("moved failed");
-            }
-        }
-
-        return getEntry(destinationDir);
-    }
-
-    /**
-     * Deletes a directory and all of its contents, if any. In the event of an error
-     * [e.g. trying to delete a directory that contains a file that cannot be removed],
-     * some of the contents of the directory may be deleted.
-     * It is an error to attempt to delete the root directory of a filesystem.
-     *
-     * @param filePath the directory to be removed
-     * @return a boolean representing success of failure
-     * @throws FileExistsException
-     */
-    private boolean removeRecursively(String filePath) throws FileExistsException {
-        File fp = createFileObject(filePath);
-
-        // You can't delete the root directory.
-        if (atRootDirectory(filePath)) {
-            return false;
-        }
-
-        return removeDirRecursively(fp);
-    }
-
-    /**
-     * Loops through a directory deleting all the files.
-     *
-     * @param directory to be removed
-     * @return a boolean representing success of failure
-     * @throws FileExistsException
-     */
-    private boolean removeDirRecursively(File directory) throws FileExistsException {
-        if (directory.isDirectory()) {
-            for (File file : directory.listFiles()) {
-                removeDirRecursively(file);
-            }
-        }
-
-        if (!directory.delete()) {
-            throw new FileExistsException("could not delete: " + directory.getName());
-        } else {
-            return true;
-        }
-    }
-
-    /**
-     * Deletes a file or directory. It is an error to attempt to delete a directory that is not empty.
-     * It is an error to attempt to delete the root directory of a filesystem.
-     *
-     * @param filePath file or directory to be removed
-     * @return a boolean representing success of failure
-     * @throws NoModificationAllowedException
-     * @throws InvalidModificationException
-     */
-    private boolean remove(String filePath) throws NoModificationAllowedException, InvalidModificationException {
-        File fp = createFileObject(filePath);
-
-        // You can't delete the root directory.
-        if (atRootDirectory(filePath)) {
-            throw new NoModificationAllowedException("You can't delete the root directory");
-        }
-
-        // You can't delete a directory that is not empty
-        if (fp.isDirectory() && fp.list().length > 0) {
-            throw new InvalidModificationException("You can't delete a directory that is not empty.");
-        }
-
-        return fp.delete();
-    }
-
-    /**
-     * Creates or looks up a file.
-     *
-     * @param dirPath base directory
-     * @param fileName file/directory to lookup or create
-     * @param options specify whether to create or not
-     * @param directory if true look up directory, if false look up file
-     * @return a Entry object
-     * @throws FileExistsException
-     * @throws IOException
-     * @throws TypeMismatchException
-     * @throws EncodingException
-     * @throws JSONException
-     */
-    private JSONObject getFile(String dirPath, String fileName, JSONObject options, boolean directory) throws FileExistsException, IOException, TypeMismatchException, EncodingException, JSONException {
-        boolean create = false;
-        boolean exclusive = false;
-        if (options != null) {
-            create = options.optBoolean("create");
-            if (create) {
-                exclusive = options.optBoolean("exclusive");
-            }
-        }
-
-        // Check for a ":" character in the file to line up with BB and iOS
-        if (fileName.contains(":")) {
-            throw new EncodingException("This file has a : in it's name");
-        }
-
-        File fp = createFileObject(dirPath, fileName);
-
-        if (create) {
-            if (exclusive && fp.exists()) {
-                throw new FileExistsException("create/exclusive fails");
-            }
-            if (directory) {
-                fp.mkdir();
-            } else {
-                fp.createNewFile();
-            }
-            if (!fp.exists()) {
-                throw new FileExistsException("create fails");
-            }
-        }
-        else {
-            if (!fp.exists()) {
-                throw new FileNotFoundException("path does not exist");
-            }
-            if (directory) {
-                if (fp.isFile()) {
-                    throw new TypeMismatchException("path doesn't exist or is file");
-                }
-            } else {
-                if (fp.isDirectory()) {
-                    throw new TypeMismatchException("path doesn't exist or is directory");
-                }
-            }
-        }
-
-        // Return the directory
-        return getEntry(fp);
-    }
-
-    /**
-     * If the path starts with a '/' just return that file object. If not construct the file
-     * object from the path passed in and the file name.
-     *
-     * @param dirPath root directory
-     * @param fileName new file name
-     * @return
-     */
-    private File createFileObject(String dirPath, String fileName) {
-        File fp = null;
-        if (fileName.startsWith("/")) {
-            fp = new File(fileName);
-        } else {
-            dirPath = FileHelper.getRealPath(dirPath, cordova);
-            fp = new File(dirPath + File.separator + fileName);
-        }
-        return fp;
-    }
-
-    /**
-     * Look up the parent DirectoryEntry containing this Entry.
-     * If this Entry is the root of its filesystem, its parent is itself.
-     *
-     * @param filePath
-     * @return
-     * @throws JSONException
-     */
-    private JSONObject getParent(String filePath) throws JSONException {
-        filePath = FileHelper.getRealPath(filePath, cordova);
-
-        if (atRootDirectory(filePath)) {
-            return getEntry(filePath);
-        }
-        return getEntry(new File(filePath).getParent());
-    }
-
-    /**
-     * Checks to see if we are at the root directory.  Useful since we are
-     * not allow to delete this directory.
-     *
-     * @param filePath to directory
-     * @return true if we are at the root, false otherwise.
-     */
-    private boolean atRootDirectory(String filePath) {
-        filePath = FileHelper.getRealPath(filePath, cordova);
-
-        if (filePath.equals(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + cordova.getActivity().getPackageName() + "/cache") ||
-                filePath.equals(Environment.getExternalStorageDirectory().getAbsolutePath()) ||
-                filePath.equals("/data/data/" + cordova.getActivity().getPackageName())) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Create a File object from the passed in path
-     *
-     * @param filePath
-     * @return
-     */
-    private File createFileObject(String filePath) {
-        filePath = FileHelper.getRealPath(filePath, cordova);
-
-        File file = new File(filePath);
-        return file;
-    }
-
-    /**
-     * Look up metadata about this entry.
-     *
-     * @param filePath to entry
-     * @return a long
-     * @throws FileNotFoundException
-     */
-    private long getMetadata(String filePath) throws FileNotFoundException {
-        File file = createFileObject(filePath);
-
-        if (!file.exists()) {
-            throw new FileNotFoundException("Failed to find file in getMetadata");
-        }
-
-        return file.lastModified();
-    }
-
-    /**
-     * Returns a File that represents the current state of the file that this FileEntry represents.
-     *
-     * @param filePath to entry
-     * @return returns a JSONObject represent a W3C File object
-     * @throws FileNotFoundException
-     * @throws JSONException
-     */
-    private JSONObject getFileMetadata(String filePath) throws FileNotFoundException, JSONException {
-        File file = createFileObject(filePath);
-
-        if (!file.exists()) {
-            throw new FileNotFoundException("File: " + filePath + " does not exist.");
-        }
-
-        JSONObject metadata = new JSONObject();
-        metadata.put("size", file.length());
-        metadata.put("type", FileHelper.getMimeType(filePath, cordova));
-        metadata.put("name", file.getName());
-        metadata.put("fullPath", filePath);
-        metadata.put("lastModifiedDate", file.lastModified());
-
-        return metadata;
-    }
-
-    /**
-     * Requests a filesystem in which to store application data.
-     *
-     * @param type of file system requested
-     * @return a JSONObject representing the file system
-     * @throws IOException
-     * @throws JSONException
-     */
-    private JSONObject requestFileSystem(int type) throws IOException, JSONException {
-        JSONObject fs = new JSONObject();
-        if (type == TEMPORARY) {
-            File fp;
-            fs.put("name", "temporary");
-            if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
-                fp = new File(Environment.getExternalStorageDirectory().getAbsolutePath() +
-                        "/Android/data/" + cordova.getActivity().getPackageName() + "/cache/");
-                // Create the cache dir if it doesn't exist.
-                fp.mkdirs();
-                fs.put("root", getEntry(Environment.getExternalStorageDirectory().getAbsolutePath() +
-                        "/Android/data/" + cordova.getActivity().getPackageName() + "/cache/"));
-            } else {
-                fp = new File("/data/data/" + cordova.getActivity().getPackageName() + "/cache/");
-                // Create the cache dir if it doesn't exist.
-                fp.mkdirs();
-                fs.put("root", getEntry("/data/data/" + cordova.getActivity().getPackageName() + "/cache/"));
-            }
-        }
-        else if (type == PERSISTENT) {
-            fs.put("name", "persistent");
-            if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
-                fs.put("root", getEntry(Environment.getExternalStorageDirectory()));
-            } else {
-                fs.put("root", getEntry("/data/data/" + cordova.getActivity().getPackageName()));
-            }
-        }
-        else {
-            throw new IOException("No filesystem of type requested");
-        }
-
-        return fs;
-    }
-
-    /**
-     * Returns a JSON object representing the given File.
-     *
-     * @param file the File to convert
-     * @return a JSON representation of the given File
-     * @throws JSONException
-     */
-    public static JSONObject getEntry(File file) throws JSONException {
-        JSONObject entry = new JSONObject();
-
-        entry.put("isFile", file.isFile());
-        entry.put("isDirectory", file.isDirectory());
-        entry.put("name", file.getName());
-        entry.put("fullPath", "file://" + file.getAbsolutePath());
-        // The file system can't be specified, as it would lead to an infinite loop.
-        // entry.put("filesystem", null);
-
-        return entry;
-    }
-
-    /**
-     * Returns a JSON Object representing a directory on the device's file system
-     *
-     * @param path to the directory
-     * @return
-     * @throws JSONException
-     */
-    private JSONObject getEntry(String path) throws JSONException {
-        return getEntry(new File(path));
-    }
-
-
-    //--------------------------------------------------------------------------
-    // LOCAL METHODS
-    //--------------------------------------------------------------------------
-
-    /**
-     * Read the contents of a file.
-     * This is done in a background thread; the result is sent to the callback.
-     *
-     * @param filename          The name of the file.
-     * @param start             Start position in the file.
-     * @param end               End position to stop at (exclusive).
-     * @param callbackContext   The context through which to send the result.
-     * @param encoding          The encoding to return contents as.  Typical value is UTF-8. (see http://www.iana.org/assignments/character-sets)
-     * @param resultType        The desired type of data to send to the callback.
-     * @return                  Contents of file.
-     */
-    public void readFileAs(final String filename, final int start, final int end, final CallbackContext callbackContext, final String encoding, final int resultType) {
-        this.cordova.getThreadPool().execute(new Runnable() {
-            public void run() {
-                try {
-                    byte[] bytes = readAsBinaryHelper(filename, start, end);
-                    
-                    PluginResult result;
-                    switch (resultType) {
-                        case PluginResult.MESSAGE_TYPE_STRING:
-                            result = new PluginResult(PluginResult.Status.OK, new String(bytes, encoding));
-                            break;
-                        case PluginResult.MESSAGE_TYPE_ARRAYBUFFER:
-                            result = new PluginResult(PluginResult.Status.OK, bytes);
-                            break;
-                        case PluginResult.MESSAGE_TYPE_BINARYSTRING:
-                            result = new PluginResult(PluginResult.Status.OK, bytes, true);
-                            break;
-                        default: // Base64.
-                            String contentType = FileHelper.getMimeType(filename, cordova);
-                            byte[] base64 = Base64.encodeBase64(bytes);
-                            String s = "data:" + contentType + ";base64," + new String(base64, "US-ASCII");
-                            result = new PluginResult(PluginResult.Status.OK, s);
-                    }
-
-                    callbackContext.sendPluginResult(result);
-                } catch (FileNotFoundException e) {
-                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, NOT_FOUND_ERR));
-                } catch (IOException e) {
-                    Log.d(LOG_TAG, e.getLocalizedMessage());
-                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.IO_EXCEPTION, NOT_READABLE_ERR));
-                }
-            }
-        });
-    }
-
-    /**
-     * Read the contents of a file as binary.
-     * This is done synchronously; the result is returned.
-     *
-     * @param filename          The name of the file.
-     * @param start             Start position in the file.
-     * @param end               End position to stop at (exclusive).
-     * @return                  Contents of the file as a byte[].
-     * @throws IOException
-     */
-    private byte[] readAsBinaryHelper(String filename, int start, int end) throws IOException {
-        int numBytesToRead = end - start;
-        byte[] bytes = new byte[numBytesToRead];
-        InputStream inputStream = FileHelper.getInputStreamFromUriString(filename, cordova);
-        int numBytesRead = 0;
-
-        if (start > 0) {
-            inputStream.skip(start);
-        }
-
-        while (numBytesToRead > 0 && (numBytesRead = inputStream.read(bytes, numBytesRead, numBytesToRead)) >= 0) {
-            numBytesToRead -= numBytesRead;
-        }
-
-        return bytes;
-    }
-
-    /**
-     * Write contents of file.
-     *
-     * @param filename			The name of the file.
-     * @param data				The contents of the file.
-     * @param offset			The position to begin writing the file.
-     * @throws FileNotFoundException, IOException
-     * @throws NoModificationAllowedException
-     */
-    /**/
-    public long write(String filename, String data, int offset) throws FileNotFoundException, IOException, NoModificationAllowedException {
-        if (filename.startsWith("content://")) {
-            throw new NoModificationAllowedException("Couldn't write to file given its content URI");
-        }
-
-        filename = FileHelper.getRealPath(filename, cordova);
-
-        boolean append = false;
-        if (offset > 0) {
-            this.truncateFile(filename, offset);
-            append = true;
-        }
-
-        byte[] rawData = data.getBytes();
-        ByteArrayInputStream in = new ByteArrayInputStream(rawData);
-        FileOutputStream out = new FileOutputStream(filename, append);
-        byte buff[] = new byte[rawData.length];
-        in.read(buff, 0, buff.length);
-        out.write(buff, 0, rawData.length);
-        out.flush();
-        out.close();
-
-        return rawData.length;
-    }
-
-    /**
-     * Truncate the file to size
-     *
-     * @param filename
-     * @param size
-     * @throws FileNotFoundException, IOException
-     * @throws NoModificationAllowedException
-     */
-    private long truncateFile(String filename, long size) throws FileNotFoundException, IOException, NoModificationAllowedException {
-        if (filename.startsWith("content://")) {
-            throw new NoModificationAllowedException("Couldn't truncate file given its content URI");
-        }
-
-        filename = FileHelper.getRealPath(filename, cordova);
-
-        RandomAccessFile raf = new RandomAccessFile(filename, "rw");
-        try {
-            if (raf.length() >= size) {
-                FileChannel channel = raf.getChannel();
-                channel.truncate(size);
-                return size;
-            }
-
-            return raf.length();
-        } finally {
-            raf.close();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3b1a8317/framework/src/org/apache/cordova/GPSListener.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/GPSListener.java b/framework/src/org/apache/cordova/GPSListener.java
deleted file mode 100755
index daaf7ee..0000000
--- a/framework/src/org/apache/cordova/GPSListener.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-       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.
-*/
-
-package org.apache.cordova;
-
-import android.location.LocationManager;
-
-/**
- * This class handles requests for GPS location services.
- *
- */
-public class GPSListener extends CordovaLocationListener {
-    public GPSListener(LocationManager locationManager, GeoBroker m) {
-        super(locationManager, m, "[Cordova GPSListener]");
-    }
-
-
-    /**
-     * Start requesting location updates.
-     *
-     * @param interval
-     */
-    @Override
-    protected void start() {
-        if (!this.running) {
-            if (this.locationManager.getProvider(LocationManager.GPS_PROVIDER) != null) {
-                this.running = true;
-                this.locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 0, this);
-            } else {
-                this.fail(CordovaLocationListener.POSITION_UNAVAILABLE, "GPS provider is not available.");
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3b1a8317/framework/src/org/apache/cordova/GeoBroker.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/GeoBroker.java b/framework/src/org/apache/cordova/GeoBroker.java
deleted file mode 100644
index 4a07b73..0000000
--- a/framework/src/org/apache/cordova/GeoBroker.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-       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.
-*/
-package org.apache.cordova;
-
-import org.apache.cordova.api.CallbackContext;
-import org.apache.cordova.api.CordovaPlugin;
-import org.apache.cordova.api.PluginResult;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.content.Context;
-import android.location.Location;
-import android.location.LocationManager;
-
-/*
- * This class is the interface to the Geolocation.  It's bound to the geo object.
- *
- * This class only starts and stops various GeoListeners, which consist of a GPS and a Network Listener
- */
-
-public class GeoBroker extends CordovaPlugin {
-    private GPSListener gpsListener;
-    private NetworkListener networkListener;
-    private LocationManager locationManager;    
-
-    /**
-     * Constructor.
-     */
-    public GeoBroker() {
-    }
-
-    /**
-     * Executes the request and returns PluginResult.
-     *
-     * @param action 		The action to execute.
-     * @param args 		JSONArry of arguments for the plugin.
-     * @param callbackContext	The callback id used when calling back into JavaScript.
-     * @return 			True if the action was valid, or false if not.
-     */
-    public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
-        if (this.locationManager == null) {
-            this.locationManager = (LocationManager) this.cordova.getActivity().getSystemService(Context.LOCATION_SERVICE);
-            this.networkListener = new NetworkListener(this.locationManager, this);
-            this.gpsListener = new GPSListener(this.locationManager, this);
-        }
-
-        if ( locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ||
-                locationManager.isProviderEnabled( LocationManager.NETWORK_PROVIDER )) {
-
-            if (action.equals("getLocation")) {
-                boolean enableHighAccuracy = args.getBoolean(0);
-                int maximumAge = args.getInt(1);
-                Location last = this.locationManager.getLastKnownLocation((enableHighAccuracy ? LocationManager.GPS_PROVIDER : LocationManager.NETWORK_PROVIDER));
-                // Check if we can use lastKnownLocation to get a quick reading and use less battery
-                if (last != null && (System.currentTimeMillis() - last.getTime()) <= maximumAge) {
-                    PluginResult result = new PluginResult(PluginResult.Status.OK, this.returnLocationJSON(last));
-                    callbackContext.sendPluginResult(result);
-                } else {
-                    this.getCurrentLocation(callbackContext, enableHighAccuracy, args.optInt(2, 60000));
-                }
-            }
-            else if (action.equals("addWatch")) {
-                String id = args.getString(0);
-                boolean enableHighAccuracy = args.getBoolean(1);
-                this.addWatch(id, callbackContext, enableHighAccuracy);
-            }
-            else if (action.equals("clearWatch")) {
-                String id = args.getString(0);
-                this.clearWatch(id);
-            }
-            else {
-                return false;
-            }
-        } else {
-            PluginResult.Status status = PluginResult.Status.NO_RESULT;
-            String message = "Location API is not available for this device.";
-            PluginResult result = new PluginResult(status, message);
-            callbackContext.sendPluginResult(result);
-        }
-        return true;
-    }
-
-    private void clearWatch(String id) {
-        this.gpsListener.clearWatch(id);
-        this.networkListener.clearWatch(id);
-    }
-
-    private void getCurrentLocation(CallbackContext callbackContext, boolean enableHighAccuracy, int timeout) {
-        if (enableHighAccuracy) {
-            this.gpsListener.addCallback(callbackContext, timeout);
-        } else {
-            this.networkListener.addCallback(callbackContext, timeout);
-        }
-    }
-
-    private void addWatch(String timerId, CallbackContext callbackContext, boolean enableHighAccuracy) {
-        if (enableHighAccuracy) {
-            this.gpsListener.addWatch(timerId, callbackContext);
-        } else {
-            this.networkListener.addWatch(timerId, callbackContext);
-        }
-    }
-
-    /**
-     * Called when the activity is to be shut down.
-     * Stop listener.
-     */
-    public void onDestroy() {
-        if (this.networkListener != null) {
-            this.networkListener.destroy();
-            this.networkListener = null;
-        }
-        if (this.gpsListener != null) {
-            this.gpsListener.destroy();
-            this.gpsListener = null;
-        }
-    }
-
-    /**
-     * Called when the view navigates.
-     * Stop the listeners.
-     */
-    public void onReset() {
-        this.onDestroy();
-    }
-
-    public JSONObject returnLocationJSON(Location loc) {
-        JSONObject o = new JSONObject();
-
-        try {
-            o.put("latitude", loc.getLatitude());
-            o.put("longitude", loc.getLongitude());
-            o.put("altitude", (loc.hasAltitude() ? loc.getAltitude() : null));
-            o.put("accuracy", loc.getAccuracy());
-            o.put("heading", (loc.hasBearing() ? (loc.hasSpeed() ? loc.getBearing() : null) : null));
-            o.put("velocity", loc.getSpeed());
-            o.put("timestamp", loc.getTime());
-        } catch (JSONException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        return o;
-    }
-
-    public void win(Location loc, CallbackContext callbackContext, boolean keepCallback) {
-    	PluginResult result = new PluginResult(PluginResult.Status.OK, this.returnLocationJSON(loc));
-    	result.setKeepCallback(keepCallback);
-        callbackContext.sendPluginResult(result);
-    }
-
-    /**
-     * Location failed.  Send error back to JavaScript.
-     * 
-     * @param code			The error code
-     * @param msg			The error message
-     * @throws JSONException 
-     */
-    public void fail(int code, String msg, CallbackContext callbackContext, boolean keepCallback) {
-        JSONObject obj = new JSONObject();
-        String backup = null;
-        try {
-            obj.put("code", code);
-            obj.put("message", msg);
-        } catch (JSONException e) {
-            obj = null;
-            backup = "{'code':" + code + ",'message':'" + msg.replaceAll("'", "\'") + "'}";
-        }
-        PluginResult result;
-        if (obj != null) {
-            result = new PluginResult(PluginResult.Status.ERROR, obj);
-        } else {
-            result = new PluginResult(PluginResult.Status.ERROR, backup);
-        }
-
-        result.setKeepCallback(keepCallback);
-        callbackContext.sendPluginResult(result);
-    }
-
-    public boolean isGlobalListener(CordovaLocationListener listener)
-    {
-    	if (gpsListener != null && networkListener != null)
-    	{
-    		return gpsListener.equals(listener) || networkListener.equals(listener);
-    	}
-    	else
-    		return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3b1a8317/framework/src/org/apache/cordova/Globalization.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/Globalization.java b/framework/src/org/apache/cordova/Globalization.java
deleted file mode 100644
index 5c75e10..0000000
--- a/framework/src/org/apache/cordova/Globalization.java
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
-       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.
-*/
-
-package org.apache.cordova;
-
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Currency;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TimeZone;
-
-import org.apache.cordova.api.CallbackContext;
-import org.apache.cordova.api.CordovaPlugin;
-import org.apache.cordova.api.PluginResult;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.annotation.TargetApi;
-import android.text.format.Time;
-
-/**
- *
- */
-public class Globalization extends CordovaPlugin  {
-    //GlobalizationCommand Plugin Actions
-    public static final String GETLOCALENAME = "getLocaleName";
-    public static final String DATETOSTRING = "dateToString";
-    public static final String STRINGTODATE = "stringToDate";
-    public static final String GETDATEPATTERN = "getDatePattern";
-    public static final String GETDATENAMES = "getDateNames";
-    public static final String ISDAYLIGHTSAVINGSTIME = "isDayLightSavingsTime";
-    public static final String GETFIRSTDAYOFWEEK = "getFirstDayOfWeek";
-    public static final String NUMBERTOSTRING = "numberToString";
-    public static final String STRINGTONUMBER = "stringToNumber";
-    public static final String GETNUMBERPATTERN = "getNumberPattern";
-    public static final String GETCURRENCYPATTERN = "getCurrencyPattern";
-    public static final String GETPREFERREDLANGUAGE = "getPreferredLanguage";
-
-    //GlobalizationCommand Option Parameters
-    public static final String OPTIONS = "options";
-    public static final String FORMATLENGTH = "formatLength";
-    //public static final String SHORT = "short"; //default for dateToString format
-    public static final String MEDIUM = "medium";
-    public static final String LONG = "long";
-    public static final String FULL = "full";
-    public static final String SELECTOR = "selector";
-    //public static final String DATEANDTIME = "date and time"; //default for dateToString
-    public static final String DATE = "date";
-    public static final String TIME = "time";
-    public static final String DATESTRING = "dateString";
-    public static final String TYPE = "type";
-    public static final String ITEM = "item";
-    public static final String NARROW = "narrow";
-    public static final String WIDE = "wide";
-    public static final String MONTHS = "months";
-    public static final String DAYS = "days";
-    //public static final String DECMIAL = "wide"; //default for numberToString
-    public static final String NUMBER = "number";
-    public static final String NUMBERSTRING = "numberString";
-    public static final String PERCENT = "percent";
-    public static final String CURRENCY = "currency";
-    public static final String CURRENCYCODE = "currencyCode";
-
-    @Override
-    public boolean execute(String action, JSONArray data, CallbackContext callbackContext) {
-        JSONObject obj = new JSONObject();
-
-        try{
-            if (action.equals(GETLOCALENAME)){
-                obj = getLocaleName();
-            }else if (action.equals(GETPREFERREDLANGUAGE)){
-                obj = getPreferredLanguage();
-            } else if (action.equalsIgnoreCase(DATETOSTRING)) {
-                obj = getDateToString(data);
-            }else if(action.equalsIgnoreCase(STRINGTODATE)){
-                obj = getStringtoDate(data);
-            }else if(action.equalsIgnoreCase(GETDATEPATTERN)){
-                obj = getDatePattern(data);
-            }else if(action.equalsIgnoreCase(GETDATENAMES)){
-                if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.GINGERBREAD) {
-                    throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-                } else {
-                    obj = getDateNames(data);
-                }
-            }else if(action.equalsIgnoreCase(ISDAYLIGHTSAVINGSTIME)){
-                obj = getIsDayLightSavingsTime(data);
-            }else if(action.equalsIgnoreCase(GETFIRSTDAYOFWEEK)){
-                obj = getFirstDayOfWeek(data);
-            }else if(action.equalsIgnoreCase(NUMBERTOSTRING)){
-                obj = getNumberToString(data);
-            }else if(action.equalsIgnoreCase(STRINGTONUMBER)){
-                obj = getStringToNumber(data);
-            }else if(action.equalsIgnoreCase(GETNUMBERPATTERN)){
-                obj = getNumberPattern(data);
-            }else if(action.equalsIgnoreCase(GETCURRENCYPATTERN)){
-                obj = getCurrencyPattern(data);
-            }else {
-                return false;
-            }
-
-            callbackContext.success(obj);
-        }catch (GlobalizationError ge){
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, ge.toJson()));
-        }catch (Exception e){
-            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION));
-        }
-        return true;
-    }
-    /*
-     * @Description: Returns the string identifier for the client's current locale setting
-     *
-     * @Return: JSONObject
-     *          Object.value {String}: The locale identifier
-     *
-     * @throws: GlobalizationError.UNKNOWN_ERROR
-     */
-    private JSONObject getLocaleName() throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        try{
-            obj.put("value",Locale.getDefault().toString());//get the locale from the Android Device
-            return obj;
-        }catch(Exception e){
-            throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-        }
-    }
-    /*
-     * @Description: Returns the string identifier for the client's current language
-     *
-     * @Return: JSONObject
-     *          Object.value {String}: The language identifier
-     *
-     * @throws: GlobalizationError.UNKNOWN_ERROR
-     */
-    private JSONObject getPreferredLanguage() throws GlobalizationError {
-        JSONObject obj = new JSONObject();
-        try {
-            obj.put("value", Locale.getDefault().getDisplayLanguage().toString());
-            return obj;
-        } catch (Exception e) {
-            throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-        }
-    }
-    /*
-     * @Description: Returns a date formatted as a string according to the client's user preferences and
-     * calendar using the time zone of the client.
-     *
-     * @Return: JSONObject
-     *          Object.value {String}: The localized date string
-     *
-     * @throws: GlobalizationError.FORMATTING_ERROR
-     */
-    private JSONObject getDateToString(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        try{
-            Date date = new Date((Long)options.getJSONObject(0).get(DATE));
-
-            //get formatting pattern from android device (Will only have device specific formatting for short form of date) or options supplied
-            JSONObject datePattern = getDatePattern(options);
-            SimpleDateFormat fmt = new SimpleDateFormat(datePattern.getString("pattern"));
-
-            //return formatted date
-            return obj.put("value",fmt.format(date));
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.FORMATTING_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Parses a date formatted as a string according to the client's user
-     * preferences and calendar using the time zone of the client and returns
-     * the corresponding date object
-     * @Return: JSONObject
-     *          Object.year {Number}: The four digit year
-     *          Object.month {Number}: The month from (0 - 11)
-     *          Object.day {Number}: The day from (1 - 31)
-     *          Object.hour {Number}: The hour from (0 - 23)
-     *          Object.minute {Number}: The minute from (0 - 59)
-     *          Object.second {Number}: The second from (0 - 59)
-     *          Object.millisecond {Number}: The milliseconds (from 0 - 999), not available on all platforms
-     *
-     * @throws: GlobalizationError.PARSING_ERROR
-    */
-    private JSONObject getStringtoDate(JSONArray options)throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        Date date;
-        try{
-            //get format pattern from android device (Will only have device specific formatting for short form of date) or options supplied
-            DateFormat fmt = new SimpleDateFormat(getDatePattern(options).getString("pattern"));
-
-            //attempt parsing string based on user preferences
-            date = fmt.parse(options.getJSONObject(0).get(DATESTRING).toString());
-
-            //set Android Time object
-            Time time = new Time();
-            time.set(date.getTime());
-
-            //return properties;
-            obj.put("year", time.year);
-            obj.put("month", time.month);
-            obj.put("day", time.monthDay);
-            obj.put("hour", time.hour);
-            obj.put("minute", time.minute);
-            obj.put("second", time.second);
-            obj.put("millisecond", new Long(0));
-            return obj;
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.PARSING_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns a pattern string for formatting and parsing dates according to the client's
-     * user preferences.
-     * @Return: JSONObject
-     *
-     *          Object.pattern {String}: The date and time pattern for formatting and parsing dates.
-     *                                  The patterns follow Unicode Technical Standard #35
-     *                                  http://unicode.org/reports/tr35/tr35-4.html
-     *          Object.timezone {String}: The abbreviated name of the time zone on the client
-     *          Object.utc_offset {Number}: The current difference in seconds between the client's
-     *                                      time zone and coordinated universal time.
-     *          Object.dst_offset {Number}: The current daylight saving time offset in seconds
-     *                                      between the client's non-daylight saving's time zone
-     *                                      and the client's daylight saving's time zone.
-     *
-     * @throws: GlobalizationError.PATTERN_ERROR
-    */
-    private JSONObject getDatePattern(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-
-        try{
-            SimpleDateFormat fmtDate = (SimpleDateFormat)android.text.format.DateFormat.getDateFormat(this.cordova.getActivity()); //default user preference for date
-            SimpleDateFormat fmtTime = (SimpleDateFormat)android.text.format.DateFormat.getTimeFormat(this.cordova.getActivity());  //default user preference for time
-
-            String fmt = fmtDate.toLocalizedPattern() + " " + fmtTime.toLocalizedPattern(); //default SHORT date/time format. ex. dd/MM/yyyy h:mm a
-
-            //get Date value + options (if available)
-            if (options.getJSONObject(0).length() > 1){
-                //options were included
-
-                //get formatLength option
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(FORMATLENGTH)){
-                    String fmtOpt = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(FORMATLENGTH);
-                    if (fmtOpt.equalsIgnoreCase(MEDIUM)){//medium
-                        fmtDate = (SimpleDateFormat)android.text.format.DateFormat.getMediumDateFormat(this.cordova.getActivity());
-                    }else if (fmtOpt.equalsIgnoreCase(LONG) || fmtOpt.equalsIgnoreCase(FULL)){ //long/full
-                        fmtDate = (SimpleDateFormat)android.text.format.DateFormat.getLongDateFormat(this.cordova.getActivity());
-                    }
-                }
-
-                //return pattern type
-                fmt = fmtDate.toLocalizedPattern() + " " + fmtTime.toLocalizedPattern();
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(SELECTOR)){
-                    String selOpt = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(SELECTOR);
-                    if (selOpt.equalsIgnoreCase(DATE)){
-                        fmt =  fmtDate.toLocalizedPattern();
-                    }else if (selOpt.equalsIgnoreCase(TIME)){
-                        fmt = fmtTime.toLocalizedPattern();
-                    }
-                }
-            }
-
-            //TimeZone from users device
-            //TimeZone tz = Calendar.getInstance(Locale.getDefault()).getTimeZone(); //substitute method
-            TimeZone tz = TimeZone.getTimeZone(Time.getCurrentTimezone());
-
-            obj.put("pattern", fmt);
-            obj.put("timezone", tz.getDisplayName(tz.inDaylightTime(Calendar.getInstance().getTime()),TimeZone.SHORT));
-            obj.put("utc_offset", tz.getRawOffset()/1000);
-            obj.put("dst_offset", tz.getDSTSavings()/1000);
-            return obj;
-
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.PATTERN_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns an array of either the names of the months or days of the week
-     * according to the client's user preferences and calendar
-     * @Return: JSONObject
-     *          Object.value {Array{String}}: The array of names starting from either
-     *                                      the first month in the year or the
-     *                                      first day of the week.
-     *
-     * @throws: GlobalizationError.UNKNOWN_ERROR
-    */
-    @TargetApi(9)
-    private JSONObject getDateNames(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        //String[] value;
-        JSONArray value = new JSONArray();
-        List<String> namesList = new ArrayList<String>();
-        final Map<String,Integer> namesMap; // final needed for sorting with anonymous comparator
-        try{
-            int type = 0; //default wide
-            int item = 0; //default months
-
-            //get options if available
-            if (options.getJSONObject(0).length() > 0){
-                //get type if available
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(TYPE)){
-                    String t = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(TYPE);
-                    if (t.equalsIgnoreCase(NARROW)){type++;} //DateUtils.LENGTH_MEDIUM
-                }
-                //get item if available
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(ITEM)){
-                    String t = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(ITEM);
-                    if (t.equalsIgnoreCase(DAYS)){item += 10;} //Days of week start at 1
-                }
-            }
-            //determine return value
-            int method = item + type;
-            if  (method == 1) { //months and narrow
-                namesMap = Calendar.getInstance().getDisplayNames(Calendar.MONTH, Calendar.SHORT, Locale.getDefault());
-            } else if (method == 10) { //days and wide
-                namesMap = Calendar.getInstance().getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.LONG, Locale.getDefault());
-            } else if (method == 11) { //days and narrow
-                namesMap = Calendar.getInstance().getDisplayNames(Calendar.DAY_OF_WEEK, Calendar.SHORT, Locale.getDefault());
-            } else { //default: months and wide
-                namesMap = Calendar.getInstance().getDisplayNames(Calendar.MONTH, Calendar.LONG, Locale.getDefault());
-            }
-
-            // save names as a list
-            for(String name : namesMap.keySet()) {
-                namesList.add(name);
-            }
-
-            // sort the list according to values in namesMap
-            Collections.sort(namesList, new Comparator<String>() {
-                public int compare(String arg0, String arg1) {
-                    return namesMap.get(arg0).compareTo(namesMap.get(arg1));
-                }
-            });
-
-            // convert nameList into JSONArray of String objects
-            for (int i = 0; i < namesList.size(); i ++){
-                value.put(namesList.get(i));
-            }
-
-            //return array of names
-            return obj.put("value", value);
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns whether daylight savings time is in effect for a given date using the client's
-     * time zone and calendar.
-     * @Return: JSONObject
-     *          Object.dst {Boolean}: The value "true" indicates that daylight savings time is
-     *                              in effect for the given date and "false" indicate that it is not.    *
-     *
-     * @throws: GlobalizationError.UNKNOWN_ERROR
-    */
-    private JSONObject getIsDayLightSavingsTime(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        boolean dst = false;
-        try{
-            Date date = new Date((Long)options.getJSONObject(0).get(DATE));
-            //TimeZone tz = Calendar.getInstance(Locale.getDefault()).getTimeZone();
-            TimeZone tz = TimeZone.getTimeZone(Time.getCurrentTimezone());
-            dst = tz.inDaylightTime(date); //get daylight savings data from date object and user timezone settings
-
-            return obj.put("dst",dst);
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns the first day of the week according to the client's user preferences and calendar.
-     * The days of the week are numbered starting from 1 where 1 is considered to be Sunday.
-     * @Return: JSONObject
-     *          Object.value {Number}: The number of the first day of the week.
-     *
-     * @throws: GlobalizationError.UNKNOWN_ERROR
-    */
-    private JSONObject getFirstDayOfWeek(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        try{
-            int value = Calendar.getInstance(Locale.getDefault()).getFirstDayOfWeek(); //get first day of week based on user locale settings
-            return obj.put("value", value);
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.UNKNOWN_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns a number formatted as a string according to the client's user preferences.
-     * @Return: JSONObject
-     *          Object.value {String}: The formatted number string.
-     *
-     * @throws: GlobalizationError.FORMATTING_ERROR
-    */
-    private JSONObject getNumberToString(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        String value = "";
-        try{
-            DecimalFormat fmt = getNumberFormatInstance(options);//returns Decimal/Currency/Percent instance
-            value = fmt.format(options.getJSONObject(0).get(NUMBER));
-            return obj.put("value", value);
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.FORMATTING_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Parses a number formatted as a string according to the client's user preferences and
-     * returns the corresponding number.
-     * @Return: JSONObject
-     *          Object.value {Number}: The parsed number.
-     *
-     * @throws: GlobalizationError.PARSING_ERROR
-    */
-    private JSONObject getStringToNumber(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        Number value;
-        try{
-            DecimalFormat fmt = getNumberFormatInstance(options); //returns Decimal/Currency/Percent instance
-            value = fmt.parse((String)options.getJSONObject(0).get(NUMBERSTRING));
-            return obj.put("value", value);
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.PARSING_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns a pattern string for formatting and parsing numbers according to the client's user
-     * preferences.
-     * @Return: JSONObject
-     *          Object.pattern {String}: The number pattern for formatting and parsing numbers.
-     *                                  The patterns follow Unicode Technical Standard #35.
-     *                                  http://unicode.org/reports/tr35/tr35-4.html
-     *          Object.symbol {String}: The symbol to be used when formatting and parsing
-     *                                  e.g., percent or currency symbol.
-     *          Object.fraction {Number}: The number of fractional digits to use when parsing and
-     *                                  formatting numbers.
-     *          Object.rounding {Number}: The rounding increment to use when parsing and formatting.
-     *          Object.positive {String}: The symbol to use for positive numbers when parsing and formatting.
-     *          Object.negative: {String}: The symbol to use for negative numbers when parsing and formatting.
-     *          Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
-     *          Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
-     *
-     * @throws: GlobalizationError.PATTERN_ERROR
-    */
-    private JSONObject getNumberPattern(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        try{
-            //uses java.text.DecimalFormat to format value
-            DecimalFormat fmt = (DecimalFormat) DecimalFormat.getInstance(Locale.getDefault()); //default format
-            String symbol = String.valueOf(fmt.getDecimalFormatSymbols().getDecimalSeparator());
-            //get Date value + options (if available)
-            if (options.getJSONObject(0).length() > 0){
-                //options were included
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(TYPE)){
-                    String fmtOpt = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(TYPE);
-                    if (fmtOpt.equalsIgnoreCase(CURRENCY)){
-                        fmt = (DecimalFormat) DecimalFormat.getCurrencyInstance(Locale.getDefault());
-                        symbol = fmt.getDecimalFormatSymbols().getCurrencySymbol();
-                    }else if(fmtOpt.equalsIgnoreCase(PERCENT)){
-                        fmt = (DecimalFormat) DecimalFormat.getPercentInstance(Locale.getDefault());
-                        symbol = String.valueOf(fmt.getDecimalFormatSymbols().getPercent());
-                    }
-                }
-            }
-
-            //return properties
-            obj.put("pattern", fmt.toPattern());
-            obj.put("symbol", symbol);
-            obj.put("fraction", fmt.getMinimumFractionDigits());
-            obj.put("rounding", new Integer(0));
-            obj.put("positive", fmt.getPositivePrefix());
-            obj.put("negative", fmt.getNegativePrefix());
-            obj.put("decimal", String.valueOf(fmt.getDecimalFormatSymbols().getDecimalSeparator()));
-            obj.put("grouping", String.valueOf(fmt.getDecimalFormatSymbols().getGroupingSeparator()));
-
-            return obj;
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.PATTERN_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Returns a pattern string for formatting and parsing currency values according to the client's
-     * user preferences and ISO 4217 currency code.
-     * @Return: JSONObject
-     *          Object.pattern {String}: The currency pattern for formatting and parsing currency values.
-     *                                  The patterns follow Unicode Technical Standard #35
-     *                                  http://unicode.org/reports/tr35/tr35-4.html
-     *          Object.code {String}: The ISO 4217 currency code for the pattern.
-     *          Object.fraction {Number}: The number of fractional digits to use when parsing and
-     *                                  formatting currency.
-     *          Object.rounding {Number}: The rounding increment to use when parsing and formatting.
-     *          Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
-     *          Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
-     *
-     * @throws: GlobalizationError.FORMATTING_ERROR
-    */
-    private JSONObject getCurrencyPattern(JSONArray options) throws GlobalizationError{
-        JSONObject obj = new JSONObject();
-        try{
-            //get ISO 4217 currency code
-            String code = options.getJSONObject(0).getString(CURRENCYCODE);
-
-            //uses java.text.DecimalFormat to format value
-            DecimalFormat fmt = (DecimalFormat) DecimalFormat.getCurrencyInstance(Locale.getDefault());
-
-            //set currency format
-            Currency currency = Currency.getInstance(code);
-            fmt.setCurrency(currency);
-
-            //return properties
-            obj.put("pattern", fmt.toPattern());
-            obj.put("code", currency.getCurrencyCode());
-            obj.put("fraction", fmt.getMinimumFractionDigits());
-            obj.put("rounding", new Integer(0));
-            obj.put("decimal", String.valueOf(fmt.getDecimalFormatSymbols().getDecimalSeparator()));
-            obj.put("grouping", String.valueOf(fmt.getDecimalFormatSymbols().getGroupingSeparator()));
-
-            return obj;
-        }catch(Exception ge){
-            throw new GlobalizationError(GlobalizationError.FORMATTING_ERROR);
-        }
-    }
-
-    /*
-     * @Description: Parses a JSONArray from user options and returns the correct Instance of Decimal/Percent/Currency.
-     * @Return: DecimalFormat : The Instance to use.
-     *
-     * @throws: JSONException
-    */
-    private DecimalFormat getNumberFormatInstance(JSONArray options) throws JSONException{
-        DecimalFormat fmt =  (DecimalFormat)DecimalFormat.getInstance(Locale.getDefault()); //default format
-        try{
-            if (options.getJSONObject(0).length() > 1){
-                //options were included
-                if (!((JSONObject)options.getJSONObject(0).get(OPTIONS)).isNull(TYPE)){
-                    String fmtOpt = (String)((JSONObject)options.getJSONObject(0).get(OPTIONS)).get(TYPE);
-                    if (fmtOpt.equalsIgnoreCase(CURRENCY)){
-                        fmt = (DecimalFormat)DecimalFormat.getCurrencyInstance(Locale.getDefault());
-                    }else if(fmtOpt.equalsIgnoreCase(PERCENT)){
-                        fmt = (DecimalFormat)DecimalFormat.getPercentInstance(Locale.getDefault());
-                    }
-                }
-            }
-
-        }catch (JSONException je){}
-        return fmt;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/3b1a8317/framework/src/org/apache/cordova/GlobalizationError.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/GlobalizationError.java b/framework/src/org/apache/cordova/GlobalizationError.java
deleted file mode 100644
index 8a171d4..0000000
--- a/framework/src/org/apache/cordova/GlobalizationError.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-       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.
-*/
-
-package org.apache.cordova;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-/** 
- * @description Exception class representing defined Globalization error codes
- * @Globalization error codes:
- *      GlobalizationError.UNKNOWN_ERROR = 0;
- *      GlobalizationError.FORMATTING_ERROR = 1;   
- *      GlobalizationError.PARSING_ERROR = 2;   
- *      GlobalizationError.PATTERN_ERROR = 3;
- */
-public class GlobalizationError extends Exception{
-    /**
-     * 
-     */
-    private static final long serialVersionUID = 1L;
-    public static final String UNKNOWN_ERROR = "UNKNOWN_ERROR";
-    public static final String FORMATTING_ERROR = "FORMATTING_ERROR";
-    public static final String PARSING_ERROR = "PARSING_ERROR";
-    public static final String PATTERN_ERROR = "PATTERN_ERROR";
-    
-    int error = 0;  //default unknown error thrown
-    /**
-     * Default constructor        
-     */
-    public GlobalizationError() {}
-    /**
-     * Create an exception returning an error code 
-     *    
-     * @param   s           
-     */
-    public GlobalizationError(String s) {       
-        if (s.equalsIgnoreCase(FORMATTING_ERROR)){
-            error = 1;
-        }else if (s.equalsIgnoreCase(PARSING_ERROR)){
-            error = 2;
-        }else if (s.equalsIgnoreCase(PATTERN_ERROR)){
-            error = 3;
-        }       
-    }
-    /**
-     * get error string based on error code 
-     *    
-     * @param   String msg           
-     */
-    public String getErrorString(){
-        String msg = "";
-        switch (error){
-        case 0:
-            msg = UNKNOWN_ERROR;
-            break;
-        case 1:
-            msg =  FORMATTING_ERROR;
-            break;
-        case 2:
-            msg =  PARSING_ERROR;
-            break;
-        case 3:
-            msg =  PATTERN_ERROR;
-            break;
-        }
-        return msg;
-    }
-    /**
-     * get error code 
-     *    
-     * @param   String msg           
-     */
-    public int getErrorCode(){      
-        return error;
-    }
-    
-    /**
-     * get the json version of this object to return to javascript
-     * @return
-     */
-    public JSONObject toJson() {
-        JSONObject obj = new JSONObject();
-        try {
-            obj.put("code", getErrorCode());
-            obj.put("message", getErrorString());
-        } catch (JSONException e) {
-            // never happens
-        }
-        return obj;
-    }
-}


Mime
View raw message