public abstract class AbstractClient extends Object
This is an abstract class, that implements the basic functions for communication with the IS24-Webservice.
Modifier and Type | Field and Description |
---|---|
static String |
LIVE_API |
static String |
SANDBOX_API |
Modifier | Constructor and Description |
---|---|
protected |
AbstractClient(String apiBaseUrl,
String consumerToken,
String consumerSecret)
Creates an instance of
AbstractClient . |
Modifier and Type | Method and Description |
---|---|
void |
authorize(Authorization authorization)
Initializes client with access credentials.
|
void |
authorize(String accessToken,
String accessSecret)
Initializes client with access credentials.
|
Authorization |
authorizeAfterVerification(String verificationToken,
String verificationSecret,
String verificationCode)
Initializes client after a succesful verification.
|
Authorization |
authorizeAfterVerification(Verification verification,
String verificationCode)
Initializes client after a succesful verification.
|
protected oauth.signpost.OAuthConsumer |
buildOAuthConsumer(String token,
String secret)
Creates an
OAuthConsumer object for access credentials. |
protected oauth.signpost.OAuthProvider |
buildOAuthProvider(String apiBaseUrl)
Creates an
OAuthProvider for the IS24-Webservice. |
Verification |
fetchVerification()
Initiates a verification process.
|
Verification |
fetchVerification(String callbackUrl)
Initiates a verification process.
|
String |
getApiBaseUrl()
Returns URL of the configured IS24-Webservice.
|
oauth.signpost.OAuthConsumer |
getAuthConsumer()
Returns
OAuthConsumer of the client for the current authorization. |
oauth.signpost.OAuthProvider |
getAuthProvider()
Returns
OAuthProvider of the client for the current authorization. |
static String |
getEncodedParameterValue(String value)
Deprecated.
use
getUrlEncodedValue(java.lang.String) instead |
static String |
getEncoding()
Returns encoding for transferred data.
|
static String |
getUrlEncodedValue(String value)
Encodes a string value for use in an URL.
|
protected abstract Response |
sendVideoUploadRequest(URL url,
RequestMethod method,
String auth,
InputStream input,
String fileName,
long fileSize)
Sends a video with an authentication value to the IS24-Webservice.
|
protected abstract Response |
sendXmlAttachmentRequest(URL url,
RequestMethod method,
String xml,
InputStream input,
String fileName,
String mimeType)
Sends a XML string together with a file to the IS24-Webservice.
|
protected abstract Response |
sendXmlRequest(URL url,
RequestMethod method,
String xml)
Sends a XML string to the IS24-Webservice.
|
public static final String LIVE_API
public static final String SANDBOX_API
protected AbstractClient(String apiBaseUrl, String consumerToken, String consumerSecret)
AbstractClient
.apiBaseUrl
- base URL of the IS24-Webservice (see LIVE_API
and
SANDBOX_API
)consumerToken
- consumer token, that identifies the application at the IS24-WebserviceconsumerSecret
- consumer secret, that identifies the application at the IS24-Webservicepublic final void authorize(Authorization authorization) throws oauth.signpost.exception.OAuthException
authorization
- Authorization
object, that contains the credentials for permanent
access to the IS24-Webserviceoauth.signpost.exception.OAuthException
- if intitalization of the authorization failedpublic final void authorize(String accessToken, String accessSecret) throws oauth.signpost.exception.OAuthException
accessToken
- token for permanent access to the IS24-WebserviceaccessSecret
- secret for permanent access to the IS24-Webserviceoauth.signpost.exception.OAuthException
- if intitalization of the authorization failedpublic final Authorization authorizeAfterVerification(Verification verification, String verificationCode) throws oauth.signpost.exception.OAuthException
verification
- Verification
object, that contains the credentials for temporary
access to the IS24-Webservice during verificationverificationCode
- verification code, that was received after the verification was finishedAuthorization
object, that contains the access credentials for
future useoauth.signpost.exception.OAuthException
- if intitalization of the authorization failedpublic final Authorization authorizeAfterVerification(String verificationToken, String verificationSecret, String verificationCode) throws oauth.signpost.exception.OAuthException
verificationToken
- token for temporary access to the IS24-Webservice during verificationverificationSecret
- secret for temporary access to the IS24-Webservice during verificationverificationCode
- verification code, that was received after the verification was finishedAuthorization
object, that contains the access credentials for
future useoauth.signpost.exception.OAuthException
- if intitalization of the authorization failedprotected oauth.signpost.OAuthConsumer buildOAuthConsumer(String token, String secret)
OAuthConsumer
object for access credentials.
Different implementations of AbstractClient
may create different
OAuthConsumer
objects.
token
- access or verification tokensecret
- access or verification secretOAuthConsumer
for the provided credentialsprotected oauth.signpost.OAuthProvider buildOAuthProvider(String apiBaseUrl)
OAuthProvider
for the IS24-Webservice.
Different implementations of AbstractClient
may create different
OAuthProvider
objects.
apiBaseUrl
- URL of the IS24-WebserviceOAuthProvider
for the provided URLpublic final Verification fetchVerification() throws oauth.signpost.exception.OAuthException
Verification
that contains informations about the
initiated verification processoauth.signpost.exception.OAuthException
- if initiation failedpublic final Verification fetchVerification(String callbackUrl) throws oauth.signpost.exception.OAuthException
callbackUrl
- the URL, where the user is redirected to, after the verification was
finished / cancelledVerification
that contains informations about the
initiated verification processoauth.signpost.exception.OAuthException
- if initiation failedpublic final String getApiBaseUrl()
public final oauth.signpost.OAuthConsumer getAuthConsumer() throws oauth.signpost.exception.OAuthNotAuthorizedException
OAuthConsumer
of the client for the current authorization.OAuthConsumer
instance of the clientoauth.signpost.exception.OAuthNotAuthorizedException
- if the client is not authorizedpublic final oauth.signpost.OAuthProvider getAuthProvider() throws oauth.signpost.exception.OAuthNotAuthorizedException
OAuthProvider
of the client for the current authorization.OAuthProvider
instance of the clientoauth.signpost.exception.OAuthNotAuthorizedException
- if the client is not authorized@Deprecated public static String getEncodedParameterValue(String value)
getUrlEncodedValue(java.lang.String)
insteadvalue
- the value to encodepublic static String getEncoding()
This function always returns XmlUtils.DEFAULT_ENCODING
.
public static String getUrlEncodedValue(String value)
value
- the value to encodeprotected abstract Response sendXmlRequest(URL url, RequestMethod method, String xml) throws IOException, oauth.signpost.exception.OAuthException
This function must be implemendet by specific implementations of
AbstractClient
.
url
- URL of the IS24-Webservice, where the request is sent tomethod
- HTTP method of the outgoing requestxml
- XML string, that is sent to the IS24-WebserviceIOException
- if communication with IS24-Webservice failedoauth.signpost.exception.OAuthException
- if authorization failedprotected abstract Response sendXmlAttachmentRequest(URL url, RequestMethod method, String xml, InputStream input, String fileName, String mimeType) throws IOException, oauth.signpost.exception.OAuthException
This function must be implemendet by specific implementations of
AbstractClient
.
url
- URL of the IS24-Webservice, where the request is sent tomethod
- the HTTP method of the outgoing requestxml
- the XML string, that is sent to the IS24-Webserviceinput
- the file content, that is sent to the IS24-WebservicefileName
- the name of the file, that is sent to the IS24-WebservicemimeType
- the MIME-type of the file, that is sent to the IS24-WebserviceIOException
- if communication with IS24-Webservice failedoauth.signpost.exception.OAuthException
- if authorization failedprotected abstract Response sendVideoUploadRequest(URL url, RequestMethod method, String auth, InputStream input, String fileName, long fileSize) throws IOException, oauth.signpost.exception.OAuthException
This function must be implemendet by specific implementations of
AbstractClient
.
url
- URL of the IS24-Webservice, where the request is sent tomethod
- HTTP method of the outgoing requestauth
- authentication value, that is sent to the IS24-Webserviceinput
- file content, that is sent to the IS24-WebservicefileName
- name of the file, that is sent to the IS24-WebservicefileSize
- size of the file, that is sent to the IS24-Webservice (in bytes)IOException
- if communication with IS24-Webservice failedoauth.signpost.exception.OAuthException
- if authorization failedCopyright © 2014 OpenEstate. All rights reserved.