com.mymed.controller.core.manager.connection
Class Connection

java.lang.Object
  extended by com.mymed.controller.core.manager.connection.Connection
All Implemented Interfaces:
IConnection

public class Connection
extends java.lang.Object
implements IConnection

Class that represents a connection to a Cassandra instance in mymed

Author:
Milo Casagrande

Constructor Summary
Connection()
          Create a new connection using as address the localhost address and the default value for the port (9160).
Connection(java.lang.String address, int port)
          Create a new connection with the provided address and port
 
Method Summary
 void close()
          Close the connection to the database
 boolean equals(java.lang.Object object)
           
 void flush()
          Flush the connection, resetting its internal state
 java.lang.String getAddress()
          Get the address in use with the connection
 org.apache.cassandra.thrift.Cassandra.Client getClient()
           
 int getPort()
          Get the port in use with the connection
 int hashCode()
           
 boolean isOpen()
          Check if the connection is open or not
 void open()
          Open the connection to the database
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Connection

public Connection()
Create a new connection using as address the localhost address and the default value for the port (9160).


Connection

public Connection(java.lang.String address,
                  int port)
Create a new connection with the provided address and port

Parameters:
address - the IP address to be associated with this connection
port - the port to use with this connection
Throws:
java.lang.Exception
Method Detail

getClient

public org.apache.cassandra.thrift.Cassandra.Client getClient()
Returns:
the Cassandra instance to use

getAddress

public java.lang.String getAddress()
Description copied from interface: IConnection
Get the address in use with the connection

Specified by:
getAddress in interface IConnection
Returns:
the address associated with the connection

getPort

public int getPort()
Description copied from interface: IConnection
Get the port in use with the connection

Specified by:
getPort in interface IConnection
Returns:
the port associated with the connection

isOpen

public boolean isOpen()
Description copied from interface: IConnection
Check if the connection is open or not

Specified by:
isOpen in interface IConnection
Returns:
true if the connection is open, false otherwise

open

public void open()
          throws InternalBackEndException
Description copied from interface: IConnection
Open the connection to the database

Specified by:
open in interface IConnection
Throws:
InternalBackEndException - when there is a problem opening the connection

close

public void close()
Description copied from interface: IConnection
Close the connection to the database

Specified by:
close in interface IConnection

flush

public void flush()
Description copied from interface: IConnection
Flush the connection, resetting its internal state

Specified by:
flush in interface IConnection

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object