Utils.java revision 91cb2bef1c88e70b5d433c2a34bca110a35786ce
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: Utils.java,v 1.9 2008/11/10 22:56:59 veiming Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Portions Copyright 2013 ForgeRock AS
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpackage com.sun.identity.liberty.ws.soapbinding;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport javax.xml.bind.helpers.DefaultValidationEventHandler;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.common.PeriodicCleanUpMap;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.liberty.ws.util.ProviderManager;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.liberty.ws.util.ProviderUtil;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.shared.configuration.SystemPropertiesManager;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.org.apache.xml.internal.utils.PrefixResolverDefault;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * This class contains utility methods.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @supported.api
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class Utils {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static final String NAMESPACE_PREFIX_MAPPING_LIST_PROP =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.jaxb.namespacePrefixMappingList";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.jaxb.packageList";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.common.jaxb.soap:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.common.jaxb.assertion:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.common.jaxb.protocol:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.common.jaxb.ac:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.disco.jaxb:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.disco.jaxb11:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.disco.plugins.jaxb:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.interaction.jaxb:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.meta.jaxb:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.paos.jaxb:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.common.jaxb.ps:" +
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington "com.sun.identity.liberty.ws.common.jaxb.security:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.soapbinding.jaxb:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.soapbinding.jaxb11:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.idpp.jaxb:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.idpp.plugin.jaxb:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.common.jaxb.secext:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.common.jaxb.utility:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.common.jaxb.xmlenc:" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.common.jaxb.xmlsig";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static com.sun.identity.liberty.ws.common.jaxb.soap.ObjectFactory soapOF =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster new com.sun.identity.liberty.ws.common.jaxb.soap.ObjectFactory();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static com.sun.identity.liberty.ws.soapbinding.jaxb.ObjectFactory soapBOF =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster new com.sun.identity.liberty.ws.soapbinding.jaxb.ObjectFactory();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static com.sun.identity.liberty.ws.common.jaxb.secext.ObjectFactory secOF =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster new com.sun.identity.liberty.ws.common.jaxb.secext.ObjectFactory();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster new QName(SOAPBindingConstants.NS_SOAP, "Server");
bee2440354b4bc8796e1de0b6cbd60e1f68deba0Phill Cunnington static MessageFactory messageFactory = null;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.soap.staleTimeLimit";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static int stale_time_limit = 300000; // millisec
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.soap.supportedActors";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.wsf.version";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static final String MESSAGE_ID_CACHE_CLEANUP_INTERVAL_PROP =
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "com.sun.identity.liberty.ws.soap.messageIDCacheCleanupInterval";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster static int message_ID_cleanup_interval = 60000; // millisec
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster bundle = Locale.getInstallResourceBundle("libSOAPBinding");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster faultStringServerError = bundle.getString("ServerError");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.error("Utils.static: Unable to create SOAP Message Factory",
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SystemPropertiesManager.get(NAMESPACE_PREFIX_MAPPING_LIST_PROP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (tmpNSPre != null && tmpNSPre.length() > 0) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster StringTokenizer stz = new StringTokenizer(tmpNSPre, "|");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (index != -1 && index != 0 && index != token.length() - 1) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.warning("Utils.static: Invalid syntax " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "for Namespace Prefix Mapping List: " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String tmpJaxbPkgs = SystemPropertiesManager.get(JAXB_PACKAGE_LIST_PROP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if (tmpJaxbPkgs != null && tmpJaxbPkgs.length() > 0) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster jaxbPackages = DEFAULT_JAXB_PACKAGES + ":" + tmpJaxbPkgs;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("Utils.static: jaxbPackages = " + jaxbPackages);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster String tmpstr = SystemPropertiesManager.get(STALE_TIME_LIMIT_PROP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.warning("Utils.static: Unable to get stale time " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "limit. Default value will be used");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster tmpstr = SystemPropertiesManager.get(SUPPORTED_ACTORS_PROP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster StringTokenizer stz = new StringTokenizer(tmpstr, "|");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SystemPropertiesManager.get(MESSAGE_ID_CACHE_CLEANUP_INTERVAL_PROP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster message_ID_cleanup_interval = Integer.parseInt(tmpstr);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.warning("Utils.CleanUpThread.static: Unable to" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster " get stale time limit. Default value " +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster "will be used");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster message_ID_cleanup_interval, stale_time_limit);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SystemTimerPool.getTimerPool().schedule((TaskRunnable) messageIDMap,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster new Date(((System.currentTimeMillis() + message_ID_cleanup_interval)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns JAXB namespace prefix mapping. Key is the namespace and value
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * is the prefix.
return nsPrefix;
return jaxbPackages;
throws SOAPBindingException {
xmlstr);
new ByteArrayInputStream(
} catch (Exception e) {
return msg;
throws JAXBException{
return result;
throws JAXBException {
new NamespacePrefixMapperImpl());
new NamespacePrefixMapperImpl());
if (!checkIdref) {
new DefaultValidationEventHandler() {
throws JAXBException{
return result;
throws JAXBException {
return null;
throw new Exception();
return null;
boolean isServer)
if (isServer) {
new SOAPFaultDetail(
throw new SOAPBindingException(
throw sfe;
if (isServer) {
if (isServer) {
synchronized (messageIDMap) {
if (isServer) {
new SOAPFaultDetail(
throw sfe;
throw sfe;
if (isServer) {
throw new SOAPBindingException(
throw sfe;
throw sfe;
if (isServer) {
throw new SOAPBindingException(
if (isServer) {
throw new SOAPBindingException(