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
12
13
14
15
16
17
18
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 }