Package nl.clockwork.mule.ebms.model.cpp.cpa

Examples of nl.clockwork.mule.ebms.model.cpp.cpa.PartyInfo


      {
        EbMSMessage msg = (EbMSMessage)message.getPayload();
        MessageHeader messageHeader = msg.getMessageHeader();
        CollaborationProtocolAgreement cpa = ebMSDAO.getCPA(messageHeader.getCPAId());
        Signature signature = (Signature)message.getProperty(Constants.EBMS_SIGNATURE);
        PartyInfo partyInfo = CPAUtils.getPartyInfo(cpa,messageHeader.getFrom().getPartyId());
        List<DeliveryChannel> deliveryChannels = CPAUtils.getDeliveryChannels(partyInfo,messageHeader.getFrom().getRole(),messageHeader.getService(),messageHeader.getAction());
        if (CPAUtils.isSigned(deliveryChannels.get(0)))
        {
          if (signature == null)
          {
View Full Code Here


  public static ReliableMessaging getReliableMessaging(CollaborationProtocolAgreement cpa, MessageHeader messageHeader)
  {
    try
    {
      PartyInfo partyInfo = getPartyInfo(cpa,messageHeader.getFrom().getPartyId());
      List<DeliveryChannel> deliveryChannels = getDeliveryChannels(partyInfo,messageHeader.getFrom().getRole(),messageHeader.getService(),messageHeader.getAction());
      return ((DocExchange)deliveryChannels.get(0).getDocExchangeId()).getEbXMLSenderBinding().getReliableMessaging();
    }
    catch (Exception e)
    {
View Full Code Here

    private boolean isSigned(Document document) throws XPathExpressionException, ParserConfigurationException, SAXException, IOException, JAXBException, DAOException
    {
      Node n = (Node)XMLUtils.executeXPathQuery(new EbXMLNamespaceContext(),document,"/soap:Envelope/soap:Header/ebxml:MessageHeader",XPathConstants.NODE);
      MessageHeader messageHeader = XMLMessageBuilder.getInstance(MessageHeader.class).handle(n);
      CollaborationProtocolAgreement cpa = ebMSDAO.getCPA(messageHeader.getCPAId());
      PartyInfo partyInfo = CPAUtils.getPartyInfo(cpa,messageHeader.getFrom().getPartyId());
      List<DeliveryChannel> channels = CPAUtils.getDeliveryChannels(partyInfo,messageHeader.getFrom().getRole(),messageHeader.getService(),messageHeader.getAction());
      return CPAUtils.isSigned(channels.get(0));
    }
View Full Code Here

public class EbMSMessageUtils
{
  public static MessageHeader createMessageHeader(CollaborationProtocolAgreement cpa, EbMSMessageContext context, String hostname) throws DatatypeConfigurationException
  {
    String uuid = UUID.getUUID();
    PartyInfo sendingPartyInfo = CPAUtils.getSendingPartyInfo(cpa,context.getFromRole(),context.getServiceType(),context.getService(),context.getAction());
    PartyInfo receivingPartyInfo = CPAUtils.getReceivingPartyInfo(cpa,context.getToRole(),context.getServiceType(),context.getService(),context.getAction());
    //PartyInfo receivingPartyInfo = CPAUtils.getOtherReceivingPartyInfo(cpa,context.getFromRole(),context.getServiceType(),context.getService(),context.getAction());

    MessageHeader messageHeader = new MessageHeader();

    messageHeader.setVersion(Constants.EBMS_VERSION);
    messageHeader.setMustUnderstand(true);

    messageHeader.setCPAId(cpa.getCpaid());
    messageHeader.setConversationId(context.getConversationId() != null ? context.getConversationId() : uuid);
   
    messageHeader.setFrom(new From());
    PartyId from = new PartyId();
    from.setType(sendingPartyInfo.getPartyId().get(0).getType());
    from.setValue(sendingPartyInfo.getPartyId().get(0).getValue());
    messageHeader.getFrom().getPartyId().add(from);
    messageHeader.getFrom().setRole(sendingPartyInfo.getCollaborationRole().get(0).getRole().getName());

    messageHeader.setTo(new To());
    PartyId to = new PartyId();
    to.setType(receivingPartyInfo.getPartyId().get(0).getType());
    to.setValue(receivingPartyInfo.getPartyId().get(0).getValue());
    messageHeader.getTo().getPartyId().add(to);
    messageHeader.getTo().setRole(receivingPartyInfo.getCollaborationRole().get(0).getRole().getName());
   
    messageHeader.setService(new Service());
    messageHeader.getService().setType(sendingPartyInfo.getCollaborationRole().get(0).getServiceBinding().getService().getType());
    messageHeader.getService().setValue(sendingPartyInfo.getCollaborationRole().get(0).getServiceBinding().getService().getValue());
    messageHeader.setAction(sendingPartyInfo.getCollaborationRole().get(0).getServiceBinding().getCanSend().get(0).getThisPartyActionBinding().getAction());
View Full Code Here

    return messageHeader;
  }

  public static AckRequested createAckRequested(CollaborationProtocolAgreement cpa, EbMSMessageContext context)
  {
    PartyInfo partyInfo = CPAUtils.getSendingPartyInfo(cpa,context.getFromRole(),context.getServiceType(),context.getService(),context.getAction());
    DeliveryChannel channel = CPAUtils.getDeliveryChannel(partyInfo.getCollaborationRole().get(0).getServiceBinding().getCanSend().get(0).getThisPartyActionBinding());

    if (PerMessageCharacteristicsType.ALWAYS.equals(channel.getMessagingCharacteristics().getAckRequested()))
    {
      AckRequested ackRequested = new AckRequested();
      ackRequested.setVersion(Constants.EBMS_VERSION);
View Full Code Here

      CollaborationProtocolAgreement cpa = ebMSDAO.getCPA(context.getCpaId());
      if (cpa == null)
        throw new EbMSMessageContextValidationException("No CPA found for: context.cpaId=" + context.getCpaId());

      PartyInfo sendingPartyInfo = CPAUtils.getSendingPartyInfo(cpa,context.getFromRole(),context.getServiceType(),context.getService(),context.getAction());
      if (sendingPartyInfo == null)
      {
        StringBuffer msg = new StringBuffer();

        msg.append("No CanSend action found for:");
        msg.append(" context.cpaId=").append(context.getCpaId());
        if (context.getFromRole() != null)
          msg.append(", context.fromRole=").append(context.getFromRole());
        if (context.getServiceType() != null)
          msg.append(", context.serviceType=").append(context.getServiceType());
        msg.append(", context.service=").append(context.getService());
        msg.append(", context.action=").append(context.getAction());

        throw new EbMSMessageContextValidationException(msg.toString());
      }
      PartyInfo receivingPartyInfo = CPAUtils.getReceivingPartyInfo(cpa,context.getToRole(),context.getServiceType(),context.getService(),context.getAction());
      if (receivingPartyInfo == null)
      {
        StringBuffer msg = new StringBuffer();

        msg.append("No CanReceive action found for:");
View Full Code Here

      try
      {
        EbMSBaseMessage msg = (EbMSBaseMessage)message.getPayload();
        MessageHeader messageHeader = msg.getMessageHeader();
        CollaborationProtocolAgreement cpa = ebMSDAO.getCPA(messageHeader.getCPAId());
        PartyInfo from = null;
        PartyInfo to = null;

        if (!Constants.EBMS_VERSION.equals(messageHeader.getVersion()))
        {
          message.setProperty(Constants.EBMS_ERROR,EbMSMessageUtils.createError("//Header/MessageHeader[@version]",Constants.EbMSErrorCode.INCONSISTENT.errorCode(),"Value invalid."));
          return false;
View Full Code Here

      Node n = (Node)XMLUtils.executeXPathQuery(new EbXMLNamespaceContext(),document,"/soap:Envelope/soap:Header/ebxml:MessageHeader",XPathConstants.NODE);
      MessageHeader messageHeader = XMLMessageBuilder.getInstance(MessageHeader.class).handle(n);
      CollaborationProtocolAgreement cpa = ebMSDAO.getCPA(messageHeader.getCPAId());
      if (cpa != null)
      {
        PartyInfo partyInfo = CPAUtils.getPartyInfo(cpa,messageHeader.getFrom().getPartyId());
        if (partyInfo != null)
        {
          List<DeliveryChannel> channels = CPAUtils.getDeliveryChannels(partyInfo,messageHeader.getFrom().getRole(),messageHeader.getService(),messageHeader.getAction());
          if (channels.size() == 1)
          {
View Full Code Here

            && service.equals(role.getServiceBinding().getService().getValue())
        )
          for (CanSend canSend : role.getServiceBinding().getCanSend())
            if (action.equals(canSend.getThisPartyActionBinding().getAction()))
            {
              PartyInfo p = new PartyInfo();
              p.getPartyId().addAll(partyInfo.getPartyId());
              CollaborationRole cr = new CollaborationRole();
              cr.setRole(role.getRole());
              cr.setServiceBinding(new ServiceBinding());
              cr.getServiceBinding().setService(role.getServiceBinding().getService());
              cr.getServiceBinding().getCanSend().add(canSend);
              p.getCollaborationRole().add(cr);
              return p;
            }
    return null;
  }
View Full Code Here

            && service.equals(role.getServiceBinding().getService().getValue())
        )
          for (CanReceive canReceive : role.getServiceBinding().getCanReceive())
            if (action.equals(canReceive.getThisPartyActionBinding().getAction()))
            {
              PartyInfo p = new PartyInfo();
              p.getPartyId().addAll(partyInfo.getPartyId());
              CollaborationRole r = new CollaborationRole();
              r.setRole(role.getRole());
              r.setServiceBinding(new ServiceBinding());
              r.getServiceBinding().setService(role.getServiceBinding().getService());
              r.getServiceBinding().getCanReceive().add(canReceive);
              p.getCollaborationRole().add(r);
              return p;
            }
    return null;
  }
View Full Code Here

TOP

Related Classes of nl.clockwork.mule.ebms.model.cpp.cpa.PartyInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.