/** * Processes a pre-enveloped message. The message will be decrypted and validated that it meets trust assertions. * @param envelope A message envelope containing the incoming message. * @return An incoming messaging object that contains the unwrapped and decrypted message. */ public IncomingMessage processIncoming(MessageEnvelope envelope) { if (envelope == null) { throw new IllegalArgumentException(); } this.checkEnvelopeAddresses(envelope); return this.processIncoming(new IncomingMessage(envelope)); }
/** * Processes an outgoing pre-enveloped message. The message will be wrapped, encrypted, and signed. * @param envelope A message envelope containing the outgoing message. * @return An outoing messaging object that contains the wrapped message that is and encrypted and signed. */ public OutgoingMessage processOutgoing(MessageEnvelope envelope) { Lock lock = readWriteLock.readLock(); lock.lock(); try { if (envelope == null) throw new IllegalArgumentException(); this.checkEnvelopeAddresses(envelope); OutgoingMessage message = new OutgoingMessage(envelope); return this.processOutgoing(message); } finally { lock.unlock(); } }
protected void checkEnvelopeAddresses(MessageEnvelope envelope) { this.checkEnvelopeAddresses(envelope.getRecipients(), envelope.getSender()); }
/** * Processes an incoming message represented by a raw string. The message will be decrypted and validated that it meets trust assertions. * @param messageText The raw contents of the incoming message that will be processed. * @param recipients The recipients of the message. This overrides the routing headers in the message. * @param sender The sender of the message. This overrides the to FROM routing header in the message. * @return An incoming messaging object that contains the unwrapped and decrypted message. */ public IncomingMessage processIncoming(String messageText, NHINDAddressCollection recipients, NHINDAddress sender) { this.checkEnvelopeAddresses(recipients, sender); IncomingMessage message = new IncomingMessage(messageText, recipients, sender); return this.processIncoming(message); }
/** * Processes an outgoing message represented by a raw string. The message will be wrapped, encrypted, and signed. * @param messageText The raw contents of the incoming message that will be processed. * @param recipients The recipients of the message. This overrides the routing headers in the message. * @param sender The sender of the message. This overrides the to FROM routing header in the message. * @return An outoing messaging object that contains the wrapped message that is and encrypted and signed. */ public OutgoingMessage processOutgoing(String messageText, NHINDAddressCollection recipients, NHINDAddress sender) { Lock lock = readWriteLock.readLock(); lock.lock(); try { this.checkEnvelopeAddresses(recipients, sender); OutgoingMessage message = new OutgoingMessage(this.wrapMessage(messageText), recipients, sender); return this.processOutgoing(message); } finally { lock.unlock(); } }