edu.iris.dmc.service
Class BaseService

java.lang.Object
  extended by edu.iris.dmc.service.BaseService
Direct Known Subclasses:
EventService, RespService, SacpzService, StationService, WaveformService

public class BaseService
extends Object


Field Summary
protected  String appName
           
protected  String baseUrl
           
static int DEFAULT_READ_TIMEOUT_IN_MS
           
protected  String password
           
protected  String userAgent
           
protected  String username
           
 
Constructor Summary
BaseService(String version, String v, String userAgent)
           
 
Method Summary
protected  void authenticate(boolean authenticate)
           
 String getAppName()
           
 String getBaseUrl()
           
protected  HttpURLConnection getConnection(URL u)
           
 void setAppName(String appName)
          Provide an appName included in the User-Agent.
 void setBaseUrl(String url)
           
 void stream(OutputStream out, Criteria criteria)
          Stream result into output stream, can be used to save result to a local file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_READ_TIMEOUT_IN_MS

public static int DEFAULT_READ_TIMEOUT_IN_MS

appName

protected String appName

baseUrl

protected String baseUrl

userAgent

protected String userAgent

username

protected String username

password

protected String password
Constructor Detail

BaseService

public BaseService(String version,
                   String v,
                   String userAgent)
Method Detail

authenticate

protected void authenticate(boolean authenticate)

getConnection

protected HttpURLConnection getConnection(URL u)
                                   throws IOException,
                                          ServiceNotSupportedException
Throws:
IOException
ServiceNotSupportedException

stream

public void stream(OutputStream out,
                   Criteria criteria)
            throws NoDataFoundException,
                   CriteriaException,
                   IOException,
                   ServiceNotSupportedException,
                   UnauthorizedAccessException
Stream result into output stream, can be used to save result to a local file.

Parameters:
out -
criteria -
Throws:
NoDataFoundException - (404)
CriteriaException - (400)
IOException
ServiceNotSupportedException
UnauthorizedAccessException

setAppName

public void setAppName(String appName)
Provide an appName included in the User-Agent. This text string is intended to uniquely identify an application. Preferred string format: "APPNAME/VERSION"

Parameters:
appName -

getAppName

public String getAppName()
Returns:
the App name used for User-Agent

getBaseUrl

public String getBaseUrl()

setBaseUrl

public void setBaseUrl(String url)


Copyright © 2013. All Rights Reserved.