Ejemplo n.º 1
0
        /// <summary>
        /// References to the rest of the topmost level of the other Petra Module Namespaces will go here
        /// </summary>
        /// <returns>void</returns>
        public TRemote(IClientManagerInterface AClientManager,
                       IMCommonNamespace ACommonObject,
                       IMConferenceNamespace AConferenceObject,
                       IMPartnerNamespace APartnerObject,
                       IMPersonnelNamespace APersonnelObject,
                       IMFinanceNamespace AFinanceObject,
                       IMReportingNamespace AReportingObject,
                       IMSysManNamespace ASysManObject)
            : base(AClientManager)
        {
            USysManObject     = ASysManObject;
            UConferenceObject = AConferenceObject;
            UPartnerObject    = APartnerObject;
            UCommonObject     = ACommonObject;
            UPersonnelObject  = APersonnelObject;
            UFinanceObject    = AFinanceObject;
            UReportingObject  = AReportingObject;

            FRemoteObjects.Add((MarshalByRefObject)USysManObject);
            FRemoteObjects.Add((MarshalByRefObject)UConferenceObject);
            FRemoteObjects.Add((MarshalByRefObject)UPartnerObject);
            FRemoteObjects.Add((MarshalByRefObject)UCommonObject);
            FRemoteObjects.Add((MarshalByRefObject)UPersonnelObject);
            FRemoteObjects.Add((MarshalByRefObject)UFinanceObject);
            FRemoteObjects.Add((MarshalByRefObject)UReportingObject);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// specific things for connecting all the services
        /// </summary>
        /// <param name="AUserName"></param>
        /// <param name="APassword"></param>
        /// <param name="AClientManager"></param>
        /// <param name="AProcessID"></param>
        /// <param name="AWelcomeMessage"></param>
        /// <param name="ASystemEnabled"></param>
        /// <param name="AError"></param>
        /// <param name="AUserInfo"></param>
        /// <returns></returns>
        protected override bool ConnectClient(String AUserName,
                                              String APassword,
                                              IClientManagerInterface AClientManager,
                                              out Int32 AProcessID,
                                              out String AWelcomeMessage,
                                              out Boolean ASystemEnabled,
                                              out String AError,
                                              out IPrincipal AUserInfo)
        {
            try
            {
                base.ConnectClient(AUserName,
                                   APassword,
                                   AClientManager,
                                   out AProcessID,
                                   out AWelcomeMessage,
                                   out ASystemEnabled,
                                   out AError,
                                   out AUserInfo);

                if (FRemotingURLs.ContainsKey(SharedConstantsTest.REMOTINGURL_IDENTIFIER_MYSERVICE))
                {
                    FRemotingURL_MyService = (String)FRemotingURLs[SharedConstantsTest.REMOTINGURL_IDENTIFIER_MYSERVICE];
                }

                return(true);
            }
            catch (ELoginFailedServerTooBusyException)
            {
                throw;
            }
            catch (Exception exp)
            {
                TLogging.Log(exp.ToString() + Environment.NewLine + exp.StackTrace, TLoggingType.ToLogfile);
                throw;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Opens a .NET Remoting connection to the PetraServer's ClientManager.
        ///
        /// </summary>
        /// <param name="ConfigFile">File name of the .NET (Remoting) Configuration file</param>
        /// <param name="ARemote">.NET Remoting Proxy object for the ClientManager object
        /// </param>
        /// <returns>void</returns>
        public virtual void GetRemoteServerConnection(string ConfigFile, out IClientManagerInterface ARemote)
        {
            ARemote = null;
            try
            {
                if (!FRemotingConfigurationSetup)
                {
                    FRemotingConfigurationSetup = true;

                    if (TAppSettingsManager.HasValue("Server.Port"))
                    {
                        IChannel[] regChannels = ChannelServices.RegisteredChannels;

                        foreach (IChannel ch in regChannels)
                        {
                            ChannelServices.UnregisterChannel(ch);
                        }

                        ChannelServices.RegisterChannel(new TcpChannel(0), false);
                    }
                    else if (TAppSettingsManager.HasValue("OpenPetra.ChannelEncryption.PublicKeyfile"))
                    {
                        IClientChannelSinkProvider TCPSink = new BinaryClientFormatterSinkProvider();

                        Hashtable properties = new Hashtable();
                        properties.Add("HttpsPublicKeyXml", TAppSettingsManager.GetValue("OpenPetra.ChannelEncryption.PublicKeyfile"));

                        TCPSink.Next = new EncryptionClientSinkProvider(properties);

                        Hashtable ChannelProperties = new Hashtable();

                        TcpChannel Channel = new TcpChannel(ChannelProperties, TCPSink, null);
                        ChannelServices.RegisterChannel(Channel, false);
                    }
                    else
                    {
                        // The following call must be done only once while the application runs (otherwise a RemotingException occurs)
                        RemotingConfiguration.Configure(ConfigFile, false);
                    }
                }

                DetermineServerIPAddress();

                ARemote = (IClientManagerInterface)
                          Activator.GetObject(typeof(IClientManagerInterface),
                    String.Format("tcp://{0}:{1}/Clientmanager", FServerIPAddr, FServerPort));

                if (ARemote != null)
                {
                    if (TLogging.DebugLevel >= CONNECTOR_LOGGING)
                    {
                        TLogging.Log("GetRemoteServerConnection: connected.", TLoggingType.ToLogfile);
                    }
                }
            }
            catch (Exception exp)
            {
                TLogging.Log("Error in GetRemoteServerConnection(), Possible reasons :-" + exp.ToString(), TLoggingType.ToLogfile);
                throw;
            }
        }
        /// <summary>
        /// connect the client
        /// </summary>
        /// <param name="AUserName"></param>
        /// <param name="APassword"></param>
        /// <param name="AClientManager"></param>
        /// <param name="AProcessID"></param>
        /// <param name="AWelcomeMessage"></param>
        /// <param name="ASystemEnabled"></param>
        /// <param name="AError"></param>
        /// <param name="AUserInfo"></param>
        /// <returns></returns>
        virtual protected bool ConnectClient(String AUserName,
            String APassword,
            IClientManagerInterface AClientManager,
            out Int32 AProcessID,
            out String AWelcomeMessage,
            out Boolean ASystemEnabled,
            out String AError,
            out IPrincipal AUserInfo)
        {
            AError = "";
            ASystemEnabled = false;
            AWelcomeMessage = "";
            AProcessID = -1;
            AUserInfo = null;

            try
            {
                AClientManager.ConnectClient(AUserName, APassword,
                    TClientInfo.ClientComputerName,
                    TClientInfo.ClientIPAddress,
                    new Version(TClientInfo.ClientAssemblyVersion),
                    DetermineClientServerConnectionType(),
                    out FClientName,
                    out FClientID,
                    out FCrossDomainURI,
                    out FRemotingURLs,
                    out FServerOS,
                    out AProcessID,
                    out AWelcomeMessage,
                    out ASystemEnabled,
                    out AUserInfo);

                if (FRemotingURLs.ContainsKey(RemotingConstants.REMOTINGURL_IDENTIFIER_POLLCLIENTTASKS))
                {
                    FRemotingURL_PollClientTasks = (String)FRemotingURLs[RemotingConstants.REMOTINGURL_IDENTIFIER_POLLCLIENTTASKS];
                }

                FConnector.Init(FCrossDomainURI, FClientID.ToString());

                return true;
            }
            catch (EUserNotExistantException exp)
            {
                AError = exp.Message;
                return false;
            }
            catch (ESystemDisabledException exp)
            {
                AError = exp.Message;
                return false;
            }
            catch (EClientVersionMismatchException)
            {
                throw;
            }
            catch (ELoginFailedServerTooBusyException)
            {
                throw;
            }
            catch (Exception exp)
            {
                TLogging.Log(exp.ToString() + Environment.NewLine + exp.StackTrace, TLoggingType.ToLogfile);
                throw;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Opens a .NET Remoting connection to the PetraServer's ClientManager.
        ///
        /// </summary>
        /// <param name="ConfigFile">File name of the .NET (Remoting) Configuration file</param>
        /// <param name="ARemote">.NET Remoting Proxy object for the ClientManager object
        /// </param>
        /// <returns>void</returns>
        public virtual void GetRemoteServerConnection(string ConfigFile, out IClientManagerInterface ARemote)
        {
            ARemote = null;
            try
            {
                if (!FRemotingConfigurationSetup)
                {
                    FRemotingConfigurationSetup = true;

                    if (TAppSettingsManager.HasValue("Server.Port"))
                    {
                        IChannel[] regChannels = ChannelServices.RegisteredChannels;

                        foreach (IChannel ch in regChannels)
                        {
                            ChannelServices.UnregisterChannel(ch);
                        }

                        ChannelServices.RegisterChannel(new TcpChannel(0), false);
                    }
                    else if (TAppSettingsManager.HasValue("OpenPetra.ChannelEncryption.PublicKeyfile"))
                    {
                        IClientChannelSinkProvider TCPSink = new BinaryClientFormatterSinkProvider();

                        Hashtable properties = new Hashtable();
                        properties.Add("HttpsPublicKeyXml", TAppSettingsManager.GetValue("OpenPetra.ChannelEncryption.PublicKeyfile"));

                        TCPSink.Next = new EncryptionClientSinkProvider(properties);

                        Hashtable ChannelProperties = new Hashtable();

                        TcpChannel Channel = new TcpChannel(ChannelProperties, TCPSink, null);
                        ChannelServices.RegisterChannel(Channel, false);
                    }
                    else
                    {
                        // The following call must be done only once while the application runs (otherwise a RemotingException occurs)
                        RemotingConfiguration.Configure(ConfigFile, false);
                    }
                }

                DetermineServerIPAddress();

                ARemote = (IClientManagerInterface)
                          Activator.GetObject(typeof(IClientManagerInterface),
                                              String.Format("tcp://{0}:{1}/Clientmanager", FServerIPAddr, FServerPort));

                if (ARemote != null)
                {
                    if (TLogging.DebugLevel >= CONNECTOR_LOGGING)
                    {
                        TLogging.Log("GetRemoteServerConnection: connected.", TLoggingType.ToLogfile);
                    }
                }
            }
            catch (Exception exp)
            {
                TLogging.Log("Error in GetRemoteServerConnection(), Possible reasons :-" + exp.ToString(), TLoggingType.ToLogfile);
                throw;
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// References to the rest of the topmost level of the other Petra Module Namespaces will go here
 /// </summary>
 /// <returns>void</returns>
 public TRemote(IClientManagerInterface AClientManager,
     IMyService AMyServiceObject)
     : base(AClientManager)
 {
     UMyServiceObject = AMyServiceObject;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// constructor
 /// </summary>
 public TRemoteBase(IClientManagerInterface AClientManager)
 {
     UClientManager = AClientManager;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// specific things for connecting all the services
        /// </summary>
        /// <param name="AUserName"></param>
        /// <param name="APassword"></param>
        /// <param name="AClientManager"></param>
        /// <param name="AProcessID"></param>
        /// <param name="AWelcomeMessage"></param>
        /// <param name="ASystemEnabled"></param>
        /// <param name="AError"></param>
        /// <param name="AUserInfo"></param>
        /// <returns></returns>
        protected override bool ConnectClient(String AUserName,
            String APassword,
            IClientManagerInterface AClientManager,
            out Int32 AProcessID,
            out String AWelcomeMessage,
            out Boolean ASystemEnabled,
            out String AError,
            out IPrincipal AUserInfo)
        {
            try
            {
                if (!base.ConnectClient(AUserName,
                        APassword,
                        AClientManager,
                        out AProcessID,
                        out AWelcomeMessage,
                        out ASystemEnabled,
                        out AError,
                        out AUserInfo))
                {
                    return false;
                }

                Ict.Petra.Shared.UserInfo.GUserInfo = (TPetraPrincipal)AUserInfo;

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MSYSMAN))
                {
                    FRemotingURL_MSysMan = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MSYSMAN];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MCOMMON))
                {
                    FRemotingURL_MCommon = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MCOMMON];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MCONFERENCE))
                {
                    FRemotingURL_MConference = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MCONFERENCE];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MPARTNER))
                {
                    FRemotingURL_MPartner = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MPARTNER];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MPERSONNEL))
                {
                    FRemotingURL_MPersonnel = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MPERSONNEL];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MFINANCE))
                {
                    FRemotingURL_MFinance = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MFINANCE];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MREPORTING))
                {
                    FRemotingURL_MReporting = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MREPORTING];
                }

                return true;
            }
            catch (ELoginFailedServerTooBusyException)
            {
                throw;
            }
            catch (Exception exp)
            {
                TLogging.Log(exp.ToString() + Environment.NewLine + exp.StackTrace, TLoggingType.ToLogfile);
                throw;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// connect the client
        /// </summary>
        /// <param name="AUserName"></param>
        /// <param name="APassword"></param>
        /// <param name="AClientManager"></param>
        /// <param name="AProcessID"></param>
        /// <param name="AWelcomeMessage"></param>
        /// <param name="ASystemEnabled"></param>
        /// <param name="AError"></param>
        /// <param name="AUserInfo"></param>
        /// <returns></returns>
        virtual protected bool ConnectClient(String AUserName,
                                             String APassword,
                                             IClientManagerInterface AClientManager,
                                             out Int32 AProcessID,
                                             out String AWelcomeMessage,
                                             out Boolean ASystemEnabled,
                                             out String AError,
                                             out IPrincipal AUserInfo)
        {
            AError          = "";
            ASystemEnabled  = false;
            AWelcomeMessage = "";
            AProcessID      = -1;
            AUserInfo       = null;

            try
            {
                AClientManager.ConnectClient(AUserName, APassword,
                                             TClientInfo.ClientComputerName,
                                             TClientInfo.ClientIPAddress,
                                             new Version(TClientInfo.ClientAssemblyVersion),
                                             DetermineClientServerConnectionType(),
                                             out FClientName,
                                             out FClientID,
                                             out FCrossDomainURI,
                                             out FRemotingURLs,
                                             out FServerOS,
                                             out AProcessID,
                                             out AWelcomeMessage,
                                             out ASystemEnabled,
                                             out AUserInfo);

                if (FRemotingURLs.ContainsKey(RemotingConstants.REMOTINGURL_IDENTIFIER_POLLCLIENTTASKS))
                {
                    FRemotingURL_PollClientTasks = (String)FRemotingURLs[RemotingConstants.REMOTINGURL_IDENTIFIER_POLLCLIENTTASKS];
                }

                FConnector.Init(FCrossDomainURI, FClientID.ToString());

                return(true);
            }
            catch (EUserNotExistantException exp)
            {
                AError = exp.Message;
                return(false);
            }
            catch (ESystemDisabledException exp)
            {
                AError = exp.Message;
                return(false);
            }
            catch (EClientVersionMismatchException)
            {
                throw;
            }
            catch (ELoginFailedServerTooBusyException)
            {
                throw;
            }
            catch (Exception exp)
            {
                TLogging.Log(exp.ToString() + Environment.NewLine + exp.StackTrace, TLoggingType.ToLogfile);
                throw;
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// specific things for connecting all the services
        /// </summary>
        /// <param name="AUserName"></param>
        /// <param name="APassword"></param>
        /// <param name="AClientManager"></param>
        /// <param name="AProcessID"></param>
        /// <param name="AWelcomeMessage"></param>
        /// <param name="ASystemEnabled"></param>
        /// <param name="AError"></param>
        /// <param name="AUserInfo"></param>
        /// <returns></returns>
        protected override bool ConnectClient(String AUserName,
                                              String APassword,
                                              IClientManagerInterface AClientManager,
                                              out Int32 AProcessID,
                                              out String AWelcomeMessage,
                                              out Boolean ASystemEnabled,
                                              out String AError,
                                              out IPrincipal AUserInfo)
        {
            try
            {
                if (!base.ConnectClient(AUserName,
                                        APassword,
                                        AClientManager,
                                        out AProcessID,
                                        out AWelcomeMessage,
                                        out ASystemEnabled,
                                        out AError,
                                        out AUserInfo))
                {
                    return(false);
                }

                Ict.Petra.Shared.UserInfo.GUserInfo = (TPetraPrincipal)AUserInfo;

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MSYSMAN))
                {
                    FRemotingURL_MSysMan = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MSYSMAN];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MCOMMON))
                {
                    FRemotingURL_MCommon = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MCOMMON];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MCONFERENCE))
                {
                    FRemotingURL_MConference = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MCONFERENCE];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MPARTNER))
                {
                    FRemotingURL_MPartner = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MPARTNER];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MPERSONNEL))
                {
                    FRemotingURL_MPersonnel = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MPERSONNEL];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MFINANCE))
                {
                    FRemotingURL_MFinance = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MFINANCE];
                }

                if (FRemotingURLs.ContainsKey(SharedConstants.REMOTINGURL_IDENTIFIER_MREPORTING))
                {
                    FRemotingURL_MReporting = (String)FRemotingURLs[SharedConstants.REMOTINGURL_IDENTIFIER_MREPORTING];
                }

                return(true);
            }
            catch (ELoginFailedServerTooBusyException)
            {
                throw;
            }
            catch (Exception exp)
            {
                TLogging.Log(exp.ToString() + Environment.NewLine + exp.StackTrace, TLoggingType.ToLogfile);
                throw;
            }
        }
 /// <summary>
 /// Assigns the passed in reference to the TClientManager Object to an internal
 /// variable, which is later used to make calls to this object.
 ///
 /// </summary>
 /// <param name="AClientManagerRef">Reference to the TClientManager Object
 /// </param>
 /// <returns>void</returns>
 public TClientManagerCallForwarder(IClientManagerInterface AClientManagerRef) : base()
 {
     FClientManagerRef = AClientManagerRef;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// constructor
 /// </summary>
 public TRemoteBase(IClientManagerInterface AClientManager)
 {
     UClientManager = AClientManager;
 }
Ejemplo n.º 13
0
        /// <summary>
        /// References to the rest of the topmost level of the other Petra Module Namespaces will go here
        /// </summary>
        /// <returns>void</returns>
        public TRemote(IClientManagerInterface AClientManager,
            IMCommonNamespace ACommonObject,
            IMConferenceNamespace AConferenceObject,
            IMPartnerNamespace APartnerObject,
            IMPersonnelNamespace APersonnelObject,
            IMFinanceNamespace AFinanceObject,
            IMReportingNamespace AReportingObject,
            IMSysManNamespace ASysManObject)
            : base(AClientManager)
        {
            USysManObject = ASysManObject;
            UConferenceObject = AConferenceObject;
            UPartnerObject = APartnerObject;
            UCommonObject = ACommonObject;
            UPersonnelObject = APersonnelObject;
            UFinanceObject = AFinanceObject;
            UReportingObject = AReportingObject;

            FRemoteObjects.Add((MarshalByRefObject)USysManObject);
            FRemoteObjects.Add((MarshalByRefObject)UConferenceObject);
            FRemoteObjects.Add((MarshalByRefObject)UPartnerObject);
            FRemoteObjects.Add((MarshalByRefObject)UCommonObject);
            FRemoteObjects.Add((MarshalByRefObject)UPersonnelObject);
            FRemoteObjects.Add((MarshalByRefObject)UFinanceObject);
            FRemoteObjects.Add((MarshalByRefObject)UReportingObject);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// specific things for connecting all the services
        /// </summary>
        /// <param name="AUserName"></param>
        /// <param name="APassword"></param>
        /// <param name="AClientManager"></param>
        /// <param name="AProcessID"></param>
        /// <param name="AWelcomeMessage"></param>
        /// <param name="ASystemEnabled"></param>
        /// <param name="AError"></param>
        /// <param name="AUserInfo"></param>
        /// <returns></returns>
        protected override bool ConnectClient(String AUserName,
            String APassword,
            IClientManagerInterface AClientManager,
            out Int32 AProcessID,
            out String AWelcomeMessage,
            out Boolean ASystemEnabled,
            out String AError,
            out IPrincipal AUserInfo)
        {
            try
            {
                base.ConnectClient(AUserName,
                    APassword,
                    AClientManager,
                    out AProcessID,
                    out AWelcomeMessage,
                    out ASystemEnabled,
                    out AError,
                    out AUserInfo);

                if (FRemotingURLs.ContainsKey(SharedConstantsTest.REMOTINGURL_IDENTIFIER_MYSERVICE))
                {
                    FRemotingURL_MyService = (String)FRemotingURLs[SharedConstantsTest.REMOTINGURL_IDENTIFIER_MYSERVICE];
                }

                return true;
            }
            catch (ELoginFailedServerTooBusyException)
            {
                throw;
            }
            catch (Exception exp)
            {
                TLogging.Log(exp.ToString() + Environment.NewLine + exp.StackTrace, TLoggingType.ToLogfile);
                throw;
            }
        }
Ejemplo n.º 15
0
 /// <summary>
 /// References to the rest of the topmost level of the other Petra Module Namespaces will go here
 /// </summary>
 /// <returns>void</returns>
 public TRemote(IClientManagerInterface AClientManager,
                IMyService AMyServiceObject)
     : base(AClientManager)
 {
     UMyServiceObject = AMyServiceObject;
 }
 /// <summary>
 /// Assigns the passed in reference to the TClientManager Object to an internal
 /// variable, which is later used to make calls to this object.
 ///
 /// </summary>
 /// <param name="AClientManagerRef">Reference to the TClientManager Object
 /// </param>
 /// <returns>void</returns>
 public TClientManagerCallForwarder(IClientManagerInterface AClientManagerRef) : base()
 {
     FClientManagerRef = AClientManagerRef;
 }