simpledb.remote
Class RemoteMetaDataImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by simpledb.remote.RemoteMetaDataImpl
All Implemented Interfaces:
Serializable, Remote, RemoteMetaData

public class RemoteMetaDataImpl
extends UnicastRemoteObject
implements RemoteMetaData

The RMI server-side implementation of RemoteMetaData.

Author:
Edward Sciore
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RemoteMetaDataImpl(Schema sch)
          Creates a metadata object that wraps the specified schema.
 
Method Summary
 int getColumnCount()
          Returns the size of the field list.
 int getColumnDisplaySize(int column)
          Returns the number of characters required to display the specified column.
 String getColumnName(int column)
          Returns the field name for the specified column number.
 int getColumnType(int column)
          Returns the type of the specified column.
 
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
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteMetaDataImpl

public RemoteMetaDataImpl(Schema sch)
                   throws RemoteException
Creates a metadata object that wraps the specified schema. The method also creates a list to hold the schema's collection of field names, so that the fields can be accessed by position.

Parameters:
sch - the schema
Throws:
RemoteException
Method Detail

getColumnCount

public int getColumnCount()
                   throws RemoteException
Returns the size of the field list.

Specified by:
getColumnCount in interface RemoteMetaData
Throws:
RemoteException
See Also:
RemoteMetaData.getColumnCount()

getColumnName

public String getColumnName(int column)
                     throws RemoteException
Returns the field name for the specified column number. In JDBC, column numbers start with 1, so the field is taken from position (column-1) in the list.

Specified by:
getColumnName in interface RemoteMetaData
Throws:
RemoteException
See Also:
RemoteMetaData.getColumnName(int)

getColumnType

public int getColumnType(int column)
                  throws RemoteException
Returns the type of the specified column. The method first finds the name of the field in that column, and then looks up its type in the schema.

Specified by:
getColumnType in interface RemoteMetaData
Throws:
RemoteException
See Also:
RemoteMetaData.getColumnType(int)

getColumnDisplaySize

public int getColumnDisplaySize(int column)
                         throws RemoteException
Returns the number of characters required to display the specified column. For a string-type field, the method simply looks up the field's length in the schema and returns that. For an int-type field, the method needs to decide how large integers can be. Here, the method arbitrarily chooses 6 characters, which means that integers over 999,999 will probably get displayed improperly.

Specified by:
getColumnDisplaySize in interface RemoteMetaData
Throws:
RemoteException
See Also:
RemoteMetaData.getColumnDisplaySize(int)


Copyright © 2011. All Rights Reserved.