Revision 37731

View differences:

tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/resources-test/log4j.xml
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
3

  
4
<!-- 
5
Log4J configuration file for unit tests execution.
6
 -->
7
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
8

  
9
    <!-- Appender configuration to show logging messages through the console -->
10
    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
11
        <layout class="org.apache.log4j.PatternLayout">
12
            <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]  %m%n" />
13
        </layout>
14
    </appender>
15

  
16
    <!-- 
17
    Activate logging messages of DEBUG level of higher only for the
18
    org.gvsig.fmap.dal packages.
19
    You can put full classes names or packages instead, to configure
20
    logging for all the classes and subpackages of the package.
21
    -->
22
    <category name="org.gvsig.fmap.dal">
23
        <priority value="TRACE" />
24
    </category>
25

  
26
    <!-- 
27
    By default, show only logging messages of INFO level or higher, 
28
    through the previously configured CONSOLE appender. 
29
    -->
30
    <root>
31
        <priority value="INFO" />
32
        <appender-ref ref="CONSOLE" />
33
    </root>
34
</log4j:configuration>
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/FileHelper.java
1
package org.gvsig.fmap.dal;
2

  
3
import java.io.InputStream;
4

  
5
import org.gvsig.fmap.dal.store.shp.SHPStoreProvider;
6
import org.gvsig.metadata.MetadataLocator;
7
import org.gvsig.metadata.MetadataManager;
8
import org.gvsig.metadata.exceptions.MetadataException;
9
import org.gvsig.tools.ToolsLocator;
10
import org.gvsig.tools.dynobject.DynObject;
11
import org.gvsig.tools.dynobject.DynStruct;
12
import org.gvsig.tools.exception.BaseRuntimeException;
13
import org.gvsig.tools.persistence.PersistenceManager;
14
import org.slf4j.Logger;
15
import org.slf4j.LoggerFactory;
16

  
17
public class FileHelper {
18

  
19
	private static final Logger LOG = LoggerFactory.getLogger(FileHelper.class);
20

  
21
	private FileHelper() {
22
		// Do nothing
23
	}
24
	
25
	@SuppressWarnings("unchecked")
26
	public static DynStruct registerParametersDefinition(String name, Class theClass, String filename) {
27
		DynStruct definition = null;
28
		
29
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
30
		definition = manager.getDefinition(name);
31
		if ( definition == null) {
32
			InputStream stream = theClass.getResourceAsStream(filename);
33
			if( stream == null ) {
34
				throw new DefinitionNotFoundException(theClass,filename);
35
			}
36
			definition = manager.addDefinition(
37
					theClass,
38
					name, 
39
					stream,
40
					theClass.getClassLoader(), 
41
					null, 
42
					null
43
			);
44
		}
45
		return definition;
46
	}
47
	
48
	@SuppressWarnings("unchecked")
49
	public static DynStruct registerMetadataDefinition(String name, Class theClass, String filename) throws MetadataException {
50
		DynStruct definition = null;
51

  
52
		MetadataManager manager = MetadataLocator.getMetadataManager();
53
		definition = manager.getDefinition(name);
54
		if ( definition == null) {
55
			InputStream stream = theClass.getResourceAsStream(filename);
56
			if( stream == null ) {
57
				throw new DefinitionNotFoundException(theClass,filename);
58
			}
59
			definition = manager.addDefinition(
60
					name, 
61
					theClass.getResourceAsStream(filename),
62
					theClass.getClassLoader()
63
			);
64
		}
65
		return definition;
66
	}
67

  
68
	public static DynObject newParameters(String name) {
69
    	return ToolsLocator.getDynObjectManager()
70
			.createDynObject(
71
				ToolsLocator.getPersistenceManager().getDefinition(name)
72
			);
73
	}
74
	
75
	public static DynObject newMetadataContainer(String name) {
76
		try {
77
			MetadataManager manager = MetadataLocator.getMetadataManager();
78
			DynStruct definition = manager.getDefinition(name);
79
	    	return ToolsLocator.getDynObjectManager().createDynObject(definition);
80
		} catch(NullPointerException e) {
81
			throw new CantCreateMetadataException(name,e);
82
		}
83
	}
84

  
85
	private static class DefinitionNotFoundException extends BaseRuntimeException {
86
		
87
		/**
88
		 * 
89
		 */
90
		private static final long serialVersionUID = 7598155353307119897L;
91

  
92
		public DefinitionNotFoundException(Class<?> theClass, String filename ) {
93
			super(
94
				"Can't open parameters definition '%(filename)' from class %(classname).",
95
				"_ResourceForParametersDefinitionNotFoundException",
96
				serialVersionUID
97
			);
98
			this.setValue("filename", filename);
99
			this.setValue("classname", theClass.getClass().getName());
100
		}
101
	}
102
	
103
	private static class CantCreateMetadataException extends RuntimeException {
104
		
105
		/**
106
		 * 
107
		 */
108
		private static final long serialVersionUID = -8373306339537106075L;
109

  
110
		CantCreateMetadataException(String name, Throwable cause) {
111
			super("Can't retrieve metadata definition for '"+name+"'.", cause);			
112
		}
113
	}
114
}
0 115

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/DALFileLocator.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
package org.gvsig.fmap.dal;
29

  
30
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerManager;
31
import org.gvsig.tools.locator.AbstractLocator;
32
import org.gvsig.tools.locator.Locator;
33
import org.gvsig.tools.locator.LocatorException;
34

  
35
public class DALFileLocator extends AbstractLocator {
36

  
37

  
38
	private static final String LOCATOR_NAME = "DALFileLocator";
39

  
40
	/**
41
	 * DataManager name used by the locator to access the instance
42
	 */
43
	public static final String FILESYSTEMSERVEREXPLORERE_MANAGER_NAME = "FilesystemServerExplorereManager";
44

  
45
	private static final String FILESYSTEMSERVEREXPLORERE_MANAGER_DESCRIPTION = "FilesystemServerExplorereManager of gvSIG Data Access Library";
46

  
47
	/**
48
	 * Unique instance.
49
	 */
50
	private static final DALFileLocator instance = new DALFileLocator();
51

  
52
	/**
53
	 * Return the singleton instance.
54
	 *
55
	 * @return the singleton instance
56
	 */
57
	public static DALFileLocator getInstance() {
58
		return instance;
59
	}
60

  
61
	public String getLocatorName() {
62
		return LOCATOR_NAME;
63
	}
64

  
65
	/**
66
	 * Return a reference to FilesystemServerExplorerManager.
67
	 *
68
	 * @return a reference to FilesystemServerExplorerManager
69
	 * @throws LocatorException
70
	 *             if there is no access to the class or the class cannot be
71
	 *             instantiated
72
	 * @see Locator#get(String)
73
	 */
74
	public static FilesystemServerExplorerManager getFilesystemServerExplorerManager()
75
			throws LocatorException {
76
		return (FilesystemServerExplorerManager) getInstance().get(
77
				FILESYSTEMSERVEREXPLORERE_MANAGER_NAME);
78
	}
79

  
80
	/**
81
	 * Registers the Class implementing the FilesystemSeverExplorerManager
82
	 * interface.
83
	 * 
84
	 * @param clazz
85
	 *            implementing the FilesystemSeverExplorerManager interface
86
	 */
87
	public static void registerFilesystemSeverExplorerManager(Class clazz) {
88
		getInstance().register(FILESYSTEMSERVEREXPLORERE_MANAGER_NAME,
89
				FILESYSTEMSERVEREXPLORERE_MANAGER_DESCRIPTION,
90
				clazz);
91
	}
92

  
93
}
0 94

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/DALFileLibrary.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 {{Company}}   {{Task}}
26
*/
27

  
28

  
29
package org.gvsig.fmap.dal;
30

  
31
import org.gvsig.fmap.dal.resource.file.FileResource;
32
import org.gvsig.fmap.dal.resource.file.FileResourceParameters;
33
import org.gvsig.fmap.dal.resource.spi.ResourceManagerProviderServices;
34
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
35
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
36
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.DefaultFilesystemServerExplorer;
37
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.DefaultFilesystemServerExplorerManager;
38
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
39
import org.gvsig.tools.library.AbstractLibrary;
40
import org.gvsig.tools.library.LibraryException;
41

  
42

  
43
public class DALFileLibrary extends AbstractLibrary {
44

  
45
    @Override
46
    public void doRegistration() {
47
        registerAsServiceOf(DALLibrary.class);
48
    }
49

  
50
	@Override
51
	protected void doInitialize() throws LibraryException {
52
	}
53

  
54
	@Override
55
	protected void doPostInitialize() throws LibraryException {
56
    	DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator.getDataManager();
57

  
58
    	ResourceManagerProviderServices resman = (ResourceManagerProviderServices) DALLocator.getResourceManager();
59

  
60
    	if (!resman.getResourceProviders().contains(FileResource.NAME)) {
61
			resman.register(FileResource.NAME, FileResource.DESCRIPTION,
62
					FileResource.class, FileResourceParameters.class);
63
		}
64

  
65
    	if (!dataman.getExplorerProviders().contains(FilesystemServerExplorer.NAME)) {
66
			dataman.registerExplorerProvider(FilesystemServerExplorer.NAME,
67
					DefaultFilesystemServerExplorer.class,
68
					FilesystemServerExplorerParameters.class);
69
			DALFileLocator
70
					.registerFilesystemSeverExplorerManager(DefaultFilesystemServerExplorerManager.class);
71
    	}
72
	}
73
}
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResource.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I   {{Task}}
26
*/
27

  
28
/**
29
 *
30
 */
31
package org.gvsig.fmap.dal.resource.file;
32

  
33
import java.io.File;
34
import java.io.FileInputStream;
35
import java.io.FileNotFoundException;
36
import java.text.MessageFormat;
37

  
38
import org.gvsig.fmap.dal.exception.InitializeException;
39
import org.gvsig.fmap.dal.resource.ResourceParameters;
40
import org.gvsig.fmap.dal.resource.exception.AccessResourceException;
41
import org.gvsig.fmap.dal.resource.exception.PrepareResourceException;
42
import org.gvsig.fmap.dal.resource.exception.ResourceException;
43
import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException;
44
import org.gvsig.fmap.dal.resource.spi.AbstractResource;
45

  
46
/**
47
 * @author jmvivo
48
 *
49
 */
50
public class FileResource extends AbstractResource {
51

  
52
	final public static String NAME = "file";
53
	final public static String DESCRIPTION = "File of filesystem";
54

  
55
	private File file;
56

  
57
	public FileResource(FileResourceParameters params)
58
			throws InitializeException {
59
		super(params);
60
		file = null;
61
	}
62

  
63
	public Object get() throws AccessResourceException {
64
		return getFile();
65
	}
66

  
67
	public String getFileName() throws AccessResourceException {
68
		return (String) getFile().getPath();
69
	}
70

  
71
	public File getFile() throws AccessResourceException {
72

  
73
		try {
74
			prepare();
75
		} catch (PrepareResourceException e) {
76
			throw new AccessResourceException(this, e);
77
		}
78
		return ((FileResourceParameters)getParameters()).getFile();
79
	}
80

  
81
	// TODO ???
82
	public FileInputStream getFileInputStream() throws AccessResourceException,
83
			FileNotFoundException {
84
		FileInputStream fis = new FileInputStream(getFile());
85
		try {
86
			notifyOpen();
87
		} catch (ResourceNotifyOpenException e) {
88
			throw new AccessResourceException(this, e);
89
		}
90
		return fis;
91
	}
92

  
93
	public String getName() throws AccessResourceException {
94
		return MessageFormat.format("FileResource({0})",
95
				new Object[] { getFileName() });
96
	}
97

  
98
	public boolean isThis(ResourceParameters parameters)
99
			throws ResourceException {
100
		if (!(parameters instanceof FileResourceParameters)) {
101
			return false;
102
		}
103
		FileResourceParameters params;
104
		params = (FileResourceParameters) parameters.getCopy();
105
		prepare(params);
106
		return params.getFileName().equals(this.getFileName());
107

  
108
	}
109

  
110
}
111

  
0 112

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/resource/file/FileResourceParameters.java
1
package org.gvsig.fmap.dal.resource.file;
2

  
3
import java.io.File;
4

  
5
import org.gvsig.fmap.dal.resource.spi.AbstractResourceParameters;
6
import org.gvsig.tools.ToolsLocator;
7
import org.gvsig.tools.dataTypes.DataTypes;
8
import org.gvsig.tools.dynobject.DelegatedDynObject;
9
import org.gvsig.tools.dynobject.DynClass;
10
import org.gvsig.tools.persistence.PersistenceManager;
11

  
12

  
13
public class FileResourceParameters extends AbstractResourceParameters {
14

  
15
    public static final String DYNCLASS_NAME = "FileResourceParameters";
16

  
17
    private static final String DYNFIELDNAME_FILE = "file";
18

  
19
	private DelegatedDynObject delegatedDynObject;
20

  
21
    public FileResourceParameters() {
22
		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
23
				.getDynObjectManager()
24
				.createDynObject(registerDynClass());
25
	}
26

  
27
	public FileResourceParameters(Object[] params) {
28
		this();
29
		// XXX puede que sobre
30
        setDynValue(DYNFIELDNAME_FILE, params[0]);
31
	}
32

  
33
	public FileResourceParameters(String name) {
34
		this();
35
		setDynValue(DYNFIELDNAME_FILE, name);
36
	}
37

  
38
	public String getFileName() {
39
		if( this.getFile()== null ) {
40
			return null;
41
		}
42
		return this.getFile().getPath();
43
	}
44

  
45
	public FileResourceParameters setFileName(String fileName) {
46
		this.setDynValue(DYNFIELDNAME_FILE, fileName);
47
		return this;
48
	}
49

  
50
	public File getFile() {
51
		return (File) this.getDynValue(DYNFIELDNAME_FILE);
52
	}
53

  
54
	public FileResourceParameters setFile(File file) {
55
		this.setDynValue(DYNFIELDNAME_FILE, file);
56
		return this;
57
	}
58

  
59
	public FileResourceParameters setFile(String fileName) {
60
		this.setDynValue(DYNFIELDNAME_FILE, fileName);
61
		return this;
62
	}
63

  
64
	public String getTypeName() {
65
		return FileResource.NAME;
66
	}
67

  
68
	protected DelegatedDynObject getDelegatedDynObject() {
69
		return delegatedDynObject;
70
	}
71

  
72
    private DynClass registerDynClass() {
73
    	PersistenceManager manager = ToolsLocator.getPersistenceManager();
74
    	DynClass definition = (DynClass) manager.getDefinition(DYNCLASS_NAME);
75
    	if( definition == null ) {
76
    		definition = (DynClass) manager.addDefinition(
77
    				FileResourceParameters.class,
78
    				DYNCLASS_NAME, 
79
    				DYNCLASS_NAME+" persistence definition", 
80
    				null, 
81
    				null
82
    		);
83

  
84
			definition.addDynField(DYNFIELDNAME_FILE).setType(DataTypes.FILE)
85
					.setDescription("The file");
86
        }
87
        return definition;
88
    }
89
}
0 90

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemServerExplorerParameters.java
1
package org.gvsig.fmap.dal.serverexplorer.filesystem;
2

  
3
import org.gvsig.fmap.dal.DataServerExplorerParameters;
4
import org.gvsig.fmap.dal.DataTypes;
5
import org.gvsig.fmap.dal.spi.AbstractDataParameters;
6
import org.gvsig.tools.ToolsLocator;
7
import org.gvsig.tools.dynobject.DelegatedDynObject;
8
import org.gvsig.tools.dynobject.DynClass;
9
import org.gvsig.tools.dynobject.DynField;
10
import org.gvsig.tools.dynobject.DynObjectManager;
11

  
12
public class FilesystemServerExplorerParameters extends AbstractDataParameters
13
		implements DataServerExplorerParameters {
14

  
15
    public static final String DYNCLASS_NAME = "FilesystemServerExplorerParameters";
16

  
17
    private static final String FIELD_ROOT = "root";
18

  
19
	private DelegatedDynObject delegatedDynObject;
20

  
21
	public FilesystemServerExplorerParameters() {
22
		this.delegatedDynObject = (DelegatedDynObject) ToolsLocator
23
				.getDynObjectManager()
24
				.createDynObject(this.registerDynClass());
25
	}
26

  
27
	private DynClass registerDynClass() {
28
	   	DynObjectManager dynman = ToolsLocator.getDynObjectManager();
29
    	DynClass dynClass = dynman.get(DYNCLASS_NAME);
30
    	DynField field;
31
    	if (dynClass == null) {
32
    		dynClass = dynman.add(DYNCLASS_NAME);
33

  
34
    		field = dynClass.addDynField(FIELD_ROOT);
35
    		field.setType(DataTypes.STRING);
36
    		field.setDescription("Root directory path of the explorer");
37
    		field.setTheTypeOfAvailableValues(DynField.ANY);
38

  
39

  
40
    		field = dynClass.addDynField("initialpath");
41
			field.setType(DataTypes.STRING);
42
			field.setDescription("Initial path of the explorer");
43
			field.setTheTypeOfAvailableValues(DynField.ANY);
44

  
45
    	}
46
    	return dynClass;
47
	}
48

  
49
	public void setRoot(String path) {
50
		this.setDynValue(FIELD_ROOT, path);
51
	}
52

  
53
	public String getRoot() {
54
		return (String) this.getDynValue(FIELD_ROOT);
55
	}
56

  
57
	public void setInitialpath(String path) {
58
		this.setDynValue("initialpath", path);
59
	}
60

  
61
	public String getInitialpath() {
62
		return (String) this.getDynValue("initialpath");
63
	}
64

  
65
	public String getExplorerName() {
66
		return FilesystemServerExplorer.NAME;
67
	}
68

  
69
	protected DelegatedDynObject getDelegatedDynObject() {
70
		return delegatedDynObject;
71
	}
72
}
0 73

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/AbstractFilesystemServerExplorerProvider.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

  
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2010 {Prodevelop}   {Task}
26
 */
27

  
28
package org.gvsig.fmap.dal.serverexplorer.filesystem.impl;
29

  
30
import java.io.File;
31

  
32
import org.gvsig.fmap.dal.DataServerExplorer;
33
import org.gvsig.fmap.dal.DataStore;
34
import org.gvsig.fmap.dal.resource.file.FileResource;
35
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
36

  
37
/**
38
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera Llodr&aacute;</a>
39
 */
40
public abstract class AbstractFilesystemServerExplorerProvider implements FilesystemServerExplorerProvider {
41

  
42
	public String getResourceRootPathName(DataStore dataStore) {
43
		if (dataStore.getParameters().hasDynValue(FileResource.NAME)){
44
			Object obj = (dataStore.getParameters().getDynValue(FileResource.NAME));
45
			if (obj != null){	
46
				return removeFileExtension(new File(obj.toString()));		
47
			}
48
		}
49
		return null;
50
	}
51
	
52
	protected String removeFileExtension(File file){
53
		int whereDot = file.getName().lastIndexOf(".");	
54
		if ((0 < whereDot) && (whereDot <= file.getName().length() - 2)) {
55
			whereDot = file.getAbsolutePath().lastIndexOf(".");
56
			return file.getAbsolutePath().substring(0, whereDot);
57
		}	
58
		return file.getAbsolutePath();
59
	}
60
	
61
	public int getMode() {
62
		return DataServerExplorer.MODE_ALL;
63
	}
64
	
65
	public boolean isMode(int mode) {
66
		if( mode == DataServerExplorer.MODE_ALL ) {
67
			return true;
68
		}
69
		return (this.getMode() & mode) != 0;
70
	}
71

  
72
}
73

  
0 74

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/DefaultFilesystemServerExplorerManager.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
package org.gvsig.fmap.dal.serverexplorer.filesystem.impl;
29

  
30
import java.util.Iterator;
31

  
32
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerManager;
33
import org.gvsig.tools.ToolsLocator;
34

  
35
public class DefaultFilesystemServerExplorerManager implements
36
		FilesystemServerExplorerManager {
37

  
38
	public Iterator getRegisteredProviders() {
39
		return ToolsLocator.getExtensionPointManager().get(FILE_FILTER_EPSNAME)
40
				.iterator();
41
	}
42

  
43
	public void registerProvider(String name, String description,
44
			Class filesystemServerProvicerClass) {
45
		ToolsLocator.getExtensionPointManager().add(FILE_FILTER_EPSNAME,
46
				FILE_FILTER_EPSDESCRIPTION).append(
47
				name, description,
48
				filesystemServerProvicerClass);
49
	}
50

  
51
}
0 52

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/impl/DefaultFilesystemServerExplorer.java
1
package org.gvsig.fmap.dal.serverexplorer.filesystem.impl;
2

  
3
import java.io.File;
4
import java.util.ArrayList;
5
import java.util.HashSet;
6
import java.util.Iterator;
7
import java.util.List;
8
import java.util.Set;
9

  
10
import org.gvsig.fmap.dal.DALFileLocator;
11
import org.gvsig.fmap.dal.DALLocator;
12
import org.gvsig.fmap.dal.DataManager;
13
import org.gvsig.fmap.dal.DataServerExplorerParameters;
14
import org.gvsig.fmap.dal.DataStore;
15
import org.gvsig.fmap.dal.DataStoreParameters;
16
import org.gvsig.fmap.dal.NewDataStoreParameters;
17
import org.gvsig.fmap.dal.exception.DataException;
18
import org.gvsig.fmap.dal.exception.FileNotFoundException;
19
import org.gvsig.fmap.dal.exception.InitializeException;
20
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
21
import org.gvsig.fmap.dal.exception.RemoveException;
22
import org.gvsig.fmap.dal.exception.ServerExplorerAddException;
23
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
24
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemFileFilter;
25
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorer;
26
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemServerExplorerParameters;
27
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters;
28
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider;
29
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices;
30
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
31
import org.gvsig.fmap.dal.spi.DataServerExplorerProviderServices;
32
import org.gvsig.tools.dispose.impl.AbstractDisposable;
33
import org.gvsig.tools.exception.BaseException;
34
import org.gvsig.tools.extensionpoint.ExtensionPoint.Extension;
35

  
36
@SuppressWarnings({"unchecked"})
37
public class DefaultFilesystemServerExplorer extends AbstractDisposable
38
		implements FilesystemServerExplorerProviderServices,
39
		FilesystemFileFilter {
40

  
41
	FilesystemServerExplorerParameters parameters;
42

  
43
	private File root;
44

  
45
	private File current; // Current path
46

  
47
	private DataServerExplorerProviderServices providerServices;
48

  
49
	private List serverProviders;
50

  
51
	public DefaultFilesystemServerExplorer(
52
			FilesystemServerExplorerParameters parameters,
53
			DataServerExplorerProviderServices services)
54
			throws InitializeException {
55
		this.parameters = parameters;
56
		this.providerServices = services;
57
		if (this.parameters.getRoot() != null) {
58
			this.root = new File(this.parameters.getRoot());
59
		}
60
		if (this.parameters.getInitialpath() != null) {
61
			this.current = new File(this.parameters.getInitialpath());
62
		}
63
		if (this.root == null && this.current == null) {
64
			// throw new InitializeException(this.getName(),
65
			// new IllegalArgumentException());
66
		} else if (this.current == null) {
67
			this.current = new File(this.parameters.getRoot());
68
		}
69
	}
70

  
71
	public DataServerExplorerParameters getParameters() {
72
		return parameters;
73
	}
74

  
75
	protected void doDispose() throws BaseException {
76
		this.parameters = null;
77
		this.root = null;
78
	}
79

  
80
	public List list(int mode) throws DataException {
81
		if (this.current == null) {
82
			throw new IllegalStateException();
83
		}
84
		if (!this.current.exists()) {
85
			new org.gvsig.fmap.dal.exception.FileNotFoundException(this.current);
86
		}
87

  
88
		if (!this.current.isDirectory()) {
89
			new IllegalArgumentException(this.getProviderName()
90
					+ ": Path not a directory '" + this.current + "'");
91
		}
92

  
93
		List files = new ArrayList(); // return files
94
		List providers = this.getProviders(mode); 
95
		String allfiles[] = this.current.list();
96

  
97
		for (int i = 0; i < allfiles.length; i++) {
98
			File file = new File(this.root, allfiles[i]);
99
			Iterator providersit = providers.iterator();
100
			while (providersit.hasNext()) {
101
				FilesystemServerExplorerProvider provider = (FilesystemServerExplorerProvider) providersit
102
						.next();
103
				if( provider.accept(file)) {
104
					DataStoreParameters dsp = this.createStoreParameters(file);
105
					if (dsp != null) {
106
						files.add(dsp);
107
					}
108
					break;
109
				}
110
			}
111
		}
112
		return files;
113
	}
114

  
115
	public List list() throws DataException {
116
		if (this.current == null) {
117
			throw new IllegalStateException(); // FIXME
118
		}
119
		if (!this.current.exists()) {
120
			// TODO crear excepcion de Data??
121
			new org.gvsig.fmap.dal.exception.FileNotFoundException(this.current);
122
		}
123

  
124
		if (!this.current.isDirectory()) {
125
			new IllegalArgumentException(this.getProviderName()
126
					+ ": Path not a directory '" + this.current + "'");
127
		}
128

  
129
		String files[] = this.current.list();
130
		int i;
131
		File theFile;
132
		ArrayList list = new ArrayList();
133
		DataStoreParameters dsp = null;
134

  
135
		for (i = 0; i < files.length; i++) {
136
			theFile = new File(this.root, files[i]);
137
			dsp = this.createStoreParameters(theFile);
138
			if (dsp != null) {
139
				list.add(dsp);
140
			}
141
		}
142
		return list;
143
	}
144

  
145
	public void setCurrentPath(File path) throws FileNotFoundException {
146
		// FIXME Comprobar si es un directorio existente
147
		if (!path.exists()) {
148
			throw new FileNotFoundException(path);
149
		}
150
		if (!path.isDirectory()) {
151
			throw new IllegalArgumentException(path.getPath()
152
					+ " is not a directory");
153
		}
154
		if (!isFromRoot(path)) {
155
			throw new IllegalArgumentException(path.getPath()
156
					+ " is not from root");
157

  
158
		}
159

  
160
		this.current = path;
161
	}
162

  
163
	public File getCurrentPath() {
164
		return this.current;
165
	}
166

  
167
	public File getRoot() {
168
		return this.root;
169
	}
170

  
171
	public void remove(DataStoreParameters dsp) throws RemoveException {
172
		String providerName = dsp.getDataStoreName();
173
		try {
174
			this.checkIsMine(dsp);
175
			FilesystemServerExplorerProvider provider = this
176
					.getProvider(providerName);
177

  
178
			provider.remove(dsp);
179
		} catch (DataException e) {
180
			throw new RemoveException(this.getProviderName(), e);
181
		}
182
	}
183

  
184
	public boolean add(String providerName, NewDataStoreParameters ndsp,
185
			boolean overwrite) throws DataException {
186

  
187
		try {
188
			this.checkIsMine(ndsp);
189
			FilesystemServerExplorerProvider provider = this
190
					.getProvider(providerName);
191

  
192
			ndsp.validate();
193
			provider.create(ndsp, overwrite);
194
			return true; 
195
		} catch (DataException e) {
196
			throw new ServerExplorerAddException(this.getProviderName(), e);
197
		} catch (ValidateDataParametersException e) {
198
			throw new ServerExplorerAddException(this.getProviderName(), e);
199
		}
200
	}
201

  
202
	public boolean canAdd() {
203
		return this.root.canWrite();
204
	}
205

  
206
	public String getProviderName() {
207
		return FilesystemServerExplorer.NAME;
208
	}
209

  
210
	public NewDataStoreParameters getAddParameters(String storeName)
211
			throws DataException {
212
		FilesystemServerExplorerProvider provider = this.getProvider(storeName);
213
		if (provider == null) {
214
			throw new IllegalArgumentException(
215
					"Not registered in this explorer"); // FIXME
216
		}
217

  
218
		NewDataStoreParameters nParams = provider.getCreateParameters();
219
		// nParams.setAttribute("path", this.getCurrentPath().getPath());
220
		return nParams;
221
	}
222

  
223
	public boolean canAdd(String storeName) throws DataException {
224
		if (storeName == null) {
225
			return false;// CanAdd with genericFilter
226
		}
227
		FilesystemServerExplorerProvider provider = this.getProvider(storeName);
228
		if (provider == null) {
229
			throw new IllegalArgumentException(
230
					"Not registered in this explorer"); // FIXME
231
		}
232

  
233
		return provider.canCreate();
234

  
235
	}
236

  
237
	// ==========================================
238

  
239
	private FilesystemServerExplorerProvider getProvider(String storeName)
240
			throws InitializeException, ProviderNotRegisteredException {
241
		Iterator providers = getProviders(FilesystemServerExplorer.MODE_ALL).iterator();
242
		FilesystemServerExplorerProvider provider;
243
		while (providers.hasNext()) {
244
			provider = (FilesystemServerExplorerProvider) providers.next();
245
			if (provider.getDataStoreProviderName().equals(storeName)) {
246
				return provider;
247
			}
248
		}
249
		return null;
250
	}
251

  
252
	private DataManagerProviderServices getManager() {
253
		return (DataManagerProviderServices) DALLocator.getDataManager();
254
	}
255
	
256
	public DataStoreParameters createStoreParameters(File file, String providerName) throws DataException {
257

  
258
		return this.getParametersFor(file, providerName, true);
259
	}
260

  
261
	public DataStoreParameters createStoreParameters(File file) throws DataException {
262

  
263
		return this.getParametersFor(file, null, true);
264
	}
265
	
266
	public DataStoreParameters getParametersFor(File file, String providerName, boolean checksExist) throws DataException {
267
		
268
		if (checksExist) {
269
			if (!file.exists()) {
270
				return null;
271
			}
272
			if (!file.isFile()) {
273
				return null;
274
			}
275
			if (!file.canRead()) {
276
				return null;
277
			}
278
			if (file.isHidden()) { // XXX ???
279
				return null;
280
			}
281
		}
282
		if(providerName == null)
283
			providerName = this.getProviderName(file);
284
		if (providerName != null) {
285
			DataStoreParameters params = this.getManager()
286
			.createStoreParameters(providerName);
287
			((FilesystemStoreParameters) params).setFile(file);
288
			return params;
289

  
290
		}
291
		return null;
292
	}
293
	
294
	public ArrayList<String> getProviderNameList(File file) {
295
		Iterator filters = getFilters();
296
		ArrayList<String> list = new ArrayList<String>();
297
		while (filters.hasNext()) {
298
			FilesystemFileFilter filter = (FilesystemFileFilter) filters.next();
299
			if (filter.accept(file)) {
300
				list.add(filter.getDataStoreProviderName());
301
			}
302
		}
303
		return list;
304
	}
305

  
306
	public String getProviderName(File file) {
307
		Iterator filters = getFilters();
308
		while (filters.hasNext()) {
309
			FilesystemFileFilter filter = (FilesystemFileFilter) filters.next();
310
			if (filter.accept(file)) {
311
				return filter.getDataStoreProviderName();
312
			}
313
		}
314
		return null;
315
	}
316

  
317
	public List getDataStoreProviderNames() {
318
		Set names = new HashSet();
319
		
320
		Iterator filters = getFilters();
321
		while (filters.hasNext()) {
322
			FilesystemFileFilter filter = (FilesystemFileFilter) filters.next();
323
			names.add(filter.getDataStoreProviderName());
324
		}
325
		return new ArrayList(names);	
326
	}
327

  
328
	private void checkIsMine(DataStoreParameters dsp)
329
			throws IllegalArgumentException, DataException {
330
		// FIXME Exception ???
331
		if (!(dsp instanceof FilesystemStoreParameters)) {
332
			new IllegalArgumentException(
333
					"not instance of FilesystemStoreParameters");
334
		}
335
		Iterator filters = getFilters();
336
		File file = ((FilesystemStoreParameters) dsp).getFile();
337
		if (!this.isFromRoot(file)) {
338
			throw new IllegalArgumentException("worng explorer");
339
		}
340
		FilesystemFileFilter filter;
341
		while (filters.hasNext()) {
342
			filter = (FilesystemFileFilter) filters.next();
343
			if (dsp.getDataStoreName()
344
					.equals(filter.getDataStoreProviderName())) {
345
				return;
346
			}
347
		}
348
		throw new IllegalArgumentException("worng explorer");
349
	}
350

  
351
	private boolean isFromRoot(File file) {
352
		if (this.root == null) {
353
			return true;
354
		}
355
		return file.getAbsolutePath().startsWith(this.root.getAbsolutePath());
356
	}
357

  
358
	public List getProviders() {
359
		if (this.serverProviders == null) {
360
			Iterator iter = DALFileLocator.getFilesystemServerExplorerManager()
361
					.getRegisteredProviders();
362
			this.serverProviders = new ArrayList();
363
			Extension ext;
364
			FilesystemServerExplorerProvider provider;
365
			while (iter.hasNext()) {
366
				ext = (Extension) iter.next();
367
				try {
368
					provider = (FilesystemServerExplorerProvider) ext.create();
369
				} catch (Exception e) {
370
					throw new RuntimeException(e);// FIXME !!!
371
				}
372
				provider.initialize(this);
373
				this.serverProviders.add(provider);
374
			}
375
		}
376
		return this.serverProviders;
377
	}
378

  
379
	public List getProviders(int mode) {
380
		Iterator iter = DALFileLocator.getFilesystemServerExplorerManager()
381
				.getRegisteredProviders();
382
		List providers = new ArrayList();
383
		Extension ext;
384
		FilesystemServerExplorerProvider provider;
385
		while (iter.hasNext()) {
386
			ext = (Extension) iter.next();
387
			try {
388
				provider = (FilesystemServerExplorerProvider) ext.create();
389
			} catch (Exception e) {
390
				throw new RuntimeException(e);// FIXME !!!
391
			}
392
			if (provider.isMode(mode)) {
393
				provider.initialize(this);
394
				providers.add(provider);
395
			}
396
		}
397
		return providers;
398
	}
399

  
400
	public Iterator getFilters(int mode) {
401
		return this.getProviders(mode).iterator();
402
	}
403
	
404
	public Iterator getFilters() {
405
		return this.getProviders().iterator();
406
	}
407

  
408
	public FilesystemFileFilter getFilter(int mode, final String description ) {
409
		
410
		final List filters = new ArrayList();
411
		Iterator it = this.getFilters(mode);
412
		while( it.hasNext() ) {
413
			filters.add( it.next() );
414
		}
415
		FilesystemFileFilter filter = new FilesystemFileFilter() {
416
			
417
			public boolean accept(File f) {
418
				if (f.isDirectory()) {
419
					return true;
420
				}
421
				for(int i=0; i<filters.size(); i++) {
422
					if( ((FilesystemFileFilter)filters.get(i)).accept(f) ) {
423
						return true;
424
					}
425
				}
426
				return false;
427
			}
428
			
429
			public String getDescription() {
430
				return description;
431
			}
432
			
433
			public String getDataStoreProviderName() {
434
				return null;
435
			}
436
		};
437
		return filter;
438
	}
439

  
440
	public FilesystemFileFilter getGenericFilter() {
441
		// FIXME: Este metodo, getGenericFilter, no tengo claro que deba existir (jjdc)
442
		return this;
443
	}
444

  
445
	public String getDataStoreProviderName() {
446
		return null;
447
	}
448

  
449
	public String getDescription() {
450
		return "All supporteds";
451
	}
452

  
453
	public boolean accept(File pathname) {
454
		try {
455
			return this.createStoreParameters(pathname) != null;
456
		} catch (DataException e) {
457
			throw new RuntimeException(e); // FIXME excpetion??
458
		}
459
	}
460

  
461
	public DataServerExplorerProviderServices getServerExplorerProviderServices() {
462
		return this.providerServices;
463
	}
464

  
465
	public DataStore open(File file) throws DataException,
466
			ValidateDataParametersException {
467
		DataManager manager =  DALLocator.getDataManager();
468
		String providerName = this.getProviderName(file);
469
		
470
        DataStoreParameters params = this.getAddParameters(file);
471
		return manager.openStore(providerName, params);
472
	}
473

  
474
	public NewDataStoreParameters getAddParameters(File file)
475
			throws DataException {
476
		DataStoreParameters params = this.getParametersFor(file, null, false);
477
		NewDataStoreParameters newParams = this.getAddParameters(params
478
				.getDataStoreName());
479
		((FilesystemStoreParameters) newParams)
480
				.setFile(((FilesystemStoreParameters) params).getFile());
481
		return newParams;
482
	}
483

  
484
	public File getResourcePath(DataStore dataStore, String resourceName) throws DataException {
485
		FilesystemServerExplorerProvider provider = 
486
			this.getProvider(dataStore.getProviderName());
487
		if (provider == null){
488
			return null;
489
		}		
490
		String rootPath = provider.getResourceRootPathName(dataStore);
491
		if (rootPath == null){
492
			return null;
493
		}
494
		return new File(rootPath + "." + resourceName);
495
	}
496
}
0 497

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemStoreParameters.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
/**
29
 *
30
 */
31
package org.gvsig.fmap.dal.serverexplorer.filesystem;
32

  
33
import java.io.File;
34

  
35
/**
36
 * @author jmvivo
37
 *
38
 */
39
public interface FilesystemStoreParameters {
40

  
41
	public File getFile();
42

  
43
	public void setFile(File file);
44
}
0 45

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/FilesystemFileFilter.java
1
package org.gvsig.fmap.dal.serverexplorer.filesystem;
2

  
3
import java.io.FileFilter;
4

  
5
public interface FilesystemFileFilter extends FileFilter {
6

  
7
	public String getDataStoreProviderName();
8
	public String getDescription();
9

  
10
}
0 11

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/AbsolutePathRequiredException.java
1
package org.gvsig.fmap.dal.serverexplorer.filesystem;
2

  
3
import org.gvsig.fmap.dal.exception.CreateException;
4

  
5
public class AbsolutePathRequiredException extends CreateException {
6

  
7
	private static final long serialVersionUID = 8723525042950358334L;
8
	private final static String MESSAGE_FORMAT = "Absolute path required creating '%(resource)'.";
9
	private final static String MESSAGE_KEY = "_AbsolutePathRequiredException";
10

  
11
	public AbsolutePathRequiredException(String resource) {
12
		super(MESSAGE_FORMAT, MESSAGE_KEY, serialVersionUID);
13
		setValue("resource", resource);
14
	}
15

  
16
}
17

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerManager.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
package org.gvsig.fmap.dal.serverexplorer.filesystem.spi;
29

  
30
import java.util.Iterator;
31

  
32
public interface FilesystemServerExplorerManager {
33
	final public static String FILE_FILTER_EPSNAME = "FilesystemExplorerFilters";
34
	final public String FILE_FILTER_EPSDESCRIPTION = "Registro de filtros asociados al explorador del sistema de ficheros.";
35

  
36
	public void registerProvider(String name, String description,
37
			Class filesystemServerProvicerClass);
38

  
39
	public Iterator getRegisteredProviders();
40

  
41
}
0 42

  
tags/v2_0_0_Build_2043/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/serverexplorer/filesystem/spi/FilesystemServerExplorerProvider.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

  
28
/**
29
 *
30
 */
31
package org.gvsig.fmap.dal.serverexplorer.filesystem.spi;
32

  
33
import org.gvsig.fmap.dal.DataStore;
34
import org.gvsig.fmap.dal.DataStoreParameters;
35
import org.gvsig.fmap.dal.NewDataStoreParameters;
36
import org.gvsig.fmap.dal.exception.CreateException;
37
import org.gvsig.fmap.dal.exception.DataException;
38
import org.gvsig.fmap.dal.exception.RemoveException;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff