org.openrdf.http.object.client
Class HTTPObjectClient

java.lang.Object
  extended by org.openrdf.http.object.client.HTTPObjectClient
All Implemented Interfaces:
HTTPService, HTTPObjectAgentMXBean

public class HTTPObjectClient
extends Object
implements HTTPService, HTTPObjectAgentMXBean

Manages the connections and cache for outgoing requests.

Author:
James Leigh

Field Summary
protected static String DEFAULT_NAME
           
 
Method Summary
 void destroy()
           
 int getCacheCapacity()
           
 int getCacheSize()
           
 ConnectionBean[] getConnections()
           
 String getEnvelopeType()
           
 String getFrom()
           
static HTTPObjectClient getInstance()
           
 String getName()
           
 String getStatus()
           
 void invalidateCache()
           
 boolean isCacheAggressive()
           
 boolean isCacheDisconnected()
           
 boolean isCacheEnabled()
           
 boolean isRunning()
           
 void poke()
           
 boolean removeProxy(InetSocketAddress destination, HTTPService proxy)
           
 void resetCache()
           
 void resetConnections()
           
 org.apache.http.HttpResponse service(org.apache.http.HttpRequest request)
          HttpEntity.consumeContent() or HttpEntity.writeTo(java.io.OutputStream) must be called if HttpResponse.getEntity() is non-null.
 org.apache.http.HttpResponse service(InetSocketAddress proxy, org.apache.http.HttpRequest request)
          HttpEntity.consumeContent() or HttpEntity.writeTo(java.io.OutputStream) must be called if HttpResponse.getEntity() is non-null.
 void setCacheAggressive(boolean cacheAggressive)
           
 void setCacheCapacity(int capacity)
           
 void setCacheDisconnected(boolean cacheDisconnected)
           
 void setCacheEnabled(boolean cacheEnabled)
           
 void setEnvelopeType(String type)
           
 void setFrom(String from)
           
static void setInstance(File dir, int maxCapacity)
           
 void setName(String agent)
           
 HTTPService setProxy(InetSocketAddress destination, HTTPService proxy)
           
 void start()
           
 void stop()
           
 Future<org.apache.http.HttpResponse> submitRequest(org.apache.http.HttpRequest request)
          HttpEntity.consumeContent() or HttpEntity.writeTo(java.io.OutputStream) must be called if HttpResponse.getEntity() is non-null.
 Future<org.apache.http.HttpResponse> submitRequest(InetSocketAddress proxy, org.apache.http.HttpRequest request)
          HttpEntity.consumeContent() or HttpEntity.writeTo(java.io.OutputStream) must be called if HttpResponse.getEntity() is non-null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NAME

protected static final String DEFAULT_NAME
Method Detail

getInstance

public static HTTPObjectClient getInstance()
                                    throws IOException
Throws:
IOException

setInstance

public static void setInstance(File dir,
                               int maxCapacity)
                        throws Exception
Throws:
Exception

getName

public String getName()
Specified by:
getName in interface HTTPObjectAgentMXBean

setName

public void setName(String agent)
Specified by:
setName in interface HTTPObjectAgentMXBean

getEnvelopeType

public String getEnvelopeType()

setEnvelopeType

public void setEnvelopeType(String type)
                     throws MimeTypeParseException
Throws:
MimeTypeParseException

setProxy

public HTTPService setProxy(InetSocketAddress destination,
                            HTTPService proxy)

removeProxy

public boolean removeProxy(InetSocketAddress destination,
                           HTTPService proxy)

isCacheAggressive

public boolean isCacheAggressive()
Specified by:
isCacheAggressive in interface HTTPObjectAgentMXBean

isCacheDisconnected

public boolean isCacheDisconnected()
Specified by:
isCacheDisconnected in interface HTTPObjectAgentMXBean

isCacheEnabled

public boolean isCacheEnabled()
Specified by:
isCacheEnabled in interface HTTPObjectAgentMXBean

setCacheAggressive

public void setCacheAggressive(boolean cacheAggressive)
Specified by:
setCacheAggressive in interface HTTPObjectAgentMXBean

setCacheDisconnected

public void setCacheDisconnected(boolean cacheDisconnected)
Specified by:
setCacheDisconnected in interface HTTPObjectAgentMXBean

setCacheEnabled

public void setCacheEnabled(boolean cacheEnabled)
Specified by:
setCacheEnabled in interface HTTPObjectAgentMXBean

getCacheCapacity

public int getCacheCapacity()
Specified by:
getCacheCapacity in interface HTTPObjectAgentMXBean

setCacheCapacity

public void setCacheCapacity(int capacity)
Specified by:
setCacheCapacity in interface HTTPObjectAgentMXBean

getCacheSize

public int getCacheSize()
Specified by:
getCacheSize in interface HTTPObjectAgentMXBean

invalidateCache

public void invalidateCache()
                     throws IOException,
                            InterruptedException
Specified by:
invalidateCache in interface HTTPObjectAgentMXBean
Throws:
IOException
InterruptedException

resetCache

public void resetCache()
                throws IOException,
                       InterruptedException
Specified by:
resetCache in interface HTTPObjectAgentMXBean
Throws:
IOException
InterruptedException

getFrom

public String getFrom()
Specified by:
getFrom in interface HTTPObjectAgentMXBean

setFrom

public void setFrom(String from)
Specified by:
setFrom in interface HTTPObjectAgentMXBean

start

public void start()
Specified by:
start in interface HTTPObjectAgentMXBean

isRunning

public boolean isRunning()

submitRequest

public Future<org.apache.http.HttpResponse> submitRequest(InetSocketAddress proxy,
                                                          org.apache.http.HttpRequest request)
                                                   throws IOException
HttpEntity.consumeContent() or HttpEntity.writeTo(java.io.OutputStream) must be called if HttpResponse.getEntity() is non-null.

Throws:
IOException

submitRequest

public Future<org.apache.http.HttpResponse> submitRequest(org.apache.http.HttpRequest request)
                                                   throws IOException
HttpEntity.consumeContent() or HttpEntity.writeTo(java.io.OutputStream) must be called if HttpResponse.getEntity() is non-null.

Throws:
IOException

service

public org.apache.http.HttpResponse service(InetSocketAddress proxy,
                                            org.apache.http.HttpRequest request)
                                     throws IOException,
                                            GatewayTimeout
HttpEntity.consumeContent() or HttpEntity.writeTo(java.io.OutputStream) must be called if HttpResponse.getEntity() is non-null.

Throws:
IOException
GatewayTimeout

service

public org.apache.http.HttpResponse service(org.apache.http.HttpRequest request)
                                     throws IOException,
                                            GatewayTimeout
HttpEntity.consumeContent() or HttpEntity.writeTo(java.io.OutputStream) must be called if HttpResponse.getEntity() is non-null.

Specified by:
service in interface HTTPService
Throws:
IOException
GatewayTimeout

stop

public void stop()
          throws Exception
Specified by:
stop in interface HTTPObjectAgentMXBean
Throws:
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface HTTPObjectAgentMXBean
Throws:
Exception

resetConnections

public void resetConnections()
                      throws IOException
Specified by:
resetConnections in interface HTTPObjectAgentMXBean
Throws:
IOException

poke

public void poke()
Specified by:
poke in interface HTTPObjectAgentMXBean

getStatus

public String getStatus()
Specified by:
getStatus in interface HTTPObjectAgentMXBean

getConnections

public ConnectionBean[] getConnections()
Specified by:
getConnections in interface HTTPObjectAgentMXBean


Copyright © 2004-2010 James Leigh Services Inc.. All Rights Reserved.