// HelloServant.java import HelloApp.*; import org.omg.CORBA.*; import org.omg.PortableServer.*; import org.omg.PortableServer.POA; import java.util.Properties; /** * Description of the Class * *@author donsez *@created 20 juin 2003 */ public class HelloServant extends HelloPOA { private ORB orb; private String language; // constructor /** * Constructor for the HelloServant object */ public HelloServant() { setLanguage("en"); } // constructor /** * Constructor for the HelloServant object * *@param language Description of the Parameter */ public HelloServant(String language) { setLanguage(language); } /** * Sets the oRB attribute of the HelloServant object * *@param orb The new oRB value */ public void setORB(ORB orb) { this.orb = orb; } /** * Gets the language attribute of the HelloServant object * *@return The language value */ public String getLanguage() { return language; } /** * Sets the language attribute of the HelloServant object * *@param language The new language value */ public void setLanguage(String language) { this.language = language; } // implement sayHello() IDL operation /** * Description of the Method * *@param name Description of the Parameter *@return Description of the Return Value */ public String sayHello(String name) { if (language.equals("fr")) { return "\nSalut " + name + " !!\n"; } else if (language.equals("it")) { return "\nCiao " + name + " !!\n"; } else if (language.equals("es")) { return "\nHola " + name + " !!\n"; } else if (language.equals("en-us")) { return "\nHi " + name + " !!\n"; } else if (language.equals("de")) { return "\nHallo " + name + " !!\n"; } else { return "\nHello " + name + " !!\n"; } } // implement shutdown() IDL operation /** * Description of the Method */ public void shutdown() { if (orb != null) { orb.shutdown(false); } } }