livespace.elvin.client
Class ElvinClient

java.lang.Object
  extended by livespace.elvin.client.ElvinClient
All Implemented Interfaces:
IElvinClient

public class ElvinClient
extends Object
implements IElvinClient

Manages the shared client connection to an Elvin router for all OSGi services.

Author:
Matthew Phillips

Field Summary
protected  livespace.elvin.client.ElvinClient.ElvinConnectThread connectionThread
           
protected  org.osgi.framework.BundleContext context
           
protected  boolean disableTcpDelay
           
protected  Elvin elvin
           
protected  org.osgi.framework.ServiceRegistration elvinRegistration
           
protected  String elvinUrl
           
protected  boolean running
           
protected  Properties serviceConfig
           
 
Constructor Summary
ElvinClient(Properties config, org.osgi.framework.BundleContext context)
           
 
Method Summary
protected  void asyncConnect()
           
protected static int avisLogToDfc(int type)
           
protected  void connect()
          Connect to elvin.
protected  void disconnect()
          Disconnect from elvin.
 Elvin getConnection()
          The shared Elvin client connection.
protected  void initConnection()
           
protected  void register()
          Register this instance as the Elvin OSGi service.
 void start()
           
 void stop()
           
protected  void tryConnect()
          Try to connect to elvin.
protected  void unregister()
          Unregister this instance as the Elvin OSGi service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elvinUrl

protected String elvinUrl

disableTcpDelay

protected boolean disableTcpDelay

elvin

protected Elvin elvin

context

protected org.osgi.framework.BundleContext context

elvinRegistration

protected org.osgi.framework.ServiceRegistration elvinRegistration

connectionThread

protected livespace.elvin.client.ElvinClient.ElvinConnectThread connectionThread

serviceConfig

protected Properties serviceConfig

running

protected boolean running
Constructor Detail

ElvinClient

public ElvinClient(Properties config,
                   org.osgi.framework.BundleContext context)
            throws ConfigurationException
Throws:
ConfigurationException
Method Detail

avisLogToDfc

protected static int avisLogToDfc(int type)

start

public void start()

stop

public void stop()

initConnection

protected void initConnection()

tryConnect

protected void tryConnect()
Try to connect to elvin. If the connection fails, start a reconnect thread in the background.

See Also:
connect()

asyncConnect

protected void asyncConnect()

connect

protected void connect()
                throws IOException
Connect to elvin. Does nothing if already connected.

Throws:
IOException - if the connection failed.
See Also:
tryConnect()

disconnect

protected void disconnect()
Disconnect from elvin. Does nothing if already disconnected.


getConnection

public Elvin getConnection()
Description copied from interface: IElvinClient
The shared Elvin client connection.

Specified by:
getConnection in interface IElvinClient

register

protected void register()
Register this instance as the Elvin OSGi service.

See Also:
unregister()

unregister

protected void unregister()
Unregister this instance as the Elvin OSGi service.

See Also:
register()


Copyright © 2008 Commonwealth of Australia