Commit 8e06675c authored by Alan McNatty's avatar Alan McNatty
Browse files

Added copyright, license information, author credits to original author of...

Added copyright, license information, author credits to original author of much of the code used in MaharaDroid
parent cc40023b
bin
gen
.classpath
.project
local.properties
build
......@@ -2,7 +2,7 @@
* MaharaDroid - Artefact uploader
*
* This file is part of MaharaDroid.
*
*
* Copyright [2010] [Catalyst IT Limited]
*
* Licensed under the Apache License, Version 2.0 (the "License");
......@@ -25,6 +25,14 @@ import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
/*
* The ArtifactSendReceiver class is taken from the PictureSendReceiver class
* written by Russel Stewart (rnstewart@gmail.com) as part of the Flickr Free
* Android application.
*
* @author Alan McNatty (alan.mcnatty@catalyst.net.nz)
*/
public class ArtifactSendReceiver extends Activity {
@Override
......
/*
* MaharaDroid - Artefact uploader
*
* This file is part of MaharaDroid.
*
* Copyright [2010] [Catalyst IT Limited]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nz.co.catalyst.MaharaDroid;
import android.app.Activity;
......@@ -14,6 +34,15 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;
/*
* The ArtifactSettings class is based on the PictureSettings class,
* it has been modified to only support upload components. The original was
* written by Russel Stewart (rnstewart@gmail.com) as part of the Flickr Free
* Android application.
*
* @author Alan McNatty (alan.mcnatty@catalyst.net.nz)
*/
public class ArtifactSettings extends Activity implements OnClickListener {
private Bundle m_extras;
......
/*
* ENUM Discoverer. ENUM Demonstration software, demonstrating the potential of ENUM.
*
* Copyright (C) 2009 SIDN and ISOC.nl
* MaharaDroid - Artefact uploader
*
* This file is part of ENUM Discoverer.
*
* Copyright (C) 2009 SIDN and ISOC.nl
*
* ENUM Discoverer is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
......
/*
* MaharaDroid - Artefact uploader
*
* This file is part of MaharaDroid.
*
* Copyright [2010] [Catalyst IT Limited]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nz.co.catalyst.MaharaDroid;
/*
* The GlobalResources class is taken from the GlobalResources class
* written by Russel Stewart (rnstewart@gmail.com) as part of the Flickr Free
* Android application. Changes were made to reduce support to simple HTTP POST
* upload of content only.
*
* @author Alan McNatty (alan.mcnatty@catalyst.net.nz)
*/
public class GlobalResources {
public static final String INTENT_UPLOAD_STARTED = "nz.co.catalyst.MaharaDroid.UPLOAD_STARTED";
......
package nz.co.catalyst.MaharaDroid;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class JSONParser {
// Path should be of the form "<object name>/<object name>/<object name>"
public static JSONObject getObject(JSONObject obj, String path) {
JSONObject r_obj = null;
String[] path_arr = path.split("/");
try {
for (int i = 0; i < path_arr.length; ++i) {
if (obj == null || !obj.has(path_arr[i])) {
// Something is wrong with the path, or the object
// requested does not exist.
break;
}
obj = obj.getJSONObject(path_arr[i]);
if (i == path_arr.length - 1){
// This is the last entry in the path.
r_obj = obj;
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return r_obj;
}
public static JSONArray getArray(JSONObject obj, String path) {
JSONArray r_obj = null;
String partial_path = path.contains("/") ? path.substring(0,path.lastIndexOf("/")) : "";
String array_name = path.substring(path.lastIndexOf("/") + 1);
try {
JSONObject json_obj = partial_path.equals("") ? obj : getObject(obj, partial_path);
if (json_obj != null && json_obj.has(array_name)) {
r_obj = json_obj.getJSONArray(array_name);
}
} catch (JSONException e) {
e.printStackTrace();
}
return r_obj;
}
public static String getString(JSONObject obj, String path) {
String r_str = null;
String partial_path = path.contains("/") ? path.substring(0,path.lastIndexOf("/")) : "";
String string_name = path.substring(path.lastIndexOf("/") + 1);
try {
JSONObject json_obj = partial_path.equals("") ? obj : getObject(obj, partial_path);
if (json_obj != null && json_obj.has(string_name)) {
r_str = json_obj.getString(string_name);
}
} catch (JSONException e) {
e.printStackTrace();
}
return r_str;
}
public static Integer getInt(JSONObject obj, String path) {
Integer r_int = 0;
String partial_path = path.contains("/") ? path.substring(0,path.lastIndexOf("/")) : "";
String string_name = path.substring(path.lastIndexOf("/") + 1);
try {
JSONObject json_obj = partial_path.equals("") ? obj : getObject(obj, partial_path);
if (json_obj != null && json_obj.has(string_name)) {
r_int = json_obj.getInt(string_name);
}
} catch (JSONException e) {
e.printStackTrace();
}
return r_int;
}
}
package nz.co.catalyst.MaharaDroid;
/**
* Copyright (c) 2008 Mark S. Kolich
* http://mark.kolich.com
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class JavaMD5Sum {
public static final String MD5_ALGORITHM = "MD5";
public static void main ( String [] args ) {
try {
System.out.println( "string 1 = " + computeSum("string 1") );
System.out.println( "string 2 = " + computeSum("string 2") );
System.out.println( "string 3 = " + computeSum("string 3") );
} catch (NoSuchAlgorithmException e) {
System.err.print( e.getStackTrace() );
}
}
/**
* Uses Java to compute the MD5 sum of a given input String.
* @param input
* @return
*/
public static final String computeSum(String input)
throws NoSuchAlgorithmException {
if (input == null) {
throw new IllegalArgumentException("Input cannot be null!");
}
StringBuffer sbuf = new StringBuffer();
MessageDigest md = MessageDigest.getInstance(MD5_ALGORITHM);
byte [] raw = md.digest(input.getBytes());
for (int i = 0; i < raw.length; i++) {
int c = (int) raw[i];
if (c < 0) {
c = (Math.abs(c) - 1) ^ 255;
}
String block = toHex(c >>> 4) + toHex(c & 15);
sbuf.append(block);
}
return sbuf.toString();
}
private static final String toHex(int s) {
if (s < 10) {
return new StringBuffer().append((char)('0' + s)).toString();
} else {
return new StringBuffer().append((char)('A' + (s - 10))).toString();
}
}
}
/*
* MaharaDroid - Artefact uploader
*
* This file is part of MaharaDroid.
*
* Copyright [2010] [Catalyst IT Limited]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nz.co.catalyst.MaharaDroid;
import android.app.Activity;
......
/*
* MaharaDroid - Artefact uploader
*
* This file is part of MaharaDroid.
*
* Copyright [2010] [Catalyst IT Limited]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nz.co.catalyst.MaharaDroid;
import java.io.FilterOutputStream;
......@@ -12,6 +32,15 @@ import android.content.Context;
import android.content.Intent;
import android.util.Log;
/*
* The MultipartEntityMonitored class is taken from the MultipartEntityMonitored class
* written by Russel Stewart (rnstewart@gmail.com) as part of the Flickr Free
* Android application. Changes were made to reduce support to simple HTTP POST
* upload of content only.
*
* @author Alan McNatty (alan.mcnatty@catalyst.net.nz)
*/
public class MultipartEntityMonitored extends MultipartEntity {
public class OutputStreamMonitored extends FilterOutputStream {
......
/*
* MaharaDroid - Artefact uploader
*
* This file is part of MaharaDroid.
*
* Copyright [2010] [Catalyst IT Limited]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nz.co.catalyst.MaharaDroid;
import java.io.BufferedReader;
......@@ -34,6 +54,15 @@ import org.json.JSONObject;
import android.content.Context;
import android.util.Log;
/*
* The RestClient class is taken from the RestClient class
* written by Russel Stewart (rnstewart@gmail.com) as part of the Flickr Free
* Android application. Changes were made to reduce support to simple HTTP POST
* upload of content only.
*
* @author Alan McNatty (alan.mcnatty@catalyst.net.nz)
*/
public class RestClient {
private static final int CONNECTION_TIMEOUT = 15000000;
......
/*
* MaharaDroid - Artefact uploader
*
* This file is part of MaharaDroid.
*
* Copyright [2010] [Catalyst IT Limited]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nz.co.catalyst.MaharaDroid;
import java.util.ArrayList;
......@@ -22,6 +42,15 @@ import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.content.ServiceConnection;
/*
* The TransferProgress class is taken from the TransferProgress class
* written by Russel Stewart (rnstewart@gmail.com) as part of the Flickr Free
* Android application. Changes were made to reduce support to simple HTTP POST
* upload of content only.
*
* @author Alan McNatty (alan.mcnatty@catalyst.net.nz)
*/
public class TransferProgress extends Activity implements OnClickListener {
private ServiceConnection m_svc = new ServiceConnection() {
......
/*
* MaharaDroid - Artefact uploader
*
* This file is part of MaharaDroid.
*
* Copyright [2010] [Catalyst IT Limited]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nz.co.catalyst.MaharaDroid;
import java.util.LinkedList;
......@@ -24,6 +44,15 @@ import android.telephony.TelephonyManager;
import android.widget.RemoteViews;
import android.widget.Toast;
/*
* The GlobalResources class is taken from the GlobalResources class
* written by Russel Stewart (rnstewart@gmail.com) as part of the Flickr Free
* Android application. Changes were made to reduce support to simple HTTP POST
* upload of content only.
*
* @author Alan McNatty (alan.mcnatty@catalyst.net.nz)
*/
public class TransferService extends Service implements OnSharedPreferenceChangeListener {
private Notification m_upload_notification = null;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment