Examples of MessagePart


Examples of com.google.caja.reporting.MessagePart

  static List<Message> sortMessages(List<Message> messages) {
    List<Message> sorted = Lists.newArrayList(messages);
    Collections.sort(sorted, new Comparator<Message>() {
      public int compare(Message a, Message b) {
        MessagePart a0 = firstPartOf(a);
        MessagePart b0 = firstPartOf(b);
        InputSource aSrc = toInputSource(a0), bSrc = toInputSource(b0);
        // Compure by source first.
        if (aSrc != null && bSrc != null) {
          int delta = aSrc.getUri().compareTo(bSrc.getUri());
          if (delta != 0) { return delta; }
        }
        // Sort positionless parts after ones with a position.
        long aSPos = Integer.MAX_VALUE + 1L, aEPos = Integer.MAX_VALUE + 1L;
        long bSPos = Integer.MAX_VALUE + 1L, bEPos = Integer.MAX_VALUE + 1L;
        if (a0 instanceof FilePosition) {
          FilePosition pos = (FilePosition) a0;
          aSPos = pos.startCharInFile();
          aEPos = pos.endCharInFile();
        } else if (a0 instanceof InputSource) {
          // sort file level messages before messages within file
          aSPos = aEPos = -1;
        }
        if (b0 instanceof FilePosition) {
          FilePosition pos = (FilePosition) b0;
          bSPos = pos.startCharInFile();
          bEPos = pos.endCharInFile();
        } else if (b0 instanceof InputSource) {
          // sort file level messages before messages within file
          bSPos = bEPos = -1;
        }
        int delta = Long.signum(aSPos - bSPos);
        if (delta != 0) { return delta; }
        delta = Long.signum(aEPos - bEPos);
        if (delta != 0) { return delta; }

        StringBuilder aBuf = new StringBuilder(), bBuf = new StringBuilder();
        MessageContext mc = new MessageContext();
        try {
          a0.format(mc, aBuf);
          b0.format(mc, bBuf);
        } catch (IOException ex) {
          throw new RuntimeException(ex);
        }
        return aBuf.toString().compareTo(bBuf.toString());
      }
View Full Code Here

Examples of com.sun.tools.internal.ws.wsdl.document.MessagePart

                        e.getLocalName());
                }
                gotDocumentation = true;
                message.setDocumentation(getDocumentationFor(e2));
            } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PART)) {
                MessagePart part = parseMessagePart(context, e2);
                message.add(part);
            } else {
                Util.fail(
                    "parsing.invalidElement",
                    e2.getTagName(),
View Full Code Here

Examples of com.sun.tools.internal.ws.wsdl.document.MessagePart

    }

    private MessagePart parseMessagePart(TWSDLParserContextImpl context, Element e) {
        context.push();
        context.registerNamespaces(e);
        MessagePart part = new MessagePart(forest.locatorTable.getStartLocation(e));
        String partName = Util.getRequiredAttribute(e, Constants.ATTR_NAME);
        part.setName(partName);

        String elementAttr =
            XmlUtil.getAttributeOrNull(e, Constants.ATTR_ELEMENT);
        String typeAttr = XmlUtil.getAttributeOrNull(e, Constants.ATTR_TYPE);

        if (elementAttr != null) {
            if (typeAttr != null) {
                errReceiver.error(context.getLocation(e), WsdlMessages.PARSING_ONLY_ONE_OF_ELEMENT_OR_TYPE_REQUIRED(partName));

            }

            part.setDescriptor(context.translateQualifiedName(context.getLocation(e), elementAttr));
            part.setDescriptorKind(SchemaKinds.XSD_ELEMENT);
        } else if (typeAttr != null) {
            part.setDescriptor(context.translateQualifiedName(context.getLocation(e), typeAttr));
            part.setDescriptorKind(SchemaKinds.XSD_TYPE);
        } else {
            // XXX-NOTE - this is wrong; for extensibility purposes,
            // any attribute can be specified on a <part> element, so
            // we need to put an extensibility hook here
            errReceiver.warning(forest.locatorTable.getStartLocation(e), WsdlMessages.PARSING_ELEMENT_OR_TYPE_REQUIRED(partName));
View Full Code Here

Examples of com.sun.tools.ws.wsdl.document.MessagePart

                        e.getLocalName());
                }
                gotDocumentation = true;
                message.setDocumentation(getDocumentationFor(e2));
            } else if (XmlUtil.matchesTagNS(e2, WSDLConstants.QNAME_PART)) {
                MessagePart part = parseMessagePart(context, e2);
                message.add(part);
            } else {
                Util.fail(
                    "parsing.invalidElement",
                    e2.getTagName(),
View Full Code Here

Examples of javax.wireless.messaging.MessagePart

        // Check that content has not already been added. For this sample there
        // is no point in attaching the same file twice. Note that every
        // MessagePart contained within a MultipartMessage must have a unique
        // content id.
        for (int i = 0; i < getMessageParts().getNumberOfRows(); i++) {
            final MessagePart messagePart =
                    (MessagePart) getMessageParts().getRow(i);
            final String contentLocation = messagePart.getContentLocation();
            if (contentLocation.equals(FOLDER_NAMES[type] + '0'
                    + EXTENSIONS[type])) {
                exists = true;
            }
        }
        if (!exists) {
            // Obtain content data from project resource
            final String filename = FOLDER_NAMES[type] + "0" + EXTENSIONS[type];
            final StringBuffer path = new StringBuffer("/media/");
            path.append(FOLDER_NAMES[type]);
            path.append("/");
            path.append(filename);
            final InputStream inputStream =
                    getClass().getResourceAsStream(path.toString());
            try {
                final byte[] contentData =
                        IOUtilities.streamToBytes(inputStream);

                // Create a MessagePart object with the contentData and add it
                // to the message parts vector
                final MessagePart messagePart =
                        new MessagePart(contentData, MIME_TYPES[type],
                                FOLDER_NAMES[type], filename, null);
                addMessagePart(messagePart);
            } catch (final IOException ioe) {
                errorDialog(ioe.toString());
            }
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

      assertEquals(3, cPart.getPart("areaCode").getMinCount());
      assertTrue(msg.getRoot().getAggregation() != CompositeMessagePart.SINGLE);
      msg = (Message)msgRegistry.get("phoneNumberA");
      assertTrue(msg.getRoot().getAggregation() != CompositeMessagePart.SINGLE);

      MessagePart p = msg.getRoot().getPart("phoneNumber");
     
      assertEquals(0, p.getMinCount());
      p = msg.getRoot().getPart("areaCode");
      assertEquals(0, p.getMinCount());
      p = msg.getRoot().getPart("number");
      assertEquals(0, p.getMinCount());

      msg = (Message)msgRegistry.get("sequencechoice");
      p = msg.getRoot().getPart("externalAct");
      assertEquals(0, p.getMinCount());

      msg = (Message)msgRegistry.get("unboundedChoice");
      p = msg.getRoot().getPart("th");
      assertEquals(0, p.getMinCount());

      msg = (Message)msgRegistry.get("wierdBoolean");
      p = msg.getRoot().getPart("ba");
      assertEquals(((XMLMessagePartMapping)p.getMapping()).getFormat(), "true;false");
   }
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

      //System.err.println(XMLUtil.formatXML(writer.toString()));
     
      Message recursiveElement = getMessage("recursiveElement");
     
      MessagePart elem2 = recursiveElement.getRoot().getPart("recursiveElement2");
     
      assertTrue(elem2 instanceof CompositeMessagePartRef);
     
      CompositeMessagePartRef msgRef = (CompositeMessagePartRef)elem2;
     
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

     
      msgA.getRoot().getPart("booleanA");
      msgA.getRoot().getPart("stringA");
     
      Message msgB = (Message)msgRegistry.get("elementB");
      MessagePart childB = msgB.getRoot().getPart("childB");
     
      assertTrue(childB instanceof CompositeMessagePartRef);
      assertEquals(((CompositeMessagePartRef)childB).getRefPart().getName(), "elementA");
   }
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

      codeType.getRoot().getPart("code");
      codeType.getRoot().getPart("description");
     
      Message msgA = (Message)msgRegistry.get("elementA");
     
      MessagePart codeA = msgA.getRoot().getPart("codeA");
     
      assertTrue(codeA instanceof CompositeMessagePartRef);
      assertEquals(((CompositeMessagePartRef)codeA).getRefPart().getName(), "CodeType");
     
      msgA.getRoot().getPart("stringA");
     
      Message msgB = (Message)msgRegistry.get("elementB");
      MessagePart codeB = msgB.getRoot().getPart("codeB");
      MessagePart childB = msgB.getRoot().getPart("childB");
     
      assertTrue(codeB instanceof CompositeMessagePartRef);
      assertEquals(((CompositeMessagePartRef)codeB).getRefPart().getName(), "CodeType");
     
      assertTrue(childB instanceof CompositeMessagePartRef);
View Full Code Here

Examples of nexj.core.meta.integration.MessagePart

      {
         assertNotNull(e);
      }
     
      Message myBaseType = (Message)msgRegistry.get("myBaseType");
      MessagePart part = myBaseType.getRoot().getPart("baseElement");
        
      assertTrue(part instanceof PrimitiveMessagePart);

      Message parent = (Message)msgRegistry.get("parent");
      MessagePart child = parent.getRoot().getPart("child");

      assertTrue(child instanceof CompositeMessagePartRef);
     
      Message childMsg = (Message)msgRegistry.get("parent_child");
     
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.