View Javadoc

1   /*$Id: ProtocolLibrary.java,v 1.3 2004/11/29 20:00:56 clq2 Exp $
2    * Created on 16-Jun-2004
3    *
4    * Copyright (C) AstroGrid. All rights reserved.
5    *
6    * This software is published under the terms of the AstroGrid 
7    * Software License version 1.2, a copy of which has been included 
8    * with this distribution in the LICENSE.txt file.  
9    *
10  **/
11  package org.astrogrid.applications.parameter.protocol;
12  
13  import org.astrogrid.applications.beans.v1.parameters.ParameterValue;
14  
15  import java.net.URI;
16  import java.net.URISyntaxException;
17  
18  /*** A library of protocol-handling code, for working with External Values
19   * @author Noel Winstanley nw@jb.man.ac.uk 16-Jun-2004
20   *
21   */
22  public interface ProtocolLibrary {
23      /*** build an external value for a particular indirect parameter value
24       * 
25       * @param pval parameter to build external value for
26       * @return an external value for this parameter.
27       * @throws InaccessibleExternalValueException - if the external value cannot be gained - e.g. cannot resolve, no path
28       * @throws UnrecognizedProtocolException - if the indirection uri format is not recognized.
29       */
30      ExternalValue getExternalValue(ParameterValue pval) throws InaccessibleExternalValueException, UnrecognizedProtocolException;
31      
32      /*** build an external value, direct from a URI
33       * @param location location to build external value for
34       * @return an external value for this location
35       * @throws InaccessibleExternalValueException - if the external value cannot be accessed - e.g. cannot resolve, 
36       * @throws UnrecognizedProtocolException - if the uri protocol / scheme is not recognized */
37      ExternalValue getExternalValue(URI location) throws InaccessibleExternalValueException, UnrecognizedProtocolException;
38  
39      /*** build an external value, direct from a URI String
40       * @param location String representation of URI location to build external value for
41       * @return an external value for this location
42       * @throws InaccessibleExternalValueException - if the external value cannot be accessed - e.g. cannot resolve, 
43       * @throws UnrecognizedProtocolException - if the uri protocol / scheme is not recognized */
44      ExternalValue getExternalValue(String location) throws InaccessibleExternalValueException, UnrecognizedProtocolException, URISyntaxException;
45  
46      
47      
48      /*** list the protocols supported in this library */
49      String[] listSupportedProtocols();
50      
51      /*** return true if this library supports the protcol in question */
52      boolean isProtocolSupported(String protocol);
53      
54      
55  }