1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Copyright 1999-2004 The Apache Software Foundation.
   7  *
   8  *  Licensed under the Apache License, Version 2.0 (the "License");
   9  *  you may not use this file except in compliance with the License.
  10  *  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  *  Unless required by applicable law or agreed to in writing, software
  15  *  distributed under the License is distributed on an "AS IS" BASIS,
  16  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  *  See the License for the specific language governing permissions and
  18  *  limitations under the License.
  19  *
  20  */
  21 
  22 package com.sun.org.apache.xml.internal.security.utils.resolver.implementations;
  23 
  24 import java.io.FileInputStream;
  25 import java.io.FileNotFoundException;
  26 import java.io.IOException;
  27 import java.io.InputStream;
  28 
  29 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
  30 import com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverSpi;
  31 import org.w3c.dom.Attr;
  32 
  33 /**
  34  *
  35  * @author $Author: mullan $
  36  */
  37 
  38 public class ResolverAnonymous extends ResourceResolverSpi {
  39 
  40    private XMLSignatureInput _input = null;
  41 
  42    /**
  43     * @param filename
  44      * @throws FileNotFoundException
  45      * @throws IOException
  46      */
  47    public ResolverAnonymous(String filename) throws FileNotFoundException, IOException {
  48       this._input = new XMLSignatureInput(new FileInputStream(filename));
  49    }
  50 
  51    /**
  52     * @param is
  53      */
  54    public ResolverAnonymous(InputStream is) {
  55       this._input = new XMLSignatureInput(is);
  56    }
  57 
  58    /** @inheritDoc */
  59    public XMLSignatureInput engineResolve(Attr uri, String BaseURI) {
  60       return this._input;
  61    }
  62 
  63    /**
  64     * @inheritDoc
  65     */
  66    public boolean engineCanResolve(Attr uri, String BaseURI) {
  67       if (uri == null) {
  68          return true;
  69       }
  70       return false;
  71    }
  72 
  73    /** @inheritDoc */
  74    public String[] engineGetPropertyKeys() {
  75       return new String[0];
  76    }
  77 }