com.appaloosastore.client
Class AppaloosaClient

java.lang.Object
  extended by com.appaloosastore.client.AppaloosaClient

public class AppaloosaClient
extends java.lang.Object

Client for appaloosa, http://www.appaloosa-store.com. Usage :
AppaloosaClient client = new AppaloosaClient("my_organisation_token");
try {
client.deployFile("/path/to/archive");
System.out.println("Archive deployed");
} catch (AppaloosaDeployException e) {
System.err.println("Something went wrong");
}
Organisation token is available on settings page.

Author:
Benoit Lafontaine

Constructor Summary
AppaloosaClient(java.lang.String organisationToken)
           
AppaloosaClient(java.lang.String organisationToken, java.lang.String proxyHost, int proxyPort, java.lang.String proxyUser, java.lang.String proxyPass)
           
 
Method Summary
protected  void addParam(org.apache.http.entity.mime.MultipartEntity entity, java.lang.String paramName, java.lang.String paramValue)
           
protected  java.lang.String constructKey(java.lang.String key, java.lang.String filePath)
           
protected  AppaloosaDeployException createExceptionWithAppaloosaErrorResponse(org.apache.http.HttpResponse response, java.lang.String prefix)
           
protected  org.apache.http.client.methods.HttpPost createHttpPost(UploadBinaryForm uploadForm, java.io.File file)
           
 void deployFile(java.lang.String filePath)
           
protected  java.lang.String getAppaloosaBaseUrl()
           
protected  MobileApplicationUpdate getMobileApplicationUpdateDetails(java.lang.Integer id)
           
protected  UploadBinaryForm getUploadForm()
           
protected  java.lang.String newBinaryUrl()
           
protected  MobileApplicationUpdate notifyAppaloosaForFile(java.lang.String filePath, UploadBinaryForm uploadForm)
           
protected  java.lang.String onBinaryUploadUrl()
           
protected  MobileApplicationUpdate publish(MobileApplicationUpdate update)
           
protected  java.lang.String publishUpdateUrl()
           
protected  java.lang.String readBodyResponse(org.apache.http.HttpResponse response)
           
protected  java.lang.String readErrorFormAmazon(java.lang.String body)
           
 void setBaseUrl(java.lang.String appaloosaUrl)
          To change the url of appaloosa server.
 void setPort(int port)
          To change port of appaloosa server.
protected  void setWaitDuration(int waitDuration)
           
protected  void smallWait()
           
protected  java.lang.String updateUrl(java.lang.Integer id)
           
protected  void uploadFile(java.lang.String filePath, UploadBinaryForm uploadForm)
           
 void useLogger(java.io.PrintStream logger)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppaloosaClient

public AppaloosaClient(java.lang.String organisationToken)

AppaloosaClient

public AppaloosaClient(java.lang.String organisationToken,
                       java.lang.String proxyHost,
                       int proxyPort,
                       java.lang.String proxyUser,
                       java.lang.String proxyPass)
Method Detail

deployFile

public void deployFile(java.lang.String filePath)
                throws AppaloosaDeployException
Parameters:
filePath - physical path of the file to upload
Throws:
AppaloosaDeployException - when something went wrong

publish

protected MobileApplicationUpdate publish(MobileApplicationUpdate update)
                                   throws AppaloosaDeployException
Throws:
AppaloosaDeployException

readBodyResponse

protected java.lang.String readBodyResponse(org.apache.http.HttpResponse response)
                                     throws org.apache.http.ParseException,
                                            java.io.IOException
Throws:
org.apache.http.ParseException
java.io.IOException

publishUpdateUrl

protected java.lang.String publishUpdateUrl()

getMobileApplicationUpdateDetails

protected MobileApplicationUpdate getMobileApplicationUpdateDetails(java.lang.Integer id)
                                                             throws AppaloosaDeployException
Throws:
AppaloosaDeployException

createExceptionWithAppaloosaErrorResponse

protected AppaloosaDeployException createExceptionWithAppaloosaErrorResponse(org.apache.http.HttpResponse response,
                                                                             java.lang.String prefix)
                                                                      throws org.apache.http.ParseException,
                                                                             java.io.IOException
Throws:
org.apache.http.ParseException
java.io.IOException

updateUrl

protected java.lang.String updateUrl(java.lang.Integer id)

smallWait

protected void smallWait()

notifyAppaloosaForFile

protected MobileApplicationUpdate notifyAppaloosaForFile(java.lang.String filePath,
                                                         UploadBinaryForm uploadForm)
                                                  throws AppaloosaDeployException
Throws:
AppaloosaDeployException

constructKey

protected java.lang.String constructKey(java.lang.String key,
                                        java.lang.String filePath)

uploadFile

protected void uploadFile(java.lang.String filePath,
                          UploadBinaryForm uploadForm)
                   throws AppaloosaDeployException
Throws:
AppaloosaDeployException

createHttpPost

protected org.apache.http.client.methods.HttpPost createHttpPost(UploadBinaryForm uploadForm,
                                                                 java.io.File file)
                                                          throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

addParam

protected void addParam(org.apache.http.entity.mime.MultipartEntity entity,
                        java.lang.String paramName,
                        java.lang.String paramValue)
                 throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException

readErrorFormAmazon

protected java.lang.String readErrorFormAmazon(java.lang.String body)

getUploadForm

protected UploadBinaryForm getUploadForm()
                                  throws AppaloosaDeployException
Throws:
AppaloosaDeployException

useLogger

public void useLogger(java.io.PrintStream logger)

onBinaryUploadUrl

protected java.lang.String onBinaryUploadUrl()

newBinaryUrl

protected java.lang.String newBinaryUrl()

getAppaloosaBaseUrl

protected java.lang.String getAppaloosaBaseUrl()

setBaseUrl

public void setBaseUrl(java.lang.String appaloosaUrl)
To change the url of appaloosa server. Mostly for tests usage or for future evolutions.

Parameters:
appaloosaUrl -

setPort

public void setPort(int port)
To change port of appaloosa server. Mostly for tests usage or for future evolutions.

Parameters:
appaloosaUrl -

setWaitDuration

protected void setWaitDuration(int waitDuration)


Copyright © 2004-2012. All Rights Reserved.