import HelloApp.*; import org.omg.CORBA.*; import org.omg.PortableServer.*; import org.omg.PortableServer.POA; /** * HelloImplWithTie example of a distributed object according to the delegation * model * *@author Didier Donsez *@created 21 juin 2003 *@version 21 juin 2003 */ public class HelloImplWithTie // may extend a super class implements HelloOperations { private String language; /** * Constructor for the HelloImplWithTie object */ public HelloImplWithTie() { setLanguage("en"); } /** * Constructor for the HelloImplWithTie object * *@param language the default language */ public HelloImplWithTie(String language) { setLanguage(language); } /** * 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(name) IDL operation * *@param name the name to hello *@return the hello sentence in the default language */ 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 */ public void shutdown() { if (orb != null) { orb.shutdown(false); } } /** * uses by shutdown() */ private ORB orb; /** * Sets the orb attribute of the HelloImplWithTie object * *@param orb The new oRB value */ public void setORB(ORB orb) { this.orb = orb; } }