com.citygrid
Class CGShared

java.lang.Object
  extended by com.citygrid.CGShared
All Implemented Interfaces:
Serializable

public class CGShared
extends Object
implements Serializable

See Also:
Serialized Form

Field Summary
private  String baseUrl
           
private  int connectTimeout
           
private  boolean debug
           
private static CGShared instance
           
private static Logger logger
           
private  String mobileType
           
private  String muid
           
private  String placement
           
private  String publisher
           
private  int readTimeout
           
private static long serialVersionUID
           
private  boolean simulation
           
 
Constructor Summary
private CGShared()
           
 
Method Summary
(package private)  String buildSimulationJsonPath(String apiUrl)
           
(package private)  String dictAsUrlEncodedParameters(Map<String,Object> dict)
          IMPOOTANT!!! Only String and String[] are allowed as value of a parameter.
 boolean equals(Object obj)
           
 CGError errorWithErrorNum(CGErrorNum errorNum)
           
 String getBaseUrl()
           
 Integer getConnectTimeout()
           
 boolean getDebug()
           
 String getMobileType()
           
 String getMuid()
           
 String getPlacement()
           
 String getPublisher()
           
 int getReadTimeout()
           
private  String getResponseAsString(HttpURLConnection connection)
           
static CGShared getSharedInstance()
           
 boolean getSimulation()
           
 int hashCode()
           
private  String readStringFromInputStream(InputStream is)
           
 org.codehaus.jackson.JsonNode sendSynchronousRequest(String apiUrl, Map<String,Object> parameters, int connectTimeout, int readTimeout)
          Mirroring citygrid-ios API so using List to return errors instead of throw exceptions.
 void setBaseUrl(String baseUrl)
           
 void setConnectTimeout(int connectTimeout)
           
 void setDebug(boolean debug)
           
 void setMobileType(String mobileType)
           
 void setMuid(String muid)
           
 void setPlacement(String placement)
           
 void setPublisher(String publisher)
           
 void setReadTimeout(int readTimeout)
           
 void setSimulation(boolean simulation)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

logger

private static Logger logger

instance

private static final CGShared instance

publisher

private String publisher

placement

private String placement

connectTimeout

private int connectTimeout

readTimeout

private int readTimeout

baseUrl

private String baseUrl

debug

private boolean debug

simulation

private boolean simulation

muid

private String muid

mobileType

private String mobileType
Constructor Detail

CGShared

private CGShared()
Method Detail

getSharedInstance

public static CGShared getSharedInstance()

getPublisher

public String getPublisher()

setPublisher

public void setPublisher(String publisher)

getPlacement

public String getPlacement()

setPlacement

public void setPlacement(String placement)

getConnectTimeout

public Integer getConnectTimeout()

setConnectTimeout

public void setConnectTimeout(int connectTimeout)

getReadTimeout

public int getReadTimeout()

setReadTimeout

public void setReadTimeout(int readTimeout)

getBaseUrl

public String getBaseUrl()

setBaseUrl

public void setBaseUrl(String baseUrl)

getDebug

public boolean getDebug()

setDebug

public void setDebug(boolean debug)

getSimulation

public boolean getSimulation()

setSimulation

public void setSimulation(boolean simulation)

getMuid

public String getMuid()

setMuid

public void setMuid(String muid)

getMobileType

public String getMobileType()

setMobileType

public void setMobileType(String mobileType)

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

sendSynchronousRequest

public org.codehaus.jackson.JsonNode sendSynchronousRequest(String apiUrl,
                                                            Map<String,Object> parameters,
                                                            int connectTimeout,
                                                            int readTimeout)
                                                     throws CGException
Mirroring citygrid-ios API so using List to return errors instead of throw exceptions.

Parameters:
apiUrl -
parameters -
connectTimeout -
readTimeout - @return
Throws:
CGException

buildSimulationJsonPath

String buildSimulationJsonPath(String apiUrl)

getResponseAsString

private String getResponseAsString(HttpURLConnection connection)
                            throws IOException
Throws:
IOException

readStringFromInputStream

private String readStringFromInputStream(InputStream is)
                                  throws IOException
Throws:
IOException

dictAsUrlEncodedParameters

String dictAsUrlEncodedParameters(Map<String,Object> dict)
IMPOOTANT!!! Only String and String[] are allowed as value of a parameter. Other types will lead to run time exception!!!

Parameters:
dict -
Returns:

errorWithErrorNum

public CGError errorWithErrorNum(CGErrorNum errorNum)


Copyright © 2011. All Rights Reserved.