Statistics
| Revision:

svn-gvsig-desktop / branches / org.gvsig.desktop-2018a / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.tilecache / org.gvsig.fmap.dal.tilecache.raster / src / main / java / org / gvsig / raster / tilecache / provider / TileCacheFileSystemServerProvider.java @ 43803

History | View | Annotate | Download (4.02 KB)

1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2016 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.raster.tilecache.provider;
24

    
25
import java.io.File;
26

    
27
import org.gvsig.fmap.dal.DataServerExplorer;
28
import org.gvsig.fmap.dal.DataStoreParameters;
29
import org.gvsig.fmap.dal.NewDataStoreParameters;
30
import org.gvsig.fmap.dal.exception.CreateException;
31
import org.gvsig.fmap.dal.exception.DataException;
32
import org.gvsig.fmap.dal.exception.RemoveException;
33
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer;
34
import org.gvsig.fmap.dal.resource.spi.ResourceProvider;
35
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider;
36
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
37
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
38

    
39
/**
40
 * Filesystem Provider for JIMI. Initially, accepts png files
41
 * @author dmartinezizquierdo
42
 *
43
 */
44
public class TileCacheFileSystemServerProvider extends AbstractFilesystemServerExplorerProvider
45
implements FilesystemServerExplorerProvider, ResourceConsumer{
46

    
47
    protected FilesystemServerExplorerProviderServices serverExplorer;
48

    
49
    public int getMode() {
50
        return DataServerExplorer.MODE_RASTER;
51
    }
52

    
53
    @Override
54
    public boolean canCreate() {
55
        return false;
56
    }
57

    
58
    @Override
59
    public boolean canCreate(NewDataStoreParameters arg0) {
60
        return false;
61
    }
62

    
63
    @Override
64
    public void create(NewDataStoreParameters arg0, boolean arg1)
65
        throws CreateException {
66
        throw new UnsupportedOperationException();
67

    
68
    }
69

    
70
    @Override
71
    public NewDataStoreParameters getCreateParameters() throws DataException {
72
        throw new UnsupportedOperationException();
73
    }
74

    
75
    @Override
76
    public void initialize(FilesystemServerExplorerProviderServices serverExplorer) {
77
        this.serverExplorer = serverExplorer;
78
    }
79

    
80
    @Override
81
    public void remove(DataStoreParameters parameters) throws RemoveException {
82
        //FIXME
83
//        TileCacheStoreProviderParameters params = (TileCacheStoreProviderParameters) parameters;
84
//        File file = params.getFile();
85
//        if (!file.exists()) {
86
//            throw new RemoveException(this.getDataStoreProviderName(),
87
//                    new FileNotFoundException(params.getFile()));
88
//        }
89
//        if (!file.delete()) {
90
//            throw new RemoveException(this.getDataStoreProviderName(),
91
//                    new IOException("Error deleting file: "+file.getName()));
92
//        }
93

    
94
    }
95

    
96
    @Override
97
    public String getDataStoreProviderName() {
98
        return TileCacheStoreProvider.NAME;
99
    }
100

    
101
    @Override
102
    public String getDescription() {
103
        return TileCacheStoreProvider.DESCRIPTION;
104
    }
105

    
106
    @Override
107
    public boolean accept(File pathname) {
108
        //TODO Creo que deber?a de preguntar al provider que a su vez preguntar?a a la librer?a
109
        return (pathname.getName().toLowerCase().endsWith(".png"));
110
    }
111

    
112
    @Override
113
    public boolean closeResourceRequested(ResourceProvider resource) {
114
        return !(this.equals(resource));
115
    }
116

    
117
    @Override
118
    public void resourceChanged(ResourceProvider resource) {
119
        //Do nothing
120
    }
121

    
122
}