edu.pdx.cs399J.family
Class XmlRemoteFamilyTree

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by edu.pdx.cs399J.family.XmlRemoteFamilyTree
All Implemented Interfaces:
RemoteFamilyTree, Serializable, Remote

public class XmlRemoteFamilyTree
extends UnicastRemoteObject
implements RemoteFamilyTree

This class is a remote family tree whose contents are read from and saved to an XML file. It extends UnicastRemoteObject because it is going to be bound into the RMI registry.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
XmlRemoteFamilyTree(File xmlFile)
          Creates a new XmlRemoteFamilyTree that gets its data from a given XML file.
 
Method Summary
 RemoteMarriage createMarriage(int husbandId, int wifeId)
          Creates a new marriage between two people
 RemotePerson createPerson(Person.Gender gender)
          Creates a new Person of a given gender
 Collection<RemotePerson> getLiving()
          Returns the people in the family tree that are living (i.e. have a date of birth, but no date of death)
 Collection<RemotePerson> getLiving(Date date)
          Returns the people in the family tree were alive at a certain time
 RemoteMarriage getMarriage(int husbandId, int wifeId)
          Returns the marriage between two people.
 RemotePerson getPerson(int id)
          Gets the person with the given id.
 RemotePerson getPerson(String firstName, String lastName)
          Gets the person with the given first and last name.
static void main(String[] args)
           
 void shutdown()
          Shuts down this PersonFactory.
 
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

XmlRemoteFamilyTree

public XmlRemoteFamilyTree(File xmlFile)
                    throws RemoteException,
                           IOException,
                           FamilyTreeException
Creates a new XmlRemoteFamilyTree that gets its data from a given XML file.

Throws:
ParserException - A problem occurred while parsing the XML file
RemoteException
IOException
FamilyTreeException
Method Detail

createPerson

public RemotePerson createPerson(Person.Gender gender)
                          throws RemoteException
Description copied from interface: RemoteFamilyTree
Creates a new Person of a given gender

Specified by:
createPerson in interface RemoteFamilyTree
Throws:
RemoteException

getPerson

public RemotePerson getPerson(int id)
                       throws RemoteException
Description copied from interface: RemoteFamilyTree
Gets the person with the given id. If no person with that id exists, then null is returned.

Specified by:
getPerson in interface RemoteFamilyTree
Throws:
RemoteException

getPerson

public RemotePerson getPerson(String firstName,
                              String lastName)
                       throws RemoteException
Description copied from interface: RemoteFamilyTree
Gets the person with the given first and last name. If no person with that name is found, then null is returned.

Specified by:
getPerson in interface RemoteFamilyTree
Throws:
RemoteException

getMarriage

public RemoteMarriage getMarriage(int husbandId,
                                  int wifeId)
                           throws RemoteException
Description copied from interface: RemoteFamilyTree
Returns the marriage between two people. If the two people have never been married, then null is returned.

Specified by:
getMarriage in interface RemoteFamilyTree
Throws:
RemoteException

createMarriage

public RemoteMarriage createMarriage(int husbandId,
                                     int wifeId)
                              throws RemoteException
Description copied from interface: RemoteFamilyTree
Creates a new marriage between two people

Specified by:
createMarriage in interface RemoteFamilyTree
Throws:
RemoteException

getLiving

public Collection<RemotePerson> getLiving()
                                   throws RemoteException
Description copied from interface: RemoteFamilyTree
Returns the people in the family tree that are living (i.e. have a date of birth, but no date of death)

Specified by:
getLiving in interface RemoteFamilyTree
Throws:
RemoteException

getLiving

public Collection<RemotePerson> getLiving(Date date)
                                   throws RemoteException
Description copied from interface: RemoteFamilyTree
Returns the people in the family tree were alive at a certain time

Specified by:
getLiving in interface RemoteFamilyTree
Throws:
RemoteException

shutdown

public void shutdown()
              throws IOException,
                     RemoteException
Description copied from interface: RemoteFamilyTree
Shuts down this PersonFactory. Modified Persons are written to persistent storage as appropriate.

Specified by:
shutdown in interface RemoteFamilyTree
Throws:
IOException
RemoteException

main

public static void main(String[] args)


Copyright © 2000-2009 Portland State University. All Rights Reserved.