/** ** ** 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 AttributeSrv { 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=.\\AttributeSrv.log Level=20"}; public ServerImpl( IFrm 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( ".\\AttributeSrv.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: Attribute.GreetingsPOA { private string m_strCity = "Hamburg"; private string m_strName; private ServerImpl m_oServer; public GreetingsImpl( ServerImpl a_oServer) { m_oServer = a_oServer; } public override string hello( ) { m_oServer.theFrm.writeLog( "Function 'Hello'."); return "Greetings to " + m_strName; } public override string City { get { m_oServer.theFrm.writeLog( "Request Attribute City:" + m_strCity); return m_strCity; } } public override string Name { set { m_strName = value; m_oServer.theFrm.writeLog( "Set Attribute Name:" + m_strName); } get { m_oServer.theFrm.writeLog( "Request Attribute Name:" + m_strName); return m_strName; } } } }