├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── libs
│ ├── jackson-annotations.jar
│ ├── jackson-core.jar
│ └── jackson-databind.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-web.png
│ ├── ic_launcher_xiandian-web.png
│ ├── ic_xiandian-web.png
│ ├── java
│ │ └── com
│ │ │ └── xiandian
│ │ │ └── openstack
│ │ │ └── cloud
│ │ │ └── swiftstorage
│ │ │ ├── AppState.java
│ │ │ ├── LoginActivity.java
│ │ │ ├── MainActivity.java
│ │ │ ├── RegisterActivity.java
│ │ │ ├── WelcomeActivity.java
│ │ │ ├── application
│ │ │ └── Tpapplication.java
│ │ │ ├── base
│ │ │ └── TaskResult.java
│ │ │ ├── fragment
│ │ │ ├── CategoryFragment.java
│ │ │ ├── GarbageFragment.java
│ │ │ ├── ImgFragment.java
│ │ │ ├── ImggridviewFragment.java
│ │ │ ├── ImglistviewFragment.java
│ │ │ ├── MainFragment.java
│ │ │ ├── MyFragmentPagerAdapter.java
│ │ │ ├── SFileData.java
│ │ │ ├── SFileEditable.java
│ │ │ ├── SFileEditableImpl.java
│ │ │ ├── SFileListViewAdapter.java
│ │ │ ├── VideoFragment.java
│ │ │ ├── VideogridviewFragment.java
│ │ │ └── VideolistviewFragment.java
│ │ │ ├── fs
│ │ │ ├── OSSFile.java
│ │ │ ├── OSSFileSystem.java
│ │ │ └── SFile.java
│ │ │ └── utils
│ │ │ ├── Constants.java
│ │ │ ├── DisplayUtils.java
│ │ │ ├── FileIconHelper.java
│ │ │ ├── FileUtils.java
│ │ │ ├── GraphicsUtil.java
│ │ │ ├── PromptDialogUtil.java
│ │ │ └── Sort_dialog.java
│ └── res
│ │ ├── drawable-v21
│ │ ├── ic_action_share.xml
│ │ ├── ic_file_doc.xml
│ │ ├── ic_file_folder.xml
│ │ ├── ic_file_music.xml
│ │ ├── ic_file_others.xml
│ │ ├── ic_file_pic.xml
│ │ ├── ic_file_video.xml
│ │ ├── ic_menu_camera.xml
│ │ ├── ic_menu_doc.xml
│ │ ├── ic_menu_gallery.xml
│ │ ├── ic_menu_manage.xml
│ │ ├── ic_menu_music.xml
│ │ ├── ic_menu_pic.xml
│ │ ├── ic_menu_recycle.xml
│ │ ├── ic_menu_send.xml
│ │ ├── ic_menu_setting.xml
│ │ ├── ic_menu_slideshow.xml
│ │ ├── ic_menu_swiftstorage.xml
│ │ ├── ic_menu_video.xml
│ │ └── side_nav_bar.xml
│ │ ├── drawable
│ │ ├── ic_action_copy.xml
│ │ ├── ic_action_create_dir.xml
│ │ ├── ic_action_details.xml
│ │ ├── ic_action_download.xml
│ │ ├── ic_action_empty.xml
│ │ ├── ic_action_grid_thumbnail.xml
│ │ ├── ic_action_license.xml
│ │ ├── ic_action_move.xml
│ │ ├── ic_action_open.xml
│ │ ├── ic_action_record_audio.xml
│ │ ├── ic_action_record_video.xml
│ │ ├── ic_action_recycle.xml
│ │ ├── ic_action_rename.xml
│ │ ├── ic_action_restore.xml
│ │ ├── ic_action_search.xml
│ │ ├── ic_action_select_all.xml
│ │ ├── ic_action_setting.xml
│ │ ├── ic_action_share.xml
│ │ ├── ic_action_sort.xml
│ │ ├── ic_action_sort_name.xml
│ │ ├── ic_action_sort_size.xml
│ │ ├── ic_action_sort_time.xml
│ │ ├── ic_action_take_photo.xml
│ │ ├── ic_action_unselect_all.xml
│ │ ├── ic_action_upload.xml
│ │ ├── ic_file_doc.xml
│ │ ├── ic_file_folder.xml
│ │ ├── ic_file_music.xml
│ │ ├── ic_file_others.xml
│ │ ├── ic_file_pic.xml
│ │ ├── ic_file_video.xml
│ │ ├── ic_menu_camera.xml
│ │ ├── ic_menu_doc.xml
│ │ ├── ic_menu_gallery.xml
│ │ ├── ic_menu_manage.xml
│ │ ├── ic_menu_music.xml
│ │ ├── ic_menu_pic.xml
│ │ ├── ic_menu_recycle.xml
│ │ ├── ic_menu_send.xml
│ │ ├── ic_menu_setting.xml
│ │ ├── ic_menu_slideshow.xml
│ │ ├── ic_menu_swiftstorage.xml
│ │ ├── ic_menu_video.xml
│ │ └── welcome.png
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_register.xml
│ │ ├── activity_sort_dialog.xml
│ │ ├── activity_welcome.xml
│ │ ├── app_bar_main.xml
│ │ ├── content_main.xml
│ │ ├── fragment_category.xml
│ │ ├── fragment_garbage.xml
│ │ ├── fragment_main.xml
│ │ ├── grad_item.xml
│ │ ├── img_video.xml
│ │ ├── img_videogridview.xml
│ │ ├── input_text_edit_dialog.xml
│ │ ├── login.xml
│ │ ├── login_option_setting.xml
│ │ ├── main_list_item.xml
│ │ └── nav_header_main.xml
│ │ ├── menu
│ │ ├── activity_main_drawer.xml
│ │ ├── login_option.xml
│ │ └── main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_xiandian.png
│ │ ├── mipmap-mdpi
│ │ └── ic_xiandian.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_xiandian.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_xiandian.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_xiandian.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── drawables.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── openstack-java-jdk
├── .gitignore
├── build.gradle
├── libs
│ ├── jackson-annotations.jar
│ ├── jackson-core.jar
│ └── jackson-databind.jar
└── src
│ └── main
│ └── java
│ ├── com
│ ├── woorea
│ │ └── openstack
│ │ │ ├── base
│ │ │ └── client
│ │ │ │ ├── Entity.java
│ │ │ │ ├── HttpMethod.java
│ │ │ │ ├── OpenStackClient.java
│ │ │ │ ├── OpenStackClientConnector.java
│ │ │ │ ├── OpenStackRequest.java
│ │ │ │ ├── OpenStackResponse.java
│ │ │ │ ├── OpenStackResponseException.java
│ │ │ │ ├── OpenStackResponseStatus.java
│ │ │ │ ├── OpenStackSimpleTokenProvider.java
│ │ │ │ └── OpenStackTokenProvider.java
│ │ │ ├── keystone
│ │ │ ├── Keystone.java
│ │ │ ├── api
│ │ │ │ ├── EndpointsResource.java
│ │ │ │ ├── RolesResource.java
│ │ │ │ ├── ServicesResource.java
│ │ │ │ ├── TenantsResource.java
│ │ │ │ ├── TokensResource.java
│ │ │ │ └── UsersResource.java
│ │ │ ├── model
│ │ │ │ ├── Access.java
│ │ │ │ ├── Authentication.java
│ │ │ │ ├── Endpoint.java
│ │ │ │ ├── Endpoints.java
│ │ │ │ ├── Error.java
│ │ │ │ ├── Extra.java
│ │ │ │ ├── Link.java
│ │ │ │ ├── Role.java
│ │ │ │ ├── Roles.java
│ │ │ │ ├── Service.java
│ │ │ │ ├── Services.java
│ │ │ │ ├── Tenant.java
│ │ │ │ ├── Tenants.java
│ │ │ │ ├── Token.java
│ │ │ │ ├── User.java
│ │ │ │ ├── Users.java
│ │ │ │ └── authentication
│ │ │ │ │ ├── AccessKey.java
│ │ │ │ │ ├── TokenAuthentication.java
│ │ │ │ │ └── UsernamePassword.java
│ │ │ ├── utils
│ │ │ │ ├── KeystoneTokenProvider.java
│ │ │ │ └── KeystoneUtils.java
│ │ │ └── v3
│ │ │ │ ├── Keystone.java
│ │ │ │ ├── api
│ │ │ │ ├── CredentialsResources.java
│ │ │ │ ├── DomainGroupRolesResource.java
│ │ │ │ ├── DomainUserRolesResource.java
│ │ │ │ ├── DomainsResource.java
│ │ │ │ ├── EndpointsResource.java
│ │ │ │ ├── GenericResource.java
│ │ │ │ ├── GroupUsersResource.java
│ │ │ │ ├── GroupsResource.java
│ │ │ │ ├── PoliciesResource.java
│ │ │ │ ├── ProjectGroupRolesResource.java
│ │ │ │ ├── ProjectRolesResource.java
│ │ │ │ ├── ProjectUserRolesResource.java
│ │ │ │ ├── ProjectsResource.java
│ │ │ │ ├── RolesResource.java
│ │ │ │ ├── ServicesResource.java
│ │ │ │ ├── TokensResource.java
│ │ │ │ └── UsersResource.java
│ │ │ │ └── model
│ │ │ │ ├── Authentication.java
│ │ │ │ ├── Credential.java
│ │ │ │ ├── Credentials.java
│ │ │ │ ├── Domain.java
│ │ │ │ ├── Domains.java
│ │ │ │ ├── Endpoint.java
│ │ │ │ ├── Endpoints.java
│ │ │ │ ├── Group.java
│ │ │ │ ├── Groups.java
│ │ │ │ ├── Policies.java
│ │ │ │ ├── Policy.java
│ │ │ │ ├── Project.java
│ │ │ │ ├── Projects.java
│ │ │ │ ├── Role.java
│ │ │ │ ├── Roles.java
│ │ │ │ ├── Service.java
│ │ │ │ ├── Services.java
│ │ │ │ ├── Token.java
│ │ │ │ ├── User.java
│ │ │ │ └── Users.java
│ │ │ └── swift
│ │ │ ├── Swift.java
│ │ │ ├── api
│ │ │ ├── AccountResource.java
│ │ │ ├── ContainerResource.java
│ │ │ └── ContainersResource.java
│ │ │ ├── deserializer
│ │ │ ├── ContainersDeserializer.java
│ │ │ └── ObjectsDeserializer.java
│ │ │ └── model
│ │ │ ├── Account.java
│ │ │ ├── Container.java
│ │ │ ├── Containers.java
│ │ │ ├── Object.java
│ │ │ ├── ObjectDownload.java
│ │ │ ├── ObjectForUpload.java
│ │ │ └── Objects.java
│ └── xiandian
│ │ └── openstack
│ │ └── cloud
│ │ └── swiftstorage
│ │ └── sdk
│ │ ├── connector
│ │ ├── AndroidOpenStackClientConnector.java
│ │ └── AndroidOpenStackResponse.java
│ │ ├── service
│ │ └── OpenStackClientService.java
│ │ └── test
│ │ └── OpenStackSDKTest.java
│ └── org
│ └── apache
│ └── http
│ └── util
│ ├── Consts.java
│ └── EncodingUtils.java
├── projectFilesBackup
└── .idea
│ └── workspace.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | CloudStorage_android
2 | ===================================
3 | 一个云计算比赛用的app开发项目
4 | 大概是第一次用安卓做开发项目
5 | 所以还有很懂地方不会的说
6 | 所以麻烦各位大佬加以指导了qwq
7 |
8 | 设计架构
9 | -----------------------------------
10 | 系统功能是基于 OpenStack Swif实现的
11 |
12 | 1、 Swift 云存储云端服务:能够连接 OpenStack Swift 云存储,需要在 Android 端引入
13 | SDK,同样使用上面的 SDK(openstack-java-sdk_v1.1.jar)。目前 SDK 是成熟的工
14 | 程,直接引入即可。实现的原理基于 HTTP 协议连接云存储 Swift Restful 服务。同
15 | 样使用封装的 OpenStackClientService 进行异步网络操作。
16 |
17 | 2、 登录:还原和登录各定义一个 Activity。Swift 账户管理使用 Keystone 完成,这里需
18 | 要 Keystone 的访问 SDK,openstack-java-sdk 提供了对 OpenStack 各服务访问的接
19 | 口,可以直接使用。
20 |
21 | 3、 文件系统:目前 SDK 提供了对 Swift 云存储的操作,云存储不是一种文件系统(File
22 | System),为了实现文件,基于 Swift 的 SDK 接口,封装模拟文件操作的类文件系
23 | 统,命名为 OssFilesystem。
24 |
25 | 4、 主界面:使用一个 Activity 来完成主界面,导航通过 NavigationView 控件实现、文
26 | 件列表通过 Fragment 来实现。不同的分类操作不同,我们使用不同的 Fragment 实
27 | 现,降低程序的复杂性。
28 |
29 | 5、 所有文档:实现展示所有文件类别,采用 Fragment。
30 |
31 | 6、 分类:实现文档、图片、视频分类的文件列表,采用 Fragment
32 |
33 | 7、 回收站:实现回收站的文件列表,采用 Fragment。
34 |
35 | 8、 文件上传:上传本地文件,实现一个本地存储文件导航选择窗口 Activity,完成文
36 | 件选择和上传
39 | 了提供性能,对当前操作文件路径进行缓存,跟踪状态信息。
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.3"
6 |
7 | defaultConfig {
8 | applicationId "com.xiandian.openstack.cloud.swiftstorage"
9 | minSdkVersion 13
10 | targetSdkVersion 22
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | compile project(':openstack-java-jdk')
25 | compile files('libs/jackson-annotations.jar')
26 | compile files('libs/jackson-core.jar')
27 | compile files('libs/jackson-databind.jar')
28 | compile 'com.android.support:appcompat-v7:23.0.0'
29 | compile 'com.android.support:design:23.0.0'
30 | compile 'com.android.support:support-v4:23.0.0'
31 | }
32 |
--------------------------------------------------------------------------------
/app/libs/jackson-annotations.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/libs/jackson-annotations.jar
--------------------------------------------------------------------------------
/app/libs/jackson-core.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/libs/jackson-core.jar
--------------------------------------------------------------------------------
/app/libs/jackson-databind.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/libs/jackson-databind.jar
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\soongxueyong\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | import android.app.Application;
2 | import android.test.ApplicationTestCase;
3 |
4 | /**
5 | * Testing Fundamentals
6 | */
7 | public class ApplicationTest extends ApplicationTestCase {
8 | public ApplicationTest() {
9 | super(Application.class);
10 | }
11 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
23 |
27 |
32 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/ic_launcher_xiandian-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/src/main/ic_launcher_xiandian-web.png
--------------------------------------------------------------------------------
/app/src/main/ic_xiandian-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/src/main/ic_xiandian-web.png
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/WelcomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.xiandian.openstack.cloud.swiftstorage;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.view.animation.AlphaAnimation;
9 | import android.view.animation.Animation;
10 |
11 | /**
12 | * 欢迎视图。展示一个图片。
13 | */
14 | public class WelcomeActivity extends Activity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_welcome);
20 |
21 | //渐变展示启动屏
22 | AlphaAnimation alphaAnimation = new AlphaAnimation(0.5f,1.0f);
23 | alphaAnimation.setDuration(1000);
24 | getRootView().startAnimation(alphaAnimation);
25 | alphaAnimation.setAnimationListener(new Animation.AnimationListener()
26 | {
27 | @Override
28 | public void onAnimationEnd(Animation arg0) {
29 | startActivity(new Intent(WelcomeActivity.this,
30 | LoginActivity.class));
31 | finish();
32 | }
33 | @Override
34 | public void onAnimationRepeat(Animation animation) {}
35 | @Override
36 | public void onAnimationStart(Animation animation) {}
37 |
38 | });
39 |
40 | }
41 |
42 | private View getRootView()
43 | {
44 | return ((ViewGroup)findViewById(android.R.id.content)).getChildAt(0);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/application/Tpapplication.java:
--------------------------------------------------------------------------------
1 | package com.xiandian.openstack.cloud.swiftstorage.application;
2 |
3 | import android.app.Application;
4 | import android.content.res.Configuration;
5 |
6 | import java.util.LinkedList;
7 | import java.util.List;
8 |
9 | /**
10 | * Created by 62566 on 2016/9/13.
11 | */
12 | public class Tpapplication extends Application {
13 | private String globalVar;
14 | private Application instance;
15 | private List activities;
16 |
17 | /**
18 | * 在创建应用程序时调用,可以重写这个方法来实例化应用程序单态,以及创建和实例化任何应用
19 | * 程序状态变量或共享资源
20 | */
21 | @Override
22 | public void onCreate() {
23 | super.onCreate();
24 | activities = new LinkedList();
25 |
26 | }
27 | /**
28 | * 作为onLowMemory的一个特定于应用程序的替代选择,在android4.0时引入,
29 | * 在程序运行时决定当前应用程序应该尝试减少其内存开销时(通常在它进入后台时)调用
30 | * 它包含一个level参数,用于提供请求的上下文
31 | */
32 | @Override
33 | public void onTrimMemory(int level) {
34 | super.onTrimMemory(level);
35 | }
36 |
37 | /**
38 | * 与Activity不同,在配置改变时,应用程序对象不会被终止和重启。
39 | * 如果应用程序使用的值依赖于特定的配置,则重写这个方法来重新加载这些值,或者在应用程序级别处理这些值的改变
40 | */
41 | @Override
42 | public void onConfigurationChanged(Configuration newConfig) {
43 | super.onConfigurationChanged(newConfig);
44 | }
45 |
46 | /**
47 | * 当系统处于资源匮乏时,具有良好行为的应用程序可以释放额外的内存。
48 | * 这个方法一般只会在后台进程已经终止,但是前台应用程序仍然缺少内存时调用。
49 | * 我们可以重写这个程序来清空缓存或者释放不必要的资源
50 | */
51 | @Override
52 | public void onLowMemory() {
53 | super.onLowMemory();
54 | }
55 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/base/TaskResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2015, XIANDIAN and/or its affiliates. All rights reserved.
3 | * XIANDIAN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4 | *
5 | */
6 | package com.xiandian.openstack.cloud.swiftstorage.base;
7 |
8 | /**
9 | * 异步任务执行结果封装。包括正常结果或异常。
10 | *
11 | * @author 云计算应用与开发项目组
12 | * @since V1.0
13 | */
14 | public class TaskResult {
15 |
16 | /** 异常. */
17 | private Exception exception;
18 |
19 | /** 数据类型. */
20 | private T result;
21 |
22 | /**
23 | * 创建任务结果。
24 | *
25 | * @param result
26 | * the result
27 | */
28 | public TaskResult(final T result) {
29 | this.result = result;
30 | }
31 |
32 | /**
33 | * 创建任务结果。
34 | *
35 | * @param result
36 | * the result
37 | */
38 | public TaskResult(final Exception exception) {
39 | this.exception = exception;
40 | }
41 |
42 | /**
43 | * 是否有异常。
44 | *
45 | * @return true, 正常。
46 | */
47 | public final boolean isValid() {
48 | return exception == null;
49 | }
50 |
51 | /**
52 | *获得异常。
53 | *
54 | * @return the exception
55 | */
56 | public final Exception getException() {
57 | return exception;
58 | }
59 |
60 | /**
61 | * Gets the result.
62 | *
63 | * @return the result
64 | */
65 | public final T getResult() {
66 | return result;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/fragment/MyFragmentPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.xiandian.openstack.cloud.swiftstorage.fragment;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentPagerAdapter;
6 |
7 | import java.util.ArrayList;
8 |
9 |
10 | public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
11 | private ArrayList fragmentsList;
12 |
13 | public MyFragmentPagerAdapter(FragmentManager fm) {
14 | super(fm);
15 | }
16 |
17 | public MyFragmentPagerAdapter(FragmentManager fm, ArrayList fragments) {
18 | super(fm);
19 | this.fragmentsList = fragments;
20 | }
21 |
22 | @Override
23 | public int getCount() {
24 | return fragmentsList.size();
25 | }
26 |
27 | @Override
28 | public Fragment getItem(int arg0) {
29 | return fragmentsList.get(arg0);
30 | }
31 |
32 | @Override
33 | public int getItemPosition(Object object) {
34 | return super.getItemPosition(object);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/fragment/SFileEditable.java:
--------------------------------------------------------------------------------
1 | package com.xiandian.openstack.cloud.swiftstorage.fragment;
2 |
3 | import android.app.AlertDialog;
4 | import android.content.DialogInterface;
5 | import android.widget.EditText;
6 | import android.widget.Toast;
7 |
8 | import com.xiandian.openstack.cloud.swiftstorage.fs.SFile;
9 | import com.xiandian.openstack.cloud.swiftstorage.sdk.service.OpenStackClientService;
10 |
11 | import static com.xiandian.openstack.cloud.swiftstorage.R.id.start;
12 |
13 | /**
14 | * 操作实现,具体由各Fragment来实现。
15 | * 默认MainFragment有个通用实现,各个部分,有自己的实现方式。
16 | *
17 | * @author 云计算应用与开发项目组
18 | * @since V1.0
19 | */
20 | public interface SFileEditable {
21 |
22 | /**
23 | * 根据给定内容,搜索文件。
24 | * @param fileName 支持通配符的字串
25 | */
26 | public void search(String fileName);
27 |
28 | /////////////////////获取跟文件系统,并填充listView的任务/////////////////////>
29 |
30 | /**
31 | * 分享
32 | */
33 | void share();
34 |
35 | /**
36 | * 全选
37 | */
38 | public void selectAll();
39 |
40 | /**
41 | * 取消全选
42 | */
43 | public void unselectAll();
44 |
45 | /**
46 | * 打开一个文件。
47 | * @param filePath
48 | */
49 | public void openFile(SFile filePath);
50 |
51 |
52 |
53 |
54 |
55 | /**
56 | * 创建一个目录。
57 | * @param filePath
58 | */
59 |
60 | public void createDir(String filePath);
61 |
62 | /**
63 | * 上传文件,回调给当前Activity。
64 | */
65 | public void upload();
66 |
67 | /**
68 | * 下载本地,保存在自己存储空间中。
69 | */
70 | public void download();
71 |
72 | /**
73 | * 拍照,并回传到Activity。
74 | */
75 | public void takePhoto();
76 |
77 | /**
78 | * 拍视频,并回传到Activity
79 | */
80 | void recordvideo();
81 |
82 | /**
83 | * 录音,并回传到Activity
84 | */
85 | void recordaudio();
86 |
87 | /**
88 | * 改名。
89 | * @param oldFilePath
90 | * @param newFilePath
91 | */
92 |
93 | public void rename(String oldFilePath, String newFilePath);
94 |
95 | /**
96 | * 复制文件到另外一个路径。
97 | * @param fromPath
98 | * @param toPath
99 | */
100 | public void copy(String fromPath, String toPath);
101 |
102 | /**
103 | * 移动一个文件,从一个路径去另外一个路径。
104 | * @param fromPath
105 | * @param toPath
106 | */
107 | public void move(String fromPath, String toPath);
108 |
109 | /**
110 | * 删除文件到回收站。
111 | * @param filePath
112 | */
113 | public void recycle(String filePath);
114 |
115 | /**
116 | * 对文件进行排序。
117 | * @param type
118 | * @param ascend
119 | */
120 | public void sort();
121 |
122 |
123 | /**
124 | * 详细信息。
125 | * @param type
126 | * @param ascend
127 | */
128 | public void details(int type, boolean ascend);
129 |
130 | /**
131 | * 刷新当前视口。
132 | */
133 | public void refresh();
134 |
135 |
136 | void restroe();
137 |
138 | void empty();
139 | }
140 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/fragment/SFileEditableImpl.java:
--------------------------------------------------------------------------------
1 | package com.xiandian.openstack.cloud.swiftstorage.fragment;
2 |
3 | import com.xiandian.openstack.cloud.swiftstorage.fs.SFile;
4 |
5 | /**
6 | * 默认的实现。实际上是Fragement编辑交集。
7 | *
8 | * @author 云计算应用与开发项目组
9 | * @since V1.0
10 | */
11 | public class SFileEditableImpl implements SFileEditable {
12 | @Override
13 | public void search(String fileName) {
14 |
15 | }
16 |
17 | @Override
18 | public void share() {
19 |
20 | }
21 |
22 | @Override
23 | public void selectAll() {
24 |
25 | }
26 |
27 | @Override
28 | public void unselectAll() {
29 |
30 | }
31 |
32 | @Override
33 | public void openFile(SFile filePath) {
34 |
35 | }
36 |
37 | @Override
38 | public void createDir(String filePath) {
39 |
40 | }
41 |
42 | @Override
43 | public void upload() {
44 |
45 | }
46 |
47 | @Override
48 | public void download() {
49 |
50 | }
51 |
52 | @Override
53 | public void takePhoto() {
54 |
55 | }
56 |
57 | @Override
58 | public void recordvideo() {
59 |
60 | }
61 |
62 | @Override
63 | public void recordaudio() {
64 |
65 | }
66 |
67 | @Override
68 | public void rename(String oldFilePath, String newFilePath) {
69 |
70 | }
71 |
72 | @Override
73 | public void copy(String fromPath, String toPath) {
74 |
75 | }
76 |
77 | @Override
78 | public void move(String fromPath, String toPath) {
79 |
80 | }
81 |
82 | @Override
83 | public void recycle(String filePath) {
84 |
85 | }
86 |
87 | @Override
88 | public void sort() {
89 |
90 | }
91 |
92 | @Override
93 | public void details(int type, boolean ascend) {
94 |
95 | }
96 |
97 | @Override
98 | public void refresh()
99 | {
100 |
101 | }
102 |
103 | @Override
104 | public void restroe() {
105 |
106 | }
107 |
108 | @Override
109 | public void empty() {
110 |
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/fs/SFile.java:
--------------------------------------------------------------------------------
1 | package com.xiandian.openstack.cloud.swiftstorage.fs;
2 |
3 |
4 | import com.woorea.openstack.swift.model.Object;
5 |
6 | import java.util.Calendar;
7 | import java.util.Collection;
8 |
9 | /**
10 | * 模拟文件系统的File Java接口定义。
11 | *
12 | * @author 云计算应用与开发项目组
13 | * @since V1.0
14 | */
15 | public interface SFile{
16 |
17 | /**
18 | * 获取当前节点下的目录。
19 | * @return
20 | */
21 | public Collection listDirectories() ;
22 |
23 |
24 | /**
25 | * 获取当前节点下的文件。
26 | * @return
27 | */
28 | public Collection listFiles();
29 |
30 |
31 | /**
32 | * 增加文件。
33 | * @param name
34 | * @param obj
35 | */
36 | public void putFile(String name, SFile obj);
37 |
38 |
39 | /**
40 | * 增加目录。
41 | * @param name
42 | * @param obj
43 | */
44 | public void putDirectory(String name, SFile obj);
45 |
46 |
47 | /**
48 | * 获取当前文件或目录对应的云存储对象。
49 | * @return
50 | */
51 | public Object getSwiftObject() ;
52 |
53 |
54 | /**
55 | *设置当前文件或目录对应的云存储对象。
56 | * @param metaData
57 | */
58 | public void setSwiftObject(Object metaData);
59 |
60 |
61 | /**
62 | * 是否有云存储对象数据?
63 | * @return
64 | */
65 | public boolean hasData();
66 |
67 |
68 | /**
69 | * 获得名称(包含路径)。
70 | * @return
71 | */
72 | public String getName();
73 |
74 |
75 | /**
76 | * 获得最后修改时间。
77 | *
78 | * @return
79 | */
80 | public Calendar getLastModified();
81 |
82 |
83 | /**
84 | * 获得父节点。
85 | * @return
86 | */
87 | public SFile getParent() ;
88 |
89 |
90 | /**
91 | *
92 | * @param parent
93 | * @return
94 | */
95 | public void setParent(SFile parent) ;
96 |
97 |
98 | /**
99 | * 获得根节点。
100 | *
101 | * @return
102 | */
103 | public SFile getRoot();
104 |
105 |
106 | /**
107 | * 调试信息。
108 | * @param ident
109 | * @return
110 | */
111 | public String toString(String ident);
112 |
113 |
114 | /**
115 | * 内容类型。(http contenttype)
116 | * @return
117 | */
118 | public String getContentType();
119 |
120 |
121 | /**
122 | * 长度,自生的长度,目录为0,文件有自己大小。
123 | * @return
124 | */
125 | public int getSize();
126 |
127 | /**
128 | * 判断是文件还是文件夹。
129 | */
130 | public boolean isFile();
131 |
132 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/utils/Constants.java:
--------------------------------------------------------------------------------
1 | package com.xiandian.openstack.cloud.swiftstorage.utils;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 | import java.io.OutputStream;
6 |
7 | /**
8 | * 模拟文件系统的File Java接口定义。
9 | *
10 | * @author 云计算应用与开发项目组
11 | * @since V1.0
12 | */
13 | public class Constants {
14 |
15 | //类型Key
16 | public static final String CATEGORY_TYPE = "Category_Type";
17 | /**
18 | * 常用的文档类型格式。通常"text/"开头。再加Office文档、pdf文档。
19 | */
20 | public static final String[] MIME_DOC = {
21 | "text/",
22 | "application/pdf", //"pdf"
23 | "application/msword",//doc
24 | "application/vnd.openxmlformats-officedocument.wordprocessingml.document",// "docx
25 | "application/vnd.openxmlformats-officedocument.wordprocessingml.template",// "dotx
26 | "application/vnd.ms-excel",//xls
27 | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",// "xlsx
28 | "application/vnd.openxmlformats-officedocument.spreadsheetml.template",// "xltx
29 | "application/vnd.ms-powerpoint",//ppt
30 | "application/vnd.openxmlformats-officedocument.presentationml.presentation",// "pptx"
31 | "application/vnd.openxmlformats-officedocument.presentationml.template",// "potx"
32 | "application/xhtml+xml"//xhtml
33 | };
34 |
35 | /**
36 | * 常用的图片类型格式,通常"image/"开头。
37 | */
38 | public static final String[] MIME_IMAGE = {
39 | "image/"
40 | };
41 |
42 | /**
43 | * 常用的视频类型格式,通常以"image/"开头。
44 | */
45 | public static final String[] MIME_VIDEO = {
46 | "video/"
47 | };
48 |
49 | /**
50 | * 常用的音频类型格式,通常以"audio/"开头。
51 | */
52 | public static final String[] MIME_AUDIO = {
53 | "audio/"
54 | };
55 |
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/utils/FileIconHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2015, XIANDIAN and/or its affiliates. All rights reserved.
3 | * XIANDIAN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4 | *
5 | */
6 | package com.xiandian.openstack.cloud.swiftstorage.utils;
7 |
8 | import android.content.Context;
9 | import android.graphics.Bitmap;
10 | import android.graphics.BitmapFactory;
11 | import android.media.ThumbnailUtils;
12 |
13 | public class FileIconHelper {
14 | //图片工具类
15 | private Context mContext;
16 | private static final int MICRO_KIND = 3;
17 |
18 | public FileIconHelper(Context _context){
19 | this.mContext=_context;
20 | }
21 |
22 | public Bitmap getImageThumbnail(String path) {
23 | // 图片缩略图
24 | Bitmap bitmap = null;
25 | BitmapFactory.Options options = new BitmapFactory.Options();
26 | options.inPreferredConfig = Bitmap.Config.ARGB_4444;
27 | options.inPurgeable = true;
28 | options.inInputShareable = true;
29 | options.inJustDecodeBounds = true;
30 | bitmap = BitmapFactory.decodeFile(path, options);
31 | options.inJustDecodeBounds = false; // 设为 false
32 | // 计算缩放比
33 | int h = options.outHeight;
34 | int w = options.outWidth;
35 | int beWidth = w / 32;
36 | int beHeight = h / 32;
37 | int be = 1;
38 | if (beWidth < beHeight) {
39 | be = beWidth;
40 | } else {
41 | be = beHeight;
42 | }
43 | if (be <= 0) {
44 | be = 1;
45 | }
46 | options.inSampleSize = be;
47 | try {
48 | bitmap=BitmapFactory.decodeFile(path,options);
49 | bitmap=ThumbnailUtils.extractThumbnail(
50 | bitmap, 32, 32, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
51 | } catch (OutOfMemoryError e) {
52 | // TODO Auto-generated catch block
53 | e.printStackTrace();
54 | }
55 | return bitmap;
56 | }
57 |
58 | public Bitmap getVideoThumbnail(String path) {
59 | Bitmap bitmap=null;
60 | try {
61 | bitmap=ThumbnailUtils.createVideoThumbnail(path,MICRO_KIND);
62 | bitmap = ThumbnailUtils.extractThumbnail(
63 | bitmap, 32, 32, ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
64 | } catch (OutOfMemoryError e) {
65 | // TODO Auto-generated catch block
66 | e.printStackTrace();
67 | }
68 | return bitmap;
69 | }
70 |
71 | public void destoryBimap(Bitmap mBitmap) {
72 | // TODO Auto-generated method stub
73 | if (mBitmap != null && !mBitmap.isRecycled()) {
74 | mBitmap.recycle();
75 | mBitmap = null;
76 | }
77 | }
78 |
79 |
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/utils/PromptDialogUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2014, 2015, XIANDIAN and/or its affiliates. All rights reserved.
3 | * XIANDIAN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4 | *
5 | */
6 | package com.xiandian.openstack.cloud.swiftstorage.utils;
7 |
8 | import android.app.AlertDialog;
9 | import android.content.Context;
10 | import android.content.DialogInterface;
11 | import android.content.Intent;
12 | import android.widget.Toast;
13 |
14 | /**
15 | * 错误输出帮助类
16 | * @author 云计算应用与开发项目组
17 | * @since V1.0
18 | */
19 | public class PromptDialogUtil {
20 |
21 | /**
22 | * Show error dialog.
23 | *
24 | * @param context
25 | * the context
26 | * @param title
27 | * the title
28 | * @param e
29 | * the e
30 | * @param onOK
31 | * the on ok
32 | */
33 | public static void showErrorDialog(final Context context, String title,
34 | Exception e, final Intent onOK) {
35 | showDialog(context, title, e.getMessage() != null ? e.getMessage() : e
36 | .getClass().getName(), onOK);
37 | }
38 |
39 | /**
40 | * Show error dialog.
41 | *
42 | * @param context
43 | * the context
44 | * @param ressource
45 | * the ressource
46 | * @param e
47 | * the e
48 | * @param onOK
49 | * the on ok
50 | */
51 | public static void showErrorDialog(final Context context, int ressource,
52 | Exception e, final Intent onOK) {
53 | e.printStackTrace();
54 | Toast.makeText(context, "错误: " + e.getLocalizedMessage(),
55 | Toast.LENGTH_LONG).show();
56 | }
57 |
58 | /**
59 | * Show dialog.
60 | *
61 | * @param context
62 | * the context
63 | * @param title
64 | * the title
65 | * @param message
66 | * the message
67 | * @param onOK
68 | * the on ok
69 | */
70 | public static void showDialog(final Context context, String title,
71 | String message, final Intent onOK) {
72 | AlertDialog alertDialog = new AlertDialog.Builder(context).create();
73 | alertDialog.setTitle(title);
74 | alertDialog.setMessage(message);
75 | if (onOK != null) {
76 | alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "OK",
77 | new DialogInterface.OnClickListener() {
78 | public void onClick(DialogInterface dialog, int which) {
79 | context.startActivity(onOK);
80 | return;
81 | }
82 | });
83 | }
84 | alertDialog.show();
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/app/src/main/java/com/xiandian/openstack/cloud/swiftstorage/utils/Sort_dialog.java:
--------------------------------------------------------------------------------
1 | package com.xiandian.openstack.cloud.swiftstorage.utils;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.os.Bundle;
6 |
7 | import com.xiandian.openstack.cloud.swiftstorage.R;
8 |
9 | public class Sort_dialog extends Dialog{
10 | Context context;
11 | public Sort_dialog(Context context) {
12 | super(context);
13 | this.context=context;
14 | }
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | // TODO Auto-generated method stub
18 | super.onCreate(savedInstanceState);
19 | this.setContentView(R.layout.activity_sort_dialog);
20 | }
21 | protected Sort_dialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
22 | super(context, cancelable, cancelListener);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_action_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_file_doc.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_file_folder.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_file_music.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_file_others.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_file_pic.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_file_video.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_doc.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_music.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_pic.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_recycle.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_setting.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_swiftstorage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/ic_menu_video.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_copy.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_create_dir.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_details.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_download.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_empty.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_grid_thumbnail.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_license.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_move.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_open.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_record_audio.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_record_video.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_recycle.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_rename.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_restore.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_search.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_select_all.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_setting.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_sort.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_sort_name.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_sort_size.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_sort_time.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_take_photo.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_unselect_all.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_action_upload.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_file_doc.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_file_folder.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_file_music.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_file_others.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_file_pic.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_file_video.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_doc.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_gallery.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_music.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_pic.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_recycle.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_send.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_setting.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_slideshow.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_swiftstorage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_video.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/welcome.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/src/main/res/drawable/welcome.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_register.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
16 |
17 |
25 |
26 |
27 |
31 |
32 |
40 |
41 |
45 |
46 |
54 |
55 |
60 |
61 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_sort_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
17 |
26 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_welcome.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_category.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_garbage.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
11 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_main.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
14 |
15 |
19 |
20 |
24 |
25 |
26 |
27 |
30 |
40 |
41 |
47 |
48 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/grad_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/img_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
18 |
19 |
28 |
29 |
37 |
38 |
39 |
46 |
47 |
48 |
49 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/img_videogridview.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
12 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/input_text_edit_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
16 |
17 |
23 |
24 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/login.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
27 |
28 |
36 |
37 |
38 |
42 |
43 |
51 |
52 |
53 |
58 |
59 |
65 |
73 |
74 |
75 |
80 |
81 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/login_option_setting.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
16 |
17 |
23 |
24 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
21 |
22 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/login_option.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_xiandian.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/src/main/res/mipmap-hdpi/ic_xiandian.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_xiandian.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/src/main/res/mipmap-mdpi/ic_xiandian.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_xiandian.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/src/main/res/mipmap-xhdpi/ic_xiandian.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_xiandian.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/src/main/res/mipmap-xxhdpi/ic_xiandian.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_xiandian.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/app/src/main/res/mipmap-xxxhdpi/ic_xiandian.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #303030
7 | #8A8A8A
8 | #66000000
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 160dp
5 |
6 | 16dp
7 | 16dp
8 | 16dp
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
27 |
28 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/test/java/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | import org.junit.Test;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | /**
6 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
7 | */
8 | public class ExampleUnitTest {
9 | @Test
10 | public void addition_isCorrect() throws Exception {
11 | assertEquals(4, 2 + 2);
12 | }
13 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.1.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 | allprojects {
25 | repositories {
26 | jcenter()
27 | }
28 | tasks.withType(JavaCompile) {
29 | sourceCompatibility = 1.7
30 | targetCompatibility = 1.7
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx1024m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Mon Apr 03 23:13:07 CST 2017
16 | systemProp.http.proxyHost=127.0.0.1
17 | systemProp.http.proxyPort=1080
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/openstack-java-jdk/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/openstack-java-jdk/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 |
3 | dependencies {
4 | compile fileTree(dir: 'libs', include: ['*.jar'])
5 | compile files('libs/jackson-annotations.jar')
6 | compile files('libs/jackson-core.jar')
7 | compile files('libs/jackson-databind.jar')
8 | }
9 |
10 | [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
--------------------------------------------------------------------------------
/openstack-java-jdk/libs/jackson-annotations.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/openstack-java-jdk/libs/jackson-annotations.jar
--------------------------------------------------------------------------------
/openstack-java-jdk/libs/jackson-core.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/openstack-java-jdk/libs/jackson-core.jar
--------------------------------------------------------------------------------
/openstack-java-jdk/libs/jackson-databind.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kuriaki-Nanami/CloudStorage_android/24585a5660d5148f6b8910c3d8204fca0b879191/openstack-java-jdk/libs/jackson-databind.jar
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/base/client/Entity.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.base.client;
2 |
3 |
4 |
5 | public class Entity {
6 |
7 | private T entity;
8 |
9 | private String contentType;
10 |
11 | public static Entity json(T entity) {
12 | return new Entity(entity, "application/json");
13 | }
14 |
15 | public static Entity stream(T entity) {
16 | return new Entity(entity, "application/octet-stream");
17 | }
18 |
19 | public Entity(T entity, String contentType) {
20 | super();
21 | this.entity = entity;
22 | this.contentType = contentType;
23 | }
24 |
25 | /**
26 | * @return the entity
27 | */
28 | public T getEntity() {
29 | return entity;
30 | }
31 |
32 | /**
33 | * @param entity the entity to set
34 | */
35 | public void setEntity(T entity) {
36 | this.entity = entity;
37 | }
38 |
39 | /**
40 | * @return the contentType
41 | */
42 | public String getContentType() {
43 | return contentType;
44 | }
45 |
46 | /**
47 | * @param contentType the contentType to set
48 | */
49 | public void setContentType(String contentType) {
50 | this.contentType = contentType;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/base/client/HttpMethod.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.base.client;
2 |
3 | public enum HttpMethod {
4 | HEAD, GET, POST, PUT, PATCH, DELETE, OPTIONS, TRACE
5 | }
6 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.base.client;
2 |
3 | import java.util.Properties;
4 | import java.util.ServiceLoader;
5 |
6 | public class OpenStackClient {
7 |
8 | protected String endpoint;
9 |
10 | protected OpenStackTokenProvider tokenProvider;
11 |
12 | protected static int AUTHENTICATION_RETRIES = 1;
13 |
14 | protected OpenStackClientConnector connector;
15 |
16 | protected Properties properties = new Properties();
17 |
18 | protected static OpenStackClientConnector DEFAULT_CONNECTOR;
19 |
20 | static {
21 | ServiceLoader connectorLoader;
22 | connectorLoader = ServiceLoader.load(OpenStackClientConnector.class);
23 |
24 | for (OpenStackClientConnector clientConnector : connectorLoader) {
25 | DEFAULT_CONNECTOR = clientConnector;
26 | break;
27 | }
28 | }
29 |
30 | public OpenStackClient(String endpoint) {
31 | this.endpoint = endpoint;
32 | this.connector = DEFAULT_CONNECTOR;
33 | }
34 |
35 | public OpenStackClient(String endpoint, OpenStackClientConnector connector) {
36 | this.endpoint = endpoint;
37 | this.connector = (connector == null) ? DEFAULT_CONNECTOR : connector;
38 | }
39 |
40 | public OpenStackResponse request(OpenStackRequest request) {
41 | OpenStackResponseException authException = null;
42 |
43 | for (int i = 0; i <= AUTHENTICATION_RETRIES; i++) {
44 | request.endpoint(endpoint);
45 |
46 | if (tokenProvider != null) {
47 | request.header("X-Auth-Token", tokenProvider.getToken());
48 | }
49 |
50 | try {
51 | return connector.request(request);
52 | } catch (OpenStackResponseException e) {
53 | if (e.getStatus() != OpenStackResponseStatus.NOT_AUTHORIZED
54 | || tokenProvider == null) {
55 | throw e;
56 | }
57 | authException = e;
58 | tokenProvider.expireToken();
59 | e.printStackTrace();//bu shizheli
60 | }
61 | }
62 |
63 | throw authException;
64 | }
65 |
66 | public T execute(OpenStackRequest request) {
67 | OpenStackResponse response = request(request);
68 | return (request.returnType() != null && request.returnType() != Void.class) ? response.getEntity(request.returnType()) : null;
69 | }
70 |
71 | public void property(String property, String value) {
72 | properties.put(property, value);
73 | }
74 |
75 | public void setTokenProvider(OpenStackTokenProvider tokenProvider) {
76 | this.tokenProvider = tokenProvider;
77 | }
78 |
79 | public void token(String token) {
80 | setTokenProvider(new OpenStackSimpleTokenProvider(token));
81 | }
82 |
83 | public OpenStackRequest get(String path, Class returnType) {
84 | return new OpenStackRequest(this, HttpMethod.GET, path, null, returnType);
85 | }
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/base/client/OpenStackClientConnector.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.base.client;
2 |
3 |
4 | public interface OpenStackClientConnector {
5 |
6 | public OpenStackResponse request(OpenStackRequest request);
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/base/client/OpenStackResponse.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.base.client;
2 |
3 | import java.io.InputStream;
4 | import java.util.Map;
5 |
6 | public interface OpenStackResponse {
7 |
8 | public T getEntity(Class returnType);
9 |
10 | public InputStream getInputStream();
11 |
12 | public String header(String name);
13 |
14 | public Map headers();
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/base/client/OpenStackResponseException.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.base.client;
2 |
3 | public class OpenStackResponseException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = 7294957362769575271L;
6 |
7 | protected String message;
8 |
9 | protected int status;
10 |
11 | public OpenStackResponseException(String message, int status) {
12 | this.message = message;
13 | this.status = status;
14 | }
15 |
16 | public String getMessage() {
17 | return message;
18 | }
19 |
20 | public int getStatus() {
21 | return status;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/base/client/OpenStackResponseStatus.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.base.client;
2 |
3 | public class OpenStackResponseStatus {
4 |
5 | public static final int OK = 200;
6 |
7 | public static final int NOT_AUTHORIZED = 401;
8 |
9 | public static final int CONFLICT = 409;
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/base/client/OpenStackSimpleTokenProvider.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.base.client;
2 |
3 | public class OpenStackSimpleTokenProvider implements OpenStackTokenProvider {
4 |
5 | String token;
6 |
7 | public OpenStackSimpleTokenProvider(String token) {
8 | this.token = token;
9 | }
10 |
11 | @Override
12 | public String getToken() {
13 | return this.token;
14 | }
15 |
16 | @Override
17 | public void expireToken() {
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/base/client/OpenStackTokenProvider.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.base.client;
2 |
3 | public interface OpenStackTokenProvider {
4 |
5 | String getToken();
6 |
7 | void expireToken();
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/Keystone.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.base.client.OpenStackClientConnector;
5 | import com.woorea.openstack.keystone.api.EndpointsResource;
6 | import com.woorea.openstack.keystone.api.RolesResource;
7 | import com.woorea.openstack.keystone.api.ServicesResource;
8 | import com.woorea.openstack.keystone.api.TenantsResource;
9 | import com.woorea.openstack.keystone.api.TokensResource;
10 | import com.woorea.openstack.keystone.api.UsersResource;
11 |
12 | public class Keystone extends OpenStackClient {
13 |
14 | private final TokensResource TOKENS;
15 |
16 | private final TenantsResource TENANTS;
17 |
18 | private final UsersResource USERS;
19 |
20 | private final RolesResource ROLES;
21 |
22 | private final ServicesResource SERVICES;
23 |
24 | private final EndpointsResource ENDPOINTS;
25 |
26 | public Keystone(String endpoint, OpenStackClientConnector connector) {
27 | super(endpoint, connector);
28 | TOKENS = new TokensResource(this);
29 | TENANTS = new TenantsResource(this);
30 | USERS = new UsersResource(this);
31 | ROLES = new RolesResource(this);
32 | SERVICES = new ServicesResource(this);
33 | ENDPOINTS = new EndpointsResource(this);
34 | }
35 |
36 | public Keystone(String endpoint) {
37 | this(endpoint, null);
38 | }
39 |
40 | public TokensResource tokens() {
41 | return TOKENS;
42 | }
43 |
44 | public TenantsResource tenants() {
45 | return TENANTS;
46 | }
47 |
48 | public UsersResource users() {
49 | return USERS;
50 | }
51 |
52 | public RolesResource roles() {
53 | return ROLES;
54 | }
55 |
56 | public ServicesResource services() {
57 | return SERVICES;
58 | }
59 |
60 | public EndpointsResource endpoints() {
61 | return ENDPOINTS;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/api/EndpointsResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.api;
2 |
3 |
4 | import com.woorea.openstack.base.client.Entity;
5 | import com.woorea.openstack.base.client.HttpMethod;
6 | import com.woorea.openstack.base.client.OpenStackClient;
7 | import com.woorea.openstack.base.client.OpenStackRequest;
8 | import com.woorea.openstack.keystone.model.Endpoint;
9 | import com.woorea.openstack.keystone.model.Endpoints;
10 |
11 | public class EndpointsResource {
12 |
13 | private OpenStackClient client;
14 |
15 | public EndpointsResource(OpenStackClient client) {
16 | this.client = client;
17 | }
18 |
19 | public List list() {
20 | return new List();
21 | }
22 |
23 | public Create create(Endpoint endpoint) {
24 | return new Create(endpoint);
25 | }
26 |
27 | public Show show(String id) {
28 | return new Show(id);
29 | }
30 |
31 |
32 | public Delete delete(String id) {
33 | return new Delete(id);
34 | }
35 |
36 | public class List extends OpenStackRequest {
37 |
38 | public List() {
39 | super(client, HttpMethod.GET, "/endpoints", null, Endpoints.class);
40 | }
41 |
42 | }
43 |
44 | public class Create extends OpenStackRequest {
45 |
46 | private Endpoint endpoint;
47 |
48 | public Create(Endpoint endpoint) {
49 | super(client, HttpMethod.POST, "/endpoints", Entity.json(endpoint), Endpoint.class);
50 | this.endpoint = endpoint;
51 | }
52 |
53 | }
54 |
55 | public class Show extends OpenStackRequest {
56 |
57 | public Show(String id) {
58 | super(client, HttpMethod.GET, new StringBuilder("/endpoints/").append(id).toString(), null, Endpoint.class);
59 | }
60 |
61 | }
62 |
63 | public class Delete extends OpenStackRequest {
64 |
65 | public Delete(String id) {
66 | super(client, HttpMethod.DELETE, new StringBuilder("/endpoints/").append(id).toString(), null, Void.class);
67 | }
68 |
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/api/RolesResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.api;
2 |
3 |
4 | import com.woorea.openstack.base.client.Entity;
5 | import com.woorea.openstack.base.client.HttpMethod;
6 | import com.woorea.openstack.base.client.OpenStackClient;
7 | import com.woorea.openstack.base.client.OpenStackRequest;
8 | import com.woorea.openstack.keystone.model.Role;
9 | import com.woorea.openstack.keystone.model.Roles;
10 |
11 | public class RolesResource {
12 |
13 | private OpenStackClient client;
14 |
15 | public RolesResource(OpenStackClient client) {
16 | this.client = client;
17 | }
18 |
19 | public List list() {
20 | return new List();
21 | }
22 |
23 | public Create create(Role role) {
24 | return new Create(role);
25 | }
26 |
27 | public Delete delete(String id) {
28 | return new Delete(id);
29 | }
30 |
31 | public class List extends OpenStackRequest {
32 |
33 | public List() {
34 | super(client, HttpMethod.GET, "/OS-KSADM/roles", null, Roles.class);
35 | }
36 |
37 | }
38 |
39 | public class Create extends OpenStackRequest {
40 |
41 | private Role role;
42 |
43 | public Create(Role role) {
44 | super(client, HttpMethod.POST, "/OS-KSADM/roles", Entity.json(role), Role.class);
45 | this.role = role;
46 | }
47 |
48 | }
49 |
50 | public class Delete extends OpenStackRequest {
51 |
52 | public Delete(String id) {
53 | super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/roles/").append(id).toString(), null, Void.class);
54 | }
55 |
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/api/ServicesResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.api;
2 |
3 |
4 | import com.woorea.openstack.base.client.Entity;
5 | import com.woorea.openstack.base.client.HttpMethod;
6 | import com.woorea.openstack.base.client.OpenStackClient;
7 | import com.woorea.openstack.base.client.OpenStackRequest;
8 | import com.woorea.openstack.keystone.model.Service;
9 | import com.woorea.openstack.keystone.model.Services;
10 |
11 | public class ServicesResource {
12 |
13 | private OpenStackClient client;
14 |
15 | public ServicesResource(OpenStackClient client) {
16 | this.client = client;
17 | }
18 |
19 | public List list() {
20 | return new List();
21 | }
22 |
23 | public Create create(Service service) {
24 | return new Create(service);
25 | }
26 |
27 | public Show show(String id) {
28 | return new Show(id);
29 | }
30 |
31 | public Delete delete(String id) {
32 | return new Delete(id);
33 | }
34 |
35 | public class List extends OpenStackRequest {
36 |
37 | public List() {
38 | super(client, HttpMethod.GET, "/OS-KSADM/services", null, Services.class);
39 | }
40 |
41 | }
42 |
43 | public class Create extends OpenStackRequest {
44 |
45 | private Service service;
46 |
47 | public Create(Service service) {
48 | super(client, HttpMethod.POST, "/OS-KSADM/services", Entity.json(service), Service.class);
49 | this.service = service;
50 | }
51 |
52 | }
53 |
54 | public class Show extends OpenStackRequest {
55 |
56 | public Show(String id) {
57 | super(client, HttpMethod.GET, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Service.class);
58 | }
59 |
60 | }
61 |
62 | public class Delete extends OpenStackRequest {
63 |
64 | public Delete(String id) {
65 | super(client, HttpMethod.DELETE, new StringBuilder("/OS-KSADM/services/").append(id).toString(), null, Void.class);
66 | }
67 |
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/api/TokensResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.api;
2 |
3 |
4 | import com.woorea.openstack.base.client.Entity;
5 | import com.woorea.openstack.base.client.HttpMethod;
6 | import com.woorea.openstack.base.client.OpenStackClient;
7 | import com.woorea.openstack.base.client.OpenStackRequest;
8 | import com.woorea.openstack.keystone.model.Access;
9 | import com.woorea.openstack.keystone.model.Authentication;
10 | import com.woorea.openstack.keystone.model.authentication.AccessKey;
11 | import com.woorea.openstack.keystone.model.authentication.TokenAuthentication;
12 | import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
13 |
14 | public class TokensResource {
15 |
16 | private final OpenStackClient CLIENT;
17 |
18 | public TokensResource(OpenStackClient client) {
19 | CLIENT = client;
20 | }
21 |
22 | public Authenticate.Builder authenticate() {
23 | return new Authenticate().new Builder();
24 | }
25 |
26 | public Authenticate authenticate(Authentication authentication) {
27 | return new Authenticate(authentication);
28 | }
29 |
30 | public class Authenticate extends OpenStackRequest {
31 |
32 | private Authentication authentication;
33 |
34 | public Authenticate() {
35 |
36 | }
37 |
38 | public Authenticate(Authentication authentication) {
39 | super(CLIENT, HttpMethod.POST, "/tokens", Entity.json(authentication), Access.class);
40 | this.authentication = authentication;
41 | }
42 |
43 | public Authenticate withTenantId(String tenantId) {
44 | authentication.setTenantId(tenantId);
45 | return this;
46 | }
47 |
48 | public Authenticate withTenantName(String tenantName) {
49 | authentication.setTenantName(tenantName);
50 | return this;
51 | }
52 |
53 | public class Builder {
54 |
55 | public Authenticate withUsernamePassword(String username, String password) {
56 | Authentication authentication = new UsernamePassword(username, password);
57 | return new Authenticate(authentication);
58 | }
59 |
60 | public Authenticate withToken(String token) {
61 | Authentication authentication = new TokenAuthentication(token);
62 | return new Authenticate(authentication);
63 | }
64 |
65 | public Authenticate withAccessKey(String accessKey, String secretKey) {
66 | Authentication authentication = new AccessKey(accessKey, secretKey);
67 | return new Authenticate(authentication);
68 | }
69 |
70 | }
71 |
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/api/UsersResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.api;
2 |
3 | import java.io.UnsupportedEncodingException;
4 | import java.net.URLEncoder;
5 |
6 | import com.woorea.openstack.base.client.Entity;
7 | import com.woorea.openstack.base.client.HttpMethod;
8 | import com.woorea.openstack.base.client.OpenStackClient;
9 | import com.woorea.openstack.base.client.OpenStackRequest;
10 | import com.woorea.openstack.keystone.model.User;
11 | import com.woorea.openstack.keystone.model.Users;
12 |
13 |
14 |
15 | public class UsersResource {
16 | private OpenStackClient client;
17 |
18 | public UsersResource(OpenStackClient client) {
19 | this.client = client;
20 | }
21 |
22 | public List list() {
23 | return new List();
24 | }
25 |
26 | public Create create(User user) {
27 | return new Create(user);
28 | }
29 |
30 | public Show show(String id) {
31 | return new Show(id);
32 | }
33 |
34 | public Find find(String username) {
35 | return new Find(username);
36 | }
37 |
38 | public Update update(String id, User user) {
39 | return new Update(id, user);
40 | }
41 |
42 | public Delete delete(String id) {
43 | return new Delete(id);
44 | }
45 |
46 | public class List extends OpenStackRequest {
47 | public List() {
48 | super(client, HttpMethod.GET, "/users", null, Users.class);
49 | }
50 | }
51 |
52 | public class Create extends OpenStackRequest {
53 | public Create(User user) {
54 | super(client, HttpMethod.POST, "/users/", Entity.json(user),
55 | User.class);
56 | }
57 | }
58 | public class Show extends OpenStackRequest {
59 | public Show(String id) {
60 | super(client, HttpMethod.GET,
61 | new StringBuilder("/users/").append(id).toString(), null,
62 | User.class);
63 | }
64 | }
65 |
66 | public class Find extends OpenStackRequest {
67 | public Find(String username) {
68 | super(client, HttpMethod.GET, new StringBuilder("/users/"), null,
69 | User.class);
70 |
71 | try {
72 | this.queryParam("name", URLEncoder.encode(username, "UTF-8"));
73 | } catch (UnsupportedEncodingException e) {
74 | //ignore
75 | }
76 | }
77 | }
78 |
79 | public class Update extends OpenStackRequest {
80 | private User user;
81 |
82 | public Update(String id, User user) {
83 | super(client, HttpMethod.PUT,
84 | new StringBuilder("/users/").append(id).toString(),
85 | Entity.json(user), User.class);
86 | this.user = user;
87 | }
88 | }
89 |
90 | public class Delete extends OpenStackRequest {
91 | public Delete(String id) {
92 | super(client, HttpMethod.DELETE,
93 | new StringBuilder("/users/").append(id).toString(), null,
94 | Void.class);
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Authentication.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 |
5 | public abstract class Authentication implements Serializable {
6 |
7 | private String tenantId;
8 |
9 | private String tenantName;
10 |
11 | /**
12 | * @return the tenantId
13 | */
14 | public String getTenantId() {
15 | return tenantId;
16 | }
17 |
18 | /**
19 | * @param tenantId the tenantId to set
20 | */
21 | public void setTenantId(String tenantId) {
22 | this.tenantId = tenantId;
23 | }
24 |
25 | /**
26 | * @return the tenantName
27 | */
28 | public String getTenantName() {
29 | return tenantName;
30 | }
31 |
32 | /**
33 | * @param tenantName the tenantName to set
34 | */
35 | public void setTenantName(String tenantName) {
36 | this.tenantName = tenantName;
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Endpoint.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 |
5 | import com.fasterxml.jackson.annotation.JsonProperty;
6 | import com.fasterxml.jackson.annotation.JsonRootName;
7 |
8 | @JsonRootName("endpoint")
9 | public class Endpoint implements Serializable {
10 |
11 | private String id;
12 |
13 | @JsonProperty("service_id")
14 | private String serviceId;
15 |
16 | private String region;
17 |
18 | @JsonProperty("publicurl")
19 | private String publicURL;
20 |
21 | @JsonProperty("internalurl")
22 | private String internalURL;
23 |
24 | @JsonProperty("adminurl")
25 | private String adminURL;
26 |
27 | /**
28 | * @return the id
29 | */
30 | public String getId() {
31 | return id;
32 | }
33 |
34 | /**
35 | * @param id the id to set
36 | */
37 | public void setId(String id) {
38 | this.id = id;
39 | }
40 |
41 | /**
42 | * @return the serviceId
43 | */
44 | public String getServiceId() {
45 | return serviceId;
46 | }
47 |
48 | /**
49 | * @param serviceId the serviceId to set
50 | */
51 | public void setServiceId(String serviceId) {
52 | this.serviceId = serviceId;
53 | }
54 |
55 | /**
56 | * @return the region
57 | */
58 | public String getRegion() {
59 | return region;
60 | }
61 |
62 | /**
63 | * @param region the region to set
64 | */
65 | public void setRegion(String region) {
66 | this.region = region;
67 | }
68 |
69 | /**
70 | * @return the publicURL
71 | */
72 | public String getPublicURL() {
73 | return publicURL;
74 | }
75 |
76 | /**
77 | * @param publicURL the publicURL to set
78 | */
79 | public void setPublicURL(String publicURL) {
80 | this.publicURL = publicURL;
81 | }
82 |
83 | /**
84 | * @return the internalURL
85 | */
86 | public String getInternalURL() {
87 | return internalURL;
88 | }
89 |
90 | /**
91 | * @param internalURL the internalURL to set
92 | */
93 | public void setInternalURL(String internalURL) {
94 | this.internalURL = internalURL;
95 | }
96 |
97 | /**
98 | * @return the adminURL
99 | */
100 | public String getAdminURL() {
101 | return adminURL;
102 | }
103 |
104 | /**
105 | * @param adminURL the adminURL to set
106 | */
107 | public void setAdminURL(String adminURL) {
108 | this.adminURL = adminURL;
109 | }
110 |
111 | /* (non-Javadoc)
112 | * @see java.lang.Object#toString()
113 | */
114 | @Override
115 | public String toString() {
116 | return "Endpoint [id=" + id + ", serviceId=" + serviceId + ", region="
117 | + region + ", publicURL=" + publicURL + ", internalURL="
118 | + internalURL + ", adminURL=" + adminURL + "]";
119 | }
120 |
121 | }
122 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Endpoints.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Endpoints implements Iterable, Serializable {
10 |
11 | @JsonProperty("endpoints")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Endpoints [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Error.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 |
5 | import com.fasterxml.jackson.annotation.JsonRootName;
6 |
7 | @JsonRootName("error")
8 | public class Error implements Serializable {
9 |
10 | private Integer code;
11 |
12 | private String title;
13 |
14 | private String message;
15 |
16 | /**
17 | * @return the code
18 | */
19 | public Integer getCode() {
20 | return code;
21 | }
22 |
23 | /**
24 | * @return the title
25 | */
26 | public String getTitle() {
27 | return title;
28 | }
29 |
30 | /**
31 | * @return the message
32 | */
33 | public String getMessage() {
34 | return message;
35 | }
36 |
37 | /* (non-Javadoc)
38 | * @see java.lang.Object#toString()
39 | */
40 | @Override
41 | public String toString() {
42 | return "Error [code=" + code + ", title=" + title + ", message="
43 | + message + "]";
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Extra.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 |
7 | import com.fasterxml.jackson.annotation.JsonAnyGetter;
8 | import com.fasterxml.jackson.annotation.JsonAnySetter;
9 |
10 | public class Extra implements Serializable {
11 |
12 | Map map = new HashMap();
13 |
14 | @JsonAnyGetter
15 | public Map any() {
16 | return map;
17 | }
18 |
19 | @JsonAnySetter
20 | public void set(String name, String value) {
21 | map.put(name, value);
22 | }
23 |
24 | public String toString() {
25 | return "extra=" + map.toString();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Link.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 |
5 | public class Link implements Serializable {
6 |
7 | private String rel;
8 |
9 | private String href;
10 |
11 | private String type;
12 |
13 | /**
14 | * @return the rel
15 | */
16 | public String getRel() {
17 | return rel;
18 | }
19 |
20 | /**
21 | * @return the href
22 | */
23 | public String getHref() {
24 | return href;
25 | }
26 |
27 | /**
28 | * @return the type
29 | */
30 | public String getType() {
31 | return type;
32 | }
33 |
34 | /* (non-Javadoc)
35 | * @see java.lang.Object#toString()
36 | */
37 | @Override
38 | public String toString() {
39 | return "Link [rel=" + rel + ", href=" + href + ", type=" + type + "]";
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Role.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 |
5 | import com.fasterxml.jackson.annotation.JsonRootName;
6 |
7 | @JsonRootName("role")
8 | public class Role implements Serializable {
9 |
10 | private String id;
11 |
12 | private String name;
13 |
14 | private String description;
15 |
16 | private String enabled;
17 |
18 | /**
19 | * @return the id
20 | */
21 | public String getId() {
22 | return id;
23 | }
24 |
25 | /**
26 | * @return the name
27 | */
28 | public String getName() {
29 | return name;
30 | }
31 |
32 | /**
33 | * @param name the name to set
34 | */
35 | public void setName(String name) {
36 | this.name = name;
37 | }
38 |
39 | /**
40 | * @return the description
41 | */
42 | public String getDescription() {
43 | return description;
44 | }
45 |
46 | /**
47 | * @param description the description to set
48 | */
49 | public void setDescription(String description) {
50 | this.description = description;
51 | }
52 |
53 | /**
54 | * @return the enabled
55 | */
56 | public String getEnabled() {
57 | return enabled;
58 | }
59 |
60 | /**
61 | * @param enabled the enabled to set
62 | */
63 | public void setEnabled(String enabled) {
64 | this.enabled = enabled;
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Roles.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Roles implements Iterable, Serializable {
10 |
11 | @JsonProperty("roles")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Roles [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Service.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 |
5 | import com.fasterxml.jackson.annotation.JsonRootName;
6 |
7 | @JsonRootName("OS-KSADM:service")
8 | public class Service implements Serializable {
9 |
10 | private String id;
11 |
12 | private String type;
13 |
14 | private String name;
15 |
16 | private String description;
17 |
18 | /**
19 | * @return the id
20 | */
21 | public String getId() {
22 | return id;
23 | }
24 |
25 | /**
26 | * @return the type
27 | */
28 | public String getType() {
29 | return type;
30 | }
31 |
32 | /**
33 | * @param type the type to set
34 | */
35 | public void setType(String type) {
36 | this.type = type;
37 | }
38 |
39 | /**
40 | * @return the name
41 | */
42 | public String getName() {
43 | return name;
44 | }
45 |
46 | /**
47 | * @param name the name to set
48 | */
49 | public void setName(String name) {
50 | this.name = name;
51 | }
52 |
53 | /**
54 | * @return the description
55 | */
56 | public String getDescription() {
57 | return description;
58 | }
59 |
60 | /**
61 | * @param description the description to set
62 | */
63 | public void setDescription(String description) {
64 | this.description = description;
65 | }
66 |
67 | /* (non-Javadoc)
68 | * @see java.lang.Object#toString()
69 | */
70 | @Override
71 | public String toString() {
72 | return "Service [id=" + id + ", type=" + type + ", name=" + name
73 | + ", description=" + description + "]";
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Services.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Services implements Iterable, Serializable {
10 |
11 | @JsonProperty("OS-KSADM:services")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Services [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Tenant.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 |
5 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
6 | import com.fasterxml.jackson.annotation.JsonRootName;
7 |
8 | @JsonRootName("tenant")
9 | @JsonIgnoreProperties(ignoreUnknown=true)
10 | public class Tenant implements Serializable {
11 |
12 | private String id;
13 |
14 | private String name;
15 |
16 | private String description;
17 |
18 | private Boolean enabled;
19 |
20 | public Tenant(String name, String description, Boolean enabled) {
21 | this.name = name;
22 | this.description = description;
23 | this.enabled = enabled;
24 | }
25 |
26 | public Tenant(String name, String description) {
27 | this(name, description, Boolean.TRUE);
28 | }
29 |
30 | public Tenant(String name) {
31 | this(name, null);
32 | }
33 |
34 | public Tenant() {
35 | }
36 |
37 | /**
38 | * @return the id
39 | */
40 | public String getId() {
41 | return id;
42 | }
43 |
44 | /**
45 | * @param id the id to set
46 | */
47 | public void setId(String id) {
48 | this.id = id;
49 | }
50 |
51 | /**
52 | * @return the name
53 | */
54 | public String getName() {
55 | return name;
56 | }
57 |
58 | /**
59 | * @param name the name to set
60 | */
61 | public void setName(String name) {
62 | this.name = name;
63 | }
64 |
65 | /**
66 | * @return the description
67 | */
68 | public String getDescription() {
69 | return description;
70 | }
71 |
72 | /**
73 | * @param description the description to set
74 | */
75 | public void setDescription(String description) {
76 | this.description = description;
77 | }
78 |
79 | /**
80 | * @return the enabled
81 | */
82 | public Boolean getEnabled() {
83 | return enabled;
84 | }
85 |
86 | /**
87 | * @param enabled the enabled to set
88 | */
89 | public void setEnabled(Boolean enabled) {
90 | this.enabled = enabled;
91 | }
92 |
93 | /* (non-Javadoc)
94 | * @see java.lang.Object#toString()
95 | */
96 | @Override
97 | public String toString() {
98 | return "Tenant [id=" + id + ", name=" + name + ", description="
99 | + description + ", enabled=" + enabled + "]";
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Tenants.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Tenants implements Iterable, Serializable {
10 |
11 | @JsonProperty("tenants")
12 | private List list;
13 |
14 | @JsonProperty("tenants_links")
15 | private List links;
16 |
17 | /**
18 | * @return the list
19 | */
20 | public List getList() {
21 | return list;
22 | }
23 |
24 | /**
25 | * @return the links
26 | */
27 | public List getLinks() {
28 | return links;
29 | }
30 |
31 | /* (non-Javadoc)
32 | * @see java.lang.Object#toString()
33 | */
34 | @Override
35 | public String toString() {
36 | return "Tenants [list=" + list + ", links=" + links + "]";
37 | }
38 |
39 | @Override
40 | public Iterator iterator() {
41 | return list.iterator();
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Token.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.util.Calendar;
4 |
5 | public final class Token {
6 |
7 | private String id;
8 |
9 | private Calendar issued_at;
10 |
11 | private Calendar expires;
12 |
13 | private Tenant tenant;
14 |
15 | /**
16 | * @return the id
17 | */
18 | public String getId() {
19 | return id;
20 | }
21 |
22 | /**
23 | * @return the issued_at
24 | */
25 | public Calendar getIssued_at() {
26 | return issued_at;
27 | }
28 |
29 | /**
30 | * @return the expires
31 | */
32 | public Calendar getExpires() {
33 | return expires;
34 | }
35 |
36 | /**
37 | * @return the tenant
38 | */
39 | public Tenant getTenant() {
40 | return tenant;
41 | }
42 |
43 | /* (non-Javadoc)
44 | * @see java.lang.Object#toString()
45 | */
46 | @Override
47 | public String toString() {
48 | return "Token [id=" + id + ", Issued_at=" + issued_at + ", expires=" + expires + ", tenant="
49 | + tenant + "]";
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/Users.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Users implements Iterable, Serializable {
10 |
11 | @JsonProperty("users")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Users [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/authentication/AccessKey.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model.authentication;
2 |
3 | import com.fasterxml.jackson.annotation.JsonRootName;
4 | import com.woorea.openstack.keystone.model.Authentication;
5 |
6 | @JsonRootName("auth")
7 | public class AccessKey extends Authentication {
8 |
9 | public static final class ApiAccessKeyCredentials {
10 |
11 | private String accessKey;
12 |
13 | private String secretKey;
14 |
15 | /**
16 | * @return the accessKey
17 | */
18 | public String getAccessKey() {
19 | return accessKey;
20 | }
21 |
22 | /**
23 | * @param accessKey the accessKey to set
24 | */
25 | public void setAccessKey(String accessKey) {
26 | this.accessKey = accessKey;
27 | }
28 |
29 | /**
30 | * @return the secretKey
31 | */
32 | public String getSecretKey() {
33 | return secretKey;
34 | }
35 |
36 | /**
37 | * @param secretKey the secretKey to set
38 | */
39 | public void setSecretKey(String secretKey) {
40 | this.secretKey = secretKey;
41 | }
42 |
43 | }
44 |
45 | private ApiAccessKeyCredentials apiAccessKeyCredentials = new ApiAccessKeyCredentials();
46 |
47 | public AccessKey() {
48 |
49 | }
50 |
51 | public AccessKey(String accessKey, String secretKey) {
52 | apiAccessKeyCredentials.setAccessKey(accessKey);
53 | apiAccessKeyCredentials.setSecretKey(secretKey);
54 | }
55 |
56 | /**
57 | * @return the apiAccessKeyCredentials
58 | */
59 | public ApiAccessKeyCredentials getApiAccessKeyCredentials() {
60 | return apiAccessKeyCredentials;
61 | }
62 |
63 | /**
64 | * @param apiAccessKeyCredentials the apiAccessKeyCredentials to set
65 | */
66 | public void setApiAccessKeyCredentials(
67 | ApiAccessKeyCredentials apiAccessKeyCredentials) {
68 | this.apiAccessKeyCredentials = apiAccessKeyCredentials;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/authentication/TokenAuthentication.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model.authentication;
2 |
3 | import com.fasterxml.jackson.annotation.JsonRootName;
4 | import com.woorea.openstack.keystone.model.Authentication;
5 |
6 | @JsonRootName("auth")
7 | public class TokenAuthentication extends Authentication {
8 |
9 | public static final class Token {
10 |
11 | private String id;
12 |
13 | /**
14 | * @return the id
15 | */
16 | public String getId() {
17 | return id;
18 | }
19 |
20 | /**
21 | * @param id the id to set
22 | */
23 | public void setId(String id) {
24 | this.id = id;
25 | }
26 |
27 | }
28 |
29 | private Token token = new Token();
30 |
31 | public TokenAuthentication(String token) {
32 | this.token.id = token;
33 | }
34 |
35 | /**
36 | * @return the token
37 | */
38 | public Token getToken() {
39 | return token;
40 | }
41 |
42 | /**
43 | * @param token the token to set
44 | */
45 | public void setToken(Token token) {
46 | this.token = token;
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/model/authentication/UsernamePassword.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.model.authentication;
2 |
3 | import com.fasterxml.jackson.annotation.JsonRootName;
4 | import com.woorea.openstack.keystone.model.Authentication;
5 |
6 | @JsonRootName("auth")
7 | public class UsernamePassword extends Authentication {
8 |
9 | public static final class PasswordCredentials {
10 |
11 | private String username;
12 |
13 | private String password;
14 |
15 | /**
16 | * @return the username
17 | */
18 | public String getUsername() {
19 | return username;
20 | }
21 |
22 | /**
23 | * @param username the username to set
24 | */
25 | public void setUsername(String username) {
26 | this.username = username;
27 | }
28 |
29 | /**
30 | * @return the password
31 | */
32 | public String getPassword() {
33 | return password;
34 | }
35 |
36 | /**
37 | * @param password the password to set
38 | */
39 | public void setPassword(String password) {
40 | this.password = password;
41 | }
42 |
43 | }
44 |
45 | private PasswordCredentials passwordCredentials = new PasswordCredentials();
46 |
47 | public UsernamePassword() {
48 |
49 | }
50 |
51 | public UsernamePassword(String username, String password) {
52 | passwordCredentials.setUsername(username);
53 | passwordCredentials.setPassword(password);
54 | }
55 |
56 | /**
57 | * @return the passwordCredentials
58 | */
59 | public PasswordCredentials getPasswordCredentials() {
60 | return passwordCredentials;
61 | }
62 |
63 | /**
64 | * @param passwordCredentials the passwordCredentials to set
65 | */
66 | public void setPasswordCredentials(PasswordCredentials passwordCredentials) {
67 | this.passwordCredentials = passwordCredentials;
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/utils/KeystoneTokenProvider.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.utils;
2 |
3 | import java.util.concurrent.ConcurrentHashMap;
4 |
5 | import com.woorea.openstack.base.client.OpenStackTokenProvider;
6 | import com.woorea.openstack.keystone.Keystone;
7 | import com.woorea.openstack.keystone.model.Access;
8 | import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
9 |
10 | public class KeystoneTokenProvider {
11 |
12 | protected Keystone keystone;
13 |
14 | protected String username;
15 |
16 | protected String password;
17 |
18 | ConcurrentHashMap hashTenantAccess;
19 |
20 | public KeystoneTokenProvider(String endpoint, String username, String password) {
21 | this.keystone = new Keystone(endpoint);
22 | this.username = username;
23 | this.password = password;
24 | this.hashTenantAccess = new ConcurrentHashMap();
25 | }
26 |
27 | public Access getAccessByTenant(String tenantName) {
28 | Access access = hashTenantAccess.get(tenantName);
29 | if (access == null) {
30 | access = keystone.tokens().authenticate(new UsernamePassword(username, password))
31 | .withTenantName(tenantName)
32 | .execute();
33 | hashTenantAccess.put(tenantName, access);
34 | }
35 | return access;
36 | }
37 |
38 | public void expireAccessByTenant(String tenantName) {
39 | hashTenantAccess.remove(tenantName);
40 | }
41 |
42 | public OpenStackTokenProvider getProviderByTenant(final String tenantName) {
43 | final KeystoneTokenProvider keystoneTokenProvider = this;
44 | return new OpenStackTokenProvider() {
45 | @Override
46 | public String getToken() {
47 | return keystoneTokenProvider.getAccessByTenant(tenantName)
48 | .getToken().getId();
49 | }
50 | @Override
51 | public void expireToken() {
52 | keystoneTokenProvider.expireAccessByTenant(tenantName);
53 | }
54 | };
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/utils/KeystoneUtils.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.utils;
2 |
3 | import java.util.List;
4 |
5 | import com.woorea.openstack.keystone.model.Access.Service;
6 |
7 | public class KeystoneUtils {
8 |
9 | public static String findEndpointURL(List serviceCatalog, String type, String region, String facing) {
10 | for(Service service : serviceCatalog) {
11 | if(type.equals(service.getType())) {
12 | for(Service.Endpoint endpoint : service.getEndpoints()) {
13 | if(region == null || region.equals(endpoint.getRegion())) {
14 | if(endpoint.getPublicURL() != null && facing.equals("public")) {
15 | return endpoint.getPublicURL();
16 | } else if(endpoint.getInternalURL() != null && facing.equals("internal")) {
17 | return endpoint.getInternalURL();
18 | } else if(endpoint.getAdminURL() != null && facing.equals("admin")) {
19 | return endpoint.getAdminURL();
20 | }
21 | }
22 | }
23 | }
24 | }
25 | throw new RuntimeException("endpoint url not found");
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/Keystone.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.base.client.OpenStackClientConnector;
5 | import com.woorea.openstack.keystone.v3.api.DomainsResource;
6 | import com.woorea.openstack.keystone.v3.api.EndpointsResource;
7 | import com.woorea.openstack.keystone.v3.api.ProjectsResource;
8 | import com.woorea.openstack.keystone.v3.api.RolesResource;
9 | import com.woorea.openstack.keystone.v3.api.ServicesResource;
10 | import com.woorea.openstack.keystone.v3.api.TokensResource;
11 | import com.woorea.openstack.keystone.v3.api.UsersResource;
12 |
13 | public class Keystone extends OpenStackClient {
14 |
15 | private final TokensResource TOKENS;
16 |
17 | private final DomainsResource DOMAINS;
18 |
19 | private final ProjectsResource PROJECTS;
20 |
21 | private final UsersResource USERS;
22 |
23 | private final RolesResource ROLES;
24 |
25 | private final ServicesResource SERVICES;
26 |
27 | private final EndpointsResource ENDPOINTS;
28 |
29 | public Keystone(String endpoint, OpenStackClientConnector connector) {
30 | super(endpoint, connector);
31 | TOKENS = new TokensResource(this);
32 | DOMAINS = new DomainsResource(this);
33 | PROJECTS = new ProjectsResource(this);
34 | USERS = new UsersResource(this);
35 | ROLES = new RolesResource(this);
36 | SERVICES = new ServicesResource(this);
37 | ENDPOINTS = new EndpointsResource(this);
38 | }
39 |
40 | public Keystone(String endpoint) {
41 | this(endpoint, null);
42 | }
43 |
44 | public TokensResource tokens() {
45 | return TOKENS;
46 | }
47 |
48 | public DomainsResource domains() {
49 | return DOMAINS;
50 | }
51 |
52 | public ProjectsResource projects() {
53 | return PROJECTS;
54 | }
55 |
56 | public UsersResource users() {
57 | return USERS;
58 | }
59 |
60 | public RolesResource roles() {
61 | return ROLES;
62 | }
63 |
64 | public ServicesResource services() {
65 | return SERVICES;
66 | }
67 |
68 | public EndpointsResource endpoints() {
69 | return ENDPOINTS;
70 | }
71 |
72 | }
73 |
74 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/CredentialsResources.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.keystone.v3.model.Credential;
5 | import com.woorea.openstack.keystone.v3.model.Credentials;
6 |
7 | public class CredentialsResources extends GenericResource {
8 |
9 | public CredentialsResources(OpenStackClient client) {
10 | super(client, "/credentials", Credential.class, Credentials.class);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/DomainGroupRolesResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.keystone.v3.model.Role;
5 | import com.woorea.openstack.keystone.v3.model.Roles;
6 |
7 | public class DomainGroupRolesResource extends GenericResource {
8 |
9 | public DomainGroupRolesResource(OpenStackClient client, String path) {
10 | super(client, path, Role.class, Roles.class);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/DomainUserRolesResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.Entity;
4 | import com.woorea.openstack.base.client.HttpMethod;
5 | import com.woorea.openstack.base.client.OpenStackClient;
6 | import com.woorea.openstack.base.client.OpenStackRequest;
7 | import com.woorea.openstack.keystone.model.Role;
8 | import com.woorea.openstack.keystone.model.Roles;
9 |
10 | public class DomainUserRolesResource extends GenericResource {
11 |
12 | public DomainUserRolesResource(OpenStackClient client, String path) {
13 | super(client, path, Role.class, Roles.class);
14 | }
15 |
16 | public OpenStackRequest add(String roleId) {
17 | return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(path).append("/").append(roleId).toString(), Entity.json(""), Void.class);
18 | }
19 |
20 | public OpenStackRequest remove(String roleId) {
21 | return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(roleId).toString(), null, Void.class);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/DomainsResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.keystone.v3.model.Domain;
5 | import com.woorea.openstack.keystone.v3.model.Domains;
6 |
7 | public class DomainsResource extends GenericResource {
8 |
9 | public DomainsResource(OpenStackClient client) {
10 | super(client, "/domains", Domain.class, Domains.class);
11 | }
12 |
13 | public DomainUserRolesResource userRoles(String domainId, String userId) {
14 | return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString());
15 | }
16 |
17 | public DomainUserRolesResource groupRoles(String domainId, String groupId) {
18 | return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/groups/").append(groupId).append("/roles").toString());
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/EndpointsResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.keystone.v3.model.Endpoint;
5 | import com.woorea.openstack.keystone.v3.model.Endpoints;
6 |
7 | public class EndpointsResource extends GenericResource {
8 |
9 | public EndpointsResource(OpenStackClient client) {
10 | super(client, "/endpoints", Endpoint.class, Endpoints.class);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/GenericResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.Entity;
4 | import com.woorea.openstack.base.client.HttpMethod;
5 | import com.woorea.openstack.base.client.OpenStackClient;
6 | import com.woorea.openstack.base.client.OpenStackRequest;
7 |
8 | public class GenericResource {
9 |
10 | protected final OpenStackClient CLIENT;
11 |
12 | protected CharSequence path;
13 |
14 | protected Class oneClass;
15 | protected Class manyClass;
16 |
17 | public GenericResource(OpenStackClient client, CharSequence path, Class oneClass, Class manyClass) {
18 | CLIENT = client;
19 | this.path = path;
20 | this.oneClass = oneClass;
21 | this.manyClass = manyClass;
22 | }
23 |
24 | public OpenStackRequest list() {
25 | return new OpenStackRequest(CLIENT, HttpMethod.GET, path, null, manyClass);
26 | }
27 |
28 | public OpenStackRequest create(One one) {
29 | return new OpenStackRequest(CLIENT, HttpMethod.POST, path, Entity.json(one), oneClass);
30 | }
31 |
32 | public OpenStackRequest show(String id) {
33 | return new OpenStackRequest(CLIENT, HttpMethod.GET, new StringBuilder(path).append("/").append(id).toString(), null, oneClass);
34 | }
35 |
36 | public OpenStackRequest update(String id, One one) {
37 | return new OpenStackRequest(CLIENT, HttpMethod.PATCH, new StringBuilder(path).append("/").append(id).toString(), Entity.json(one), oneClass);
38 | }
39 |
40 | public OpenStackRequest delete(String id) {
41 | return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(path).append("/").append(id).toString(), null, oneClass);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/GroupUsersResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.keystone.v3.model.User;
5 | import com.woorea.openstack.keystone.v3.model.Users;
6 |
7 |
8 | public class GroupUsersResource extends GenericResource {
9 |
10 | public GroupUsersResource(OpenStackClient client, String path) {
11 | super(client, path, User.class, Users.class);
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/GroupsResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.keystone.v3.model.Group;
5 | import com.woorea.openstack.keystone.v3.model.Groups;
6 |
7 | public class GroupsResource extends GenericResource {
8 |
9 | public GroupsResource(OpenStackClient client) {
10 | super(client, "/groups", Group.class, Groups.class);
11 | }
12 |
13 | public DomainUserRolesResource userRoles(String domainId, String userId) {
14 | return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString());
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/PoliciesResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.keystone.v3.model.Policies;
5 | import com.woorea.openstack.keystone.v3.model.Policy;
6 |
7 | public class PoliciesResource extends GenericResource {
8 |
9 | public PoliciesResource(OpenStackClient client) {
10 | super(client, "/policies", Policy.class, Policies.class);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectGroupRolesResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.base.client.OpenStackRequest;
5 | import com.woorea.openstack.keystone.model.Role;
6 | import com.woorea.openstack.keystone.model.Roles;
7 |
8 | public class ProjectGroupRolesResource extends GenericResource {
9 |
10 | public ProjectGroupRolesResource(OpenStackClient client, String path) {
11 | super(client, path, Role.class, Roles.class);
12 | }
13 |
14 | @Override
15 | public OpenStackRequest create(Role one) {
16 | throw new UnsupportedOperationException();
17 | }
18 |
19 | @Override
20 | public OpenStackRequest show(String id) {
21 | throw new UnsupportedOperationException();
22 | }
23 |
24 | @Override
25 | public OpenStackRequest update(String id, Role one) {
26 | throw new UnsupportedOperationException();
27 | }
28 |
29 | @Override
30 | public OpenStackRequest delete(String id) {
31 | throw new UnsupportedOperationException();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectRolesResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.Entity;
4 | import com.woorea.openstack.base.client.HttpMethod;
5 | import com.woorea.openstack.base.client.OpenStackClient;
6 | import com.woorea.openstack.base.client.OpenStackRequest;
7 |
8 | public class ProjectRolesResource {
9 |
10 | private final OpenStackClient CLIENT;
11 |
12 | private final String PATH;
13 |
14 | public ProjectRolesResource(OpenStackClient client, String path) {
15 | this.CLIENT = client;
16 | this.PATH = path;
17 | }
18 |
19 | public OpenStackRequest add(String roleId) {
20 | return new OpenStackRequest(CLIENT, HttpMethod.PUT, new StringBuilder(PATH).append("/").append(roleId).toString(), Entity.json(""), Void.class);
21 | }
22 |
23 | public OpenStackRequest remove(String roleId) {
24 | return new OpenStackRequest(CLIENT, HttpMethod.DELETE, new StringBuilder(PATH).append("/").append(roleId).toString(), null, Void.class);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectUserRolesResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.keystone.model.Role;
5 | import com.woorea.openstack.keystone.model.Roles;
6 |
7 | public class ProjectUserRolesResource extends GenericResource {
8 |
9 | public ProjectUserRolesResource(OpenStackClient client, String path) {
10 | super(client, path, Role.class, Roles.class);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/ProjectsResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.base.client.OpenStackRequest;
5 | import com.woorea.openstack.keystone.model.Users;
6 | import com.woorea.openstack.keystone.v3.model.Project;
7 | import com.woorea.openstack.keystone.v3.model.Projects;
8 |
9 | public class ProjectsResource extends GenericResource {
10 |
11 | public ProjectsResource(OpenStackClient client) {
12 | super(client, "/projects", Project.class, Projects.class);
13 | }
14 |
15 | public OpenStackRequest users(String projectId) {
16 | return CLIENT.get(new StringBuilder(path).append("/").append(projectId).append("/users/").toString(), Users.class);
17 | }
18 |
19 | public DomainUserRolesResource userRoles(String projectId, String userId) {
20 | return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/users/").append(userId).append("/roles").toString());
21 | }
22 |
23 | public DomainUserRolesResource groupRoles(String projectId, String groupId) {
24 | return new DomainUserRolesResource(CLIENT, new StringBuilder(path).append("/").append(projectId).append("/groups/").append(groupId).append("/roles").toString());
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/RolesResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.base.client.OpenStackRequest;
5 | import com.woorea.openstack.keystone.v3.model.Role;
6 | import com.woorea.openstack.keystone.v3.model.Roles;
7 | import com.woorea.openstack.keystone.v3.model.Users;
8 |
9 | public class RolesResource extends GenericResource {
10 |
11 | public RolesResource(OpenStackClient client) {
12 | super(client, "/roles", Role.class, Roles.class);
13 | }
14 |
15 | public OpenStackRequest users(String domainId, String userId) {
16 | return CLIENT.get(new StringBuilder(path).append("/").append(domainId).append("/users/").append(userId).append("/roles").toString(), Users.class);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/ServicesResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.keystone.model.Service;
5 | import com.woorea.openstack.keystone.model.Services;
6 |
7 | public class ServicesResource extends GenericResource {
8 |
9 | public ServicesResource(OpenStackClient client) {
10 | super(client, "/services", Service.class, Services.class);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/TokensResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.Entity;
4 | import com.woorea.openstack.base.client.HttpMethod;
5 | import com.woorea.openstack.base.client.OpenStackClient;
6 | import com.woorea.openstack.base.client.OpenStackRequest;
7 | import com.woorea.openstack.keystone.v3.model.Authentication;
8 | import com.woorea.openstack.keystone.v3.model.Token;
9 |
10 | public class TokensResource {
11 |
12 | private final OpenStackClient CLIENT;
13 |
14 | public TokensResource(OpenStackClient client) {
15 | CLIENT = client;
16 | }
17 |
18 | public Authenticate authenticate(Authentication authentication) {
19 | return new Authenticate(authentication);
20 | }
21 |
22 | public OpenStackRequest show() {
23 | return CLIENT.get("/auth/tokens", Token.class);
24 | }
25 |
26 | public class Authenticate extends OpenStackRequest {
27 |
28 | private Authentication authentication;
29 |
30 | public Authenticate() {
31 |
32 | }
33 |
34 | public Authenticate(Authentication authentication) {
35 | super(CLIENT, HttpMethod.POST, "/auth/tokens", Entity.json(authentication), Token.class);
36 | this.authentication = authentication;
37 | }
38 |
39 | }
40 |
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/api/UsersResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.base.client.OpenStackRequest;
5 | import com.woorea.openstack.keystone.model.Services;
6 | import com.woorea.openstack.keystone.v3.model.User;
7 | import com.woorea.openstack.keystone.v3.model.Users;
8 |
9 | public class UsersResource extends GenericResource {
10 |
11 | public UsersResource(OpenStackClient client) {
12 | super(client, "/users", User.class, Users.class);
13 | }
14 |
15 | public OpenStackRequest groups(String userId) {
16 | return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/groups").toString(), Services.class);
17 | }
18 |
19 | public OpenStackRequest projects(String userId) {
20 | return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/projects").toString(), Services.class);
21 | }
22 |
23 | public OpenStackRequest roles(String userId) {
24 | return CLIENT.get(new StringBuilder(path).append("/").append(userId).append("/roles").toString(), Services.class);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Credential.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import com.fasterxml.jackson.annotation.JsonRootName;
7 |
8 | @JsonRootName("credential")
9 | public class Credential {
10 |
11 | private String id;
12 |
13 | private String projectId;
14 |
15 | private String type;
16 |
17 | private String userId;
18 |
19 | private Map blob = new HashMap();
20 |
21 | public String getId() {
22 | return id;
23 | }
24 |
25 | public void setId(String id) {
26 | this.id = id;
27 | }
28 |
29 | public String getProjectId() {
30 | return projectId;
31 | }
32 |
33 | public void setProjectId(String projectId) {
34 | this.projectId = projectId;
35 | }
36 |
37 | public String getType() {
38 | return type;
39 | }
40 |
41 | public void setType(String type) {
42 | this.type = type;
43 | }
44 |
45 | public String getUserId() {
46 | return userId;
47 | }
48 |
49 | public void setUserId(String userId) {
50 | this.userId = userId;
51 | }
52 |
53 | public Map getBlob() {
54 | return blob;
55 | }
56 |
57 | public void setBlob(Map blob) {
58 | this.blob = blob;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Credentials.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Credentials implements Iterable, Serializable {
10 |
11 | @JsonProperty("credentials")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Credentials [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Domain.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonRootName;
4 |
5 | @JsonRootName("domain")
6 | public class Domain {
7 |
8 | private String id;
9 |
10 | private String name;
11 |
12 | private String description;
13 |
14 | private Boolean enabled;
15 |
16 | public String getId() {
17 | return id;
18 | }
19 |
20 | public void setId(String id) {
21 | this.id = id;
22 | }
23 |
24 | public String getName() {
25 | return name;
26 | }
27 |
28 | public void setName(String name) {
29 | this.name = name;
30 | }
31 |
32 | public String getDescription() {
33 | return description;
34 | }
35 |
36 | public void setDescription(String description) {
37 | this.description = description;
38 | }
39 |
40 | public Boolean getEnabled() {
41 | return enabled;
42 | }
43 |
44 | public void setEnabled(Boolean enabled) {
45 | this.enabled = enabled;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Domains.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Domains implements Iterable, Serializable {
10 |
11 | @JsonProperty("domains")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Domains [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoint.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import com.fasterxml.jackson.annotation.JsonRootName;
5 |
6 | @JsonRootName("endpoint")
7 | public class Endpoint {
8 |
9 | private String id;
10 |
11 | @JsonProperty("interface")
12 | private String iface;
13 |
14 | private String name;
15 |
16 | @JsonProperty("service_id")
17 | private String serviceId;
18 |
19 | public String getId() {
20 | return id;
21 | }
22 |
23 | public void setId(String id) {
24 | this.id = id;
25 | }
26 |
27 | public String getInterface() {
28 | return iface;
29 | }
30 |
31 | public void setInterface(String iface) {
32 | this.iface = iface;
33 | }
34 |
35 | public String getName() {
36 | return name;
37 | }
38 |
39 | public void setName(String name) {
40 | this.name = name;
41 | }
42 |
43 | public String getServiceId() {
44 | return serviceId;
45 | }
46 |
47 | public void setServiceId(String serviceId) {
48 | this.serviceId = serviceId;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Endpoints.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Endpoints implements Iterable, Serializable {
10 |
11 | @JsonProperty("endpoints")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Endpoints [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Group.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import com.fasterxml.jackson.annotation.JsonRootName;
5 |
6 | @JsonRootName("group")
7 | public class Group {
8 |
9 | private String id;
10 |
11 | @JsonProperty("domain_id")
12 | private String domainId;
13 |
14 | private String name;
15 |
16 | private String description;
17 |
18 | public String getId() {
19 | return id;
20 | }
21 |
22 | public void setId(String id) {
23 | this.id = id;
24 | }
25 |
26 | public String getDomainId() {
27 | return domainId;
28 | }
29 |
30 | public void setDomainId(String domainId) {
31 | this.domainId = domainId;
32 | }
33 |
34 | public String getName() {
35 | return name;
36 | }
37 |
38 | public void setName(String name) {
39 | this.name = name;
40 | }
41 |
42 | public String getDescription() {
43 | return description;
44 | }
45 |
46 | public void setDescription(String description) {
47 | this.description = description;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Groups.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Groups implements Iterable, Serializable {
10 |
11 | @JsonProperty("groups")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Groups [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Policies.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Policies implements Iterable, Serializable {
10 |
11 | @JsonProperty("policies")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Policies [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Policy.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import com.fasterxml.jackson.annotation.JsonRootName;
7 |
8 | @JsonRootName("policy")
9 | public class Policy {
10 |
11 | private String id;
12 |
13 | private String projectId;
14 |
15 | private String type;
16 |
17 | private String userId;
18 |
19 | private Map blob = new HashMap();
20 |
21 | public String getId() {
22 | return id;
23 | }
24 |
25 | public void setId(String id) {
26 | this.id = id;
27 | }
28 |
29 | public String getProjectId() {
30 | return projectId;
31 | }
32 |
33 | public void setProjectId(String projectId) {
34 | this.projectId = projectId;
35 | }
36 |
37 | public String getType() {
38 | return type;
39 | }
40 |
41 | public void setType(String type) {
42 | this.type = type;
43 | }
44 |
45 | public String getUserId() {
46 | return userId;
47 | }
48 |
49 | public void setUserId(String userId) {
50 | this.userId = userId;
51 | }
52 |
53 | public Map getBlob() {
54 | return blob;
55 | }
56 |
57 | public void setBlob(Map blob) {
58 | this.blob = blob;
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Project.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import com.fasterxml.jackson.annotation.JsonRootName;
5 |
6 | @JsonRootName("project")
7 | public class Project {
8 |
9 | private String id;
10 |
11 | @JsonProperty("domain_id")
12 | private String domainId;
13 |
14 | private String name;
15 |
16 | private Boolean enabled;
17 |
18 | public String getId() {
19 | return id;
20 | }
21 |
22 | public void setId(String id) {
23 | this.id = id;
24 | }
25 |
26 | public String getDomainId() {
27 | return domainId;
28 | }
29 |
30 | public void setDomainId(String domainId) {
31 | this.domainId = domainId;
32 | }
33 |
34 | public String getName() {
35 | return name;
36 | }
37 |
38 | public void setName(String name) {
39 | this.name = name;
40 | }
41 |
42 | public Boolean getEnabled() {
43 | return enabled;
44 | }
45 |
46 | public void setEnabled(Boolean enabled) {
47 | this.enabled = enabled;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Projects.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Projects implements Iterable, Serializable {
10 |
11 | @JsonProperty("projects")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Projects [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Role.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.io.Serializable;
4 |
5 | import com.fasterxml.jackson.annotation.JsonRootName;
6 |
7 | @JsonRootName("role")
8 | public class Role implements Serializable {
9 |
10 | private String id;
11 |
12 | private String name;
13 |
14 | private String description;
15 |
16 | private String enabled;
17 |
18 | /**
19 | * @return the id
20 | */
21 | public String getId() {
22 | return id;
23 | }
24 |
25 | /**
26 | * @return the name
27 | */
28 | public String getName() {
29 | return name;
30 | }
31 |
32 | /**
33 | * @param name the name to set
34 | */
35 | public void setName(String name) {
36 | this.name = name;
37 | }
38 |
39 | /**
40 | * @return the description
41 | */
42 | public String getDescription() {
43 | return description;
44 | }
45 |
46 | /**
47 | * @param description the description to set
48 | */
49 | public void setDescription(String description) {
50 | this.description = description;
51 | }
52 |
53 | /**
54 | * @return the enabled
55 | */
56 | public String getEnabled() {
57 | return enabled;
58 | }
59 |
60 | /**
61 | * @param enabled the enabled to set
62 | */
63 | public void setEnabled(String enabled) {
64 | this.enabled = enabled;
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Roles.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 |
9 | public class Roles implements Iterable, Serializable {
10 |
11 | @JsonProperty("roles")
12 | private List list;
13 |
14 | /**
15 | * @return the list
16 | */
17 | public List getList() {
18 | return list;
19 | }
20 |
21 | /* (non-Javadoc)
22 | * @see java.lang.Object#toString()
23 | */
24 | @Override
25 | public String toString() {
26 | return "Roles [list=" + list + "]";
27 | }
28 |
29 | @Override
30 | public Iterator iterator() {
31 | return list.iterator();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Service.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonRootName;
4 |
5 | @JsonRootName("service")
6 | public class Service {
7 |
8 | private String id;
9 |
10 | private String type;
11 |
12 | private String name;
13 |
14 | private String description;
15 |
16 | public String getId() {
17 | return id;
18 | }
19 |
20 | public void setId(String id) {
21 | this.id = id;
22 | }
23 |
24 | public String getType() {
25 | return type;
26 | }
27 |
28 | public void setType(String type) {
29 | this.type = type;
30 | }
31 |
32 | public String getName() {
33 | return name;
34 | }
35 |
36 | public void setName(String name) {
37 | this.name = name;
38 | }
39 |
40 | public String getDescription() {
41 | return description;
42 | }
43 |
44 | public void setDescription(String description) {
45 | this.description = description;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Services.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 | import com.woorea.openstack.keystone.model.Service;
9 |
10 | public class Services implements Iterable, Serializable {
11 |
12 | @JsonProperty("services")
13 | private List list;
14 |
15 | /**
16 | * @return the list
17 | */
18 | public List getList() {
19 | return list;
20 | }
21 |
22 | /* (non-Javadoc)
23 | * @see java.lang.Object#toString()
24 | */
25 | @Override
26 | public String toString() {
27 | return "Services [list=" + list + "]";
28 | }
29 |
30 | @Override
31 | public Iterator iterator() {
32 | return list.iterator();
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/User.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import com.fasterxml.jackson.annotation.JsonRootName;
5 |
6 | @JsonRootName("user")
7 | public class User {
8 |
9 | private String id;
10 |
11 | @JsonProperty("domain_id")
12 | private String domainId;
13 |
14 | @JsonProperty("default_project_id")
15 | private String defaultProjectId;
16 |
17 | private String name;
18 |
19 | private String password;
20 |
21 | private String email;
22 |
23 | private String description;
24 |
25 | private Boolean enabled;
26 |
27 | public String getId() {
28 | return id;
29 | }
30 |
31 | public void setId(String id) {
32 | this.id = id;
33 | }
34 |
35 | public String getDomainId() {
36 | return domainId;
37 | }
38 |
39 | public void setDomainId(String domainId) {
40 | this.domainId = domainId;
41 | }
42 |
43 | public String getDefaultProjectId() {
44 | return defaultProjectId;
45 | }
46 |
47 | public void setDefaultProjectId(String defaultProjectId) {
48 | this.defaultProjectId = defaultProjectId;
49 | }
50 |
51 | public String getName() {
52 | return name;
53 | }
54 |
55 | public void setName(String name) {
56 | this.name = name;
57 | }
58 |
59 | public String getPassword() {
60 | return password;
61 | }
62 |
63 | public void setPassword(String password) {
64 | this.password = password;
65 | }
66 |
67 | public String getEmail() {
68 | return email;
69 | }
70 |
71 | public void setEmail(String email) {
72 | this.email = email;
73 | }
74 |
75 | public String getDescription() {
76 | return description;
77 | }
78 |
79 | public void setDescription(String description) {
80 | this.description = description;
81 | }
82 |
83 | public Boolean getEnabled() {
84 | return enabled;
85 | }
86 |
87 | public void setEnabled(Boolean enabled) {
88 | this.enabled = enabled;
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/keystone/v3/model/Users.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.keystone.v3.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Iterator;
5 | import java.util.List;
6 |
7 | import com.fasterxml.jackson.annotation.JsonProperty;
8 | import com.woorea.openstack.keystone.model.User;
9 |
10 | public class Users implements Iterable, Serializable {
11 |
12 | @JsonProperty("users")
13 | private List list;
14 |
15 | /**
16 | * @return the list
17 | */
18 | public List getList() {
19 | return list;
20 | }
21 |
22 | /* (non-Javadoc)
23 | * @see java.lang.Object#toString()
24 | */
25 | @Override
26 | public String toString() {
27 | return "Users [list=" + list + "]";
28 | }
29 |
30 | @Override
31 | public Iterator iterator() {
32 | return list.iterator();
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/Swift.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift;
2 |
3 |
4 | import com.woorea.openstack.base.client.OpenStackClient;
5 | import com.woorea.openstack.base.client.OpenStackClientConnector;
6 | import com.woorea.openstack.swift.api.AccountResource;
7 | import com.woorea.openstack.swift.api.ContainersResource;
8 |
9 | public class Swift extends OpenStackClient {
10 |
11 | private final AccountResource ACCOUNT;
12 |
13 | private final ContainersResource CONTAINERS;
14 |
15 | public Swift(String endpoint, OpenStackClientConnector connector) {
16 | super(endpoint, connector);
17 | CONTAINERS = new ContainersResource(this);
18 | ACCOUNT = new AccountResource(this);
19 | }
20 |
21 | public Swift(String endpoint) {
22 | this(endpoint, null);
23 | }
24 |
25 | public ContainersResource containers() {
26 | return CONTAINERS;
27 | }
28 |
29 | public AccountResource account() {
30 | return ACCOUNT;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/api/AccountResource.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift.api;
2 |
3 | import com.woorea.openstack.base.client.OpenStackClient;
4 | import com.woorea.openstack.base.client.OpenStackRequest;
5 |
6 | public class AccountResource {
7 |
8 | private final OpenStackClient CLIENT;
9 |
10 | public AccountResource(OpenStackClient client) {
11 | CLIENT = client;
12 | }
13 |
14 | public class ShowAccount extends OpenStackRequest {
15 |
16 | public ShowAccount() {
17 | // return target.request(MediaType.APPLICATION_JSON).head();
18 | }
19 |
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/deserializer/ContainersDeserializer.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift.deserializer;
2 |
3 | import java.io.IOException;
4 |
5 | import com.fasterxml.jackson.core.JsonParser;
6 | import com.fasterxml.jackson.core.JsonProcessingException;
7 | import com.fasterxml.jackson.databind.DeserializationContext;
8 | import com.fasterxml.jackson.databind.JsonDeserializer;
9 | import com.woorea.openstack.swift.model.Container;
10 | import com.woorea.openstack.swift.model.Containers;
11 |
12 | public class ContainersDeserializer extends JsonDeserializer {
13 |
14 | @Override
15 | public Containers deserialize(JsonParser jp, DeserializationContext ctxt)
16 | throws IOException, JsonProcessingException {
17 | Container[] containersArray = jp.readValueAs(Container[].class);
18 | return new Containers(containersArray);
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/deserializer/ObjectsDeserializer.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift.deserializer;
2 |
3 | import java.io.IOException;
4 |
5 | import com.fasterxml.jackson.core.JsonParser;
6 | import com.fasterxml.jackson.core.JsonProcessingException;
7 | import com.fasterxml.jackson.databind.DeserializationContext;
8 | import com.fasterxml.jackson.databind.JsonDeserializer;
9 | import com.woorea.openstack.swift.model.Objects;
10 |
11 | public class ObjectsDeserializer extends JsonDeserializer {
12 |
13 | @Override
14 | public Objects deserialize(JsonParser jp, DeserializationContext ctxt)
15 | throws IOException, JsonProcessingException {
16 | com.woorea.openstack.swift.model.Object[] containersArray = jp.readValueAs(com.woorea.openstack.swift.model.Object[].class);
17 | return new Objects(containersArray);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/model/Account.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift.model;
2 |
3 | import java.io.Serializable;
4 |
5 | public class Account implements Serializable {
6 |
7 | private Integer containerCount;
8 |
9 | private Integer objectCount;
10 |
11 | private Integer bytesUsed;
12 |
13 | /**
14 | * @return the containerCount
15 | */
16 | public Integer getContainerCount() {
17 | return containerCount;
18 | }
19 |
20 | /**
21 | * @param containerCount the containerCount to set
22 | */
23 | public void setContainerCount(Integer containerCount) {
24 | this.containerCount = containerCount;
25 | }
26 |
27 | /**
28 | * @return the objectCount
29 | */
30 | public Integer getObjectCount() {
31 | return objectCount;
32 | }
33 |
34 | /**
35 | * @param objectCount the objectCount to set
36 | */
37 | public void setObjectCount(Integer objectCount) {
38 | this.objectCount = objectCount;
39 | }
40 |
41 | /**
42 | * @return the bytesUsed
43 | */
44 | public Integer getBytesUsed() {
45 | return bytesUsed;
46 | }
47 |
48 | /**
49 | * @param bytesUsed the bytesUsed to set
50 | */
51 | public void setBytesUsed(Integer bytesUsed) {
52 | this.bytesUsed = bytesUsed;
53 | }
54 |
55 | /* (non-Javadoc)
56 | * @see java.lang.Object#toString()
57 | */
58 | @Override
59 | public String toString() {
60 | return "Account [containerCount=" + containerCount + ", objectCount="
61 | + objectCount + ", bytesUsed=" + bytesUsed + "]";
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/model/Container.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift.model;
2 |
3 | import java.io.Serializable;
4 |
5 | import com.fasterxml.jackson.annotation.JsonProperty;
6 |
7 | public class Container implements Serializable {
8 |
9 | private String name;
10 |
11 | @JsonProperty("count")
12 | private Integer objectCount;
13 |
14 | @JsonProperty("bytes")
15 | private Long bytesUsed;
16 |
17 | /**
18 | * @return the name
19 | */
20 | public String getName() {
21 | return name;
22 | }
23 |
24 | /**
25 | * @param name the name to set
26 | */
27 | public void setName(String name) {
28 | this.name = name;
29 | }
30 |
31 | /**
32 | * @return the objectCount
33 | */
34 | public Integer getObjectCount() {
35 | return objectCount;
36 | }
37 |
38 | /**
39 | * @param objectCount the objectCount to set
40 | */
41 | public void setObjectCount(Integer objectCount) {
42 | this.objectCount = objectCount;
43 | }
44 |
45 | /**
46 | * @return the bytesUsed
47 | */
48 | public Long getBytesUsed() {
49 | return bytesUsed;
50 | }
51 |
52 | /**
53 | * @param bytesUsed the bytesUsed to set
54 | */
55 | public void setBytesUsed(Long bytesUsed) {
56 | this.bytesUsed = bytesUsed;
57 | }
58 |
59 | /* (non-Javadoc)
60 | * @see java.lang.Object#toString()
61 | */
62 | @Override
63 | public String toString() {
64 | return "Container [name=" + name + ", objectCount=" + objectCount
65 | + ", bytesUsed=" + bytesUsed + "]";
66 | }
67 |
68 |
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/model/Containers.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Arrays;
5 | import java.util.Iterator;
6 | import java.util.List;
7 |
8 | import com.fasterxml.jackson.annotation.JsonProperty;
9 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
10 | import com.woorea.openstack.swift.deserializer.ContainersDeserializer;
11 |
12 | @JsonDeserialize(using = ContainersDeserializer.class)
13 | public class Containers implements Iterable, Serializable {
14 |
15 | /**
16 | *
17 | */
18 | private static final long serialVersionUID = 1L;
19 | @JsonProperty("containers")
20 | private List list;
21 |
22 | public Containers(Container[] containersArray) {
23 | list = Arrays.asList(containersArray);
24 | }
25 |
26 | /**
27 | * @return the list
28 | */
29 | public List getList() {
30 | return list;
31 | }
32 |
33 | /*
34 | * (non-Javadoc)
35 | *
36 | * @see java.lang.Object#toString()
37 | */
38 | @Override
39 | public String toString() {
40 | return "Containers [list=" + list + "]";
41 | }
42 |
43 | @Override
44 | public Iterator iterator() {
45 | return list.iterator();
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/model/Object.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Calendar;
5 |
6 | import com.fasterxml.jackson.annotation.JsonProperty;
7 |
8 |
9 | public class Object implements Serializable {
10 | private String subdir;
11 | private String name;
12 | private String hash;
13 | private int bytes;
14 | @JsonProperty("content_type")
15 | private String contentType;
16 | @JsonProperty("last_modified")
17 | private Calendar lastModified;
18 |
19 | /**
20 | * @return the subdir
21 | */
22 | public String getSubdir() {
23 | return subdir;
24 | }
25 |
26 | /**
27 | * @param subdir the subdir to set
28 | */
29 | public void setSubdir(String subdir) {
30 | this.subdir = subdir;
31 | }
32 |
33 | /**
34 | * @return the name
35 | */
36 | public String getName() {
37 | return name;
38 | }
39 |
40 | /**
41 | * @param name the name to set
42 | */
43 | public void setName(String name) {
44 | this.name = name;
45 | }
46 |
47 | /**
48 | * @return the hash
49 | */
50 | public String getHash() {
51 | return hash;
52 | }
53 |
54 | /**
55 | * @param hash the hash to set
56 | */
57 | public void setHash(String hash) {
58 | this.hash = hash;
59 | }
60 |
61 | /**
62 | * @return the bytes
63 | */
64 | public int getBytes() {
65 | return bytes;
66 | }
67 |
68 | /**
69 | * @param bytes the bytes to set
70 | */
71 | public void setBytes(int bytes) {
72 | this.bytes = bytes;
73 | }
74 |
75 | /**
76 | * @return the contentType
77 | */
78 | public String getContentType() {
79 | return contentType;
80 | }
81 |
82 | /**
83 | * @param contentType the contentType to set
84 | */
85 | public void setContentType(String contentType) {
86 | this.contentType = contentType;
87 | }
88 |
89 | /**
90 | * @return the lastModified
91 | */
92 | public Calendar getLastModified() {
93 | return lastModified;
94 | }
95 |
96 | /**
97 | * @param lastModified the lastModified to set
98 | */
99 | public void setLastModified(Calendar lastModified) {
100 | this.lastModified = lastModified;
101 | }
102 |
103 | /* (non-Javadoc)
104 | * @see java.lang.Object#toString()
105 | */
106 | @Override
107 | public String toString() {
108 | return "Object [name=" + name + ", bytes=" + bytes +
109 | ", content_type=" + contentType + ", last_modified=" + lastModified +
110 | ", hash=" + hash + "]";
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/model/ObjectDownload.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift.model;
2 |
3 | import java.io.InputStream;
4 |
5 |
6 |
7 | public class ObjectDownload {
8 |
9 | private Object object;
10 |
11 | private InputStream inputStream;
12 |
13 | /**
14 | * @return the object
15 | */
16 | public Object getObject() {
17 | return object;
18 | }
19 |
20 | /**
21 | * @param object the object to set
22 | */
23 | public void setObject(Object object) {
24 | this.object = object;
25 | }
26 |
27 | /**
28 | * @return the inputStream
29 | */
30 | public InputStream getInputStream() {
31 | return inputStream;
32 | }
33 |
34 | /**
35 | * @param inputStream the inputStream to set
36 | */
37 | public void setInputStream(InputStream inputStream) {
38 | this.inputStream = inputStream;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/model/ObjectForUpload.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift.model;
2 |
3 | import java.io.InputStream;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 |
7 |
8 | public class ObjectForUpload {
9 |
10 | private String container;
11 |
12 | private String name;
13 |
14 | private Map properties;
15 |
16 | private InputStream inputStream;
17 |
18 | /**
19 | * @return the container
20 | */
21 | public String getContainer() {
22 | return container;
23 | }
24 |
25 | /**
26 | * @param container the container to set
27 | */
28 | public void setContainer(String container) {
29 | this.container = container;
30 | }
31 |
32 | /**
33 | * @return the name
34 | */
35 | public String getName() {
36 | return name;
37 | }
38 |
39 | /**
40 | * @param name the name to set
41 | */
42 | public void setName(String name) {
43 | this.name = name;
44 | }
45 |
46 | /**
47 | * @return the properties
48 | */
49 | public Map getProperties() {
50 | if(properties == null) {
51 | properties = new HashMap();
52 | }
53 | return properties;
54 | }
55 |
56 | /**
57 | * @return the inputStream
58 | */
59 | public InputStream getInputStream() {
60 | return inputStream;
61 | }
62 |
63 | /**
64 | * @param inputStream the inputStream to set
65 | */
66 | public void setInputStream(InputStream inputStream) {
67 | this.inputStream = inputStream;
68 | }
69 |
70 |
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/com/woorea/openstack/swift/model/Objects.java:
--------------------------------------------------------------------------------
1 | package com.woorea.openstack.swift.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.Arrays;
5 | import java.util.Iterator;
6 | import java.util.List;
7 |
8 | import com.fasterxml.jackson.annotation.JsonProperty;
9 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
10 | import com.woorea.openstack.swift.deserializer.ObjectsDeserializer;
11 |
12 | @JsonDeserialize(using = ObjectsDeserializer.class)
13 | public class Objects implements Iterable, Serializable {
14 |
15 | /**
16 | *
17 | */
18 | private static final long serialVersionUID = 1L;
19 | @JsonProperty("objects")
20 | private List list;
21 |
22 | public Objects(com.woorea.openstack.swift.model.Object[] objectsArray) {
23 | list = Arrays.asList(objectsArray);
24 | }
25 |
26 | /**
27 | * @return the list
28 | */
29 | public List getList() {
30 | return list;
31 | }
32 |
33 | /*
34 | * (non-Javadoc)
35 | *
36 | * @see java.lang.Object#toString()
37 | */
38 | @Override
39 | public String toString() {
40 | return "Objects [list=" + list + "]";
41 | }
42 |
43 | @Override
44 | public Iterator iterator() {
45 | return list.iterator();
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/openstack-java-jdk/src/main/java/org/apache/http/util/Consts.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ====================================================================
3 | * Licensed to the Apache Software Foundation (ASF) under one
4 | * or more contributor license agreements. See the NOTICE file
5 | * distributed with this work for additional information
6 | * regarding copyright ownership. The ASF licenses this file
7 | * to you under the Apache License, Version 2.0 (the
8 | * "License"); you may not use this file except in compliance
9 | * with the License. You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing,
14 | * software distributed under the License is distributed on an
15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | * KIND, either express or implied. See the License for the
17 | * specific language governing permissions and limitations
18 | * under the License.
19 | * ====================================================================
20 | *
21 | * This software consists of voluntary contributions made by many
22 | * individuals on behalf of the Apache Software Foundation. For more
23 | * information on the Apache Software Foundation, please see
24 | * .
25 | *
26 | */
27 |
28 | package org.apache.http.util;
29 |
30 | import java.nio.charset.Charset;
31 |
32 | /**
33 | * Commons constants.
34 | *
35 | * @since 4.2
36 | */
37 | public final class Consts {
38 |
39 | public static final int CR = 13; //
40 | public static final int LF = 10; //
41 | public static final int SP = 32; //
42 | public static final int HT = 9; //
43 |
44 | public static final Charset UTF_8 = Charset.forName("UTF-8");
45 | public static final Charset ASCII = Charset.forName("US-ASCII");
46 | public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
47 |
48 | private Consts() {
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':openstack-java-jdk'
2 |
--------------------------------------------------------------------------------