Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.impl / src / main / java / org / gvsig / fmap / dal / impl / DALResourcesStorage.java @ 44276

History | View | Annotate | Download (1.59 KB)

1
package org.gvsig.fmap.dal.impl;
2

    
3
import java.util.List;
4
import org.gvsig.fmap.dal.DataServerExplorer;
5
import org.gvsig.fmap.dal.DataStore;
6
import org.gvsig.tools.util.ResourcesStorage;
7

    
8
/**
9
 *
10
 * @author jjdelcerro
11
 */
12
@SuppressWarnings("UseSpecificCatch")
13
public class DALResourcesStorage implements ResourcesStorage {
14

    
15
    private final DataServerExplorer explorer;
16
    private final DataStore store;
17

    
18
    public DALResourcesStorage(DataServerExplorer explorer, DataStore store) {
19
        this.explorer = explorer;
20
        this.store = store;
21
    }
22
    
23
    public DALResourcesStorage(DataStore store) {
24
        try {
25
            this.explorer = store.getExplorer();
26
            this.store = store;
27
        } catch (Throwable th) {
28
            throw new RuntimeException("Can't get explorer frem store '"+store.getFullName()+"'.");
29
        }
30
    }
31
    
32
    @Override
33
    public Resource getResource(String name) {
34
        try {
35
            Resource resource = explorer.getResource(store, name);
36
            return resource;
37
        } catch (Exception ex) {
38
            return null;
39
        }
40
    }
41

    
42
    @Override
43
    public List<Resource> getResources(String name) {
44
        try {
45
            List<Resource> resources = explorer.getResources(store, name);
46
            return resources;
47
        } catch (Exception ex) {
48
            return null;
49
        }
50
    }
51

    
52
    
53
    @Override
54
    public boolean exists(String name) {
55
        try {
56
            Resource resource = explorer.getResource(store, name);
57
            return resource.exists();
58
        } catch (Exception ex) {
59
            return false;
60
        }
61
    }
62
    
63
}