public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException{ if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } return data.is; }
public boolean isDestructiveRead() { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } return true; }
public void checkDocumentElement(OMElement element) { if (!(element instanceof SOAPEnvelope)) { throw new OMException("Child not allowed; must be a SOAPEnvelope"); } } }
public void setParent(OMContainer element) { if (element instanceof ParentNode) { this.parentNode = (ParentNode) element; } else { throw new OMException("The given parent is not of the type " + ParentNode.class); } }
public boolean isDestructiveWrite() { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } // Writing an input stream is destructive return true; }
public void close() { if (data.is != null) { try { data.is.close(); } catch (IOException e) { throw new OMException(e); } data.is = null; } }
public static String getContentID(XMLStreamReader parser) { if (parser.getAttributeCount() > 0 && parser.getAttributeLocalName(0).equals("href")) { return getContentIDFromHref(parser.getAttributeValue(0)); } else { throw new OMException( "Href attribute not found in XOP:Include element"); } }
public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } super.serialize(xmlWriter); }
public InputStream getXMLInputStream(String encoding) throws UnsupportedEncodingException { try{ return data.readParserInputStream(); }catch(XMLStreamException e){ throw new OMException(e); } }
/** * @deprecated Not used anywhere */ public void init(InputStream inputStream, String charSetEncoding, String url, String contentType) throws OMException { try { this.parser = StAXUtils.createXMLStreamReader(inputStream); } catch (XMLStreamException e1) { throw new OMException(e1); } omfactory = (OMFactoryEx)OMAbstractFactory.getOMFactory(); }
public XMLStreamReader getReader() throws XMLStreamException { if (data == null) { throw new OMException("The InputStreamDataSource does not have a backing object"); } return StAXUtils.createXMLStreamReader(data.is,data.encoding); }
public Object fromOMElement(OMElement msgNumberPart) throws OMException { if (msgNumberPart==null) throw new OMException (SandeshaMessageHelper.getMessage( SandeshaMessageKeys.noMessageNumberPartInElement)); String msgNoStr = msgNumberPart.getText(); messageNumber = Long.parseLong(msgNoStr); return this; }
String getRootPartContentType() { String rootPartContentID = getRootPartContentID(); if (rootPartContentID == null) { throw new OMException("Unable to determine the content ID of the root part"); } DataHandler rootPart = getDataHandler(rootPartContentID); if (rootPart == null) { throw new OMException("Unable to locate the root part; content ID was " + rootPartContentID); } return rootPart.getContentType(); }
public char[] toCharArray() { if (dataHandlerObject != null) { try { return Base64Utils.encodeToCharArray(getDataHandler()); } catch (IOException ex) { throw new OMException(ex); } } else { return value.toCharArray(); } }
public char[] toCharArray() { if (dataHandlerObject != null) { try { return Base64Utils.encodeToCharArray(getDataHandler()); } catch (IOException ex) { throw new OMException(ex); } } else { return value.toCharArray(); } }
public final byte[] getXMLBytes(String encoding) throws UnsupportedEncodingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OMOutputFormat format = new OMOutputFormat(); format.setCharSetEncoding(encoding); try { serialize(baos, format); } catch (XMLStreamException ex) { throw new OMException(ex); } return baos.toByteArray(); }
@Override public String toString() { if (dataHandlerObject != null) { try { return Base64Utils.encode(getDataHandler()); } catch (Exception e) { throw new OMException(e); } } else { return value; } }
public OMElement toOMElement(OMElement element) throws OMException,AxisFault { if (epr == null) throw new OMException(SandeshaMessageHelper.getMessage( SandeshaMessageKeys.cannotSetAcksTo, null)); OMFactory factory = element.getOMFactory(); QName acksTo = new QName (rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.ACKS_TO, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM); OMElement endpointElement = EndpointReferenceHelper.toOM (factory,epr, acksTo ,addressingNamespaceValue); element.addChild(endpointElement); return element; }
public OMElement toOMElement(OMElement element) throws OMException,AxisFault { OMFactory factory = element.getOMFactory(); if (acksTo == null) throw new OMException(SandeshaMessageHelper.getMessage( SandeshaMessageKeys.acceptNullAcksTo)); OMNamespace rmNamespace = factory.createOMNamespace(rmNamespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM); OMElement acceptElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.ACCEPT, rmNamespace); acksTo.toOMElement(acceptElement); element.addChild(acceptElement); return element; }
public OMElement toOMElement(OMElement element) throws OMException { if (duration == null || duration == "") throw new OMException(SandeshaMessageHelper.getMessage( SandeshaMessageKeys.cannotProcessExpires)); OMFactory factory = element.getOMFactory(); OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM); OMElement expiresElement = factory.createOMElement( Sandesha2Constants.WSRM_COMMON.EXPIRES, rmNamespace); expiresElement.setText(duration); element.addChild(expiresElement); return element; }