Retire stackforge/openstackdroid
This commit is contained in:
parent
f13a59d755
commit
cf49cf97e8
23
.gitignore
vendored
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/
|
191
LICENSE.md
191
LICENSE.md
@ -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.
|
7
README.rst
Normal file
7
README.rst
Normal file
@ -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 |
Binary file not shown.
Binary file not shown.
@ -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://<Openstack IP>:<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.openstackdroid.model.ImageModel;
|
||||
|
||||
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 ImageDetailsFragment extends Fragment {
|
||||
private ScrollView scroller;
|
||||
private TextView tv;
|
||||
|
||||
public static ImageDetailsFragment newInstance(int position) {
|
||||
ImageDetailsFragment f = new ImageDetailsFragment();
|
||||
|
||||
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);
|
||||
ImageModel im = (((CloudBrowserActivity)getActivity()).getImages()).get(getShownIndex());
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("ID: " + im.getId() + "\n\n");
|
||||
sb.append("Name: " + im.getName() + "\n\n");
|
||||
sb.append("Status: " + im.getStatus() + "\n\n");
|
||||
sb.append("Visibility: " + im.getVisibility() + "\n\n");
|
||||
sb.append("Checksum: " + im.getChecksum() + "\n\n");
|
||||
sb.append("Created: " + im.getCreated_at() + "\n\n");
|
||||
sb.append("Updated: " + im.getUpdated_at() + "\n\n");
|
||||
sb.append("Size: " + im.getSize() + "\n\n");
|
||||
sb.append("Container format: " + im.getContainer_format() + "\n\n");
|
||||
sb.append("Disk format: " + im.getDisk_format() + "\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 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;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.image.GetImagesResponse;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.image.ImageDetailsObject;
|
||||
import com.rcarrillocruz.android.openstackdroid.model.ImageModel;
|
||||
|
||||
public class ImageListFragment extends CloudBrowserListFragment {
|
||||
List<ImageModel> images;
|
||||
private ArrayAdapter<ImageModel> adapter;
|
||||
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
endpoint = ((OpenstackdroidApplication) (getActivity().getApplication())).getImageEndpoint();
|
||||
images = ((CloudBrowserActivity) getActivity()).getImages();
|
||||
|
||||
Intent serviceIntent = new Intent(getActivity(), CloudControllerService.class);
|
||||
serviceIntent.setData(Uri.parse(endpoint));
|
||||
serviceIntent.putExtra(CloudControllerService.OPERATION, CloudControllerService.GET_IMAGES_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<ImageModel>(getActivity(), android.R.layout.simple_list_item_activated_1, images);
|
||||
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) {
|
||||
ImageDetailsFragment idf = (ImageDetailsFragment) ((CloudBrowserActivity) getActivity()).getmImageDetailsFragment();
|
||||
|
||||
if (idf == null || idf.getShownIndex() != position)
|
||||
idf = ImageDetailsFragment.newInstance(position);
|
||||
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.item_details, idf);
|
||||
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_IMAGES_OPERATION)) {
|
||||
Gson gson = new Gson();
|
||||
GetImagesResponse gir = gson.fromJson(resultData.getString(CloudControllerService.OPERATION_RESULTS), GetImagesResponse.class);
|
||||
|
||||
populateItems(gir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void populateItems(GetImagesResponse gir) {
|
||||
images.clear();
|
||||
Iterator<ImageDetailsObject> it = gir.getImages().iterator();
|
||||
ImageDetailsObject item = null;
|
||||
|
||||
while(it.hasNext()) {
|
||||
|
||||
item = it.next();
|
||||
ImageModel newIm = new ImageModel(item.getId(), item.getName(), item.getStatus(), item.getVisibility(), item.getChecksum(), item.getCreated_at(), item.getUpdated_at(), item.getSize(), item.getContainer_format(), item.getDisk_format()) ;
|
||||
images.add(newIm);
|
||||
}
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
@ -1,290 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.app.ListActivity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Intent;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemLongClickListener;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleCursorAdapter;
|
||||
import android.widget.Toast;
|
||||
import android.os.Bundle;
|
||||
import android.view.ActionMode;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.content.Loader;
|
||||
import android.database.Cursor;
|
||||
import android.app.LoaderManager;
|
||||
import android.content.CursorLoader;
|
||||
import com.google.gson.Gson;
|
||||
import com.rcarrillocruz.android.openstackdroid.CloudControllerResultReceiver.Receiver;
|
||||
import com.rcarrillocruz.android.openstackdroid.db.connectionprofile.ConnectionProfileContentProvider;
|
||||
import com.rcarrillocruz.android.openstackdroid.db.connectionprofile.ConnectionProfileTable;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.EndpointObject;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.GetTokenResponse;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.RoleObject;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.ServiceCatalogObject;
|
||||
|
||||
public class LoginActivity extends ListActivity implements Receiver, LoaderManager.LoaderCallbacks<Cursor> {
|
||||
private static final String COMPUTE_ENDPOINT = "compute";
|
||||
private static final String VOLUME_ENDPOINT = "volume";
|
||||
private static final String IDENTITY_ENDPOINT = "identity";
|
||||
private static final String IMAGE_ENDPOINT = "image";
|
||||
private CloudControllerResultReceiver mReceiver;
|
||||
private SimpleCursorAdapter adapter;
|
||||
protected Object mActionMode;
|
||||
private long selectedItemId = -1;
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
final ListView lv = getListView();
|
||||
lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
|
||||
|
||||
lv.setOnItemLongClickListener(new OnItemLongClickListener() {
|
||||
|
||||
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
|
||||
if (mActionMode != null) {
|
||||
return false;
|
||||
}
|
||||
selectedItemId = id;
|
||||
|
||||
mActionMode = LoginActivity.this.startActionMode(mActionModeCallback);
|
||||
view.setSelected(true);
|
||||
lv.setItemChecked(position, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
mReceiver = new CloudControllerResultReceiver(new Handler());
|
||||
mReceiver.setReceiver(this);
|
||||
|
||||
populateProfiles();
|
||||
}
|
||||
|
||||
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
|
||||
|
||||
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
||||
MenuInflater inflater = mode.getMenuInflater();
|
||||
inflater.inflate(R.menu.login_contextual, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
||||
return false; // Return false if nothing is done
|
||||
}
|
||||
|
||||
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.edit:
|
||||
editConnectionProfile();
|
||||
mode.finish();
|
||||
return true;
|
||||
case R.id.clone:
|
||||
cloneConnectionProfile();
|
||||
mode.finish();
|
||||
return true;
|
||||
case R.id.delete:
|
||||
deleteConnectionProfile();
|
||||
mode.finish();
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void onDestroyActionMode(ActionMode mode) {
|
||||
mActionMode = null;
|
||||
selectedItemId = -1;
|
||||
}
|
||||
};
|
||||
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.login_menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
if(mActionMode == null) {
|
||||
Uri connectionProfileUri = Uri.parse(ConnectionProfileContentProvider.CONTENT_URI + "/" + id);
|
||||
|
||||
String[] projection = {ConnectionProfileTable.COLUMN_ENDPOINT, ConnectionProfileTable.COLUMN_USERNAME,
|
||||
ConnectionProfileTable.COLUMN_PASSWORD, ConnectionProfileTable.COLUMN_TENANT_ID};
|
||||
|
||||
Cursor cursor = getContentResolver().query(connectionProfileUri, projection, null, null, null);
|
||||
cursor.moveToFirst();
|
||||
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));
|
||||
cursor.close();
|
||||
|
||||
Intent serviceIntent = new Intent(this, CloudControllerService.class);
|
||||
serviceIntent.setData(Uri.parse(endpoint));
|
||||
serviceIntent.putExtra(CloudControllerService.OPERATION, CloudControllerService.GET_TOKEN_OPERATION);
|
||||
serviceIntent.putExtra(CloudControllerService.TOKEN, (String)null);
|
||||
serviceIntent.putExtra(CloudControllerService.TENANT, tenantId);
|
||||
serviceIntent.putExtra(CloudControllerService.RECEIVER, mReceiver);
|
||||
|
||||
Bundle params = new Bundle();
|
||||
params.putString("username", username);
|
||||
params.putString("password", password);
|
||||
|
||||
serviceIntent.putExtra(CloudControllerService.PARAMS, params);
|
||||
|
||||
startService(serviceIntent);
|
||||
progressDialog = ProgressDialog.show(this, null, "Authenticating...");
|
||||
|
||||
} else {
|
||||
selectedItemId = id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch(item.getItemId()) {
|
||||
case R.id.add_profile:
|
||||
addConnectionProfile();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onReceiveResult(int resultCode, Bundle resultData) {
|
||||
progressDialog.dismiss();
|
||||
|
||||
if (resultCode == 200) {
|
||||
Gson gson = new Gson();
|
||||
GetTokenResponse gtr = gson.fromJson(resultData.getString(CloudControllerService.OPERATION_RESULTS), GetTokenResponse.class);
|
||||
OpenstackdroidApplication application = (OpenstackdroidApplication) getApplication();
|
||||
List<ServiceCatalogObject> sc = gtr.getAccess().getServiceCatalog();
|
||||
|
||||
application.setAdminUser(false);
|
||||
Iterator<RoleObject> it = gtr.getAccess().getUser().getRoles().iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
if (it.next().getName().equals("admin"))
|
||||
application.setAdminUser(true);
|
||||
}
|
||||
|
||||
application.setToken(gtr.getAccess().getToken().getId());
|
||||
application.setTenantId(gtr.getAccess().getToken().getTenant().getId());
|
||||
application.setComputeEndpoint(getEndpointByType(sc, COMPUTE_ENDPOINT).getPublicURL());
|
||||
application.setVolumeEndpoint(getEndpointByType(sc, VOLUME_ENDPOINT).getPublicURL());
|
||||
|
||||
EndpointObject ieo = getEndpointByType(sc, IDENTITY_ENDPOINT);
|
||||
application.setIdentityEndpoint(ieo.getPublicURL());
|
||||
application.setIdentityAdminEndpoint(ieo.getAdminURL());
|
||||
|
||||
application.setImageEndpoint(getEndpointByType(sc, IMAGE_ENDPOINT).getPublicURL());
|
||||
|
||||
Intent browserIntent = new Intent(this, CloudBrowserActivity.class);
|
||||
startActivity(browserIntent);
|
||||
} else {
|
||||
Toast.makeText(this, "Error " + resultCode + ": " + resultData.getString(CloudControllerService.OPERATION_RESULTS) , Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
private EndpointObject getEndpointByType(List<ServiceCatalogObject> sc, String type) {
|
||||
EndpointObject eo = null;
|
||||
boolean found = false;
|
||||
ServiceCatalogObject item = null;
|
||||
|
||||
Iterator<ServiceCatalogObject> it = sc.iterator();
|
||||
|
||||
while (it.hasNext() && !found) {
|
||||
item = it.next();
|
||||
|
||||
if (item.getType().equals(type)) {
|
||||
eo = item.getEndpoints().get(0);
|
||||
found = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return eo;
|
||||
}
|
||||
|
||||
private void addConnectionProfile() {
|
||||
Intent i = new Intent(this, ConnectionProfileActivity.class);
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
private void deleteConnectionProfile() {
|
||||
Uri connectionProfileUri = Uri.parse(ConnectionProfileContentProvider.CONTENT_URI + "/" + selectedItemId);
|
||||
getContentResolver().delete(connectionProfileUri, null, null);
|
||||
}
|
||||
|
||||
private void editConnectionProfile() {
|
||||
Intent i = new Intent(this, ConnectionProfileActivity.class);
|
||||
Uri connectionProfileUri = Uri.parse(ConnectionProfileContentProvider.CONTENT_URI + "/" + selectedItemId);
|
||||
i.putExtra(ConnectionProfileContentProvider.CONTENT_ITEM_TYPE, connectionProfileUri);
|
||||
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
private void cloneConnectionProfile() {
|
||||
Uri connectionProfileUri = Uri.parse(ConnectionProfileContentProvider.CONTENT_URI + "/" + selectedItemId);
|
||||
|
||||
String[] projection = {ConnectionProfileTable.COLUMN_PROFILE_NAME, ConnectionProfileTable.COLUMN_ENDPOINT,
|
||||
ConnectionProfileTable.COLUMN_USERNAME, ConnectionProfileTable.COLUMN_PASSWORD,
|
||||
ConnectionProfileTable.COLUMN_TENANT_ID};
|
||||
|
||||
Cursor cursor = getContentResolver().query(connectionProfileUri, 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));
|
||||
|
||||
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);
|
||||
|
||||
getContentResolver().insert(ConnectionProfileContentProvider.CONTENT_URI, values);
|
||||
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
private void populateProfiles() {
|
||||
String[] from = new String[] { ConnectionProfileTable.COLUMN_PROFILE_NAME };
|
||||
int[] to = new int[] { R.id.profile_name };
|
||||
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
adapter = new SimpleCursorAdapter(this, R.layout.profile_list_item, null, from, to, 0);
|
||||
|
||||
setListAdapter(adapter);
|
||||
}
|
||||
|
||||
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
String[] projection = { ConnectionProfileTable.COLUMN_ID, ConnectionProfileTable.COLUMN_PROFILE_NAME };
|
||||
CursorLoader cursorLoader = new CursorLoader(this, ConnectionProfileContentProvider.CONTENT_URI, projection, null, null, null);
|
||||
return cursorLoader;
|
||||
}
|
||||
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
|
||||
adapter.swapCursor(data);
|
||||
}
|
||||
|
||||
public void onLoaderReset(Loader<Cursor> loader) {
|
||||
adapter.swapCursor(null);
|
||||
}
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
public class OpenstackdroidApplication extends Application {
|
||||
private String token;
|
||||
private String tenantId;
|
||||
public boolean isAdminUser;
|
||||
private String computeEndpoint;
|
||||
private String volumeEndpoint;
|
||||
private String identityEndpoint;
|
||||
private String identityAdminEndpoint;
|
||||
private String imageEndpoint;
|
||||
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public boolean isAdminUser() {
|
||||
return isAdminUser;
|
||||
}
|
||||
|
||||
public void setAdminUser(boolean isAdminUser) {
|
||||
this.isAdminUser = isAdminUser;
|
||||
}
|
||||
|
||||
public String getComputeEndpoint() {
|
||||
return computeEndpoint;
|
||||
}
|
||||
|
||||
public void setComputeEndpoint(String computeEndpoint) {
|
||||
this.computeEndpoint = computeEndpoint;
|
||||
}
|
||||
|
||||
public String getVolumeEndpoint() {
|
||||
return volumeEndpoint;
|
||||
}
|
||||
|
||||
public void setVolumeEndpoint(String volumeEndpoint) {
|
||||
this.volumeEndpoint = volumeEndpoint;
|
||||
}
|
||||
|
||||
public String getIdentityEndpoint() {
|
||||
return identityEndpoint;
|
||||
}
|
||||
|
||||
public void setIdentityEndpoint(String identityEndpoint) {
|
||||
this.identityEndpoint = identityEndpoint;
|
||||
}
|
||||
|
||||
public String getIdentityAdminEndpoint() {
|
||||
return identityAdminEndpoint;
|
||||
}
|
||||
|
||||
public void setIdentityAdminEndpoint(String identityAdminEndpoint) {
|
||||
this.identityAdminEndpoint = identityAdminEndpoint;
|
||||
}
|
||||
|
||||
public String getImageEndpoint() {
|
||||
return imageEndpoint;
|
||||
}
|
||||
|
||||
public void setImageEndpoint(String imageEndpoint) {
|
||||
this.imageEndpoint = imageEndpoint;
|
||||
}
|
||||
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.rcarrillocruz.android.openstackdroid.model.IPAddressModel;
|
||||
import com.rcarrillocruz.android.openstackdroid.model.ServerModel;
|
||||
|
||||
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 ServerDetailsFragment extends Fragment {
|
||||
private ScrollView scroller;
|
||||
private TextView tv;
|
||||
|
||||
public static ServerDetailsFragment newInstance(int position) {
|
||||
ServerDetailsFragment f = new ServerDetailsFragment();
|
||||
|
||||
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);
|
||||
ServerModel server = (((CloudBrowserActivity)getActivity()).getServers()).get(getShownIndex());
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("ID: " + server.getId() + "\n\n");
|
||||
sb.append("Name: " + server.getName() + "\n\n");
|
||||
sb.append("Created: " + server.getCreated() + "\n\n");
|
||||
sb.append("Updated: " + server.getUpdated() + "\n\n");
|
||||
sb.append("Status: " + server.getStatus() + "\n\n");
|
||||
sb.append("Image: " + server.getImage() + "\n\n");
|
||||
sb.append("Flavor: " + server.getFlavor() + "\n\n");
|
||||
sb.append("Private IP addresses:\n\n");
|
||||
|
||||
Iterator<IPAddressModel> it = (Iterator<IPAddressModel>) server.getPrivateAddresses().iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
sb.append(it.next().getAddr().toString() + "\n");
|
||||
}
|
||||
|
||||
sb.append("\nPublic IP addresses: \n\n");
|
||||
it = (Iterator<IPAddressModel>) server.getPublicAddresses().iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
sb.append(it.next().getAddr().toString() + "\n");
|
||||
}
|
||||
|
||||
tv.setText(sb.toString());
|
||||
return scroller;
|
||||
}
|
||||
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.compute.GetServersResponse;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.compute.IPAddressObject;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.compute.ServerDetailsObject;
|
||||
import com.rcarrillocruz.android.openstackdroid.model.IPAddressModel;
|
||||
import com.rcarrillocruz.android.openstackdroid.model.ServerModel;
|
||||
|
||||
public class ServerListFragment extends CloudBrowserListFragment {
|
||||
List<ServerModel> servers;
|
||||
private ArrayAdapter<ServerModel> adapter;
|
||||
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
servers = ((CloudBrowserActivity) getActivity()).getServers();
|
||||
endpoint = ((OpenstackdroidApplication) (getActivity().getApplication())).getComputeEndpoint();
|
||||
|
||||
Intent serviceIntent = new Intent(getActivity(), CloudControllerService.class);
|
||||
serviceIntent.setData(Uri.parse(endpoint));
|
||||
serviceIntent.putExtra(CloudControllerService.OPERATION, CloudControllerService.GET_SERVERS_OPERATION);
|
||||
serviceIntent.putExtra(CloudControllerService.TOKEN, ((OpenstackdroidApplication) getActivity().getApplication()).getToken());
|
||||
serviceIntent.putExtra(CloudControllerService.TENANT, ((OpenstackdroidApplication) getActivity().getApplication()).getTenantId());
|
||||
serviceIntent.putExtra(CloudControllerService.RECEIVER, mReceiver);
|
||||
Bundle params = new Bundle();
|
||||
serviceIntent.putExtra(CloudControllerService.PARAMS, params);
|
||||
|
||||
getActivity().startService(serviceIntent);
|
||||
|
||||
adapter = new ArrayAdapter<ServerModel>(getActivity(), android.R.layout.simple_list_item_activated_1, servers);
|
||||
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) {
|
||||
ServerDetailsFragment sdf = (ServerDetailsFragment) ((CloudBrowserActivity) getActivity()).getmServerDetailsFragment();
|
||||
|
||||
if (sdf == null || sdf.getShownIndex() != position)
|
||||
sdf = ServerDetailsFragment.newInstance(position);
|
||||
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.item_details, sdf);
|
||||
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_SERVERS_OPERATION)) {
|
||||
Gson gson = new Gson();
|
||||
GetServersResponse gsr = gson.fromJson(resultData.getString(CloudControllerService.OPERATION_RESULTS), GetServersResponse.class);
|
||||
|
||||
populateItems(gsr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void populateItems(GetServersResponse gsr) {
|
||||
servers.clear();
|
||||
Iterator<ServerDetailsObject> it = gsr.getServers().iterator();
|
||||
ServerDetailsObject item = null;
|
||||
|
||||
while(it.hasNext()) {
|
||||
|
||||
item = it.next();
|
||||
|
||||
ServerModel newSm = new ServerModel(item.getId(), item.getName(), item.getStatus(), item.getCreated(), item.getUpdated(), new ArrayList<IPAddressModel>(), new ArrayList<IPAddressModel>(), item.getImage().getId(), item.getFlavor().getId());
|
||||
|
||||
if (item.getAddresses().getPrivateAddresses() != null) {
|
||||
Iterator<IPAddressObject> it_addr = item.getAddresses().getPrivateAddresses().iterator();
|
||||
IPAddressObject item2 = null;
|
||||
|
||||
while (it_addr.hasNext()) {
|
||||
item2 = it_addr.next();
|
||||
newSm.getPrivateAddresses().add(new IPAddressModel(item2.getAddr(), item2.getVersion()));
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getAddresses().getPublicAddresses() != null) {
|
||||
Iterator<IPAddressObject> it_addr = item.getAddresses().getPublicAddresses().iterator();
|
||||
|
||||
while(it_addr.hasNext()) {
|
||||
IPAddressObject item2 = it_addr.next();
|
||||
newSm.getPublicAddresses().add(new IPAddressModel(item2.getAddr(), item2.getVersion()));
|
||||
}
|
||||
}
|
||||
|
||||
servers.add(newSm);
|
||||
}
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid;
|
||||
|
||||
import com.rcarrillocruz.android.openstackdroid.model.TenantModel;
|
||||
|
||||
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 TenantDetailsFragment extends Fragment {
|
||||
private ScrollView scroller;
|
||||
private TextView tv;
|
||||
|
||||
public static TenantDetailsFragment newInstance(int position) {
|
||||
TenantDetailsFragment f = new TenantDetailsFragment();
|
||||
|
||||
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);
|
||||
TenantModel tenant = (((CloudBrowserActivity)getActivity()).getTenants()).get(getShownIndex());
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("ID: " + tenant.getId() + "\n\n");
|
||||
sb.append("Name: " + tenant.getName() + "\n\n");
|
||||
sb.append("Enabled: " + tenant.isEnabled() + "\n\n");
|
||||
|
||||
String description = tenant.getDescription();
|
||||
|
||||
if (description == null)
|
||||
description = "";
|
||||
|
||||
sb.append("Description: " + description + "\n\n");
|
||||
|
||||
tv.setText(sb.toString());
|
||||
return scroller;
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.GetTenantsResponse;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.TenantDetailsObject;
|
||||
import com.rcarrillocruz.android.openstackdroid.model.TenantModel;
|
||||
|
||||
public class TenantListFragment extends CloudBrowserListFragment {
|
||||
|
||||
List<TenantModel> tenants;
|
||||
private ArrayAdapter<TenantModel> adapter;
|
||||
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
tenants = ((CloudBrowserActivity) getActivity()).getTenants();
|
||||
endpoint = ((OpenstackdroidApplication) (getActivity().getApplication())).getIdentityAdminEndpoint();
|
||||
|
||||
Intent serviceIntent = new Intent(getActivity(), CloudControllerService.class);
|
||||
serviceIntent.setData(Uri.parse(endpoint));
|
||||
serviceIntent.putExtra(CloudControllerService.OPERATION, CloudControllerService.GET_TENANTS_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<TenantModel>(getActivity(), android.R.layout.simple_list_item_activated_1, tenants);
|
||||
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) {
|
||||
TenantDetailsFragment tdf = (TenantDetailsFragment) ((CloudBrowserActivity) getActivity()).getmTenantDetailsFragment();
|
||||
|
||||
if (tdf == null || tdf.getShownIndex() != position)
|
||||
tdf = TenantDetailsFragment.newInstance(position);
|
||||
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.item_details, tdf);
|
||||
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_TENANTS_OPERATION)) {
|
||||
Gson gson = new Gson();
|
||||
GetTenantsResponse gtr = gson.fromJson(resultData.getString(CloudControllerService.OPERATION_RESULTS), GetTenantsResponse.class);
|
||||
|
||||
populateItems(gtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void populateItems(GetTenantsResponse gtr) {
|
||||
tenants.clear();
|
||||
Iterator<TenantDetailsObject> it = gtr.getTenants().iterator();
|
||||
TenantDetailsObject item = null;
|
||||
|
||||
while(it.hasNext()) {
|
||||
item = it.next();
|
||||
TenantModel newItem = new TenantModel(item.getId(), item.getName(), item.isEnabled(), item.getDescription());
|
||||
tenants.add(newItem);
|
||||
}
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid;
|
||||
|
||||
import com.rcarrillocruz.android.openstackdroid.model.UserModel;
|
||||
|
||||
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 UserDetailsFragment extends Fragment {
|
||||
private ScrollView scroller;
|
||||
private TextView tv;
|
||||
|
||||
public static UserDetailsFragment newInstance(int position) {
|
||||
UserDetailsFragment f = new UserDetailsFragment();
|
||||
|
||||
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);
|
||||
UserModel user = (((CloudBrowserActivity)getActivity()).getUsers()).get(getShownIndex());
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("ID: " + user.getId() + "\n\n");
|
||||
sb.append("Name: " + user.getName() + "\n\n");
|
||||
sb.append("Enabled: " + user.isEnabled() + "\n\n");
|
||||
sb.append("Email: " + user.getEmail() + "\n\n");
|
||||
|
||||
String tenantId = user.getTenantId();
|
||||
|
||||
if (tenantId == null)
|
||||
tenantId = "";
|
||||
|
||||
sb.append("Tenant id: " + tenantId + "\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 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;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.GetUsersResponse;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.UserDetailsObject;
|
||||
import com.rcarrillocruz.android.openstackdroid.model.UserModel;
|
||||
|
||||
public class UserListFragment extends CloudBrowserListFragment {
|
||||
|
||||
List<UserModel> users;
|
||||
private ArrayAdapter<UserModel> adapter;
|
||||
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
users = ((CloudBrowserActivity) getActivity()).getUsers();
|
||||
endpoint = ((OpenstackdroidApplication) (getActivity().getApplication())).getIdentityAdminEndpoint();
|
||||
|
||||
Intent serviceIntent = new Intent(getActivity(), CloudControllerService.class);
|
||||
serviceIntent.setData(Uri.parse(endpoint));
|
||||
serviceIntent.putExtra(CloudControllerService.OPERATION, CloudControllerService.GET_USERS_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<UserModel>(getActivity(), android.R.layout.simple_list_item_activated_1, users);
|
||||
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) {
|
||||
UserDetailsFragment udf = (UserDetailsFragment) ((CloudBrowserActivity) getActivity()).getmUserDetailsFragment();
|
||||
|
||||
if (udf == null || udf.getShownIndex() != position)
|
||||
udf = UserDetailsFragment.newInstance(position);
|
||||
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.item_details, udf);
|
||||
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_USERS_OPERATION)) {
|
||||
Gson gson = new Gson();
|
||||
GetUsersResponse gur = gson.fromJson(resultData.getString(CloudControllerService.OPERATION_RESULTS), GetUsersResponse.class);
|
||||
|
||||
populateItems(gur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void populateItems(GetUsersResponse gur) {
|
||||
users.clear();
|
||||
Iterator<UserDetailsObject> it = gur.getUsers().iterator();
|
||||
UserDetailsObject item = null;
|
||||
|
||||
while(it.hasNext()) {
|
||||
item = it.next();
|
||||
UserModel newItem = new UserModel(item.getId(), item.getName(), item.isEnabled(), item.getEmail(), item.getTenantId());
|
||||
users.add(newItem);
|
||||
}
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid;
|
||||
|
||||
import com.rcarrillocruz.android.openstackdroid.model.VolumeModel;
|
||||
|
||||
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 VolumeDetailsFragment extends Fragment {
|
||||
private ScrollView scroller;
|
||||
private TextView tv;
|
||||
|
||||
public static VolumeDetailsFragment newInstance(int position) {
|
||||
VolumeDetailsFragment f = new VolumeDetailsFragment();
|
||||
|
||||
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);
|
||||
VolumeModel volume = (((CloudBrowserActivity)getActivity()).getVolumes()).get(getShownIndex());
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("ID: " + volume.getId() + "\n\n");
|
||||
|
||||
String name = volume.getName();
|
||||
if (name == null)
|
||||
name = "";
|
||||
sb.append("Name: " + name + "\n\n");
|
||||
|
||||
String description = volume.getDescription();
|
||||
if (description == null)
|
||||
description = "";
|
||||
sb.append("Description: " + description + "\n\n");
|
||||
|
||||
sb.append("Created: " + volume.getCreated_at() + "\n\n");
|
||||
sb.append("Status: " + volume.getStatus() + "\n\n");
|
||||
sb.append("Size: " + volume.getSize() + "G" + "\n\n");
|
||||
|
||||
String attached = volume.getAttached_to();
|
||||
|
||||
if (attached == null)
|
||||
attached = "";
|
||||
|
||||
sb.append("Attached to: " + attached + "\n\n");
|
||||
|
||||
tv.setText(sb.toString());
|
||||
return scroller;
|
||||
}
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.volume.GetVolumesResponse;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.volume.VolumeDetailsObject;
|
||||
import com.rcarrillocruz.android.openstackdroid.model.VolumeModel;
|
||||
|
||||
public class VolumeListFragment extends CloudBrowserListFragment {
|
||||
List<VolumeModel> volumes;
|
||||
private ArrayAdapter<VolumeModel> adapter;
|
||||
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
volumes = ((CloudBrowserActivity) getActivity()).getVolumes();
|
||||
endpoint = ((OpenstackdroidApplication) (getActivity().getApplication())).getVolumeEndpoint();
|
||||
|
||||
Intent serviceIntent = new Intent(getActivity(), CloudControllerService.class);
|
||||
serviceIntent.setData(Uri.parse(endpoint));
|
||||
serviceIntent.putExtra(CloudControllerService.OPERATION, CloudControllerService.GET_VOLUMES_OPERATION);
|
||||
serviceIntent.putExtra(CloudControllerService.TOKEN, ((OpenstackdroidApplication) getActivity().getApplication()).getToken());
|
||||
serviceIntent.putExtra(CloudControllerService.TENANT, ((OpenstackdroidApplication) getActivity().getApplication()).getTenantId());
|
||||
serviceIntent.putExtra(CloudControllerService.RECEIVER, mReceiver);
|
||||
Bundle params = new Bundle();
|
||||
serviceIntent.putExtra(CloudControllerService.PARAMS, params);
|
||||
|
||||
getActivity().startService(serviceIntent);
|
||||
|
||||
adapter = new ArrayAdapter<VolumeModel>(getActivity(), android.R.layout.simple_list_item_activated_1, volumes);
|
||||
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) {
|
||||
VolumeDetailsFragment sdf = (VolumeDetailsFragment) ((CloudBrowserActivity) getActivity()).getmVolumeDetailsFragment();
|
||||
|
||||
if (sdf == null || sdf.getShownIndex() != position)
|
||||
sdf = VolumeDetailsFragment.newInstance(position);
|
||||
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.item_details, sdf);
|
||||
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_VOLUMES_OPERATION)) {
|
||||
Gson gson = new Gson();
|
||||
GetVolumesResponse gvr = gson.fromJson(resultData.getString(CloudControllerService.OPERATION_RESULTS), GetVolumesResponse.class);
|
||||
|
||||
populateItems(gvr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void populateItems(GetVolumesResponse gsr) {
|
||||
volumes.clear();
|
||||
Iterator<VolumeDetailsObject> it = gsr.getVolumes().iterator();
|
||||
VolumeDetailsObject item = null;
|
||||
|
||||
while(it.hasNext()) {
|
||||
item = it.next();
|
||||
VolumeModel newItem = new VolumeModel(item.getId(), item.getDisplay_name(), item.getDisplay_description(), item.getStatus(), item.getSize(), item.getCreated_at(), null);
|
||||
|
||||
if (!item.getAttachments().isEmpty())
|
||||
newItem.setAttached_to(item.getAttachments().get(0).getId());
|
||||
volumes.add(newItem);
|
||||
}
|
||||
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.db.connectionprofile;
|
||||
|
||||
public class ConnectionProfile {
|
||||
|
||||
private String profileName;
|
||||
private String username;
|
||||
private String password;
|
||||
private String tenantId;
|
||||
private String endpoint;
|
||||
|
||||
public ConnectionProfile(String profileName, String endpoint, String username, String password, String tenantId)
|
||||
{
|
||||
super();
|
||||
this.profileName = profileName;
|
||||
this.endpoint = endpoint;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getProfileName() {
|
||||
return profileName;
|
||||
}
|
||||
|
||||
public void setProfileName(String profileName) {
|
||||
this.profileName = profileName;
|
||||
}
|
||||
|
||||
|
||||
public String getEndpoint() {
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
public void setEndpoint(String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getProfileName();
|
||||
}
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.db.connectionprofile;
|
||||
|
||||
import android.content.ContentProvider;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.UriMatcher;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteQueryBuilder;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
public class ConnectionProfileContentProvider extends ContentProvider {
|
||||
private ConnectionProfileDatabaseHelper database;
|
||||
|
||||
private static final int CONNECTION_PROFILES = 10;
|
||||
private static final int CONNECTION_PROFILE_ID = 20;
|
||||
|
||||
private static final String AUTHORITY = "com.rcarrillocruz.android.openstackdroid";
|
||||
private static final String BASE_PATH = "ConnectionProfileContentProvider";
|
||||
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/" + BASE_PATH);
|
||||
public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/connection_profiles";
|
||||
public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/connection_profile";
|
||||
|
||||
private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);
|
||||
static {
|
||||
sURIMatcher.addURI(AUTHORITY, BASE_PATH, CONNECTION_PROFILES);
|
||||
sURIMatcher.addURI(AUTHORITY, BASE_PATH + "/#", CONNECTION_PROFILE_ID);
|
||||
}
|
||||
|
||||
public int delete(Uri uri, String selection, String[] selectionArgs) {
|
||||
int uriType = sURIMatcher.match(uri);
|
||||
SQLiteDatabase sqlDB = database.getWritableDatabase();
|
||||
int rowsDeleted = 0;
|
||||
|
||||
switch (uriType) {
|
||||
case CONNECTION_PROFILES:
|
||||
rowsDeleted = sqlDB.delete(ConnectionProfileTable.TABLE_CONNECTION_PROFILE, selection, selectionArgs);
|
||||
break;
|
||||
case CONNECTION_PROFILE_ID:
|
||||
|
||||
String id = uri.getLastPathSegment();
|
||||
|
||||
if (TextUtils.isEmpty(selection)) {
|
||||
rowsDeleted = sqlDB.delete(ConnectionProfileTable.TABLE_CONNECTION_PROFILE, ConnectionProfileTable.COLUMN_ID + "=" + id, null);
|
||||
} else {
|
||||
rowsDeleted = sqlDB.delete(ConnectionProfileTable.TABLE_CONNECTION_PROFILE, ConnectionProfileTable.COLUMN_ID + "=" + id + " and " + selection, selectionArgs);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown URI: " + uri);
|
||||
}
|
||||
|
||||
getContext().getContentResolver().notifyChange(uri, null);
|
||||
|
||||
return rowsDeleted;
|
||||
}
|
||||
|
||||
public String getType(Uri uri) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Uri insert(Uri uri, ContentValues values) {
|
||||
int uriType = sURIMatcher.match(uri);
|
||||
SQLiteDatabase sqlDB = database.getWritableDatabase();
|
||||
long id = 0;
|
||||
|
||||
switch (uriType) {
|
||||
case CONNECTION_PROFILES:
|
||||
id = sqlDB.insert(ConnectionProfileTable.TABLE_CONNECTION_PROFILE, null, values);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown URI: " + uri);
|
||||
}
|
||||
|
||||
getContext().getContentResolver().notifyChange(uri, null);
|
||||
|
||||
return Uri.parse(BASE_PATH + "/" + id);
|
||||
}
|
||||
|
||||
public boolean onCreate() {
|
||||
database = new ConnectionProfileDatabaseHelper(getContext());
|
||||
return false;
|
||||
}
|
||||
|
||||
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
|
||||
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
|
||||
queryBuilder.setTables(ConnectionProfileTable.TABLE_CONNECTION_PROFILE);
|
||||
int uriType = sURIMatcher.match(uri);
|
||||
|
||||
switch (uriType) {
|
||||
case CONNECTION_PROFILES:
|
||||
break;
|
||||
case CONNECTION_PROFILE_ID:
|
||||
queryBuilder.appendWhere(ConnectionProfileTable.COLUMN_ID + "=" + uri.getLastPathSegment());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown URI");
|
||||
}
|
||||
|
||||
SQLiteDatabase sqlDB = database.getReadableDatabase();
|
||||
Cursor cursor = queryBuilder.query(sqlDB, projection, selection, selectionArgs, null, null, sortOrder);
|
||||
cursor.setNotificationUri(getContext().getContentResolver(), uri);
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
|
||||
int uriType = sURIMatcher.match(uri);
|
||||
SQLiteDatabase sqlDB = database.getWritableDatabase();
|
||||
int rowsUpdated = 0;
|
||||
|
||||
switch (uriType) {
|
||||
case CONNECTION_PROFILES:
|
||||
rowsUpdated = sqlDB.update(ConnectionProfileTable.TABLE_CONNECTION_PROFILE, values, selection, selectionArgs);
|
||||
break;
|
||||
case CONNECTION_PROFILE_ID:
|
||||
String id = uri.getLastPathSegment();
|
||||
if (TextUtils.isEmpty(selection)) {
|
||||
rowsUpdated = sqlDB.update(ConnectionProfileTable.TABLE_CONNECTION_PROFILE, values, ConnectionProfileTable.COLUMN_ID + "=" + id, null);
|
||||
} else {
|
||||
rowsUpdated = sqlDB.update(ConnectionProfileTable.TABLE_CONNECTION_PROFILE, values, ConnectionProfileTable.COLUMN_ID + "=" + id + " and " + selection, selectionArgs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown URI: " + uri);
|
||||
}
|
||||
|
||||
getContext().getContentResolver().notifyChange(uri, null);
|
||||
|
||||
return rowsUpdated;
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.db.connectionprofile;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteDatabase.CursorFactory;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
public class ConnectionProfileDatabaseHelper extends SQLiteOpenHelper {
|
||||
private static final String DATABASE_NAME = "connection_profile.db";
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
|
||||
|
||||
public ConnectionProfileDatabaseHelper(Context context) {
|
||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
public ConnectionProfileDatabaseHelper(Context context, String name,
|
||||
CursorFactory factory, int version) {
|
||||
super(context, name, factory, version);
|
||||
}
|
||||
|
||||
public void onCreate(SQLiteDatabase database) {
|
||||
ConnectionProfileTable.onCreate(database);
|
||||
}
|
||||
|
||||
public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
|
||||
ConnectionProfileTable.onUpgrade(database, oldVersion, newVersion);
|
||||
}
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.db.connectionprofile;
|
||||
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
public class ConnectionProfileTable {
|
||||
|
||||
public static final String TABLE_CONNECTION_PROFILE = "connectionProfile";
|
||||
public static final String COLUMN_ID = "_id";
|
||||
public static final String COLUMN_PROFILE_NAME = "profileName";
|
||||
public static final String COLUMN_ENDPOINT = "endpoint";
|
||||
public static final String COLUMN_USERNAME = "username";
|
||||
public static final String COLUMN_PASSWORD = "password";
|
||||
public static final String COLUMN_TENANT_ID = "tenantId";
|
||||
|
||||
private static final String DATABASE_CREATE = "create table "
|
||||
+ TABLE_CONNECTION_PROFILE
|
||||
+ "("
|
||||
+ COLUMN_ID + " integer primary key autoincrement, "
|
||||
+ COLUMN_PROFILE_NAME + " text not null, "
|
||||
+ COLUMN_ENDPOINT + " text not null,"
|
||||
+ COLUMN_USERNAME + " text not null,"
|
||||
+ COLUMN_PASSWORD + " text not null,"
|
||||
+ COLUMN_TENANT_ID + " text not null"
|
||||
+ ");";
|
||||
|
||||
public static void onCreate(SQLiteDatabase database) {
|
||||
database.execSQL(DATABASE_CREATE);
|
||||
}
|
||||
|
||||
public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
|
||||
database.execSQL("DROP TABLE IF EXISTS " + TABLE_CONNECTION_PROFILE);
|
||||
onCreate(database);
|
||||
}
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class FlavorDetailsObject {
|
||||
private String id;
|
||||
private String name;
|
||||
private int vcpus;
|
||||
private int ram;
|
||||
private int disk;
|
||||
private String swap;
|
||||
@SerializedName("OS-FLV-DISABLED:disabled")
|
||||
private boolean disabled;
|
||||
@SerializedName("OS-FLV-EXT-DATA:ephemeral")
|
||||
private int ephemeral;
|
||||
@SerializedName("os-flavor-access:is_public")
|
||||
private boolean isPublic;
|
||||
private double rxtx_factor;
|
||||
private List<LinkObject> links;
|
||||
|
||||
public FlavorDetailsObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getVcpus() {
|
||||
return vcpus;
|
||||
}
|
||||
|
||||
public void setVcpus(int vcpus) {
|
||||
this.vcpus = vcpus;
|
||||
}
|
||||
|
||||
public int getRam() {
|
||||
return ram;
|
||||
}
|
||||
|
||||
public void setRam(int ram) {
|
||||
this.ram = ram;
|
||||
}
|
||||
|
||||
public int getDisk() {
|
||||
return disk;
|
||||
}
|
||||
|
||||
public void setDisk(int disk) {
|
||||
this.disk = disk;
|
||||
}
|
||||
|
||||
public String getSwap() {
|
||||
return swap;
|
||||
}
|
||||
|
||||
public void setSwap(String swap) {
|
||||
this.swap = swap;
|
||||
}
|
||||
|
||||
public boolean isDisabled() {
|
||||
return disabled;
|
||||
}
|
||||
|
||||
public void setDisabled(boolean disabled) {
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
public int getEphemeral() {
|
||||
return ephemeral;
|
||||
}
|
||||
|
||||
public void setEphemeral(int ephemeral) {
|
||||
this.ephemeral = ephemeral;
|
||||
}
|
||||
|
||||
public boolean isPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
public void setPublic(boolean isPublic) {
|
||||
this.isPublic = isPublic;
|
||||
}
|
||||
|
||||
public double getRxtx_factor() {
|
||||
return rxtx_factor;
|
||||
}
|
||||
|
||||
public void setRxtx_factor(double rxtx_factor) {
|
||||
this.rxtx_factor = rxtx_factor;
|
||||
}
|
||||
|
||||
public List<LinkObject> getLinks() {
|
||||
return links;
|
||||
}
|
||||
|
||||
public void setLinks(List<LinkObject> links) {
|
||||
this.links = links;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
public class FlavorLinkObject {
|
||||
private String href;
|
||||
private String rel;
|
||||
|
||||
public FlavorLinkObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public String getRel() {
|
||||
return rel;
|
||||
}
|
||||
|
||||
public void setRel(String rel) {
|
||||
this.rel = rel;
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FlavorObject {
|
||||
private String id;
|
||||
private List<FlavorLinkObject> links;
|
||||
|
||||
public FlavorObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public List<FlavorLinkObject> getLinks() {
|
||||
return links;
|
||||
}
|
||||
|
||||
public void setLinks(List<FlavorLinkObject> links) {
|
||||
this.links = links;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GetFlavorsResponse {
|
||||
private List<FlavorDetailsObject> flavors;
|
||||
|
||||
public GetFlavorsResponse() {
|
||||
super();
|
||||
}
|
||||
|
||||
public List<FlavorDetailsObject> getFlavors() {
|
||||
return flavors;
|
||||
}
|
||||
|
||||
public void setFlavors(List<FlavorDetailsObject> flavors) {
|
||||
this.flavors = flavors;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GetServersResponse {
|
||||
List<ServerDetailsObject> servers;
|
||||
|
||||
public GetServersResponse() {
|
||||
super();
|
||||
}
|
||||
|
||||
public List<ServerDetailsObject> getServers() {
|
||||
return servers;
|
||||
}
|
||||
|
||||
public void setServers(List<ServerDetailsObject> servers) {
|
||||
this.servers = servers;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
public class IPAddressObject {
|
||||
private String addr;
|
||||
private int version;
|
||||
|
||||
public IPAddressObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getAddr() {
|
||||
return addr;
|
||||
}
|
||||
|
||||
public void setAddr(String addr) {
|
||||
this.addr = addr;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class IPAddressesObject {
|
||||
@SerializedName("private")
|
||||
private List<IPAddressObject> privateAddresses;
|
||||
|
||||
@SerializedName("public")
|
||||
private List<IPAddressObject> publicAddresses;
|
||||
|
||||
public IPAddressesObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public List<IPAddressObject> getPrivateAddresses() {
|
||||
return privateAddresses;
|
||||
}
|
||||
|
||||
public void setPrivateAddresses(List<IPAddressObject> privateAddresses) {
|
||||
this.privateAddresses = privateAddresses;
|
||||
}
|
||||
|
||||
public List<IPAddressObject> getPublicAddresses() {
|
||||
return publicAddresses;
|
||||
}
|
||||
|
||||
public void setPublicAddresses(List<IPAddressObject> publicAddresses) {
|
||||
this.publicAddresses = publicAddresses;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
public class ImageLinkObject {
|
||||
private String href;
|
||||
private String rel;
|
||||
|
||||
public ImageLinkObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public String getRel() {
|
||||
return rel;
|
||||
}
|
||||
|
||||
public void setRel(String rel) {
|
||||
this.rel = rel;
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ImageObject {
|
||||
private String id;
|
||||
private List<ImageLinkObject> links;
|
||||
|
||||
public ImageObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public List<ImageLinkObject> getLinks() {
|
||||
return links;
|
||||
}
|
||||
|
||||
public void setLinks(List<ImageLinkObject> links) {
|
||||
this.links = links;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
public class LinkObject {
|
||||
private String href;
|
||||
private String rel;
|
||||
|
||||
public LinkObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public String getRel() {
|
||||
return rel;
|
||||
}
|
||||
|
||||
public void setRel(String rel) {
|
||||
this.rel = rel;
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
|
||||
public class ServerDetailsObject {
|
||||
private String id;
|
||||
private String name;
|
||||
private IPAddressesObject addresses;
|
||||
private String created;
|
||||
private String updated;
|
||||
private String status;
|
||||
private ImageObject image;
|
||||
private FlavorObject flavor;
|
||||
|
||||
public ServerDetailsObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public IPAddressesObject getAddresses() {
|
||||
return addresses;
|
||||
}
|
||||
|
||||
public void setAddresses(IPAddressesObject addresses) {
|
||||
this.addresses = addresses;
|
||||
}
|
||||
|
||||
public String getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(String created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public String getUpdated() {
|
||||
return updated;
|
||||
}
|
||||
|
||||
public void setUpdated(String updated) {
|
||||
this.updated = updated;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public ImageObject getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setImage(ImageObject image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public FlavorObject getFlavor() {
|
||||
return flavor;
|
||||
}
|
||||
|
||||
public void setFlavor(FlavorObject flavor) {
|
||||
this.flavor = flavor;
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.compute;
|
||||
|
||||
public class ServerLinkObject {
|
||||
private String href;
|
||||
private String rel;
|
||||
|
||||
public ServerLinkObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getHref() {
|
||||
return href;
|
||||
}
|
||||
|
||||
public void setHref(String href) {
|
||||
this.href = href;
|
||||
}
|
||||
|
||||
public String getRel() {
|
||||
return rel;
|
||||
}
|
||||
|
||||
public void setRel(String rel) {
|
||||
this.rel = rel;
|
||||
}
|
||||
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AccessObject {
|
||||
private TokenObject token;
|
||||
private UserObject user;
|
||||
private List<ServiceCatalogObject> serviceCatalog;
|
||||
private MetadataObject metadata;
|
||||
|
||||
public AccessObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public TokenObject getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(TokenObject token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public UserObject getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(UserObject user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public List<ServiceCatalogObject> getServiceCatalog() {
|
||||
return serviceCatalog;
|
||||
}
|
||||
|
||||
public void setServiceCatalog(List<ServiceCatalogObject> serviceCatalog) {
|
||||
this.serviceCatalog = serviceCatalog;
|
||||
}
|
||||
|
||||
public MetadataObject getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public void setMetadata(MetadataObject metadata) {
|
||||
this.metadata = metadata;
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
|
||||
public class AuthObject {
|
||||
private PasswordCredentialsObject passwordCredentials;
|
||||
private String tenantId;
|
||||
|
||||
public AuthObject(PasswordCredentialsObject passwordCredentials,
|
||||
String tenantId) {
|
||||
super();
|
||||
this.passwordCredentials = passwordCredentials;
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public PasswordCredentialsObject getPasswordCredentials() {
|
||||
return passwordCredentials;
|
||||
}
|
||||
|
||||
public void setPasswordCredentials(PasswordCredentialsObject passwordCredentials) {
|
||||
this.passwordCredentials = passwordCredentials;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
public class EndpointObject {
|
||||
private String adminURL;
|
||||
private String region;
|
||||
private String internalURL;
|
||||
private String id;
|
||||
private String publicURL;
|
||||
|
||||
|
||||
public EndpointObject() {
|
||||
}
|
||||
|
||||
public String getAdminURL() {
|
||||
return adminURL;
|
||||
}
|
||||
|
||||
public void setAdminURL(String adminURL) {
|
||||
this.adminURL = adminURL;
|
||||
}
|
||||
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String getInternalURL() {
|
||||
return internalURL;
|
||||
}
|
||||
|
||||
public void setInternalURL(String internalURL) {
|
||||
this.internalURL = internalURL;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPublicURL() {
|
||||
return publicURL;
|
||||
}
|
||||
|
||||
public void setPublicURL(String publicURL) {
|
||||
this.publicURL = publicURL;
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GetTenantsResponse {
|
||||
private List<TenantDetailsObject> tenants;
|
||||
|
||||
public GetTenantsResponse() {
|
||||
super();
|
||||
}
|
||||
|
||||
public List<TenantDetailsObject> getTenants() {
|
||||
return tenants;
|
||||
}
|
||||
|
||||
public void setTenants(List<TenantDetailsObject> tenants) {
|
||||
this.tenants = tenants;
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
public class GetTokenRequest {
|
||||
|
||||
private AuthObject auth;
|
||||
|
||||
public GetTokenRequest() {
|
||||
super();
|
||||
}
|
||||
|
||||
public GetTokenRequest(AuthObject auth) {
|
||||
super();
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
public AuthObject getAuth() {
|
||||
return auth;
|
||||
}
|
||||
|
||||
public void setAuth(AuthObject auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
public class GetTokenResponse {
|
||||
private AccessObject access;
|
||||
|
||||
public GetTokenResponse() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AccessObject getAccess() {
|
||||
return access;
|
||||
}
|
||||
|
||||
public void setAccess(AccessObject access) {
|
||||
this.access = access;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GetUsersResponse {
|
||||
private List<UserDetailsObject> users;
|
||||
|
||||
public List<UserDetailsObject> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
public void setUsers(List<UserDetailsObject> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
public GetUsersResponse() {
|
||||
super();
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MetadataObject {
|
||||
private int is_admin;
|
||||
private List<String> roles;
|
||||
|
||||
public MetadataObject() {
|
||||
}
|
||||
|
||||
public int getIs_admin() {
|
||||
return is_admin;
|
||||
}
|
||||
|
||||
public void setIs_admin(int is_admin) {
|
||||
this.is_admin = is_admin;
|
||||
}
|
||||
|
||||
public List<String> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<String> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
public class PasswordCredentialsObject {
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public PasswordCredentialsObject(String username, String password) {
|
||||
super();
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
public class RoleObject {
|
||||
private String name;
|
||||
|
||||
public RoleObject() {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ServiceCatalogObject {
|
||||
private List<EndpointObject> endpoints;
|
||||
private String name;
|
||||
private String type;
|
||||
private List<String> endpoints_links;
|
||||
|
||||
public ServiceCatalogObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public List<EndpointObject> getEndpoints() {
|
||||
return endpoints;
|
||||
}
|
||||
|
||||
public void setEndpoints(List<EndpointObject> endpoints) {
|
||||
this.endpoints = endpoints;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<String> getEndpoints_links() {
|
||||
return endpoints_links;
|
||||
}
|
||||
|
||||
public void setEndpoints_links(List<String> endpoints_links) {
|
||||
this.endpoints_links = endpoints_links;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
public class TenantDetailsObject {
|
||||
private String id;
|
||||
private String name;
|
||||
private boolean enabled;
|
||||
private String description;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
public class TenantObject {
|
||||
private String id;
|
||||
private String name;
|
||||
private boolean enabled;
|
||||
private String description;
|
||||
|
||||
public TenantObject() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
public class TokenObject {
|
||||
private String id;
|
||||
private String issued_at;
|
||||
private String expires;
|
||||
private TenantObject tenant;
|
||||
|
||||
public TokenObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIssued_at() {
|
||||
return issued_at;
|
||||
}
|
||||
|
||||
public void setIssued_at(String issued_at) {
|
||||
this.issued_at = issued_at;
|
||||
}
|
||||
|
||||
public String getExpires() {
|
||||
return expires;
|
||||
}
|
||||
|
||||
public void setExpires(String expires) {
|
||||
this.expires = expires;
|
||||
}
|
||||
|
||||
public TenantObject getTenant() {
|
||||
return tenant;
|
||||
}
|
||||
|
||||
public void setTenant(TenantObject tenant) {
|
||||
this.tenant = tenant;
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
public class UserDetailsObject {
|
||||
private String id;
|
||||
private String name;
|
||||
private boolean enabled;
|
||||
private String email;
|
||||
private String tenantId;
|
||||
|
||||
public UserDetailsObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.identity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UserObject {
|
||||
private String id;
|
||||
private String username;
|
||||
private String name;
|
||||
private List<RoleObject> roles;
|
||||
private List<String> roles_links;
|
||||
|
||||
public UserObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<String> getRoles_links() {
|
||||
return roles_links;
|
||||
}
|
||||
|
||||
public void setRoles_links(List<String> roles_links) {
|
||||
this.roles_links = roles_links;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public List<RoleObject> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void setRoles(List<RoleObject> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.image;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GetImagesResponse {
|
||||
private List<ImageDetailsObject> images;
|
||||
|
||||
public GetImagesResponse() {
|
||||
super();
|
||||
}
|
||||
|
||||
public List<ImageDetailsObject> getImages() {
|
||||
return images;
|
||||
}
|
||||
|
||||
public void setImages(List<ImageDetailsObject> images) {
|
||||
this.images = images;
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.image;
|
||||
|
||||
public class ImageDetailsObject {
|
||||
private String checksum;
|
||||
private String container_format;
|
||||
private String created_at;
|
||||
private String disk_format;
|
||||
private String id;
|
||||
private String name;
|
||||
private int size;
|
||||
private String status;
|
||||
private String updated_at;
|
||||
private String visibility;
|
||||
|
||||
public ImageDetailsObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
public String getChecksum() {
|
||||
return checksum;
|
||||
}
|
||||
|
||||
public void setChecksum(String checksum) {
|
||||
this.checksum = checksum;
|
||||
}
|
||||
|
||||
public String getContainer_format() {
|
||||
return container_format;
|
||||
}
|
||||
|
||||
public void setContainer_format(String container_format) {
|
||||
this.container_format = container_format;
|
||||
}
|
||||
|
||||
public String getCreated_at() {
|
||||
return created_at;
|
||||
}
|
||||
|
||||
public void setCreated_at(String created_at) {
|
||||
this.created_at = created_at;
|
||||
}
|
||||
|
||||
public String getDisk_format() {
|
||||
return disk_format;
|
||||
}
|
||||
|
||||
public void setDisk_format(String disk_format) {
|
||||
this.disk_format = disk_format;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getUpdated_at() {
|
||||
return updated_at;
|
||||
}
|
||||
|
||||
public void setUpdated_at(String updated_at) {
|
||||
this.updated_at = updated_at;
|
||||
}
|
||||
|
||||
public String getVisibility() {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void setVisibility(String visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.volume;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GetVolumesResponse {
|
||||
private List<VolumeDetailsObject> volumes;
|
||||
|
||||
public GetVolumesResponse() {
|
||||
super();
|
||||
}
|
||||
|
||||
public List<VolumeDetailsObject> getVolumes() {
|
||||
return volumes;
|
||||
}
|
||||
|
||||
public void setVolumes(List<VolumeDetailsObject> volumes) {
|
||||
this.volumes = volumes;
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.volume;
|
||||
|
||||
public class VolumeAttachmentObject {
|
||||
private String id;
|
||||
private String device;
|
||||
private String server_id;
|
||||
private String volume_id;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getDevice() {
|
||||
return device;
|
||||
}
|
||||
public void setDevice(String device) {
|
||||
this.device = device;
|
||||
}
|
||||
public String getServer_id() {
|
||||
return server_id;
|
||||
}
|
||||
public void setServer_id(String server_id) {
|
||||
this.server_id = server_id;
|
||||
}
|
||||
public String getVolume_id() {
|
||||
return volume_id;
|
||||
}
|
||||
public void setVolume_id(String volume_id) {
|
||||
this.volume_id = volume_id;
|
||||
}
|
||||
}
|
@ -1,143 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.json.volume;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class VolumeDetailsObject {
|
||||
private List<VolumeAttachmentObject> attachments;
|
||||
private String availability_zone;
|
||||
private String bootable;
|
||||
private String created_at;
|
||||
private String display_description;
|
||||
private String display_name;
|
||||
private String id;
|
||||
//private String metadata;
|
||||
@SerializedName("os-vol-host-attr")
|
||||
private String os_vol_host_attr;
|
||||
@SerializedName("os-vol-tenant-attr")
|
||||
private String os_vol_tenant_attr;
|
||||
private float size;
|
||||
private String snapshot_id;
|
||||
private String source_volid;
|
||||
private String status;
|
||||
private String volume_type;
|
||||
|
||||
public List<VolumeAttachmentObject> getAttachments() {
|
||||
return attachments;
|
||||
}
|
||||
|
||||
public void setAttachments(List<VolumeAttachmentObject> attachments) {
|
||||
this.attachments = attachments;
|
||||
}
|
||||
|
||||
public String getAvailability_zone() {
|
||||
return availability_zone;
|
||||
}
|
||||
|
||||
public void setAvailability_zone(String availability_zone) {
|
||||
this.availability_zone = availability_zone;
|
||||
}
|
||||
|
||||
public String getBootable() {
|
||||
return bootable;
|
||||
}
|
||||
|
||||
public void setBootable(String bootable) {
|
||||
this.bootable = bootable;
|
||||
}
|
||||
|
||||
public String getCreated_at() {
|
||||
return created_at;
|
||||
}
|
||||
|
||||
public void setCreated_at(String created_at) {
|
||||
this.created_at = created_at;
|
||||
}
|
||||
|
||||
public String getDisplay_description() {
|
||||
return display_description;
|
||||
}
|
||||
|
||||
public void setDisplay_description(String display_description) {
|
||||
this.display_description = display_description;
|
||||
}
|
||||
|
||||
public String getDisplay_name() {
|
||||
return display_name;
|
||||
}
|
||||
|
||||
public void setDisplay_name(String display_name) {
|
||||
this.display_name = display_name;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
/* public String getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
public void setMetadata(String metadata) {
|
||||
this.metadata = metadata;
|
||||
}*/
|
||||
|
||||
public String getOs_vol_host_attr() {
|
||||
return os_vol_host_attr;
|
||||
}
|
||||
|
||||
public void setOs_vol_host_attr(String os_vol_host_attr) {
|
||||
this.os_vol_host_attr = os_vol_host_attr;
|
||||
}
|
||||
|
||||
public String getOs_vol_tenant_attr() {
|
||||
return os_vol_tenant_attr;
|
||||
}
|
||||
|
||||
public void setOs_vol_tenant_attr(String os_vol_tenant_attr) {
|
||||
this.os_vol_tenant_attr = os_vol_tenant_attr;
|
||||
}
|
||||
|
||||
public float getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(float size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getSnapshot_id() {
|
||||
return snapshot_id;
|
||||
}
|
||||
|
||||
public void setSnapshot_id(String snapshot_id) {
|
||||
this.snapshot_id = snapshot_id;
|
||||
}
|
||||
|
||||
public String getSource_volid() {
|
||||
return source_volid;
|
||||
}
|
||||
|
||||
public void setSource_volid(String source_volid) {
|
||||
this.source_volid = source_volid;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getVolume_type() {
|
||||
return volume_type;
|
||||
}
|
||||
|
||||
public void setVolume_type(String volume_type) {
|
||||
this.volume_type = volume_type;
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.model;
|
||||
|
||||
public class FlavorModel {
|
||||
private String id;
|
||||
private String name;
|
||||
private int vcpus;
|
||||
private int ram;
|
||||
private int rootDisk;
|
||||
private String swapDisk;
|
||||
|
||||
public FlavorModel(String id, String name, int vcpus, int ram,
|
||||
int rootDisk, String swapDisk) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.vcpus = vcpus;
|
||||
this.ram = ram;
|
||||
this.rootDisk = rootDisk;
|
||||
this.swapDisk = swapDisk;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getVcpus() {
|
||||
return vcpus;
|
||||
}
|
||||
|
||||
public void setVcpus(int vcpus) {
|
||||
this.vcpus = vcpus;
|
||||
}
|
||||
|
||||
public int getRam() {
|
||||
return ram;
|
||||
}
|
||||
|
||||
public void setRam(int ram) {
|
||||
this.ram = ram;
|
||||
}
|
||||
|
||||
public int getRootDisk() {
|
||||
return rootDisk;
|
||||
}
|
||||
|
||||
public void setRootDisk(int rootDisk) {
|
||||
this.rootDisk = rootDisk;
|
||||
}
|
||||
|
||||
public String getSwapDisk() {
|
||||
return swapDisk;
|
||||
}
|
||||
|
||||
public void setSwapDisk(String swapDisk) {
|
||||
this.swapDisk = swapDisk;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.model;
|
||||
|
||||
public class IPAddressModel {
|
||||
private String addr;
|
||||
private int version;
|
||||
|
||||
public IPAddressModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
public IPAddressModel(String addr, int version) {
|
||||
super();
|
||||
this.addr = addr;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getAddr() {
|
||||
return addr;
|
||||
}
|
||||
|
||||
public void setAddr(String addr) {
|
||||
this.addr = addr;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.model;
|
||||
|
||||
public class ImageModel {
|
||||
private String id;
|
||||
private String name;
|
||||
private String status;
|
||||
private String visibility;
|
||||
private String checksum;
|
||||
private String created_at;
|
||||
private String updated_at;
|
||||
private int size;
|
||||
private String container_format;
|
||||
private String disk_format;
|
||||
|
||||
public ImageModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ImageModel(String id, String name, String status, String visibility,
|
||||
String checksum, String created_at, String updated_at, int size,
|
||||
String container_format, String disk_format) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.status = status;
|
||||
this.visibility = visibility;
|
||||
this.checksum = checksum;
|
||||
this.created_at = created_at;
|
||||
this.updated_at = updated_at;
|
||||
this.size = size;
|
||||
this.container_format = container_format;
|
||||
this.disk_format = disk_format;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getVisibility() {
|
||||
return visibility;
|
||||
}
|
||||
|
||||
public void setVisibility(String visibility) {
|
||||
this.visibility = visibility;
|
||||
}
|
||||
|
||||
public String getChecksum() {
|
||||
return checksum;
|
||||
}
|
||||
|
||||
public void setChecksum(String checksum) {
|
||||
this.checksum = checksum;
|
||||
}
|
||||
|
||||
public String getContainer_format() {
|
||||
return container_format;
|
||||
}
|
||||
|
||||
public void setContainer_format(String container_format) {
|
||||
this.container_format = container_format;
|
||||
}
|
||||
|
||||
public String getCreated_at() {
|
||||
return created_at;
|
||||
}
|
||||
|
||||
public void setCreated_at(String created_at) {
|
||||
this.created_at = created_at;
|
||||
}
|
||||
|
||||
public String getUpdated_at() {
|
||||
return updated_at;
|
||||
}
|
||||
|
||||
public void setUpdated_at(String updated_at) {
|
||||
this.updated_at = updated_at;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDisk_format() {
|
||||
return disk_format;
|
||||
}
|
||||
|
||||
public void setDisk_format(String disk_format) {
|
||||
this.disk_format = disk_format;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ServerModel {
|
||||
private String id;
|
||||
private String name;
|
||||
private String status;
|
||||
private String created;
|
||||
private String updated;
|
||||
List<IPAddressModel> privateAddresses;
|
||||
List<IPAddressModel> publicAddresses;
|
||||
private String image;
|
||||
private String flavor;
|
||||
|
||||
public ServerModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ServerModel(String id, String name) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ServerModel(String id, String name, String status, String created, String updated,
|
||||
List<IPAddressModel> privateAddresses,
|
||||
List<IPAddressModel> publicAddresses,
|
||||
String image, String flavor) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.status = status;
|
||||
this.created = created;
|
||||
this.updated = updated;
|
||||
this.privateAddresses = privateAddresses;
|
||||
this.publicAddresses = publicAddresses;
|
||||
this.image = image;
|
||||
this.flavor = flavor;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(String created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public String getUpdated() {
|
||||
return updated;
|
||||
}
|
||||
|
||||
public void setUpdated(String updated) {
|
||||
this.updated = updated;
|
||||
}
|
||||
|
||||
public List<IPAddressModel> getPrivateAddresses() {
|
||||
return privateAddresses;
|
||||
}
|
||||
|
||||
public void setPrivateAddresses(List<IPAddressModel> privateAddresses) {
|
||||
this.privateAddresses = privateAddresses;
|
||||
}
|
||||
|
||||
public List<IPAddressModel> getPublicAddresses() {
|
||||
return publicAddresses;
|
||||
}
|
||||
|
||||
public void setPublicAddresses(List<IPAddressModel> publicAddresses) {
|
||||
this.publicAddresses = publicAddresses;
|
||||
}
|
||||
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public String getFlavor() {
|
||||
return flavor;
|
||||
}
|
||||
|
||||
public void setFlavor(String flavor) {
|
||||
this.flavor = flavor;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return (this.getId().equals(((ServerModel)o).getId()));
|
||||
}
|
||||
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.model;
|
||||
|
||||
public class TenantModel {
|
||||
private String id;
|
||||
private String name;
|
||||
private boolean enabled;
|
||||
private String description;
|
||||
|
||||
public TenantModel(String id, String name, boolean enabled,
|
||||
String description) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.enabled = enabled;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.model;
|
||||
|
||||
public class UserModel {
|
||||
private String id;
|
||||
private String name;
|
||||
private boolean enabled;
|
||||
private String email;
|
||||
private String tenantId;
|
||||
|
||||
public UserModel(String id, String name, boolean enabled, String email,
|
||||
String tenantId) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.enabled = enabled;
|
||||
this.email = email;
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
public String getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
public void setTenantId(String tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.model;
|
||||
|
||||
public class VolumeModel {
|
||||
private String id;
|
||||
private String name;
|
||||
private String description;
|
||||
private String status;
|
||||
private double size;
|
||||
private String created_at;
|
||||
private String attached_to;
|
||||
|
||||
public VolumeModel() {
|
||||
super();
|
||||
}
|
||||
|
||||
public VolumeModel(String id, String name, String description,
|
||||
String status, double size, String created_at, String attached_to) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.status = status;
|
||||
this.size = size;
|
||||
this.created_at = created_at;
|
||||
this.attached_to = attached_to;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public double getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(double size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getCreated_at() {
|
||||
return created_at;
|
||||
}
|
||||
|
||||
public void setCreated_at(String created_at) {
|
||||
this.created_at = created_at;
|
||||
}
|
||||
|
||||
public String getAttached_to() {
|
||||
return attached_to;
|
||||
}
|
||||
|
||||
public void setAttached_to(String attached_to) {
|
||||
this.attached_to = attached_to;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String res = null;
|
||||
|
||||
res = this.getName();
|
||||
|
||||
if (res == null)
|
||||
res = this.id;
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.operations;
|
||||
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public interface ApiOperation {
|
||||
|
||||
public HttpRequestBase invoke(Uri endpoint, String token, String tenantId, Bundle params);
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.operations.compute;
|
||||
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
|
||||
import com.rcarrillocruz.android.openstackdroid.operations.ApiOperation;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class GetFlavorsOperation implements ApiOperation {
|
||||
private static final String urlTail = "/flavors/detail";
|
||||
|
||||
public GetFlavorsOperation() {
|
||||
super();
|
||||
}
|
||||
|
||||
public HttpRequestBase invoke(Uri endpoint, String token, String tenantId,
|
||||
Bundle params) {
|
||||
HttpGet httpGet = new HttpGet(endpoint.toString() + urlTail);
|
||||
httpGet.setHeader("X-Auth-Token", token);
|
||||
|
||||
return httpGet;
|
||||
}
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.operations.compute;
|
||||
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
|
||||
import com.rcarrillocruz.android.openstackdroid.operations.ApiOperation;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class GetServersOperation implements ApiOperation {
|
||||
private static final String urlTail = "/servers/detail";
|
||||
|
||||
public GetServersOperation() {
|
||||
super();
|
||||
}
|
||||
|
||||
public HttpRequestBase invoke(Uri endpoint, String token, String tenantId,
|
||||
Bundle params) {
|
||||
HttpGet httpGet = new HttpGet(endpoint.toString()+urlTail);
|
||||
httpGet.setHeader("X-Auth-Token", token);
|
||||
|
||||
return httpGet;
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.operations.identity;
|
||||
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
|
||||
import com.rcarrillocruz.android.openstackdroid.operations.ApiOperation;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class GetTenantsOperation implements ApiOperation {
|
||||
|
||||
private static final String urlTail = "/tenants";
|
||||
|
||||
public GetTenantsOperation() {
|
||||
super();
|
||||
}
|
||||
|
||||
public HttpRequestBase invoke(Uri endpoint, String token, String tenantId,
|
||||
Bundle params) {
|
||||
HttpGet httpGet = new HttpGet(endpoint.toString()+urlTail);
|
||||
httpGet.setHeader("X-Auth-Token", token);
|
||||
|
||||
return httpGet;
|
||||
}
|
||||
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.operations.identity;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.AuthObject;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.GetTokenRequest;
|
||||
import com.rcarrillocruz.android.openstackdroid.json.identity.PasswordCredentialsObject;
|
||||
import com.rcarrillocruz.android.openstackdroid.operations.ApiOperation;
|
||||
|
||||
public class GetTokenOperation implements ApiOperation {
|
||||
private Gson gson;
|
||||
private static final String urlTail = "/v2.0/tokens";
|
||||
private static final String TAG = "com.rcarrillocruz.android.openstackdroid.operations.identity.GetTokenOperation";
|
||||
|
||||
public GetTokenOperation() {
|
||||
super();
|
||||
gson = new Gson();
|
||||
}
|
||||
|
||||
public HttpRequestBase invoke(Uri endpoint, String token, String tenantId,
|
||||
Bundle params) {
|
||||
HttpPost httpPost = new HttpPost(endpoint.toString()+urlTail);
|
||||
httpPost.setHeader("Content-type", "application/json");
|
||||
|
||||
String username = params.getString("username");
|
||||
String password = params.getString("password");
|
||||
|
||||
GetTokenRequest request = new GetTokenRequest(new AuthObject(new PasswordCredentialsObject(username, password), tenantId));
|
||||
|
||||
StringEntity se = null;
|
||||
try {
|
||||
se = new StringEntity(gson.toJson(request));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
Log.e(TAG,Log.getStackTraceString(e));
|
||||
}
|
||||
|
||||
httpPost.setEntity(se);
|
||||
|
||||
return httpPost;
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.operations.identity;
|
||||
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
|
||||
import com.rcarrillocruz.android.openstackdroid.operations.ApiOperation;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class GetUsersOperation implements ApiOperation {
|
||||
private static final String urlTail = "/users";
|
||||
|
||||
public GetUsersOperation() {
|
||||
super();
|
||||
}
|
||||
|
||||
public HttpRequestBase invoke(Uri endpoint, String token, String tenantId,
|
||||
Bundle params) {
|
||||
HttpGet httpGet = new HttpGet(endpoint.toString()+urlTail);
|
||||
httpGet.setHeader("X-Auth-Token", token);
|
||||
|
||||
return httpGet;
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.operations.image;
|
||||
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
|
||||
import com.rcarrillocruz.android.openstackdroid.operations.ApiOperation;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class GetImagesOperation implements ApiOperation {
|
||||
private static final String urlTail = "/v2/images";
|
||||
public HttpRequestBase invoke(Uri endpoint, String token, String tenantId,
|
||||
Bundle params) {
|
||||
HttpGet httpGet = new HttpGet(endpoint.toString()+urlTail);
|
||||
httpGet.setHeader("X-Auth-Token", token);
|
||||
|
||||
return httpGet;
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package com.rcarrillocruz.android.openstackdroid.operations.volume;
|
||||
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
|
||||
import com.rcarrillocruz.android.openstackdroid.operations.ApiOperation;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class GetVolumesOperation implements ApiOperation {
|
||||
|
||||
private static final String urlTail = "/volumes/detail";
|
||||
|
||||
public GetVolumesOperation() {
|
||||
super();
|
||||
}
|
||||
|
||||
public HttpRequestBase invoke(Uri endpoint, String token, String tenantId,
|
||||
Bundle params) {
|
||||
HttpGet httpGet = new HttpGet(endpoint.toString()+urlTail);
|
||||
httpGet.setHeader("X-Auth-Token", token);
|
||||
|
||||
return httpGet;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user