001package edu.pdx.cs410J.family; 002 003import java.rmi.*; 004import java.util.Date; 005 006/** 007 * This is class implements the <code>RemoteMarriage</code> interface. 008 * Basically, it delegates all of its behavior to an underlying {@link 009 * edu.pdx.cs410J.family.Marriage} that lives only on the server. 010 */ 011@SuppressWarnings("serial") 012class RemoteMarriageImpl extends java.rmi.server.UnicastRemoteObject 013 implements RemoteMarriage { 014 015 /** The underlying Marriage that is being modeled. */ 016 private transient Marriage marriage; 017 018 ////////////////////// Constructors ////////////////////// 019 020 /** 021 * Creates a new <code>RemoteMarriageImpl</code> that delegates most 022 * of its behavior to a given <code>Marriage</code> 023 */ 024 RemoteMarriageImpl(Marriage marriage) throws RemoteException { 025 this.marriage = marriage; 026 } 027 028 //////////////////// Instance Methods //////////////////// 029 030 public int getHusbandId() throws RemoteException { 031 return this.marriage.getHusband().getId(); 032 } 033 034 public int getWifeId() throws RemoteException { 035 return this.marriage.getWife().getId(); 036 } 037 038 public Date getDate() throws RemoteException { 039 return this.marriage.getDate(); 040 } 041 042 public void setDate(Date date) throws RemoteException { 043 this.marriage.setDate(date); 044 } 045 046 public String getLocation() throws RemoteException { 047 return this.marriage.getLocation(); 048 } 049 050 public void setLocation(String location) throws RemoteException { 051 this.marriage.setLocation(location); 052 } 053 054 public String getDescription() throws RemoteException { 055 return this.marriage.toString(); 056 } 057 058}