Java源码示例:com.sun.org.apache.xerces.internal.util.SecurityManager

示例1
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}
 
示例2
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}
 
示例3
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}
 
示例4
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}
 
示例5
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}
 
示例6
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}
 
示例7
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}
 
示例8
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}
 
示例9
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}
 
示例10
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}
 
示例11
/**
 * Convert a value set through setProperty to XMLSecurityManager.
 * If the value is an instance of XMLSecurityManager, use it to override the default;
 * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
 *
 * @param value user specified security manager
 * @param securityManager an instance of XMLSecurityManager
 * @return an instance of the new security manager XMLSecurityManager
 */
static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
    if (value == null) {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        return securityManager;
    }
    if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
        return (XMLSecurityManager)value;
    } else {
        if (securityManager == null) {
            securityManager = new XMLSecurityManager(true);
        }
        if (SecurityManager.class.isAssignableFrom(value.getClass())) {
            SecurityManager origSM = (SecurityManager)value;
            securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
            securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
            securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
        }
        return securityManager;
    }
}