/** ** ** 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 UniEnuSrv { 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=.\\UniEnuSrv.log"}; public ServerImpl( FrmUniEnuSrv 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 PersonalImpl( this)); Middsol.CORBA._ORB.wrIORtoFile( ".\\UniEnuSrv.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 PersonalImpl: UniEnu.PersonalPOA { private ServerImpl m_oServer; public PersonalImpl( ServerImpl a_oServer) { m_oServer = a_oServer; } public override void queryByName( string a_strName, UniEnu.property a_oProp, out UniEnu.uniProperty a_oPropOut ) { a_oPropOut = new UniEnu.uniProperty(); switch( a_oProp) { case UniEnu.property.surname: m_oServer.theFrm.writeLog( "Query surname"); a_oPropOut.strSurname = a_strName + ", Dummy"; break; case UniEnu.property.address: m_oServer.theFrm.writeLog( "Query address"); a_oPropOut.strAddress = "Hamburg"; break; case UniEnu.property.age: m_oServer.theFrm.writeLog( "Query age"); a_oPropOut.iAge = 39; break; case UniEnu.property.female: m_oServer.theFrm.writeLog( "Query female"); a_oPropOut.bFemale = false; break; } } } }