|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.trendmicro.grid.acl.client.ServiceClient
public class ServiceClient
Implements a sharable, thread safe client to connect to the JAX-WS based web services.
Constructor Summary | |
---|---|
ServiceClient()
Creates a new service client using built-in default settings. |
|
ServiceClient(String defaultHost,
int defaultPortNumber,
boolean defaultSecure)
Creates a new service client for the given default hostname, port number and SSL option. |
|
ServiceClient(String defaultHost,
int defaultPortNumber,
boolean defaultSecure,
UUID apiKey)
Creates a new service client for the given default hostname, port number and SSL option. |
|
ServiceClient(String defaultHost,
UUID apiKey)
Creates a new service client using the given GRID ACL default host and an optional api-key. |
Method Summary | ||
---|---|---|
void |
configureWithSessionCookies(URLConnection urlConnection)
Adds session cookies to the given http url connection. |
|
static com.trendmicro.grid.acl.l0.datatypes.FileIdentifier |
generateFileIdentifier(File source)
Is a utility method that generates a file identifier from the given File. |
|
static com.trendmicro.grid.acl.l0.datatypes.FileIdentifier |
generateFileIdentifier(URL source)
Is a utility method that generates a file identifier from the given URL. |
|
net.sf.tinyjee.ws.client.ClientServiceContext |
getContext()
Returns the underlying client context instance. |
|
String |
getDefaultHost()
|
|
int |
getDefaultPortNumber()
|
|
Collection<Class<? extends com.trendmicro.grid.acl.Service>> |
getDefinedPorts()
Returns all endpoint interfaces of the service definitions. |
|
InputStream |
getFromUrl(URL sourceUrl)
Gets content from the given URL using the same session as used with web-service calls. |
|
void |
getFromUrl(URL sourceUrl,
OutputStream targetStream)
Gets content from the given URL using the same session as used with web-service calls and writes it to the provided output stream. |
|
|
getPort(Class<T> endpointInterface)
Returns a cached port (proxy) of the given endpoint interface using the specified default values for host, port-number and security. |
|
|
getPort(Class<T> endpointInterface,
String host)
Returns a cached port (proxy) of the given endpoint interface. |
|
|
getPort(Class<T> endpointInterface,
String host,
int port,
boolean secure,
WebServiceFeature... features)
Returns a cached port (proxy) of the given endpoint interface. |
|
boolean |
isDefaultSecure()
|
|
HttpURLConnection |
preparePutToUrl(URL targetUrl)
Prepares a HttpURLConnection to PUT content to the underlying URL using the same session as used with web-service calls. |
|
void |
putToUrl(InputStream inputStream,
URL targetUrl)
Puts content to the given URI using the same session as used with web-service calls. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ServiceClient()
public ServiceClient(String defaultHost, UUID apiKey)
defaultHost
- the default hostname to use when retrieving a port using getPort(Class)
.apiKey
- an optional API key to use with SOAP calls (can be set to 'null' if not relevant).
If specified, connections are by default opened using a secured (SSL/TLS) connection.public ServiceClient(String defaultHost, int defaultPortNumber, boolean defaultSecure)
defaultHost
- the default hostname to use when retrieving a port using getPort(Class)
.defaultPortNumber
- the port number of the ACL running on the given host. Use '0' to use the protocol's default port.defaultSecure
- toggles whether the service is by default accessed using a secured (SSL/TLS) connection.public ServiceClient(String defaultHost, int defaultPortNumber, boolean defaultSecure, UUID apiKey)
defaultHost
- the default hostname to use when retrieving a port using getPort(Class)
.defaultPortNumber
- the port number of the ACL running on the given host. Use '0' to use the protocol's default port.defaultSecure
- toggles whether the service is by default accessed using a secured (SSL/TLS) connection.apiKey
- an optional API key to use with SOAP calls. (can be set to 'null')Method Detail |
---|
public net.sf.tinyjee.ws.client.ClientServiceContext getContext()
public static com.trendmicro.grid.acl.l0.datatypes.FileIdentifier generateFileIdentifier(URL source) throws IOException
source
- the source to generate the file-identifier of.
IOException
- in case of reading the source failed.public static com.trendmicro.grid.acl.l0.datatypes.FileIdentifier generateFileIdentifier(File source) throws IOException
source
- the source to generate the file-identifier of.
IOException
- in case of reading the source failed.public InputStream getFromUrl(URL sourceUrl) throws IOException
sourceUrl
- the URL to GET.
IOException
- in case of reading the content failed.public void getFromUrl(URL sourceUrl, OutputStream targetStream) throws IOException
getFromUrl(java.net.URL)
as it also evaluates HTTP response codes and
error replies from the server.
sourceUrl
- the URL to GET.targetStream
- the target to write the content to.
IOException
- In case of reading or writing the content failed.public void putToUrl(InputStream inputStream, URL targetUrl) throws IOException
inputStream
- the stream of the content to put.targetUrl
- the target URL to put the content to.
IOException
- In case of reading or writing the content failed.public HttpURLConnection preparePutToUrl(URL targetUrl) throws IOException
targetUrl
- the target URL to put the content to.
IOException
- In case of reading or setting the cookies fails.public void configureWithSessionCookies(URLConnection urlConnection) throws IOException
urlConnection
- the url connection to configure.
IOException
- in case of the configuration failed.public String getDefaultHost()
public int getDefaultPortNumber()
public boolean isDefaultSecure()
public <T extends com.trendmicro.grid.acl.Service> T getPort(Class<T> endpointInterface)
Service
to see what endpoint interfaces exist and can be used here.
T
- the endpoint interface type.endpointInterface
- the interface describing the endpoint protocol.
public <T extends com.trendmicro.grid.acl.Service> T getPort(Class<T> endpointInterface, String host)
Service
to see what endpoint interfaces exist and can be used here.
T
- the endpoint interface type.endpointInterface
- the interface describing the endpoint protocol.host
- the hostname of the remote machine to connect to.
public <T extends com.trendmicro.grid.acl.Service> T getPort(Class<T> endpointInterface, String host, int port, boolean secure, WebServiceFeature... features)
Service
to see what endpoint interfaces exist and can be used here.
T
- the endpoint interface type.endpointInterface
- the interface describing the endpoint protocol.host
- the hostname of the remote machine to connect to.port
- the port number of the remote machine to connect to.secure
- whether a secure transport should be chosen.features
- specifies additional standard or vendor specific features that
may be applied to the returned port proxy.
public Collection<Class<? extends com.trendmicro.grid.acl.Service>> getDefinedPorts()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |