FileDocCategorySizeDatePackage
AbbrevBean.javaAPI DocExample3067Thu Aug 28 10:46:10 BST 2003com.jspservletcookbook

AbbrevBean

public class AbbrevBean extends Object implements SessionBean
ejbgen:session
ejb-name = AbbreviationEjb type = Stateless
ejbgen:jndi-name
remote = AbbrevHome local = AbbrevLocalHome

Fields Summary
private SessionContext
context
private Map
abbrevMap
Constructors Summary
public AbbrevBean()

 
	
	abbrevMap = new HashMap();
	
	abbrevMap.put("ALABAMA","AL");
	abbrevMap.put("ALASKA","AK");
	abbrevMap.put("AMERICAN SAMOA","AS");
	abbrevMap.put("ARIZONA","AZ");
	abbrevMap.put("ARKANSAS","AR");
	abbrevMap.put("CALIFORNIA","CA");
	abbrevMap.put("COLORADO","CO");
	abbrevMap.put("CONNECTICUTT","CT");
	
	abbrevMap.put("DELAWARE","DE");
	abbrevMap.put("DISTRICT OF COLUMBIA","DC");
	abbrevMap.put("FEDERATED STATES OF MICRONESIA","FM");
	abbrevMap.put("FLORIDA","FL");
	abbrevMap.put("GEORGIA","GA");
	abbrevMap.put("GUAM","GU");
	abbrevMap.put("HAWAII","HI");
	abbrevMap.put("IDAHO","ID");
	
	abbrevMap.put("ILLINOIS","IL");
	abbrevMap.put("INDIANA","IN");
	abbrevMap.put("IOWA","IA");
	abbrevMap.put("KANSAS","KS");
	abbrevMap.put("KENTUCKY","KY");
	abbrevMap.put("LOUISIANA","LA");
	
	abbrevMap.put("MAINE","ME");
	abbrevMap.put("MARSHALL ISLANDS","MH");
	abbrevMap.put("MARYLAND","MD");
	abbrevMap.put("MASSACHUSETTS","MA");
	abbrevMap.put("MICHIGAN","MI");
	abbrevMap.put("MINNESOTA","MN");
	
	abbrevMap.put("MISSISSIPPI","MS");
	abbrevMap.put("MISSOURI","MO");
	abbrevMap.put("MONTANA","MT");
	abbrevMap.put("NEBRASKA","NE");
	abbrevMap.put("NEVADA","NV");
	abbrevMap.put("NEW HAMPSHIRE","NH");
	
	abbrevMap.put("NEW JERSEY","Nj");
	abbrevMap.put("NEW MEXICO","NM");
	abbrevMap.put("NEW YORK","NY");
	abbrevMap.put("NORTH CAROLINA","NC");
	abbrevMap.put("NORTH DAKOTA","ND");
	abbrevMap.put("NORTHERN MARIANA ISLANDS","MP");
	
	abbrevMap.put("OKLAHOMA","OK");
	abbrevMap.put("OREGON","OR");
	abbrevMap.put("PALAU","PW");
	abbrevMap.put("PENNSYLVANIA","PA");
	abbrevMap.put("PUERTO RICO","PR");
	abbrevMap.put("RHODE ISLAND","RI");
	abbrevMap.put("SOUTH CAROLINA","SC");
	abbrevMap.put("SOUTH DAKOTA","SD");
	
	abbrevMap.put("TENNESSEE","TN");
	abbrevMap.put("TEXAS","TX");
	abbrevMap.put("UTAH","UT");
	abbrevMap.put("VERMONT","VT");
	abbrevMap.put("VIRGIN ISLANDS","VI");
	abbrevMap.put("VIRGINIA","VA");
	abbrevMap.put("WASHINGTON","WA");
   abbrevMap.put("WEST VIRGINIA","WV");
   
		abbrevMap.put("WISCONSIN","WI");
		abbrevMap.put("WYOMING","WY");

	
	
Methods Summary
public voidejbActivate()

	
	prt( "ejbActivate called.");
	
	
public voidejbCreate()

	
	prt( "ejbCreate called.");
	
	
public voidejbPassivate()

	
	prt( "ejbPassivate called.");
	
	
public voidejbRemove()

	
	prt( "ejbRemove called.");
	
	
public java.util.MapgetAbbrevMap()

	
	return abbrevMap;
	
	
public java.lang.StringgetAbbreviation(java.lang.String state)

	
	return (String) abbrevMap.get(state);
	
	
	
private voidprt(java.lang.Object message)

	
		System.out.println(message);
	
public voidsetSessionContext(SessionContext ctx)

	
	    context = ctx;