/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
*/
/*
* ===========================================================================
*
* (C) Copyright IBM Corp. 2003 All Rights Reserved.
*
* ===========================================================================
*/
/*
* $Id: DOMRetrievalMethod.java,v 1.2 2008/07/24 15:20:32 mullan Exp $
*/
/**
* DOM-based implementation of RetrievalMethod.
*
* @author Sean Mullan
* @author Joyce Leung
*/
implements RetrievalMethod, DOMURIReference {
/**
* Creates a <code>DOMRetrievalMethod</code> containing the specified
* URIReference and List of Transforms.
*
* @param uri the URI
* @param type the type
* @param transforms a list of {@link Transform}s. The list is defensively
* copied to prevent subsequent modification. May be <code>null</code>
* or empty.
* @throws IllegalArgumentException if the format of <code>uri</code> is
* invalid, as specified by Reference's URI attribute in the W3C
* specification for XML-Signature Syntax and Processing
* @throws NullPointerException if <code>uriReference</code>
* is <code>null</code>
* @throws ClassCastException if <code>transforms</code> contains any
* entries that are not of type {@link Transform}
*/
throw new NullPointerException("uri cannot be null");
}
} else {
throw new ClassCastException
("transforms["+i+"] is not a valid type");
}
}
}
try {
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e.getMessage());
}
}
}
/**
* Creates a <code>DOMRetrievalMethod</code> from an element.
*
* @param rmElem a RetrievalMethod element
*/
// get URI and Type attributes
// get here node
// get Transforms, if specified
int transformCount = 0;
if (transformsElem != null) {
while (transformElem != null) {
if (secVal &&
{
" transforms per Reference are allowed" +
" with secure validation";
throw new MarshalException(error);
}
}
}
if (transforms.isEmpty()) {
} else {
}
}
return uri;
}
return type;
}
return transforms;
}
throws MarshalException {
// add URI and Type attributes
// add Transforms elements
if (!transforms.isEmpty()) {
}
}
// save here node
}
return here;
}
throws URIReferenceException {
throw new NullPointerException("context cannot be null");
}
/*
* If URIDereferencer is specified in context; use it, otherwise use
* built-in.
*/
}
// pass dereferenced data through Transforms
try {
}
} catch (Exception e) {
throw new URIReferenceException(e);
}
// guard against RetrievalMethod loops
if (i.hasNext()) {
throw new URIReferenceException(
"It is forbidden to have one RetrievalMethod point " +
"to another when secure validation is enabled");
}
}
}
return data;
}
throws URIReferenceException {
try {
dbf.setNamespaceAware(true);
return new DOMX509Data(kiElem);
} else {
return null; // unsupported
}
} catch (Exception e) {
throw new URIReferenceException(e);
}
}
if (this == obj) {
return true;
}
if (!(obj instanceof RetrievalMethod)) {
return false;
}
}
}