Make your own free website on Tripod.com

suncertify.db
Class ServerImpl

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--suncertify.db.ServerImpl

public class ServerImpl
extends java.rmi.server.UnicastRemoteObject
implements DbServer, java.rmi.server.Unreferenced

The class implements the DbServer interface. It is the Server of the DBMS system. It is a subclass of java.rmi.server.UniCastRemoteObject.

Version:
1.0 08/09/1999
Author:
Macks Ningombam
See Also:
Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ServerImpl(java.lang.String dbName)
          The class Constructor to create the Server of the Database whose name is specified.
ServerImpl(java.lang.String dbName, FieldInfo[] fields)
          The class Constructor to create a server for an initially empty DataBase whose name and schema is specified.
 
Method Summary
 void add(java.lang.String[] newData)
          The method to add a new record into the DataBase.
 void addMul(java.lang.String[][] newDataList)
          The method to add multiple records into the DataBase.
 void delete(DataInfo toDelete)
          The method to delete a record from the DataBase.
protected  void finalize()
          The finalization method called at the time of garbage collection.
 DataInfo find(java.lang.String toMatch)
          The method to find the record whose key is specified.
 DataInfo[] findCriteria(java.lang.String criteria)
          The method to find all the records that exactly matches a given criteria.
 FieldInfo[] getFieldInfo()
          The method to get the Schema of the DataBase as collection of FieldInfos.
 DataInfo getRecord(int recNum)
          The method to get the record whose record number is provided.
 int getRecordCount()
          The method to get the total count of records in the DataBase.
 void lock(int recNum, java.lang.String clientId)
          The method to lock a record in the database.
static void main(java.lang.String[] args)
          The main method to register the Remote objects with the bootstrap register at the server side.
 void modify(DataInfo newData)
          The method to modify a record in the DataBase.
 void modifyMul(DataInfo[] newDataList)
          The method to modify multiple number of records in the DataBase.
 void unLock(int recNum, java.lang.String clientID)
          The method to unlock a record.
 void unreferenced()
          The method which is called whenever no clients are referencing the remote object.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServerImpl

public ServerImpl(java.lang.String dbName)
           throws java.rmi.RemoteException
The class Constructor to create the Server of the Database whose name is specified.
Throws:
java.rmi.RemoteException -  

ServerImpl

public ServerImpl(java.lang.String dbName,
                  FieldInfo[] fields)
           throws java.rmi.RemoteException
The class Constructor to create a server for an initially empty DataBase whose name and schema is specified.
Throws:
java.rmi.RemoteException -  
Method Detail

add

public void add(java.lang.String[] newData)
         throws java.rmi.RemoteException
The method to add a new record into the DataBase.
Specified by:
add in interface DbServer
Parameters:
newData - : The new record to be inserted into the DataBase.
Throws:
java.rmi.RemoteException -  

addMul

public void addMul(java.lang.String[][] newDataList)
            throws java.rmi.RemoteException
The method to add multiple records into the DataBase.
Specified by:
addMul in interface DbServer
Parameters:
newDataList - : The list of new records to be entered into the DataBase.
Throws:
java.rmi.RemoteException -  

delete

public void delete(DataInfo toDelete)
            throws java.rmi.RemoteException
The method to delete a record from the DataBase.
Specified by:
delete in interface DbServer
Parameters:
toDelete - : The record which is to be deleted.
Throws:
java.rmi.RemoteException -  

find

public DataInfo find(java.lang.String toMatch)
              throws java.rmi.RemoteException
The method to find the record whose key is specified.
Specified by:
find in interface DbServer
Parameters:
toMatch - : The Key of the record to find.
Throws:
java.rmi.RemoteException -  

findCriteria

public DataInfo[] findCriteria(java.lang.String criteria)
                        throws java.rmi.RemoteException
The method to find all the records that exactly matches a given criteria.
Specified by:
findCriteria in interface DbServer
Parameters:
criteria: - The criteria in the form of "field1Name=value1...fieldnName=valuen".
Throws:
java.rmi.RemoteException -  

getFieldInfo

public FieldInfo[] getFieldInfo()
                         throws java.rmi.RemoteException
The method to get the Schema of the DataBase as collection of FieldInfos.
Specified by:
getFieldInfo in interface DbServer
Throws:
java.rmi.RemoteException -  

getRecord

public DataInfo getRecord(int recNum)
                   throws java.rmi.RemoteException
The method to get the record whose record number is provided.
Specified by:
getRecord in interface DbServer
Parameters:
recNum - : The record number of the record that is to be fetched.
Throws:
java.rmi.RemoteException -  

getRecordCount

public int getRecordCount()
                   throws java.rmi.RemoteException
The method to get the total count of records in the DataBase.
Specified by:
getRecordCount in interface DbServer
Throws:
java.rmi.RemoteException -  

lock

public void lock(int recNum,
                 java.lang.String clientId)
          throws java.rmi.RemoteException
The method to lock a record in the database.
Specified by:
lock in interface DbServer
Parameters:
recNum - : The record number of the record that is to be locked.
clientId - : The ID of the client that has requested to place the lock.
Throws:
java.rmi.RemoteException -  

modify

public void modify(DataInfo newData)
            throws java.rmi.RemoteException
The method to modify a record in the DataBase.
Specified by:
modify in interface DbServer
Parameters:
newData - : The new set of values.
Throws:
java.rmi.RemoteException -  

modifyMul

public void modifyMul(DataInfo[] newDataList)
               throws java.rmi.RemoteException
The method to modify multiple number of records in the DataBase.
Specified by:
modifyMul in interface DbServer
Parameters:
newDataList - : The list of new data to be modified in the DataBase./
Throws:
java.rmi.RemoteException -  

unLock

public void unLock(int recNum,
                   java.lang.String clientID)
            throws java.rmi.RemoteException
The method to unlock a record.
Specified by:
unLock in interface DbServer
Parameters:
recNum - : The record number from which the record number is to be released.
clientId - : The Id of the client requesting release of lock.
Throws:
java.rmi.RemoteException -  

finalize

protected void finalize()
The finalization method called at the time of garbage collection.
Overrides:
finalize in class java.lang.Object

unreferenced

public void unreferenced()
The method which is called whenever no clients are referencing the remote object. It releases all pending locks from the DataBase.
Specified by:
unreferenced in interface java.rmi.server.Unreferenced

main

public static void main(java.lang.String[] args)
The main method to register the Remote objects with the bootstrap register at the server side.