Exemple #1
0
        /// <summary>Method abort</summary>
        /// <param name="error"></param>
        /// <param name="channel"></param>
        /// <exception cref="BEEPException" />
        public virtual void abort(BEEPError error, IChannel channel)
        {
            tuningChannels.Remove(channel);
            log.debug("TuningProfile.abort");

            // Log entry or something - throw an exception???
        }
Exemple #2
0
 /// <summary>Sends a message of type ERR.</summary>
 /// <param name="error">Error to send in the form of <code>BEEPError</code>.</param>
 /// <seealso cref="BEEPError"></seealso>
 /// <seealso cref="MessageStatus"></seealso>
 /// <returns>MessageStatus</returns>
 /// 
 /// <exception cref="BEEPException">if an error is encoutered or if messageType is
 /// not MESSAGE_TYPE_MSG.</exception>
 public virtual MessageStatus sendERR(BEEPError error)
 {
     throw new BEEPException(NOT_MESSAGE_TYPE_MSG);
 }
Exemple #3
0
        // Default Profile Methods
        /// <summary>Method begin</summary>
        /// <param name="channel"></param>
        /// <param name="profile"></param>
        /// <param name="data"></param>
        /// <exception cref="BEEPException" />
        public virtual void begin(IChannel channel, string profile, string data)
        {
            log.debug("TuningProfile.begin");

            SessionImpl session = (SessionImpl) channel.Session;

            try
            {
                if(!tuningChannels.Contains(channel))
                    tuningChannels.Add(channel);
                ((ChannelImpl) channel).setState(core.ChannelState.STATE_TUNING);
                session.sendProfile(profile, data, (ChannelImpl) channel);
                ((ChannelImpl) channel).setState(core.ChannelState.STATE_ACTIVE);
                session.disableIO();
            }
            catch (System.Exception x)
            {

                // If we're here, the profile didn't succesfully send, so
                // send an error
                //UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043"'
                BEEPError error = new BEEPError(BEEPStatusCode.REQUESTED_ACTION_ABORTED, "UnknownError" + x.Message);

                session.sendProfile(profile, error.createErrorMessage(), (ChannelImpl) channel);
                abort(error, channel);
            }
        }
Exemple #4
0
			public virtual void  receiveERR(IMessage message)
			{
				BEEPError err;
				
				try
				{
					err = BEEPError.convertMessageERRToException(message);
				}
				catch (BEEPException e)
				{
					//UPGRADE_TODO: The equivalent in .NET for method 'java.lang.Throwable.getMessage' may return a different value. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1043"'
					enclosingInstance.terminate(e.Message);
					
					return ;
				}
				
				Enclosing_Instance.log.debug("Received an error in response to a close. code=" + err.Code + " diagnostic=" + err.Diagnostic);
				
				this.error = err;
				
				// set the state
				channel.setState(core.ChannelState.STATE_ACTIVE);
				Enclosing_Instance.channels.Remove(channel.NumberAsString);
				
				// release the block waiting for the channel to start or close
				lock (this)
				{
					System.Threading.Monitor.Pulse(this);
				}
			}
Exemple #5
0
			internal CloseReplyListener(SessionImpl enclosingInstance, ChannelImpl channel)
			{
				InitBlock(enclosingInstance);
				this.channel = channel;
				this.error = null;
			}
Exemple #6
0
			public virtual void  receiveERR(IMessage message)
			{
				BEEPError err;
				
				try
				{
					err = BEEPError.convertMessageERRToException(message);
				}
				catch (BEEPException e)
				{
					enclosingInstance.terminate(e.Message);
					
					return ;
				}
				
				Enclosing_Instance.log.error("Received an error in response to a start. code=" + err.Code + " diagnostic=" + err.Diagnostic);
				
				this.error = err;
				
				channel.setState(core.ChannelState.STATE_CLOSED);
				Enclosing_Instance.channels.Remove(channel.NumberAsString);
				
				// release the block waiting for the channel to start or close
				lock (this)
				{
					System.Threading.Monitor.Pulse(this);
				}
			}