This is the base class for all types of data classes associated with an event.
示例#1
0
    /**
     * Processes the Event Data depending on the Type.
     * @param data EventResponseData.
     * @param type Type of Data.
     */
    private static void processEventData( BaseEdirEventData data, EdirEventType type)
    {
        switch (type)
        {
            case EdirEventType.EVT_CREATE_ENTRY :
                // Value event.
                //Output the relevant Data.
                EntryEventData valueevent = (EntryEventData) data;
                Console.WriteLine("Entry         = " + valueevent.Entry);
                Console.WriteLine("PrepetratorDN = " + valueevent.PerpetratorDN);
                Console.WriteLine("TimeStamp     = " + valueevent.TimeStamp);
                Console.WriteLine();
                break;

            default :
                //Unknow Event.
                break;
        }
    }
    protected void ProcessMessage(sbyte[] returnedValue)
    {
      LBERDecoder decoder = new LBERDecoder();
      Asn1Sequence sequence = (Asn1Sequence) decoder.decode(returnedValue);

      event_type = (EdirEventType)(((Asn1Integer) sequence.get_Renamed(0)).intValue());
      event_result_type = (EdirEventResultType)(((Asn1Integer) sequence.get_Renamed(1)).intValue());

      if (sequence.size() > 2)
      {
	Asn1Tagged objTagged = (Asn1Tagged) sequence.get_Renamed(2);
	
	switch((EdirEventDataType)(objTagged.getIdentifier().Tag))
	{
	case EdirEventDataType.EDIR_TAG_ENTRY_EVENT_DATA:
	  event_response_data = new EntryEventData(EdirEventDataType.EDIR_TAG_ENTRY_EVENT_DATA, objTagged.taggedValue());
	  break;

	case EdirEventDataType.EDIR_TAG_VALUE_EVENT_DATA:
	  event_response_data = new ValueEventData(EdirEventDataType.EDIR_TAG_VALUE_EVENT_DATA, objTagged.taggedValue());
	  break;
	  
	case EdirEventDataType.EDIR_TAG_DEBUG_EVENT_DATA:
	  event_response_data = new DebugEventData(EdirEventDataType.EDIR_TAG_DEBUG_EVENT_DATA, objTagged.taggedValue());
	  break;
	  
	case EdirEventDataType.EDIR_TAG_GENERAL_EVENT_DATA:
	  event_response_data = new GeneralDSEventData(EdirEventDataType.EDIR_TAG_GENERAL_EVENT_DATA, objTagged.taggedValue());
	  break;
	  
	case EdirEventDataType.EDIR_TAG_SKULK_DATA:
	  event_response_data = null;
	  break;
	  
	case EdirEventDataType.EDIR_TAG_BINDERY_EVENT_DATA:
	  event_response_data = new BinderyObjectEventData(EdirEventDataType.EDIR_TAG_BINDERY_EVENT_DATA, objTagged.taggedValue());
	  break;
	  
	case EdirEventDataType.EDIR_TAG_DSESEV_INFO:
	  event_response_data = new SecurityEquivalenceEventData(EdirEventDataType.EDIR_TAG_DSESEV_INFO, objTagged.taggedValue());
	  break;
	  
	case EdirEventDataType.EDIR_TAG_MODULE_STATE_DATA:
	  event_response_data = new ModuleStateEventData(EdirEventDataType.EDIR_TAG_MODULE_STATE_DATA, objTagged.taggedValue());
	  break;
	  
	case EdirEventDataType.EDIR_TAG_NETWORK_ADDRESS:
	  event_response_data = new NetworkAddressEventData(EdirEventDataType.EDIR_TAG_NETWORK_ADDRESS, objTagged.taggedValue());
	  break;
	  
	case EdirEventDataType.EDIR_TAG_CONNECTION_STATE:
	  event_response_data = new ConnectionStateEventData(EdirEventDataType.EDIR_TAG_CONNECTION_STATE, objTagged.taggedValue());
	  break;

	case EdirEventDataType.EDIR_TAG_CHANGE_SERVER_ADDRESS:
	  event_response_data = new ChangeAddressEventData(EdirEventDataType.EDIR_TAG_CHANGE_SERVER_ADDRESS, objTagged.taggedValue());
	  break;

	  /*
            case EdirEventDataType.EDIR_TAG_CHANGE_CONFIG_PARAM :
                responsedata =
                    new ChangeConfigEventData(
                        taggedobject.taggedValue());

                break;

            case EdirEventDataType.EDIR_TAG_STATUS_LOG :
                responsedata =
                    new StatusLogEventData(taggedobject.taggedValue());

                break;
	  */
	case EdirEventDataType.EDIR_TAG_NO_DATA:
	  event_response_data = null;
	  break;

	default:
	  //unhandled data.
	  throw new IOException();
	  }
      } else
      {
	//NO DATA
	event_response_data = null;
      }
    }