Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMText


    public int getTextLength() {
        int returnLength = 0;
        if (parser != null) {
            returnLength = parser.getTextLength();
        } else {
            OMText textNode = (OMText) lastNode;
            returnLength = textNode.getText().length();
        }
        return returnLength;
    }
View Full Code Here


            } catch (XMLStreamException e) {
                throw new OMStreamingException(e);
            }
        } else {
            if (hasText()) {
                OMText textNode = (OMText) lastNode;
                String str = textNode.getText();
                str.getChars(i, i + i2, chars, i1);
            }
        }
        return returnLength;
    }
View Full Code Here

        char[] returnArray = null;
        if (parser != null) {
            returnArray = parser.getTextCharacters();
        } else {
            if (hasText()) {
                OMText textNode = (OMText) lastNode;
                String str = textNode.getText();
                returnArray = str.toCharArray();
            }
        }
        return returnArray;
    }
View Full Code Here

        if (OMConstants.IS_DATA_HANDLERS_AWARE.equals(s)) {
            return Boolean.TRUE;
        }
        if (OMConstants.IS_BINARY.equals(s)) {
            if (lastNode instanceof OMText) {
                OMText text = (OMText) lastNode;
                return new Boolean(text.isBinary());
            }
            return Boolean.FALSE;
        } else if (OMConstants.DATA_HANDLER.equals(s)) {
            if (lastNode instanceof OMText) {
                OMText text = (OMText) lastNode;   
                if (text.isBinary())
                    return text.getDataHandler();
            }
        }
        // Per spec, throw IllegalArgumentException
        if (s == null) {
            throw new IllegalArgumentException();
View Full Code Here

  public void MTOMPing(OMElement in) throws Exception  {
    OMElement attachmentElem = in.getFirstChildWithName(new QName(applicationNamespaceName, Attachment));
    if (attachmentElem == null)
      throw new AxisFault("'Attachment' element is not present as a child of the 'Ping' element");

    OMText binaryElem = (OMText) attachmentElem.getFirstOMChild();

    binaryElem.setOptimize(true);
    DataHandler dataHandler = (DataHandler) binaryElem.getDataHandler();

    try {
     
      File destinationFile = new File(DESTINATION_IMAGE_FILE);
      if (destinationFile.exists())
View Full Code Here

      throw AxisFault.makeFault (e);
    }
   
      DataHandler dataHandler = new DataHandler(dataSource);

      OMText textData = fac.createOMText(dataHandler, true);
      attachmentElem.addChild(textData);
   
    pingElem.addChild(attachmentElem);

    return pingElem;
View Full Code Here

        this.headerString = headerString;
    }
   
    public OMElement getAsSOAPHeaderBlock(OMFactory factory) {
        OMElement header = super.getAsSOAPHeaderBlock(factory);
        OMText headerText = factory.createOMText(header, headerString);
        header.addChild(headerText);
        return header;
    }
View Full Code Here

                    OMElement zip = zipPart.getFirstElement();
                    if (!zipPart.getQName().getLocalPart().equals("package") ||
                            !zip.getQName().getLocalPart().equals("zip"))
                        throw new OdeFault("Your message should contain a part named 'package' with a zip element");

                    OMText binaryNode = (OMText) zip.getFirstOMChild();
                    if (binaryNode == null) {
                        throw new OdeFault("Empty binary node under <zip> element");
                    }
                    binaryNode.setOptimize(true);
                    try {
                        // We're going to create a directory under the deployment root and put
                        // files in there. The poller shouldn't pick them up so we're asking
                        // it to hold on for a while.
                        _poller.hold();

                        File dest = new File(_deployPath, namePart.getText() + "-" + _store.getCurrentVersion());
                        dest.mkdir();
                        unzip(dest, (DataHandler) binaryNode.getDataHandler());

                        // Check that we have a deploy.xml
                        File deployXml = new File(dest, "deploy.xml");
                        if (!deployXml.exists())
                            throw new OdeFault("The deployment doesn't appear to contain a deployment " +
View Full Code Here

        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        for (int b = is.read(); b >= 0; b = is.read()) {
            outputStream.write((byte) b);
        }
        String base64Enc = Base64.encode(outputStream.toByteArray());
        OMText zipContent = _factory.createOMText(base64Enc, "application/zip", true);
        root.addChild(namePart);
        root.addChild(zipPart);
        zipPart.addChild(zipElmt);
        zipElmt.addChild(zipContent);
View Full Code Here

                    OMElement zip = (zipPart == null) ? null : zipPart.getFirstElement();
                    if (zip == null || !zipPart.getQName().getLocalPart().equals("package")
                            || !zip.getQName().getLocalPart().equals("zip"))
                        throw new OdeFault("Your message should contain an element named 'package' with a 'zip' element");

                    OMText binaryNode = (OMText) zip.getFirstOMChild();
                    if (binaryNode == null) {
                        throw new OdeFault("Empty binary node under <zip> element");
                    }
                    binaryNode.setOptimize(true);
                    try {
                        // We're going to create a directory under the deployment root and put
                        // files in there. The poller shouldn't pick them up so we're asking
                        // it to hold on for a while.
                        _poller.hold();

                        File dest = new File(_deployPath, namePart.getText() + "-" + _store.getCurrentVersion());
                        dest.mkdir();
                        unzip(dest, (DataHandler) binaryNode.getDataHandler());

                        // Check that we have a deploy.xml
                        File deployXml = new File(dest, "deploy.xml");
                        if (!deployXml.exists())
                            throw new OdeFault("The deployment doesn't appear to contain a deployment " +
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMText

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.