com.toremote.gateway.connection
Class AbstractServerList

java.lang.Object
  extended by com.toremote.gateway.connection.AbstractServerList
All Implemented Interfaces:
ServerListInterface, java.lang.Cloneable

public abstract class AbstractServerList
extends java.lang.Object
implements ServerListInterface


Field Summary
 Connection[] connections
           
 java.lang.Boolean display
           
protected  java.lang.Long lastModified
           
 java.lang.String type
           
 
Fields inherited from interface com.toremote.gateway.connection.ServerListInterface
TYPE_BLACK_LIST, TYPE_NORMAL_LIST, TYPE_WHITE_LIST
 
Constructor Summary
AbstractServerList()
           
 
Method Summary
abstract  boolean add(Connection c)
          add new server, call persistent to save
abstract  boolean delete(java.lang.String id)
          delete server, call persistent to save
 Connection getConnectionById(java.lang.String id)
           
 Connection getConnectionByIdOrServer(java.lang.String is)
           
 java.lang.String getListType()
           
 boolean isAllowed(java.lang.String idOrServer)
           
 boolean isDisplay()
           
abstract  boolean persistent()
          save changes to disk
 java.lang.String toJsonTable()
           
abstract  boolean update(Connection c)
          update existing server, call persistent to save
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.toremote.gateway.connection.ServerListInterface
modifiedSince, toJson
 

Field Detail

type

public java.lang.String type

display

public java.lang.Boolean display

connections

public Connection[] connections

lastModified

protected java.lang.Long lastModified
Constructor Detail

AbstractServerList

public AbstractServerList()
Method Detail

getListType

public java.lang.String getListType()
Specified by:
getListType in interface ServerListInterface
Returns:
TYPE_WHITE_LIST, TYPE_BLACK_LIST or TYPE_NORMAL_LIST

isAllowed

public boolean isAllowed(java.lang.String idOrServer)
Specified by:
isAllowed in interface ServerListInterface
Returns:
true if this server can be accessed.

getConnectionById

public Connection getConnectionById(java.lang.String id)
Specified by:
getConnectionById in interface ServerListInterface
Returns:
Connection object, null if not found

getConnectionByIdOrServer

public Connection getConnectionByIdOrServer(java.lang.String is)
Specified by:
getConnectionByIdOrServer in interface ServerListInterface
Returns:
Connection object, null if not found

isDisplay

public boolean isDisplay()
Specified by:
isDisplay in interface ServerListInterface
Returns:
true if you want user see this list

toJsonTable

public java.lang.String toJsonTable()

delete

public abstract boolean delete(java.lang.String id)
                        throws java.io.IOException
delete server, call persistent to save

Parameters:
id -
Returns:
true if succeeded
Throws:
java.io.IOException

add

public abstract boolean add(Connection c)
                     throws java.io.IOException
add new server, call persistent to save

Parameters:
c - connection
Returns:
true if succeeded
Throws:
java.io.IOException

update

public abstract boolean update(Connection c)
                        throws java.io.IOException
update existing server, call persistent to save

Parameters:
c -
Returns:
Throws:
java.io.IOException

persistent

public abstract boolean persistent()
                            throws java.io.IOException
save changes to disk

Returns:
true if succeeded
Throws:
java.io.IOException