View Javadoc

1   package fr.in2p3.jsaga.impl.url;
2   
3   import java.util.regex.Pattern;
4   
5   import fr.in2p3.jsaga.adaptor.data.read.FileAttributes;
6   import org.ogf.saga.error.*;
7   import org.ogf.saga.url.URL;
8   import org.ogf.saga.url.URLFactory;
9   
10  /* ***************************************************
11  * *** Centre de Calcul de l'IN2P3 - Lyon (France) ***
12  * ***             http://cc.in2p3.fr/             ***
13  * ***************************************************
14  * File:   URLFactoryImpl
15  * Author: Sylvain Reynaud (sreynaud@in2p3.fr)
16  * Date:   20 oct. 2008
17  * ***************************************************
18  * Description:                                      */
19  /**
20   *
21   */
22  public class URLFactoryImpl extends URLFactory {
23      protected URL doCreateURL(String url) throws BadParameterException, NoSuccessException {
24      	return (Pattern.matches(AbsoluteURLImpl.ABSOLUTE_URL_REGEXP, url))?new AbsoluteURLImpl(url):new RelativeURLImpl(url);
25      }
26  
27      public static URL createRelativePath(String relativePath) throws BadParameterException {
28          return new RelativeURLImpl(relativePath);
29      }
30  
31      public static URL createURLWithCache(FileAttributes cache) throws BadParameterException {
32          return new RelativeURLImpl(cache);
33      }
34      
35  }