/** ** ** MinCor-C# -Demo ** CORBA Solution for .Net with C# Language mapping ** Version: 1.0 ** ** Copyright: ** Middsol GmbH, Hamburg ** Germany 2004 ** www.Middsol.com ** info@Middsol.de ** */ using System; using System.Drawing; using System.Collections; using System.Windows.Forms; using System.Data; namespace ExcepSrv { public class ServerImpl { private IFrm m_oFrm; private Middsol.CORBA.ORB m_oOrb = null; string[] m_strORBInit = { "-ORBEndpoint iiop://localhost:8545/portspan=100", "-ORBDebug Out=.\\ExcepSrv.log"}; public ServerImpl( FrmExcepSrv a_oFrm) { m_oFrm = a_oFrm; m_oOrb = Middsol.CORBA._ORB.init( m_strORBInit, null); Middsol.PortableServer.POA oRootPOA = Middsol.PortableServer.POAHelper.narrow( m_oOrb.resolve_initial_references( "RootPOA" )); oRootPOA.the_POAManager.activate(); Middsol.CORBA.Object oObjRef = oRootPOA.servant_to_reference( new GreetingsImpl( this)); Middsol.CORBA._ORB.wrIORtoFile( ".\\ExcepSrv.ior", oObjRef); theFrm.writeLog("Server runing"); } public void destroy() { if( m_oOrb != null) { m_oOrb.destroy(); m_oOrb = null; } } public IFrm theFrm { get{ return m_oFrm; } } } public class GreetingsImpl : Excep.IGreetingsPOA { private ServerImpl m_oServer; public GreetingsImpl( ServerImpl a_oServer) { m_oServer = a_oServer; } public override string hello( string a_strmyName ) { if( a_strmyName == "John") { m_oServer.theFrm.writeLog( "Function 'Hello' Parameter '" + a_strmyName +"'. Throw Exception"); throw new Excep.IGreetingsPackage.ExcpName("John was not friendly", 1001); } m_oServer.theFrm.writeLog( "Function 'Hello' Parameter '" + a_strmyName +"'"); return "Greetings to " + a_strmyName; } } }