private Event createEvent ( Endpoint endpoint , EventTypeEnum type ) { Event event = new Event ( ) ; MessageInfo messageInfo = new MessageInfo ( ) ; Originator originator = new Originator ( ) ; event . setMessageInfo ( messageInfo ) ; event . setOriginator ( originator ) ; Date date = new Date ( ) ; event . setTimestamp ( date ) ; event . setEventType ( type ) ; messageInfo . setPortType ( endpoint . getBinding ( ) . getBindingInfo ( ) . getService ( ) . getInterface ( ) . getName ( ) . toString ( ) ) ; String transportType = null ; if ( endpoint . getBinding ( ) instanceof SoapBinding ) { SoapBinding soapBinding = ( SoapBinding ) endpoint . getBinding ( ) ; if ( soapBinding . getBindingInfo ( ) instanceof SoapBindingInfo ) { SoapBindingInfo soapBindingInfo = ( SoapBindingInfo ) soapBinding . getBindingInfo ( ) ; transportType = soapBindingInfo . getTransportURI ( ) ; } } messageInfo . setTransportType ( ( transportType != null ) ? transportType : "Unknown transport type" ) ; originator . setProcessId ( Converter . getPID ( ) ) ; try { InetAddress inetAddress = InetAddress . getLocalHost ( ) ; originator . setIp ( inetAddress . getHostAddress ( ) ) ; originator . setHostname ( inetAddress . getHostName ( ) ) ; } catch ( UnknownHostException e ) { originator . setHostname ( "Unknown hostname" ) ; originator . setIp ( "Unknown ip address" ) ; } String address = endpoint . getEndpointInfo ( ) . getAddress ( ) ; event . getCustomInfo ( ) . put ( "address" , address ) ; return event ; }
Creates the event for endpoint with specific type .