org.semispace.ws.client
Class SemiSpaceProxy

java.lang.Object
  extended by org.semispace.ws.client.SemiSpaceProxy
All Implemented Interfaces:
SemiSpaceInterface

public class SemiSpaceProxy
extends Object
implements SemiSpaceInterface

Client side proxy of SemiSpace web services


Method Summary
 SemiEventRegistration notify(Object template, SemiEventListener listener, long duration)
          Notify is illegal to use in proxy
 Object read(Object template, long duration)
          Read an object from the space, which has matching fields (or getters) with the template
 Object readIfExists(Object template)
          Same as read, with duration 0
protected static WsSpace readSpaceServiceAsSpring()
          An alternative way of performing lookup
protected static WsSpace readSpaceServiceAsStandardPort()
           
protected static WsSpace readSpaceServiceAsStandardPort(String endpointAddress)
           
static SemiSpaceInterface retrieveSpace(String endpoint)
          Open WS connection to the defined end point.
protected static SemiSpaceProxy retrieveSpace(WsSpace space)
          This is a bit roundabout, but is used for junit purposes.
protected  void setSpace(WsSpace space)
           
 Object take(Object template, long duration)
          Same as read, except that the object is removed from the space.
 Object takeIfExists(Object template)
          Same as take, with a duration of 0
 SemiLease write(Object obj, long duration)
          TODO Consider fixing that null is always returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

retrieveSpace

public static SemiSpaceInterface retrieveSpace(String endpoint)
Open WS connection to the defined end point. This should be something similar to http://localhost:8080/semispace-war/services/space.


readSpaceServiceAsSpring

protected static WsSpace readSpaceServiceAsSpring()
An alternative way of performing lookup


readSpaceServiceAsStandardPort

protected static WsSpace readSpaceServiceAsStandardPort()

readSpaceServiceAsStandardPort

protected static WsSpace readSpaceServiceAsStandardPort(String endpointAddress)

retrieveSpace

protected static SemiSpaceProxy retrieveSpace(WsSpace space)
This is a bit roundabout, but is used for junit purposes.


notify

public SemiEventRegistration notify(Object template,
                                    SemiEventListener listener,
                                    long duration)
Notify is illegal to use in proxy

Specified by:
notify in interface SemiSpaceInterface
Parameters:
template - Template to be matched.
listener - Listener to be notified when object with a matching template is found
duration - How long this particular listener is valid.
Returns:
An event registration or null

read

public Object read(Object template,
                   long duration)
Description copied from interface: SemiSpaceInterface
Read an object from the space, which has matching fields (or getters) with the template

Specified by:
read in interface SemiSpaceInterface
Parameters:
template - Object of exactly the same type as what is wanted as return value, with zero or more none-null fields or getters.
duration - How long you are willing to wait for an answer / match.
Returns:
An object when matches the template, or null of none are found.

readIfExists

public Object readIfExists(Object template)
Description copied from interface: SemiSpaceInterface
Same as read, with duration 0

Specified by:
readIfExists in interface SemiSpaceInterface
See Also:
SemiSpaceInterface.read(Object, long)

take

public Object take(Object template,
                   long duration)
Description copied from interface: SemiSpaceInterface
Same as read, except that the object is removed from the space.

Specified by:
take in interface SemiSpaceInterface
See Also:
SemiSpaceInterface.read(Object, long)

takeIfExists

public Object takeIfExists(Object template)
Description copied from interface: SemiSpaceInterface
Same as take, with a duration of 0

Specified by:
takeIfExists in interface SemiSpaceInterface
See Also:
SemiSpaceInterface.take(Object, long), SemiSpaceInterface.read(Object, long)

write

public SemiLease write(Object obj,
                       long duration)
TODO Consider fixing that null is always returned.

Specified by:
write in interface SemiSpaceInterface
Parameters:
obj - Object to be written into the space
duration - Life time in milliseconds of the written object
Returns:
will presently ALWAYS return null, even when operation was a success.
See Also:
SemiSpaceInterface.write(java.lang.Object, long)

setSpace

protected void setSpace(WsSpace space)


Copyright © 2008-2012. All Rights Reserved.