Retire stackforge/openstackdroid

master
Monty Taylor 7 years ago
parent f13a59d755
commit cf49cf97e8

23
.gitignore vendored

@ -1,23 +0,0 @@
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
# Local configuration file (sdk path, etc)
local.properties
# Eclipse project files
.classpath
.project
# Proguard folder generated by Eclipse
proguard/

@ -1,191 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner]
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.

@ -1,4 +0,0 @@
openstackdroid
==============
Openstack Android client

@ -0,0 +1,7 @@
This project is no longer maintained.
The contents of this repository are still available in the Git source code
management system. To see the contents of this repository before it reached
its end of life, please check out the previous commit with
"git checkout HEAD^1".

@ -1,4 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=1.6

@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rcarrillocruz.android.openstackdroid"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:name="OpenstackdroidApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:debuggable="true" >
<activity
android:name="com.rcarrillocruz.android.openstackdroid.LoginActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.rcarrillocruz.android.openstackdroid.ConnectionProfileActivity" >
</activity>
<activity
android:name="com.rcarrillocruz.android.openstackdroid.CloudBrowserActivity"
android:screenOrientation="landscape" >
</activity>
<service android:name="com.rcarrillocruz.android.openstackdroid.CloudControllerService" />
<provider
android:name="com.rcarrillocruz.android.openstackdroid.db.connectionprofile.ConnectionProfileContentProvider"
android:exported="false"
android:authorities="com.rcarrillocruz.android.openstackdroid" >
</provider>
</application>
</manifest>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

@ -1,20 +0,0 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

@ -1,14 +0,0 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-14

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<FrameLayout
android:id="@+id/items_list"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<FrameLayout
android:id="@+id/item_details"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0"
android:background="?android:attr/detailsElementBackground" />
</LinearLayout>

@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/profile_name_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/profile_name" />
<EditText
android:id="@+id/profile_name_edittext"
android:layout_width="600dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text" >
<requestFocus />
</EditText>
<TextView
android:id="@+id/endpoint_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/endpoint" />
<EditText
android:id="@+id/endpoint_edittext"
android:layout_width="600dp"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/endpoint_hint"
android:inputType="textUri" />
<TextView
android:id="@+id/username_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/username" />
<EditText
android:id="@+id/username_edittext"
android:layout_width="600dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text" />
<TextView
android:id="@+id/password_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/password" />
<EditText
android:id="@+id/password_edittext"
android:layout_width="600dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
<TextView
android:id="@+id/tenant_id_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tenantId" />
<EditText
android:id="@+id/tenant_id_edittext"
android:layout_width="600dp"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text" />
</LinearLayout>

@ -1,8 +0,0 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/profile_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceMedium"
android:padding="10dp"
android:background="?android:attr/activatedBackgroundIndicator" >
</TextView>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/save_profile"
android:showAsAction="always"
android:title="@string/save">
</item>
</menu>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/edit" android:title="@string/edit"></item>
<item android:id="@+id/clone" android:title="@string/clone"></item>
<item android:id="@+id/delete" android:title="@string/delete"></item>
</menu>

@ -1,8 +0,0 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/add_profile"
android:showAsAction="always"
android:title="@string/add_profile">
</item>
</menu>

@ -1,8 +0,0 @@
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw600dp devices (e.g. 7" tablets) here.
-->
</resources>

@ -1,9 +0,0 @@
<resources>
<!--
Customize dimensions originally defined in res/values/dimens.xml (such as
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
-->
<dimen name="activity_horizontal_margin">128dp</dimen>
</resources>

@ -1,11 +0,0 @@
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>

@ -1,12 +0,0 @@
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>

@ -1,7 +0,0 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">OpenstackDroid</string>
<string name="action_settings">Settings</string>
<string name="add_profile">Add</string>
<string name="profile_name">Profile name</string>
<string name="endpoint">API endpoint</string>
<string name="endpoint_hint">http://&lt;Openstack IP>:&lt;port></string>
<string name="username">Username</string>
<string name="password">Password</string>
<string name="tenantId">Tenant id</string>
<string name="edit">Edit</string>
<string name="clone">Clone</string>
<string name="delete">Delete</string>
<string name="save">Save</string>
</resources>

@ -1,20 +0,0 @@
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>

@ -1,416 +0,0 @@
package com.rcarrillocruz.android.openstackdroid;
import java.util.ArrayList;
import java.util.List;
import com.rcarrillocruz.android.openstackdroid.model.FlavorModel;
import com.rcarrillocruz.android.openstackdroid.model.ImageModel;
import com.rcarrillocruz.android.openstackdroid.model.ServerModel;
import com.rcarrillocruz.android.openstackdroid.model.TenantModel;
import com.rcarrillocruz.android.openstackdroid.model.UserModel;
import com.rcarrillocruz.android.openstackdroid.model.VolumeModel;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.ActionBar.TabListener;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Intent;
public class CloudBrowserActivity extends Activity implements TabListener {
private List<ServerModel> servers;
private List<VolumeModel> volumes;
private List<FlavorModel> flavors;
private List<ImageModel> images;
public List<UserModel> users;
public List<TenantModel> tenants;
private Fragment mListFragmentAttached;
private Fragment mServerListFragment;
private Fragment mServerDetailsFragment;
private Fragment mVolumeListFragment;
private Fragment mVolumeDetailsFragment;
private Fragment mFlavorListFragment;
private Fragment mFlavorDetailsFragment;
private Fragment mImageListFragment;
private Fragment mImageDetailsFragment;
private Fragment mUserListFragment;
private Fragment mUserDetailsFragment;
private Fragment mTenantListFragment;
private Fragment mTenantDetailsFragment;
private boolean isDetailEnabled;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
servers = new ArrayList<ServerModel>();
volumes = new ArrayList<VolumeModel>();
flavors = new ArrayList<FlavorModel>();
images = new ArrayList<ImageModel>();
users = new ArrayList<UserModel>();
tenants = new ArrayList<TenantModel>();
isDetailEnabled = false;
mListFragmentAttached = null;
mServerListFragment = null;
mServerDetailsFragment = null;
mVolumeListFragment = null;
mVolumeDetailsFragment = null;
mFlavorListFragment = null;
mFlavorDetailsFragment = null;
mImageListFragment = null;
mImageDetailsFragment = null;
mUserListFragment = null;
mUserDetailsFragment = null;
mTenantListFragment = null;
mTenantDetailsFragment = null;
setContentView(R.layout.cloud_browser);
final ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
ActionBar.Tab serverTab = actionBar.newTab().setText("Instances");
ActionBar.Tab volumeTab = actionBar.newTab().setText("Volumes");
serverTab.setTabListener(this);
volumeTab.setTabListener(this);
actionBar.addTab(serverTab);
actionBar.addTab(volumeTab);
if (((OpenstackdroidApplication)getApplication()).isAdminUser) {
ActionBar.Tab flavorTab = actionBar.newTab().setText("Flavors");
ActionBar.Tab imagesTab = actionBar.newTab().setText("Images");
ActionBar.Tab usersTab = actionBar.newTab().setText("Users");
ActionBar.Tab tenantsTab = actionBar.newTab().setText("Projects");
flavorTab.setTabListener(this);
imagesTab.setTabListener(this);
usersTab.setTabListener(this);
tenantsTab.setTabListener(this);
actionBar.addTab(flavorTab);
actionBar.addTab(imagesTab);
actionBar.addTab(usersTab);
actionBar.addTab(tenantsTab);
}
}
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case android.R.id.home:
if(isDetailEnabled) {
LayoutParams params = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 0);
FrameLayout fl = (FrameLayout) findViewById(R.id.item_details);
fl.setLayoutParams(params);
setDetailEnabled(false);
} else {
Intent i = new Intent(this, LoginActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
public void onTabSelected(Tab tab, FragmentTransaction ft) {
Class<?> tabClass = null;
switch(tab.getPosition()) {
case 0:
tabClass = ServerListFragment.class;
break;
case 1:
tabClass = VolumeListFragment.class;
break;
case 2:
tabClass = FlavorListFragment.class;
break;
case 3:
tabClass = ImageListFragment.class;
break;
case 4:
tabClass = UserListFragment.class;
break;
case 5:
tabClass = TenantListFragment.class;
break;
}
hideDetailsLayout();
mListFragmentAttached = getFragmentManager().findFragmentById(R.id.items_list);
if(mListFragmentAttached==null) {
mListFragmentAttached = Fragment.instantiate(this, tabClass.getName());
if (tabClass == ServerListFragment.class) {
mServerListFragment = mListFragmentAttached;
} else if (tabClass == VolumeListFragment.class) {
mVolumeListFragment = mListFragmentAttached;
} else if (tabClass == FlavorListFragment.class) {
mFlavorListFragment = mListFragmentAttached;
} else if (tabClass == ImageListFragment.class) {
mImageListFragment = mListFragmentAttached;
} else if (tabClass == UserListFragment.class) {
mUserListFragment = mListFragmentAttached;
} else if (tabClass == TenantListFragment.class) {
mTenantListFragment = mListFragmentAttached;
}
ft.add(R.id.items_list, mListFragmentAttached);
} else {
if (tabClass == ServerListFragment.class) {
if (mServerListFragment != null) {
mListFragmentAttached = mServerListFragment;
ft.attach(mListFragmentAttached);
} else {
mListFragmentAttached = Fragment.instantiate(this, tabClass.getName());
mServerListFragment = mListFragmentAttached;
ft.add(R.id.items_list, mListFragmentAttached);
}
} else if (tabClass == VolumeListFragment.class) {
if (mVolumeListFragment != null) {
mListFragmentAttached = mVolumeListFragment;
ft.attach(mListFragmentAttached);
} else {
mListFragmentAttached = Fragment.instantiate(this, tabClass.getName());
mVolumeListFragment = mListFragmentAttached;
ft.add(R.id.items_list, mListFragmentAttached);
}
} else if (tabClass == FlavorListFragment.class) {
if (mFlavorListFragment != null) {
mListFragmentAttached = mFlavorListFragment;
ft.attach(mListFragmentAttached);
} else {
mListFragmentAttached = Fragment.instantiate(this, tabClass.getName());
mFlavorListFragment = mListFragmentAttached;
ft.add(R.id.items_list, mListFragmentAttached);
}
} else if (tabClass == ImageListFragment.class) {
if (mImageListFragment != null) {
mListFragmentAttached = mImageListFragment;
ft.attach(mListFragmentAttached);
} else {
mListFragmentAttached = Fragment.instantiate(this, tabClass.getName());
mImageListFragment = mListFragmentAttached;
ft.add(R.id.items_list, mListFragmentAttached);
}
} else if (tabClass == UserListFragment.class) {
if (mUserListFragment != null) {
mListFragmentAttached = mUserListFragment;
ft.attach(mListFragmentAttached);
} else {
mListFragmentAttached = Fragment.instantiate(this, tabClass.getName());
mUserListFragment = mListFragmentAttached;
ft.add(R.id.items_list, mListFragmentAttached);
}
} else if (tabClass == TenantListFragment.class) {
if (mTenantListFragment != null) {
mListFragmentAttached = mTenantListFragment;
ft.attach(mListFragmentAttached);
} else {
mListFragmentAttached = Fragment.instantiate(this, tabClass.getName());
mTenantListFragment = mListFragmentAttached;
ft.add(R.id.items_list, mListFragmentAttached);
}
}
}
}
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
if (mListFragmentAttached != null)
ft.detach(mListFragmentAttached);
}
public void showDetailsLayout() {
LayoutParams params = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f);
FrameLayout fl = (FrameLayout) findViewById(R.id.item_details);
fl.setLayoutParams(params);
setDetailEnabled(true);
}
public void hideDetailsLayout() {
LayoutParams params = new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 0);
FrameLayout fl = (FrameLayout) findViewById(R.id.item_details);
fl.setLayoutParams(params);
setDetailEnabled(false);
}
public boolean isDetailEnabled() {
return isDetailEnabled;
}
public void setDetailEnabled(boolean isDetailEnabled) {
this.isDetailEnabled = isDetailEnabled;
}
public Fragment getmServerDetailsFragment() {
return mServerDetailsFragment;
}
public void setmServerDetailsFragment(Fragment mServerDetailsFragment) {
this.mServerDetailsFragment = mServerDetailsFragment;
}
public Fragment getmVolumeDetailsFragment() {
return mVolumeDetailsFragment;
}
public void setmVolumeDetailsFragment(Fragment mVolumeDetailsFragment) {
this.mVolumeDetailsFragment = mVolumeDetailsFragment;
}
public List<ServerModel> getServers() {
return servers;
}
public void setServers(List<ServerModel> servers) {
this.servers = servers;
}
public List<VolumeModel> getVolumes() {
return volumes;
}
public void setVolumes(List<VolumeModel> volumes) {
this.volumes = volumes;
}
public List<ImageModel> getImages() {
return images;
}
public void setImages(List<ImageModel> images) {
this.images = images;
}
public Fragment getmImageListFragment() {
return mImageListFragment;
}
public void setmImageListFragment(Fragment mImageListFragment) {
this.mImageListFragment = mImageListFragment;
}
public Fragment getmImageDetailsFragment() {
return mImageDetailsFragment;
}
public void setmImageDetailsFragment(Fragment mImageDetailsFragment) {
this.mImageDetailsFragment = mImageDetailsFragment;
}
public List<FlavorModel> getFlavors() {
return flavors;
}
public void setFlavors(List<FlavorModel> flavors) {
this.flavors = flavors;
}
public List<UserModel> getUsers() {
return users;
}
public void setUsers(List<UserModel> users) {
this.users = users;
}
public List<TenantModel> getTenants() {
return tenants;
}
public void setTenants(List<TenantModel> tenants) {
this.tenants = tenants;
}
public Fragment getmFlavorListFragment() {
return mFlavorListFragment;
}
public void setmFlavorListFragment(Fragment mFlavorListFragment) {
this.mFlavorListFragment = mFlavorListFragment;
}
public Fragment getmFlavorDetailsFragment() {
return mFlavorDetailsFragment;
}
public void setmFlavorDetailsFragment(Fragment mFlavorDetailsFragment) {
this.mFlavorDetailsFragment = mFlavorDetailsFragment;
}
public Fragment getmListFragmentAttached() {
return mListFragmentAttached;
}
public void setmListFragmentAttached(Fragment mListFragmentAttached) {
this.mListFragmentAttached = mListFragmentAttached;
}
public Fragment getmServerListFragment() {
return mServerListFragment;
}
public void setmServerListFragment(Fragment mServerListFragment) {
this.mServerListFragment = mServerListFragment;
}
public Fragment getmVolumeListFragment() {
return mVolumeListFragment;
}
public void setmVolumeListFragment(Fragment mVolumeListFragment) {
this.mVolumeListFragment = mVolumeListFragment;
}
public Fragment getmUserListFragment() {
return mUserListFragment;
}
public void setmUserListFragment(Fragment mUserListFragment) {
this.mUserListFragment = mUserListFragment;
}
public Fragment getmUserDetailsFragment() {
return mUserDetailsFragment;
}
public void setmUserDetailsFragment(Fragment mUserDetailsFragment) {
this.mUserDetailsFragment = mUserDetailsFragment;
}
public Fragment getmTenantListFragment() {
return mTenantListFragment;
}
public void setmTenantListFragment(Fragment mTenantListFragment) {
this.mTenantListFragment = mTenantListFragment;
}
public Fragment getmTenantDetailsFragment() {
return mTenantDetailsFragment;
}
public void setmTenantDetailsFragment(Fragment mTenantDetailsFragment) {
this.mTenantDetailsFragment = mTenantDetailsFragment;
}
}

@ -1,50 +0,0 @@
package com.rcarrillocruz.android.openstackdroid;
import com.rcarrillocruz.android.openstackdroid.CloudControllerResultReceiver.Receiver;
import android.app.ListFragment;
import android.os.Bundle;
import android.os.Handler;
public abstract class CloudBrowserListFragment extends ListFragment implements Receiver {
protected String endpoint;
protected int mCurCheckPosition;
protected CloudControllerResultReceiver mReceiver;
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mReceiver = new CloudControllerResultReceiver(new Handler());
mReceiver.setReceiver(this);
}
public void onReceiveResult(int resultCode, Bundle resultData) {
}
public String getEndpoint() {
return endpoint;
}
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
public int getmCurCheckPosition() {
return mCurCheckPosition;
}
public void setmCurCheckPosition(int mCurCheckPosition) {
this.mCurCheckPosition = mCurCheckPosition;
}
public CloudControllerResultReceiver getmReceiver() {
return mReceiver;
}
public void setmReceiver(CloudControllerResultReceiver mReceiver) {
this.mReceiver = mReceiver;
}
protected abstract void showDetails(int position);
}

@ -1,28 +0,0 @@
package com.rcarrillocruz.android.openstackdroid;
import android.os.Bundle;
import android.os.Handler;
import android.os.ResultReceiver;
public class CloudControllerResultReceiver extends ResultReceiver {
private Receiver mReceiver;
public CloudControllerResultReceiver(Handler handler) {
super(handler);
}
public interface Receiver {
public void onReceiveResult(int resultCode, Bundle resultData);
}
public void setReceiver(Receiver receiver) {
mReceiver = receiver;
}
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (mReceiver != null) {
mReceiver.onReceiveResult(resultCode, resultData);
}
}
}

@ -1,120 +0,0 @@
package com.rcarrillocruz.android.openstackdroid;
import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import android.app.IntentService;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.util.Log;
import android.widget.Toast;
import com.rcarrillocruz.android.openstackdroid.operations.ApiOperation;
public class CloudControllerService extends IntentService {
public static final String TAG = CloudControllerResultReceiver.class.getName();
public static final String GET_TOKEN_OPERATION = "com.rcarrillocruz.android.openstackdroid.operations.identity.GetTokenOperation";
public static final String GET_SERVERS_OPERATION = "com.rcarrillocruz.android.openstackdroid.operations.compute.GetServersOperation";
public static final String GET_VOLUMES_OPERATION = "com.rcarrillocruz.android.openstackdroid.operations.volume.GetVolumesOperation";
public static final String GET_IMAGES_OPERATION = "com.rcarrillocruz.android.openstackdroid.operations.image.GetImagesOperation";
public static final String GET_FLAVORS_OPERATION = "com.rcarrillocruz.android.openstackdroid.operations.compute.GetFlavorsOperation";
public static final String GET_USERS_OPERATION = "com.rcarrillocruz.android.openstackdroid.operations.identity.GetUsersOperation";
public static final String GET_TENANTS_OPERATION = "com.rcarrillocruz.android.openstackdroid.operations.identity.GetTenantsOperation";
public static final String OPERATION = "com.rcarrillocruz.android.openstackdroid.OPERATION";
public static final String TOKEN = "com.rcarrillocruz.android.openstackdroid.TOKEN";
public static final String TENANT = "com.rcarrillocruz.android.openstackdroid.TENANT";
public static final String PARAMS = "com.rcarrillocruz.android.openstackdroid.PARAMS";
public static final String RECEIVER = "com.rcarrillocruz.android.openstackdroid.RECEIVER";
public static final String OPERATION_RESULTS = "com.rcarrillocruz.android.openstackdroid.RESULTS";
public CloudControllerService() {
super("CloudControllerService");
}
protected void onHandleIntent(Intent intent) {
Uri data = intent.getData();
Bundle extras = intent.getExtras();
String operation = extras.getString(OPERATION);
String token = extras.getString(TOKEN);
String tenantId = extras.getString(TENANT);
ResultReceiver receiver = extras.getParcelable(RECEIVER);
Bundle params = extras.getParcelable(PARAMS);
ApiOperation apiOperation = getOperationInstance(operation);
HttpRequestBase request = apiOperation.invoke(data, token, tenantId, params);
HttpResponse response = null;
response = executeOperation(request);
returnResultstoReceiver(operation, response, receiver);
}
private ApiOperation getOperationInstance(String operation) {
ApiOperation apiOperation = null;
try {
apiOperation = (ApiOperation) Class.forName(operation).newInstance();
} catch (InstantiationException e) {
Log.e(TAG,Log.getStackTraceString(e));
Toast.makeText(getApplicationContext(), "Instantiation exception, check the Android log!", Toast.LENGTH_LONG).show();
} catch (IllegalAccessException e) {
Log.e(TAG,Log.getStackTraceString(e));
Toast.makeText(getApplicationContext(), "Illegal access exception, check the Android log!", Toast.LENGTH_LONG).show();
} catch (ClassNotFoundException e) {
Log.e(TAG,Log.getStackTraceString(e));
Toast.makeText(getApplicationContext(), "Class not found exception, check the Android log!", Toast.LENGTH_LONG).show();
}
return apiOperation;
}
private HttpResponse executeOperation(HttpRequestBase request) {
HttpResponse response = null;
HttpClient client = new DefaultHttpClient();
try {
response = client.execute(request);
} catch (ClientProtocolException e) {
Log.e(TAG,Log.getStackTraceString(e));
Toast.makeText(getApplicationContext(), "Client protocol exception, check the Android log!", Toast.LENGTH_LONG).show();
} catch (IOException e) {
Log.e(TAG,Log.getStackTraceString(e));
Toast.makeText(getApplicationContext(), "Input/output exception, check the Android log!", Toast.LENGTH_LONG).show();
}
return response;
}
private void returnResultstoReceiver(String operation, HttpResponse response,
ResultReceiver receiver) {
Bundle results = new Bundle();
try {
results.putString(OPERATION, operation);
if (response != null) {
results.putString(OPERATION_RESULTS, EntityUtils.toString(response.getEntity()));
receiver.send(response.getStatusLine().getStatusCode(), results);
} else {
results.putString(OPERATION_RESULTS, "Connection to Openstack could not be established!");
receiver.send(504, results);
}
} catch (ParseException e) {
Log.e(TAG,Log.getStackTraceString(e));
Toast.makeText(getApplicationContext(), "Parsing exception, check the Android log!", Toast.LENGTH_LONG).show();
} catch (IOException e) {
Log.e(TAG,Log.getStackTraceString(e));
Toast.makeText(getApplicationContext(), "Input/output exception, check the Android log!", Toast.LENGTH_LONG).show();
}
}
}

@ -1,104 +0,0 @@
package com.rcarrillocruz.android.openstackdroid;
import android.app.Activity;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.EditText;
import com.rcarrillocruz.android.openstackdroid.db.connectionprofile.ConnectionProfileContentProvider;
import com.rcarrillocruz.android.openstackdroid.db.connectionprofile.ConnectionProfileTable;
public class ConnectionProfileActivity extends Activity {
private Uri connectionProfileUri;
private EditText mProfileName;
private EditText mEndpoint;
private EditText mUsername;
private EditText mPassword;
private EditText mTenantId;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.connection_profile_activity);
mProfileName = (EditText) findViewById(R.id.profile_name_edittext);
mEndpoint = (EditText) findViewById(R.id.endpoint_edittext);
mUsername = (EditText) findViewById(R.id.username_edittext);
mPassword = (EditText) findViewById(R.id.password_edittext);
mTenantId = (EditText) findViewById(R.id.tenant_id_edittext);
Bundle extras = getIntent().getExtras();
if (extras == null) {
connectionProfileUri = null;
} else {
connectionProfileUri = extras.getParcelable(ConnectionProfileContentProvider.CONTENT_ITEM_TYPE);
populateForm(connectionProfileUri);
}
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.connection_profile_menu, menu);
return true;
}
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.save_profile:
saveConnectionProfile();
return true;
}
return super.onOptionsItemSelected(item);
}
private void saveConnectionProfile() {
String profileName = (String) mProfileName.getText().toString();
String endpoint = mEndpoint.getText().toString();
String username = mUsername.getText().toString();
String password = mPassword.getText().toString();
String tenantId = mTenantId.getText().toString();
ContentValues values = new ContentValues();
values.put(ConnectionProfileTable.COLUMN_PROFILE_NAME, profileName);
values.put(ConnectionProfileTable.COLUMN_ENDPOINT, endpoint);
values.put(ConnectionProfileTable.COLUMN_USERNAME, username);
values.put(ConnectionProfileTable.COLUMN_PASSWORD, password);
values.put(ConnectionProfileTable.COLUMN_TENANT_ID, tenantId);
if (connectionProfileUri == null) {
connectionProfileUri = getContentResolver().insert(ConnectionProfileContentProvider.CONTENT_URI, values);
} else {
getContentResolver().update(connectionProfileUri, values, null, null);
}
finish();
}
private void populateForm(Uri uri) {
String[] projection = {ConnectionProfileTable.COLUMN_PROFILE_NAME, ConnectionProfileTable.COLUMN_ENDPOINT,
ConnectionProfileTable.COLUMN_USERNAME, ConnectionProfileTable.COLUMN_PASSWORD,
ConnectionProfileTable.COLUMN_TENANT_ID};
Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
cursor.moveToFirst();
String profileName = cursor.getString(cursor.getColumnIndex(ConnectionProfileTable.COLUMN_PROFILE_NAME));
String endpoint = cursor.getString(cursor.getColumnIndex(ConnectionProfileTable.COLUMN_ENDPOINT));
String username = cursor.getString(cursor.getColumnIndex(ConnectionProfileTable.COLUMN_USERNAME));
String password = cursor.getString(cursor.getColumnIndex(ConnectionProfileTable.COLUMN_PASSWORD));
String tenantId = cursor.getString(cursor.getColumnIndex(ConnectionProfileTable.COLUMN_TENANT_ID));
mProfileName.setText(profileName);
mEndpoint.setText(endpoint);
mUsername.setText(username);
mPassword.setText(password);
mTenantId.setText(tenantId);
cursor.close();
}
}

@ -1,53 +0,0 @@
package com.rcarrillocruz.android.openstackdroid;
import com.rcarrillocruz.android.openstackdroid.model.FlavorModel;
import android.app.Fragment;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ScrollView;
import android.widget.TextView;
public class FlavorDetailsFragment extends Fragment {
private ScrollView scroller;
private TextView tv;
public static FlavorDetailsFragment newInstance(int position) {
FlavorDetailsFragment f = new FlavorDetailsFragment();
Bundle args = new Bundle();
args.putInt("position", position);
f.setArguments(args);
return f;
}
public int getShownIndex() {
return getArguments().getInt("position", 0);
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
scroller = new ScrollView(getActivity());
tv = new TextView(getActivity());
int padding = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
4, getActivity().getResources().getDisplayMetrics());
tv.setPadding(padding, padding, padding, padding);
scroller.addView(tv);
FlavorModel fm = (((CloudBrowserActivity)getActivity()).getFlavors()).get(getShownIndex());
StringBuffer sb = new StringBuffer();
sb.append("ID: " + fm.getId() + "\n\n");
sb.append("Name: " + fm.getName() + "\n\n");
sb.append("VCPUs: " + fm.getVcpus() + "\n\n");
sb.append("RAM: " + fm.getRam() + "\n\n");
sb.append("Root disk: " + fm.getRootDisk() + "\n\n");
sb.append("Swap disk: " + fm.getSwapDisk() + "\n\n");
tv.setText(sb.toString());
return scroller;
}
}

@ -1,92 +0,0 @@
package com.rcarrillocruz.android.openstackdroid;
import java.util.Iterator;
import java.util.List;
import com.google.gson.Gson;
import com.rcarrillocruz.android.openstackdroid.json.compute.FlavorDetailsObject;
import com.rcarrillocruz.android.openstackdroid.json.compute.GetFlavorsResponse;
import com.rcarrillocruz.android.openstackdroid.model.FlavorModel;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class FlavorListFragment extends CloudBrowserListFragment {
List<FlavorModel> flavors;
private ArrayAdapter<FlavorModel> adapter;
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
endpoint = ((OpenstackdroidApplication) (getActivity().getApplication())).getComputeEndpoint();
flavors = ((CloudBrowserActivity) getActivity()).getFlavors();
Intent serviceIntent = new Intent(getActivity(), CloudControllerService.class);
serviceIntent.setData(Uri.parse(endpoint));
serviceIntent.putExtra(CloudControllerService.OPERATION, CloudControllerService.GET_FLAVORS_OPERATION);
serviceIntent.putExtra(CloudControllerService.TOKEN, ((OpenstackdroidApplication) getActivity().getApplication()).getToken());
serviceIntent.putExtra(CloudControllerService.TENANT, (String)null);
serviceIntent.putExtra(CloudControllerService.RECEIVER, mReceiver);
Bundle params = new Bundle();
serviceIntent.putExtra(CloudControllerService.PARAMS, params);
getActivity().startService(serviceIntent);
adapter = new ArrayAdapter<FlavorModel>(getActivity(), android.R.layout.simple_list_item_activated_1, flavors);
setListAdapter(adapter);
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
}
public void onListItemClick(ListView l, View v, int position, long id) {
mCurCheckPosition = position;
getListView().setItemChecked(position, true);
showDetails(position);
}
protected void showDetails(int position) {
FlavorDetailsFragment fdf = (FlavorDetailsFragment) ((CloudBrowserActivity) getActivity()).getmFlavorDetailsFragment();
if (fdf == null || fdf.getShownIndex() != position)
fdf = FlavorDetailsFragment.newInstance(position);
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.item_details, fdf);
ft.commit();
((CloudBrowserActivity) getActivity()).showDetailsLayout();
}
public void onReceiveResult(int resultCode, Bundle resultData) {
if (resultCode == 200) {
String operation = resultData.getString(CloudControllerService.OPERATION);
if (operation.equals(CloudControllerService.GET_FLAVORS_OPERATION)) {
Gson gson = new Gson();
GetFlavorsResponse gfr = gson.fromJson(resultData.getString(CloudControllerService.OPERATION_RESULTS), GetFlavorsResponse.class);
populateItems(gfr);
}
}
}
private void populateItems(GetFlavorsResponse gfr) {
flavors.clear();
Iterator<FlavorDetailsObject> it = gfr.getFlavors().iterator();
FlavorDetailsObject item = null;
while(it.hasNext()) {
item = it.next();
FlavorModel newModel = new FlavorModel(item.getId(), item.getName(), item.getVcpus(), item.getRam(), item.getDisk(), item.getSwap()) ;
flavors.add(newModel);
}
adapter.notifyDataSetChanged();
}
}

@ -1,56 +0,0 @@
package com.rcarrillocruz.android.openstackdroid;
import com.rcarrillocruz.android.opens