home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
wsgatsam.zip
/
AddressBook.java
< prev
next >
Wrap
Text File
|
2003-02-24
|
2KB
|
69 lines
/**
* %wsgw_sample_start%
* Licensed Materials - Property of IBM
*
* (c) Copyright IBM Corp. 2001, 2002 All Rights Reserved.
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with
* IBM Corp.
* %wsgw_sample_end%
*/
package services.addressbook;
import java.util.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import org.apache.soap.util.xml.*;
import com.ibm.www.namespace.wsif.samples.ab.types.*;
/**
* Sample service that provides add/get functionality.
*
* %wsgw_sample_start%
* Licensed Materials - Property of IBM
*
* (c) Copyright IBM Corp. 2001, 2002 All Rights Reserved.
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with
* IBM Corp.
* %wsgw_sample_end%
*
* @author Matthew J. Duftler (duftler@us.ibm.com)
* @author Aleksander Slominski
*/
public class AddressBook {
private Hashtable name2AddressTable = new Hashtable();
public AddressBook() {
addEntry("John B. Good",
new Address(123, "Main Street", "Anytown", "NY", 12345,
new Phone(123, "456", "7890")));
addEntry("Bob Q. Public",
new Address(456, "North Whatever", "Notown", "ME", 12424,
new Phone(987, "444", "5566")));
}
public void addEntry(String name, Address address)
{
name2AddressTable.put(name, address);
}
public Address getAddressFromName(String name)
throws IllegalArgumentException
{
if (name == null)
{
throw new IllegalArgumentException("The name argument must not be " +
"null.");
}
return (Address)name2AddressTable.get(name);
}
}