synapsi.data
Interface DataForMain

All Known Implementing Classes:
DataMain

public interface DataForMain

Interface to access methods and data in synapsi.data package


Method Summary
 void activateClient(boolean b, java.lang.String IP)
          Method for activating/dis-activating client This method is used to set client's online status to true or false
 boolean addGroup(java.lang.String groupID, java.lang.String version)
          Add a new group with specified version.
 boolean addNewPackage(java.lang.String pathToFiles, java.lang.String versionId)
          Adds new software package to server.
 boolean clientExist(java.lang.String IP)
          Is there a client with given IP
 DataGroup createNewClient(java.lang.String clientIP)
          Creates new client and add's it to default group
 DataClient getClient(java.lang.String IP)
          Get's the client with specified IP-address
 DataVersion getClientVersion(java.lang.String clientIP)
          TO BE REMOVED - This is not needed since you can get clients version from DataClient
 DataGroup getDefaultGroup()
          Get's reference for the default DataGroup object in this system Default group is the DataGroup object that get's new client's when they come online for a first-time
 java.util.Vector getGroupClients(java.lang.String groupID)
          Get clients for specified group
 java.util.Vector getGroups()
          Gets all groups.
 DataVersion getGroupVersion(java.lang.String groupID)
          Gets version of specified group
 int getNSSettings()
          Gets the number of concurrent clients to do update
 java.util.Vector getPackages()
          Get all software packages/versions
 boolean init()
          Initialize the data's from disk.
 boolean init(java.lang.String pathToFile)
          Inittialize the data's from disk.
 boolean removeGroup(java.lang.String groupID)
          Removes the specified group.
 boolean removePackage(java.lang.String version)
          Removes software package/version from server.
 boolean save()
          Saves the data to disk Uses the default name for file
 boolean save(java.lang.String pathToFile)
          Save's the data to disk
 void setClientToGroup(java.lang.String clientIP, java.lang.String GroupID)
          Set's the client to group
 void setClientVersion(java.lang.String clientIP, java.lang.String versíon)
          Set specified version to client.
 void setGroupInfo(java.lang.String groupID, java.lang.String version)
          Set specified version for group
 void setNSSettings(int concurrentClients)
          Set servers settings.
 

Method Detail

init


public boolean init()
Initialize the data's from disk. Uses the default name for serilized file
Returns:
false if init could not convert anything from disk.

init


public boolean init(java.lang.String pathToFile)
Inittialize the data's from disk.
Parameters:
pathToFile - path to file where the saved data is.
Returns:
false if init could not convert anything from disk.

save


public boolean save()
Saves the data to disk Uses the default name for file
Returns:
indicates success of failure

save


public boolean save(java.lang.String pathToFile)
Save's the data to disk
Parameters:
pathToFiles - location where we wish to save.
Returns:
indicates success of failure

getGroups


public java.util.Vector getGroups()
Gets all groups.
Returns:
A Vector containing DataGroup objects

getGroupClients


public java.util.Vector getGroupClients(java.lang.String groupID)
Get clients for specified group
Parameters:
groupID - - String containing the groups ID
Returns:
A Vector containing DataClient objects

getPackages


public java.util.Vector getPackages()
Get all software packages/versions
Returns:
A Vector containing DataVersion objects

getClientVersion


public DataVersion getClientVersion(java.lang.String clientIP)
TO BE REMOVED - This is not needed since you can get clients version from DataClient

getGroupVersion


public DataVersion getGroupVersion(java.lang.String groupID)
Gets version of specified group
Parameters:
groupID - String group identifier
Returns:
Dataversion object for spefied group

setGroupInfo


public void setGroupInfo(java.lang.String groupID,
                         java.lang.String version)
Set specified version for group
Parameters:
groupID - Group's identification, who's version is about to be set
version - The version we want to give to this group

addGroup


public boolean addGroup(java.lang.String groupID,
                        java.lang.String version)
Add a new group with specified version.
Parameters:
groupID - Identification we want give for the group
version - The version we want to give for this group
Returns:
returns false if unsuccessfull. Cause no such version group exists.

removeGroup


public boolean removeGroup(java.lang.String groupID)
Removes the specified group. Requires that group in question has no clients. DataVersion references to this group are removed as well. This way the group can be collected later by the GC. After this method there is no method to restore the group.
Parameters:
groupID - Identification for the group that is about to be removed

setNSSettings


public void setNSSettings(int concurrentClients)
Set servers settings. Currently the only setting is the number of concurrent client updates.
Parameters:
concurrentClients - number of client that can update concurrently

getNSSettings


public int getNSSettings()
Gets the number of concurrent clients to do update
Returns:
the number of concurrent updates

clientExist


public boolean clientExist(java.lang.String IP)
Is there a client with given IP
Parameters:
IP - The IP to be checked
Returns:
value indicating if the client exist in current system

getClient


public DataClient getClient(java.lang.String IP)
Get's the client with specified IP-address
Parameters:
IP - the ip-address for client we need to get
Returns:
if such client exist returns the object otherwise null is retured

activateClient


public void activateClient(boolean b,
                           java.lang.String IP)
Method for activating/dis-activating client This method is used to set client's online status to true or false
Parameters:
b - activate/disactivate
IP - the client ip-address that is to be activated/disactivated

getDefaultGroup


public DataGroup getDefaultGroup()
Get's reference for the default DataGroup object in this system Default group is the DataGroup object that get's new client's when they come online for a first-time
Returns:
DataGroup the default group object

addNewPackage


public boolean addNewPackage(java.lang.String pathToFiles,
                             java.lang.String versionId)
Adds new software package to server. Params need some refinement
Parameters:
pathToFiles - Path to file/files, where the update package is located.
versionId - Version identification string for this software package
Returns:
false if no success. Cause version exists

removePackage


public boolean removePackage(java.lang.String version)
Removes software package/version from server. Removing fails if current version/package is still set for some group or client. This is keeps the data structure intact.
Parameters:
version - The version to be removed

createNewClient


public DataGroup createNewClient(java.lang.String clientIP)
Creates new client and add's it to default group
Parameters:
clientIP - Clients IP-address
Returns:
The group to which client was added. Null if creating failed

setClientToGroup


public void setClientToGroup(java.lang.String clientIP,
                             java.lang.String GroupID)
Set's the client to group
Parameters:
clientIP - Client we are moving
GroupID - The group we are planning to move the client

setClientVersion


public void setClientVersion(java.lang.String clientIP,
                             java.lang.String versíon)
Set specified version to client. This is to be used from network only.So please no call from elsewhere
Parameters:
clientIP - Client who's version is to be set
version - the version we wish to set.