package com.xool.system; import java.util.HashMap; import org.jboss.ejb3.annotation.Management; import org.jboss.ejb3.annotation.Service; @Service(objectName = "jboss:service=ICoolSystemInit") @Management(ICoolSystemInit.class) public class CoolSystemInitService implements ICoolSystemInit { private String currency; private HashMap mapCurrency = new HashMap(); public double convert(double amount) { double currVal = new Double(mapCurrency.get(currency)); return (currVal * amount); } // Lifecycle methods public void create() throws Exception { System.out.println("CurrencyConverterMBean - Creating"); mapCurrency.put("USD", new Double(1.40)); mapCurrency.put("YEN", new Double(135)); mapCurrency.put("GBG", new Double(0.85)); } public String getCurrency() { return currency; } public void setCurrency(String currency) { this.currency = currency; } public void destroy() { System.out.println("CurrencyConverterMBean - Destroying"); } }