org.semispace.ws.client
Class SemiSpaceTokenProxy

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

public class SemiSpaceTokenProxy
extends Object
implements SemiSpaceInterface


Method Summary
 String getPassword()
           
 String getUsername()
           
 boolean hasToken()
          If a token is present, you are authenticated
 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 TokenWsSpace readSpaceServiceAsSpring()
          An alternative way of performing lookup
protected static TokenWsSpace readSpaceServiceAsStandardPort()
           
protected static TokenWsSpace readSpaceServiceAsStandardPort(String endpointAddress)
           
static SemiSpaceTokenProxy retrieveSpace(String endpoint)
          Open WS connection to the defined end point.
protected static SemiSpaceTokenProxy retrieveSpace(TokenWsSpace space)
          This is a bit roundabout, but is used for junit purposes.
 void setPassword(String password)
           
protected  void setSpace(TokenWsSpace space)
           
 void setUsername(String username)
           
 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

getUsername

public String getUsername()

setUsername

public void setUsername(String username)

getPassword

public String getPassword()

setPassword

public void setPassword(String password)

retrieveSpace

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


readSpaceServiceAsSpring

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


readSpaceServiceAsStandardPort

protected static TokenWsSpace readSpaceServiceAsStandardPort()

readSpaceServiceAsStandardPort

protected static TokenWsSpace readSpaceServiceAsStandardPort(String endpointAddress)

retrieveSpace

protected static SemiSpaceTokenProxy retrieveSpace(TokenWsSpace 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)

hasToken

public boolean hasToken()
If a token is present, you are authenticated


setSpace

protected void setSpace(TokenWsSpace space)


Copyright © 2008-2012. All Rights Reserved.