1- package net .dmcloud ;
1+ package net .dmcloud . cloudkey ;
22
33import java .io .*;
44import java .util .Map ;
1313import org .apache .commons .httpclient .methods .multipart .Part ;
1414import org .codehaus .jackson .map .ObjectMapper ;
1515
16- public class CloudKey extends CloudKey_Api
16+ public class CloudKey extends Api
1717{
1818 public CloudKey (String _user_id , String _api_key ) throws Exception
1919 {
20- super (_user_id , _api_key , CLOUDKEY_API_URL , CLOUDKEY_CDN_URL , "" );
20+ super (_user_id , _api_key , CloudKey . API_URL , CloudKey . CDN_URL , "" );
2121 }
2222
2323 public CloudKey (String _user_id , String _api_key , String _base_url , String _cdn_url , String _proxy ) throws Exception
2424 {
2525 super (_user_id , _api_key , _base_url , _cdn_url , _proxy );
2626 }
2727
28- public String mediaGetEmbedUrl (String id ) throws CloudKey_Exception
28+ public String mediaGetEmbedUrl (String id ) throws DCException
2929 {
30- return this .mediaGetEmbedUrl (CLOUDKEY_API_URL , id , CloudKey .CLOUDKEY_SECLEVEL_NONE , "" , "" , "" , null , null , 0 );
30+ return this .mediaGetEmbedUrl (CloudKey . API_URL , id , CloudKey .SECLEVEL_NONE , "" , "" , "" , null , null , 0 );
3131 }
3232
33- public String mediaGetEmbedUrl (String id , int seclevel , String asnum , String ip , String useragent , String [] countries , String [] referers , int expires ) throws CloudKey_Exception
33+ public String mediaGetEmbedUrl (String id , int seclevel , String asnum , String ip , String useragent , String [] countries , String [] referers , int expires ) throws DCException
3434 {
35- return this .mediaGetEmbedUrl (CLOUDKEY_API_URL , id , seclevel , asnum , ip , useragent , countries , referers , expires );
35+ return this .mediaGetEmbedUrl (CloudKey . API_URL , id , seclevel , asnum , ip , useragent , countries , referers , expires );
3636 }
3737
38- public String mediaGetEmbedUrl (String url , String id , int seclevel , String asnum , String ip , String useragent , String [] countries , String [] referers , int expires ) throws CloudKey_Exception
38+ public String mediaGetEmbedUrl (String url , String id , int seclevel , String asnum , String ip , String useragent , String [] countries , String [] referers , int expires ) throws DCException
3939 {
4040 String _url = url + "/embed/" + this .user_id + "/" + id ;
41- return CloudKey_Helpers .sign_url (_url , this .api_key , seclevel , asnum , ip , useragent , countries , referers , expires );
41+ return Helpers .sign_url (_url , this .api_key , seclevel , asnum , ip , useragent , countries , referers , expires );
4242 }
4343
44- public String mediaGetStreamUrl (String id ) throws CloudKey_Exception
44+ public String mediaGetStreamUrl (String id ) throws DCException
4545 {
46- return this .mediaGetStreamUrl (CLOUDKEY_API_URL , id , "mp4_h264_aac" , CloudKey .CLOUDKEY_SECLEVEL_NONE , "" , "" , "" , null , null , 0 , "" , false );
46+ return this .mediaGetStreamUrl (CloudKey . API_URL , id , "mp4_h264_aac" , CloudKey .SECLEVEL_NONE , "" , "" , "" , null , null , 0 , "" , false );
4747 }
4848
49- public String mediaGetStreamUrl (String id , String asset_name , int seclevel , String asnum , String ip , String useragent , String [] countries , String [] referers , int expires , String extension , Boolean download ) throws CloudKey_Exception
49+ public String mediaGetStreamUrl (String id , String asset_name , int seclevel , String asnum , String ip , String useragent , String [] countries , String [] referers , int expires , String extension , Boolean download ) throws DCException
5050 {
51- return this .mediaGetStreamUrl (CLOUDKEY_API_URL , id , asset_name , seclevel , asnum , ip , useragent , countries , referers , expires , extension , download );
51+ return this .mediaGetStreamUrl (CloudKey . API_URL , id , asset_name , seclevel , asnum , ip , useragent , countries , referers , expires , extension , download );
5252 }
5353
54- public String mediaGetStreamUrl (String url , String id , String asset_name , int seclevel , String asnum , String ip , String useragent , String [] countries , String [] referers , int expires , String extension , Boolean download ) throws CloudKey_Exception
54+ public String mediaGetStreamUrl (String url , String id , String asset_name , int seclevel , String asnum , String ip , String useragent , String [] countries , String [] referers , int expires , String extension , Boolean download ) throws DCException
5555 {
5656 if (extension == "" )
5757 {
@@ -60,12 +60,12 @@ public String mediaGetStreamUrl(String url, String id, String asset_name, int se
6060 }
6161 if (asset_name .length () >= 15 && asset_name .substring (0 , 15 ) == "jpeg_thumbnail_" )
6262 {
63- return CLOUDKEY_STATIC_URL + this .user_id + "/" + id + "/" + asset_name + "." + extension ;
63+ return CloudKey . STATIC_URL + this .user_id + "/" + id + "/" + asset_name + "." + extension ;
6464 }
6565 else
6666 {
6767 String _url = this .cdn_url + "/route/" + this .user_id + "/" + id + "/" + asset_name + ((extension != "" ) ? "." + extension : "" );
68- return CloudKey_Helpers .sign_url (_url , this .api_key , seclevel , asnum , ip , useragent , countries , referers , expires ) + (download ? "&throttle=0&helper=0&cache=0" : "" );
68+ return Helpers .sign_url (_url , this .api_key , seclevel , asnum , ip , useragent , countries , referers , expires ) + (download ? "&throttle=0&helper=0&cache=0" : "" );
6969 }
7070 }
7171
@@ -126,12 +126,12 @@ public String mediaCreate(File f, DCArray assets_names, DCObject meta) throws Ex
126126 }
127127 else
128128 {
129- throw new CloudKey_Exception ("Upload failed." );
129+ throw new DCException ("Upload failed." );
130130 }
131131 }
132132 catch (Exception e )
133133 {
134- throw new CloudKey_Exception ("Upload failed." );
134+ throw new DCException ("Upload failed." );
135135 }
136136 finally
137137 {
0 commit comments