0N/A/*
2362N/A * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A/*
0N/A * $Id: XMLCryptoContext.java,v 1.6 2005/05/10 15:47:42 mullan Exp $
0N/A */
0N/Apackage javax.xml.crypto;
0N/A
0N/A/**
0N/A * Contains common context information for XML cryptographic operations.
0N/A *
0N/A * <p>This interface contains methods for setting and retrieving properties
0N/A * that affect the processing of XML signatures or XML encrypted structures.
0N/A *
0N/A * <p>Note that <code>XMLCryptoContext</code> instances can contain information
0N/A * and state specific to the XML cryptographic structure it is used with.
0N/A * The results are unpredictable if an <code>XMLCryptoContext</code> is
0N/A * used with multiple structures (for example, you should not use the same
0N/A * {@link javax.xml.crypto.dsig.XMLValidateContext} instance to validate two
0N/A * different {@link javax.xml.crypto.dsig.XMLSignature} objects).
0N/A *
0N/A * @author Sean Mullan
0N/A * @author JSR 105 Expert Group
0N/A * @since 1.6
0N/A */
0N/Apublic interface XMLCryptoContext {
0N/A
0N/A /**
0N/A * Returns the base URI.
0N/A *
0N/A * @return the base URI, or <code>null</code> if not specified
0N/A * @see #setBaseURI(String)
0N/A */
0N/A String getBaseURI();
0N/A
0N/A /**
0N/A * Sets the base URI.
0N/A *
0N/A * @param baseURI the base URI, or <code>null</code> to remove current
0N/A * value
0N/A * @throws IllegalArgumentException if <code>baseURI</code> is not RFC
0N/A * 2396 compliant
0N/A * @see #getBaseURI
0N/A */
0N/A void setBaseURI(String baseURI);
0N/A
0N/A /**
0N/A * Returns the key selector for finding a key.
0N/A *
0N/A * @return the key selector, or <code>null</code> if not specified
0N/A * @see #setKeySelector(KeySelector)
0N/A */
0N/A KeySelector getKeySelector();
0N/A
0N/A /**
0N/A * Sets the key selector for finding a key.
0N/A *
0N/A * @param ks the key selector, or <code>null</code> to remove the current
0N/A * setting
0N/A * @see #getKeySelector
0N/A */
0N/A void setKeySelector(KeySelector ks);
0N/A
0N/A /**
0N/A * Returns a <code>URIDereferencer</code> that is used to dereference
0N/A * {@link URIReference}s.
0N/A *
0N/A * @return the <code>URIDereferencer</code>, or <code>null</code> if not
0N/A * specified
0N/A * @see #setURIDereferencer(URIDereferencer)
0N/A */
0N/A URIDereferencer getURIDereferencer();
0N/A
0N/A /**
0N/A * Sets a <code>URIDereferencer</code> that is used to dereference
0N/A * {@link URIReference}s. The specified <code>URIDereferencer</code>
0N/A * is used in place of an implementation's default
0N/A * <code>URIDereferencer</code>.
0N/A *
0N/A * @param dereferencer the <code>URIDereferencer</code>, or
0N/A * <code>null</code> to remove any current setting
0N/A * @see #getURIDereferencer
0N/A */
0N/A void setURIDereferencer(URIDereferencer dereferencer);
0N/A
0N/A /**
0N/A * Returns the namespace prefix that the specified namespace URI is
0N/A * associated with. Returns the specified default prefix if the specified
0N/A * namespace URI has not been bound to a prefix. To bind a namespace URI
0N/A * to a prefix, call the {@link #putNamespacePrefix putNamespacePrefix}
0N/A * method.
0N/A *
0N/A * @param namespaceURI a namespace URI
0N/A * @param defaultPrefix the prefix to be returned in the event that the
0N/A * the specified namespace URI has not been bound to a prefix.
0N/A * @return the prefix that is associated with the specified namespace URI,
0N/A * or <code>defaultPrefix</code> if the URI is not registered. If
0N/A * the namespace URI is registered but has no prefix, an empty string
0N/A * (<code>""</code>) is returned.
0N/A * @throws NullPointerException if <code>namespaceURI</code> is
0N/A * <code>null</code>
0N/A * @see #putNamespacePrefix(String, String)
0N/A */
0N/A String getNamespacePrefix(String namespaceURI, String defaultPrefix);
0N/A
0N/A /**
0N/A * Maps the specified namespace URI to the specified prefix. If there is
0N/A * already a prefix associated with the specified namespace URI, the old
0N/A * prefix is replaced by the specified prefix.
0N/A *
0N/A * @param namespaceURI a namespace URI
0N/A * @param prefix a namespace prefix (or <code>null</code> to remove any
0N/A * existing mapping). Specifying the empty string (<code>""</code>)
0N/A * binds no prefix to the namespace URI.
0N/A * @return the previous prefix associated with the specified namespace
0N/A * URI, or <code>null</code> if there was none
0N/A * @throws NullPointerException if <code>namespaceURI</code> is
0N/A * <code>null</code>
0N/A * @see #getNamespacePrefix(String, String)
0N/A */
0N/A String putNamespacePrefix(String namespaceURI, String prefix);
0N/A
0N/A /**
0N/A * Returns the default namespace prefix. The default namespace prefix
0N/A * is the prefix for all namespace URIs not explicitly set by the
0N/A * {@link #putNamespacePrefix putNamespacePrefix} method.
0N/A *
0N/A * @return the default namespace prefix, or <code>null</code> if none has
0N/A * been set.
0N/A * @see #setDefaultNamespacePrefix(String)
0N/A */
0N/A String getDefaultNamespacePrefix();
0N/A
0N/A /**
0N/A * Sets the default namespace prefix. This sets the namespace prefix for
0N/A * all namespace URIs not explicitly set by the {@link #putNamespacePrefix
0N/A * putNamespacePrefix} method.
0N/A *
0N/A * @param defaultPrefix the default namespace prefix, or <code>null</code>
0N/A * to remove the current setting. Specify the empty string
0N/A * (<code>""</code>) to bind no prefix.
0N/A * @see #getDefaultNamespacePrefix
0N/A */
0N/A void setDefaultNamespacePrefix(String defaultPrefix);
0N/A
0N/A /**
0N/A * Sets the specified property.
0N/A *
0N/A * @param name the name of the property
0N/A * @param value the value of the property to be set
0N/A * @return the previous value of the specified property, or
0N/A * <code>null</code> if it did not have a value
0N/A * @throws NullPointerException if <code>name</code> is <code>null</code>
0N/A * @see #getProperty(String)
0N/A */
0N/A Object setProperty(String name, Object value);
0N/A
0N/A /**
0N/A * Returns the value of the specified property.
0N/A *
0N/A * @param name the name of the property
0N/A * @return the current value of the specified property, or
0N/A * <code>null</code> if it does not have a value
0N/A * @throws NullPointerException if <code>name</code> is <code>null</code>
0N/A * @see #setProperty(String, Object)
0N/A */
0N/A Object getProperty(String name);
0N/A
0N/A /**
0N/A * Returns the value to which this context maps the specified key.
0N/A *
0N/A * <p>More formally, if this context contains a mapping from a key
0N/A * <code>k</code> to a value <code>v</code> such that
0N/A * <code>(key==null ? k==null : key.equals(k))</code>, then this method
0N/A * returns <code>v</code>; otherwise it returns <code>null</code>. (There
0N/A * can be at most one such mapping.)
0N/A *
0N/A * <p>This method is useful for retrieving arbitrary information that is
0N/A * specific to the cryptographic operation that this context is used for.
0N/A *
0N/A * @param key the key whose associated value is to be returned
0N/A * @return the value to which this context maps the specified key, or
0N/A * <code>null</code> if there is no mapping for the key
0N/A * @see #put(Object, Object)
0N/A */
0N/A Object get(Object key);
0N/A
0N/A /**
0N/A * Associates the specified value with the specified key in this context.
0N/A * If the context previously contained a mapping for this key, the old
0N/A * value is replaced by the specified value.
0N/A *
0N/A * <p>This method is useful for storing arbitrary information that is
0N/A * specific to the cryptographic operation that this context is used for.
0N/A *
0N/A * @param key key with which the specified value is to be associated with
0N/A * @param value value to be associated with the specified key
0N/A * @return the previous value associated with the key, or <code>null</code>
0N/A * if there was no mapping for the key
0N/A * @throws IllegalArgumentException if some aspect of this key or value
0N/A * prevents it from being stored in this context
0N/A * @see #get(Object)
0N/A */
0N/A Object put(Object key, Object value);
0N/A}