com.sun.ebxml.registry.util
Class Utility

java.lang.Object
  |
  +--com.sun.ebxml.registry.util.Utility

public class Utility
extends java.lang.Object

Class Declaration.

Version:
1.2, 05/02/00
Author:
Farrukh S. Najmi, Adrian Chong
See Also:

Constructor Summary
protected Utility()
          Class Constructor.
 
Method Summary
 org.oasis.ebxml.registry.bindings.rs.RegistryResponse createRegistryResponseFromThrowable(java.lang.Throwable t, java.lang.String codeContext, java.lang.String errCode)
           
 javax.xml.soap.SOAPMessage createSOAPMessageFromRequestStream(java.io.InputStream reqStream)
          Create a SOAPMessage containing a registry request (e.g.
 javax.xml.soap.SOAPMessage createSOAPMessageFromSOAPStream(java.io.InputStream soapStream)
          Create a SOAPMessage object from a InputStream to a SOAPMessage
 java.io.InputStream createSOAPStreamFromRequestStream(java.io.InputStream req)
          Create a SOAPMessage containing a registry request (e.g.
 java.lang.String createTimestamp()
           
static java.lang.String escapeSQLChars(java.lang.String stringField)
          Convert the apostrophes in a String field in a SQL statement to 2 consecutive apostrohes
 byte[] getBytesFromInputStream(java.io.InputStream is)
          Get bytes array from InputStream
static Utility getInstance()
          Method Declaration.
static java.lang.String getMimeBoundary()
          Mimics javamail boundary id generator
 org.w3c.dom.Element getSignatureElement(javax.xml.soap.SOAPMessage msg)
           
 java.lang.String getStackTraceFromThrowable(java.lang.Throwable t)
           
 java.lang.StringBuffer getStringBufferFromInputStream(java.io.InputStream is)
          Deprecated. Do not use it. It may have problem in handling encoding.
 java.lang.String getXMLDeclaration(byte[] bytes)
          Get the decalaration from XML bytes
 boolean isValidURI(java.lang.String uRI)
          Any non-Http URLs and other types of URIs will not be checked.
 byte[] removeXMLDeclaration(byte[] bytes)
          Removes the decalaration from XML bytes
 java.lang.String removeXMLDeclaration(java.lang.StringBuffer str)
          Removes the decalaration from XML string
 java.lang.String stripId(java.lang.String id)
          Strip urn:uuid: part from start of registry object id.
 java.util.ArrayList validateURIs(java.util.ArrayList sourceRegistryObjects)
          Return ArrayList of ExternalLink that points to unresolvable Http URLs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utility

protected Utility()
Class Constructor.

See Also:
Method Detail

getStringBufferFromInputStream

public java.lang.StringBuffer getStringBufferFromInputStream(java.io.InputStream is)
                                                      throws java.io.IOException
Deprecated. Do not use it. It may have problem in handling encoding.

java.io.IOException

getXMLDeclaration

public java.lang.String getXMLDeclaration(byte[] bytes)
Get the decalaration from XML bytes


removeXMLDeclaration

public byte[] removeXMLDeclaration(byte[] bytes)
                            throws java.io.IOException
Removes the decalaration from XML bytes

Returns:
the bytes of the XML document
java.io.IOException

removeXMLDeclaration

public java.lang.String removeXMLDeclaration(java.lang.StringBuffer str)
Removes the decalaration from XML string

Returns:
the XML declaration

getMimeBoundary

public static java.lang.String getMimeBoundary()
Mimics javamail boundary id generator


getBytesFromInputStream

public byte[] getBytesFromInputStream(java.io.InputStream is)
                               throws java.io.IOException
Get bytes array from InputStream

java.io.IOException

createSOAPStreamFromRequestStream

public java.io.InputStream createSOAPStreamFromRequestStream(java.io.InputStream req)
                                                      throws javax.xml.soap.SOAPException,
                                                             java.io.IOException,
                                                             javax.mail.internet.ParseException
Create a SOAPMessage containing a registry request (e.g. SubmitObjectsRequest)

Parameters:
req - the InputStream to the registry request
Returns:
the InputStream to the the created SOAPMessage
javax.xml.soap.SOAPException
java.io.IOException
javax.mail.internet.ParseException

createSOAPMessageFromRequestStream

public javax.xml.soap.SOAPMessage createSOAPMessageFromRequestStream(java.io.InputStream reqStream)
                                                              throws javax.xml.soap.SOAPException,
                                                                     java.io.IOException,
                                                                     javax.mail.internet.ParseException
Create a SOAPMessage containing a registry request (e.g. SubmitObjectsRequest)

Returns:
the created SOAPMessage
javax.xml.soap.SOAPException
java.io.IOException
javax.mail.internet.ParseException

createSOAPMessageFromSOAPStream

public javax.xml.soap.SOAPMessage createSOAPMessageFromSOAPStream(java.io.InputStream soapStream)
                                                           throws javax.xml.soap.SOAPException,
                                                                  java.io.IOException,
                                                                  javax.mail.internet.ParseException
Create a SOAPMessage object from a InputStream to a SOAPMessage

Parameters:
soapStream - the InputStream to the SOAPMessage
Returns:
the created SOAPMessage
javax.xml.soap.SOAPException
java.io.IOException
javax.mail.internet.ParseException

createRegistryResponseFromThrowable

public org.oasis.ebxml.registry.bindings.rs.RegistryResponse createRegistryResponseFromThrowable(java.lang.Throwable t,
                                                                                                 java.lang.String codeContext,
                                                                                                 java.lang.String errCode)

getStackTraceFromThrowable

public java.lang.String getStackTraceFromThrowable(java.lang.Throwable t)

createTimestamp

public java.lang.String createTimestamp()

validateURIs

public java.util.ArrayList validateURIs(java.util.ArrayList sourceRegistryObjects)
                                 throws RegistryException
Return ArrayList of ExternalLink that points to unresolvable Http URLs. Any non-Http URLs will not be checked. Any non-Http URLs and other types of URIs will not be checked. If the http response code is smaller than 200 or bigger than 299, the http URL is considered invalid.

RegistryException

isValidURI

public boolean isValidURI(java.lang.String uRI)
Any non-Http URLs and other types of URIs will not be checked. If the http response code is smaller than 200 or bigger than 299, the http URL is considered invalid.


getSignatureElement

public org.w3c.dom.Element getSignatureElement(javax.xml.soap.SOAPMessage msg)
                                        throws javax.xml.soap.SOAPException,
                                               javax.xml.transform.TransformerException
javax.xml.soap.SOAPException
javax.xml.transform.TransformerException

stripId

public java.lang.String stripId(java.lang.String id)
Strip urn:uuid: part from start of registry object id. If id is null or doesn't start with urn:uuid: then the id is returned without modification.


escapeSQLChars

public static java.lang.String escapeSQLChars(java.lang.String stringField)
Convert the apostrophes in a String field in a SQL statement to 2 consecutive apostrohes


getInstance

public static Utility getInstance()
Method Declaration.

Returns:
See Also:


Copyright © 2001-2003 OASIS. All Rights Reserved.