Revision 744

View differences:

org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.prov.installer/src/main/java/org/gvsig/educa/portableview/lib/prov/installer/PortableViewInstallerProviderLibrary.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.educa.portableview.lib.prov.installer;
29

  
30
import org.gvsig.educa.portableview.lib.prov.installer.execution.PortableViewInstallerExecutionProviderFactory;
31
import org.gvsig.installer.lib.api.InstallerLibrary;
32
import org.gvsig.installer.lib.spi.InstallerProviderLocator;
33
import org.gvsig.tools.library.AbstractLibrary;
34
import org.gvsig.tools.library.LibraryException;
35
import org.gvsig.tools.service.spi.ProviderManager;
36

  
37
public class PortableViewInstallerProviderLibrary extends AbstractLibrary {
38

  
39
    @Override
40
    public void doRegistration() {
41
        registerAsServiceOf(InstallerLibrary.class);
42
    }
43

  
44
    @Override
45
    protected void doInitialize() throws LibraryException {
46

  
47
    }
48

  
49
    @Override
50
    protected void doPostInitialize() throws LibraryException {
51
        ProviderManager providerManager =
52
            InstallerProviderLocator.getProviderManager();
53
        providerManager
54
            .addProviderFactory(new PortableViewInstallerExecutionProviderFactory());
55
    }
56
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.prov.installer/src/main/java/org/gvsig/educa/portableview/lib/prov/installer/execution/PortableViewInstallerExecutionProviderFactory.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.educa.portableview.lib.prov.installer.execution;
29

  
30
import org.gvsig.educa.portableview.PortableViewManager;
31
import org.gvsig.tools.ToolsLocator;
32
import org.gvsig.tools.dynobject.DynClass;
33
import org.gvsig.tools.dynobject.DynObject;
34
import org.gvsig.tools.dynobject.DynObjectManager;
35
import org.gvsig.tools.service.spi.AbstractProviderFactory;
36
import org.gvsig.tools.service.spi.Provider;
37
import org.gvsig.tools.service.spi.ProviderServices;
38

  
39
/**
40
 * @author gvSIG Team
41
 * @version $Id$
42
 *
43
 */
44
public class PortableViewInstallerExecutionProviderFactory extends
45
    AbstractProviderFactory {
46

  
47
    public static final String PROVIDER_DESCRIPTION =
48
        "Portable View installation provider";
49

  
50
    private DynClass dynclass;
51

  
52
    @Override
53
    protected DynClass createParametersDynClass() {
54
        if (dynclass == null) {
55
            initialize();
56
        }
57
        return dynclass;
58
    }
59

  
60
    @Override
61
    protected Provider doCreate(DynObject parameters, ProviderServices services) {
62
        return new PortableViewInstallerExecutionProvider(services);
63
    }
64

  
65
    @Override
66
    public String getName() {
67
        return PortableViewManager.INSTALLER_PROVIDER_NAME;
68
    }
69

  
70
    
71
    public void initialize() {
72
        if (dynclass == null) {
73
            DynObjectManager dynObjectManager =
74
                ToolsLocator.getDynObjectManager();
75
            dynclass =
76
                dynObjectManager.createDynClass(this.getName(),
77
                    PROVIDER_DESCRIPTION);
78
            dynObjectManager.add(dynclass);
79
        }
80
    }
81

  
82
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.prov.installer/src/main/java/org/gvsig/educa/portableview/lib/prov/installer/execution/PortableViewInstallerExecutionProvider.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.educa.portableview.lib.prov.installer.execution;
29

  
30
import java.io.File;
31
import java.io.IOException;
32
import java.io.InputStream;
33

  
34
import org.gvsig.educa.portableview.PortableViewLocator;
35
import org.gvsig.educa.portableview.PortableViewManager;
36
import org.gvsig.installer.lib.api.PackageInfo;
37
import org.gvsig.installer.lib.api.execution.InstallPackageServiceException;
38
import org.gvsig.installer.lib.spi.InstallPackageProviderServices;
39
import org.gvsig.installer.lib.spi.InstallerProviderLocator;
40
import org.gvsig.installer.lib.spi.InstallerProviderManager;
41
import org.gvsig.installer.lib.spi.execution.InstallPackageProvider;
42
import org.gvsig.tools.service.spi.AbstractProvider;
43
import org.gvsig.tools.service.spi.ProviderServices;
44

  
45
public class PortableViewInstallerExecutionProvider extends AbstractProvider
46
    implements InstallPackageProvider {
47

  
48
    private static final InstallerProviderManager installerProviderManager =
49
        InstallerProviderLocator.getProviderManager();
50
    private final PortableViewManager tmManager;
51

  
52
    public PortableViewInstallerExecutionProvider(
53
        ProviderServices providerServices) {
54
        super(providerServices);
55
        tmManager = PortableViewLocator.getManager();
56
    }
57

  
58
    public void install(File applicationDirectory, InputStream inputStream,
59
        PackageInfo packageInfo) throws InstallPackageServiceException {
60

  
61
        try {
62
            File installationFolder =
63
                new File(tmManager.getInstallationMapFolder());
64

  
65
            InstallPackageProviderServices installerProviderServices =
66
                installerProviderManager.createInstallerProviderServices();
67

  
68
            installerProviderServices.decompress(inputStream,
69
                installationFolder);
70

  
71
        } catch (Exception e) {
72
            try {
73
                // if there is an exception, installLater is called
74
                installLater(applicationDirectory, inputStream, packageInfo);
75
            } catch (IOException e1) {
76
                e1.printStackTrace();
77
                throw new InstallPackageServiceException(e1);
78
            }
79
        }
80
    }
81

  
82
    /**
83
     * This function will is called when an exception is produced during the
84
     * installation of a plugin. It will prepare the package to be installed on
85
     * the next gvSIG restart.
86
     */
87
    public void installLater(File applicationDirectory,
88
        InputStream inputStream, PackageInfo packageInfo)
89
        throws InstallPackageServiceException, IOException {
90

  
91
    }
92

  
93
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.prov.installer/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.educa.portableview.lib.prov.installer.PortableViewInstallerProviderLibrary
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.prov.installer/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.educa.portableview.lib</artifactId>
6
    <version>1.0.91</version>
7
  </parent>
8
  <artifactId>org.gvsig.educa.portableview.lib.prov.installer</artifactId>
9
  <name>org.gvsig.educa.portableview.lib.prov.installer</name>
10
  <dependencies>
11
  	<dependency>
12
  		<groupId>org.gvsig</groupId>
13
  		<artifactId>org.gvsig.installer.lib.api</artifactId>
14
  	</dependency>
15
  	<dependency>
16
  		<groupId>org.gvsig</groupId>
17
  		<artifactId>org.gvsig.installer.lib.spi</artifactId>
18
  	</dependency>
19
  	<dependency>
20
  		<groupId>org.gvsig</groupId>
21
  		<artifactId>org.gvsig.educa.portableview.lib.api</artifactId>
22
  	</dependency>
23
  	<dependency>
24
  		<groupId>org.gvsig</groupId>
25
  		<artifactId>org.gvsig.educa.portableview.lib.impl</artifactId>
26
  	</dependency>
27
  </dependencies>
28
</project>
0 29

  
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/test/resources/log4j.xml
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!--
3

  
4
    gvSIG. Desktop Geographic Information System.
5

  
6
    Copyright (C) 2007-2012 gvSIG Association.
7

  
8
    This program is free software; you can redistribute it and/or
9
    modify it under the terms of the GNU General Public License
10
    as published by the Free Software Foundation; either version 2
11
    of the License, or (at your option) any later version.
12

  
13
    This program is distributed in the hope that it will be useful,
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
    GNU General Public License for more details.
17

  
18
    You should have received a copy of the GNU General Public License
19
    along with this program; if not, write to the Free Software
20
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
    MA  02110-1301, USA.
22

  
23
    For any additional information, do not hesitate to contact us
24
    at info AT gvsig.com, or visit our website www.gvsig.com.
25

  
26
-->
27
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
28

  
29
<!-- 
30
Log4J configuration file for unit tests execution.
31
 -->
32
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
33

  
34
	<!-- Appender configuration to show logging messages through the console -->
35
	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
36
		<layout class="org.apache.log4j.PatternLayout">
37
			<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{2}.%M()]\n  %m%n" />
38
		</layout>
39
	</appender>
40

  
41
	<!-- 
42
	Activate logging messages of DEBUG level of higher only for the
43
	org.gvsig.tools packages.
44
	You can put full classes names or packages instead, to configure
45
	logging for all the classes and subpackages of the package.
46
	-->
47
	<category name="org.gvsig.tools">
48
		<priority value="DEBUG" />
49
	</category>
50
	<category name="org.gvsig.construc">
51
		<priority value="DEBUG" />
52
	</category>
53

  
54
	<!-- 
55
	By default, show only logging messages of INFO level or higher, 
56
	through the previously configured CONSOLE appender. 
57
	-->
58
	<root>
59
		<priority value="INFO" />
60
		<appender-ref ref="CONSOLE" />
61
	</root>
62
</log4j:configuration>
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/test/resources/README.txt
1
====
2
    gvSIG. Desktop Geographic Information System.
3

  
4
    Copyright (C) 2007-2012 gvSIG Association.
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
    For any additional information, do not hesitate to contact us
22
    at info AT gvsig.com, or visit our website www.gvsig.com.
23
====
24

  
25
Put into this folder the resources needed by your classes.
26

  
27
This folder is added to the classpath, so you can load any resources 
28
through the ClassLoader.
29

  
30
By default, in this folder you can find an example of log4j configuration,
31
prepared to log messages through the console, so logging works when you
32
run your classes.
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/PortableViewFileServices.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
package org.gvsig.educa.portableview;
23

  
24
import java.io.File;
25
import java.io.IOException;
26
import java.util.zip.ZipException;
27

  
28
import org.gvsig.fmap.mapcontext.MapContext;
29
import org.gvsig.tools.persistence.exception.PersistenceException;
30

  
31
/**
32
 * Portable View Utilities related to files
33
 *
34
 * @author gvSIG Team
35
 * @version $Id$
36
 *
37
 */
38
/**
39
 * @author gvSIG Team
40
 * @version $Id$
41
 * 
42
 */
43
public interface PortableViewFileServices {
44

  
45
    /**
46
     * <p>
47
     * Unzip a file into a folder
48
     * </p>
49
     * 
50
     * @param zipFile
51
     * @param outputFloder
52
     *            must exists. WARNING: <b>Contents will be removed before
53
     *            unzip</b>
54
     * @throws IOException
55
     * @throws ZipException
56
     * @throws IllegalArgumentException
57
     *             if zipFile is not a file or outputFloder doesn't exists or is
58
     *             read-only
59
     */
60
    void unzipFile(File zipFile, File outputFloder) throws ZipException,
61
        IOException;
62

  
63
    /**
64
     * <p>
65
     * Create a zip file which will contains all contents of a folder
66
     * </p>
67
     * <p>
68
     * Files will be use relative path to <code>rootFolder</code>
69
     * </p>
70
     * 
71
     * @param rootFolder
72
     *            rootFolder (must be an existing folder)
73
     * @param targetFile
74
     *            final file (must not exists)
75
     * @throws IOException
76
     * @throws IllegalArgumentException
77
     *             if there are any problem in parameters
78
     */
79
    void zipFolder(File rootFolder, File targetFile) throws IOException;
80

  
81
    /**
82
     * Informs if <code>folder</code> is a writable folder( exists & isDir &
83
     * canWrite)
84
     * 
85
     * @param folder
86
     * @return
87
     */
88
    boolean isWritableFolder(File folder);
89

  
90
    /**
91
     * Informs if <code>folder</code> is a readable folder( exists & isDir &
92
     * canRead)
93
     * 
94
     * @param folder
95
     * @return
96
     */
97
    boolean isReadableFolder(File folder);
98

  
99
    /**
100
     * Informs if <code>file</code> is a readable file ( exists & isFile &
101
     * canRead)
102
     * 
103
     * @param file
104
     * @return
105
     */
106
    boolean isReadableFile(File file);
107

  
108
    /**
109
     * <p>
110
     * Look for a folder on a <code>baseFolder</code> starts with
111
     * <code>baseName</code> which is writable.
112
     * </p>
113
     * <p>
114
     * The pattern is: <code>baseFolder/baseName.0000</code> where
115
     * <code>000</code> it's a counter.
116
     * </p>
117
     * 
118
     * @param baseFolder
119
     *            existing and writable folder
120
     * @param baseName
121
     *            start of new folder
122
     * @return new folder
123
     * @throws IllegalArgumentException
124
     *             if base folder is not a writable folder
125
     * @throws IllegalStateException
126
     *             if can't found a suitable folder
127
     */
128
    File getWritableFolder(File baseFolder, String baseName);
129

  
130
    /**
131
     * <p>
132
     * Create a new folder on a <code>baseFolder</code> starts with
133
     * <code>baseName</code> which is new and writable.
134
     * </p>
135
     * <p>
136
     * The pattern is: <code>baseFolder/baseName.0000</code> where
137
     * <code>000</code> it's a counter.
138
     * </p>
139
     * 
140
     * @param baseFolder
141
     *            existing and writable folder
142
     * @param baseName
143
     *            start of new folder
144
     * @return new folder
145
     * @throws IllegalArgumentException
146
     *             if base folder is not a writable folder
147
     * @throws IllegalStateException
148
     *             if can't found a suitable folder
149
     */
150
    File getNewWritableFolder(File baseFolder, String baseName);
151

  
152
    /**
153
     * <p>
154
     * Create {@link File} instance for a new file on a <code>baseFolder</code>
155
     * starts with <code>baseName</code>.
156
     * </p>
157
     * <p>
158
     * The pattern is: <code>baseFolder/baseName.0000.ext</code> where
159
     * <code>000</code> it's a counter.
160
     * </p>
161
     * <p>
162
     * This <b>no create</b> the file into the file system.
163
     * </p>
164
     * 
165
     * @param baseFolder
166
     *            existing and writable folder
167
     * @param name
168
     *            start of new file
169
     * @return new folder
170
     * @throws IllegalArgumentException
171
     *             if base folder is not a writable folder
172
     * @throws IllegalStateException
173
     *             if can't found a suitable folder
174
     */
175
    File getNewFileName(File baseFolder, String name);
176

  
177
    /**
178
     * <p>
179
     * Return <code>path</code> as relative from <code>basePath</code> only if
180
     * <code>basePath</code> is an ancestor of <code>path</code>:
181
     * </p>
182
     * 
183
     * @param path
184
     * @param basePath
185
     * @return
186
     * @see FilenameUtils#getRelativeTo(String, String)
187
     */
188
    File getRelativeTo(File path, File basePath);
189

  
190
    /**
191
     * <p>
192
     * Load a mapContext from a file adjusting file paths which are supposed
193
     * relatives to a folder
194
     * </p>
195
     * 
196
     * @param mapContext
197
     *            persistence file
198
     * @param relativaPathFolder
199
     *            for files refered in mapContext
200
     * @return
201
     * @throws IOException
202
     * @throws PersistenceException
203
     */
204
    MapContext loadMapContext(File mapContext, File relativaPathFolder)
205
        throws IOException, PersistenceException;
206
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/PortableViewLocator.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
package org.gvsig.educa.portableview;
23

  
24
import org.gvsig.tools.locator.BaseLocator;
25
import org.gvsig.tools.locator.Locator;
26
import org.gvsig.tools.locator.LocatorException;
27

  
28
/**
29
 * This locator is the entry point for the PortableView library, providing
30
 * access to all PortableView services through the {@link PortableViewManager} .
31
 *
32
 * @author gvSIG team
33
 * @version $Id$
34
 */
35
public class PortableViewLocator extends BaseLocator {
36

  
37
    /**
38
     * PortableView manager name.
39
     */
40
    public static final String MANAGER_NAME = "PortableView.manager";
41

  
42
    /**
43
     * PortableView manager description.
44
     */
45
    public static final String MANAGER_DESCRIPTION = "PortableView Manager";
46

  
47
    /**
48
     * PortableView file services name.
49
     */
50
    public static final String FILESERVICES_NAME = "PortableView.fileservices";
51

  
52
    /**
53
     * PortableView file services manager description.
54
     */
55
    public static final String FILESERVICES_DESCRIPTION =
56
        "PortableView File Servides";
57

  
58
    private static final String LOCATOR_NAME = "PortableView.locator";
59

  
60
    /**
61
     * Unique instance.
62
     */
63
    private static final PortableViewLocator INSTANCE = new PortableViewLocator();
64

  
65
    /**
66
     * Return the singleton instance.
67
     *
68
     * @return the singleton instance
69
     */
70
    public static PortableViewLocator getInstance() {
71
        return INSTANCE;
72
    }
73

  
74
    /**
75
     * Return the Locator's name.
76
     *
77
     * @return a String with the Locator's name
78
     */
79
    @Override
80
    public final String getLocatorName() {
81
        return LOCATOR_NAME;
82
    }
83

  
84
    /**
85
     * Return a reference to the PortableViewManager.
86
     *
87
     * @return a reference to the PortableViewManager
88
     * @throws LocatorException
89
     *             if there is no access to the class or the class cannot be
90
     *             instantiated
91
     * @see Locator#get(String)
92
     */
93
    public static PortableViewManager getManager() throws LocatorException {
94
        return (PortableViewManager) getInstance().get(MANAGER_NAME);
95
    }
96

  
97
    /**
98
     * Registers the Class implementing the PortableViewManager interface.
99
     *
100
     * @param clazz
101
     *            implementing the PortableViewManager interface
102
     */
103
    public static void registerManager(Class<? extends PortableViewManager> clazz) {
104
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
105
    }
106

  
107
    /**
108
     * Return a reference to the PortableViewFileServices.
109
     *
110
     * @return a reference to the PortableViewFileServices
111
     * @throws LocatorException
112
     *             if there is no access to the class or the class cannot be
113
     *             instantiated
114
     * @see Locator#get(String)
115
     */
116
    public static PortableViewFileServices getFileServices()
117
        throws LocatorException {
118
        return (PortableViewFileServices) getInstance().get(FILESERVICES_NAME);
119
    }
120

  
121
    /**
122
     * Registers the Class implementing the PortableViewFileServices interface.
123
     *
124
     * @param clazz
125
     *            implementing the PortableViewFileServices interface
126
     */
127
    public static void registerFileServices(
128
        Class<? extends PortableViewFileServices> clazz) {
129
        getInstance().register(FILESERVICES_NAME, FILESERVICES_DESCRIPTION,
130
            clazz);
131
    }
132

  
133
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/PortableViewLibrary.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
package org.gvsig.educa.portableview;
23

  
24
import org.gvsig.fmap.dal.DALLibrary;
25
import org.gvsig.fmap.mapcontext.MapContextLibrary;
26
import org.gvsig.tools.library.AbstractLibrary;
27
import org.gvsig.tools.library.LibraryException;
28
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
29

  
30
/**
31
 * Library for API initialization and configuration.
32
 *
33
 * @author gvSIG team
34
 * @version $Id$
35
 */
36
public class PortableViewLibrary extends AbstractLibrary {
37

  
38
    @Override
39
    public void doRegistration() {
40
        registerAsAPI(PortableViewLibrary.class);
41
        require(DALLibrary.class);
42
        require(MapContextLibrary.class);
43

  
44
    }
45

  
46
    @Override
47
    protected void doInitialize() throws LibraryException {
48
        // Do nothing
49
    }
50

  
51
    @Override
52
    protected void doPostInitialize() throws LibraryException {
53
        // Validate there is any implementation registered.
54
        PortableViewManager manager = PortableViewLocator.getManager();
55
        if (manager == null) {
56
            throw new ReferenceNotRegisteredException(
57
                PortableViewLocator.MANAGER_NAME,
58
                PortableViewLocator.getInstance());
59
        }
60
    }
61

  
62
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/map/InvalidPortableViewFormatException.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
package org.gvsig.educa.portableview.map;
23

  
24
import java.io.File;
25

  
26
import org.gvsig.educa.portableview.PortableViewException;
27

  
28
/**
29
 * Exception Throws when try to open a PortableView file with invalid format
30
 *
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class InvalidPortableViewFormatException extends PortableViewException {
36

  
37
    /**
38
     *
39
     */
40
    private static final long serialVersionUID = 8895685032043751029L;
41

  
42
    private static final String MESSAGE =
43
        "Invalid format of a PortableView file [%(filePath)]: %(info)";
44

  
45
    private static final String KEY = "_InvalidPortableViewFormatException";
46

  
47
    /**
48
     * Invalid format of a portable view file by unspecified problem
49
     *
50
     * @param mapFile
51
     */
52
    public InvalidPortableViewFormatException(File mapFile) {
53
        this(mapFile, "unspecified problem");
54
    }
55

  
56
    /**
57
     * Invalid format of a portable view file
58
     *
59
     * @param mapFile
60
     * @param message
61
     *            problem description
62
     */
63
    public InvalidPortableViewFormatException(File mapFile, String message) {
64
        super(MESSAGE, KEY, serialVersionUID);
65
        setValue("info", message);
66
        setValue("filePath", mapFile.getAbsolutePath());
67
    }
68

  
69
    /**
70
     * Invalid format of a portable view file
71
     *
72
     * @param mapFile
73
     * @param message
74
     *            problem description
75
     * @param cause
76
     */
77
    public InvalidPortableViewFormatException(File mapFile, String message,
78
        Throwable cause) {
79
        super(MESSAGE, cause, KEY, serialVersionUID);
80
        setValue("info", message);
81
        setValue("filePath", mapFile.getAbsolutePath());
82
    }
83

  
84
    /**
85
     * Invalid format of a portable view file
86
     *
87
     * @param mapFile
88
     */
89
    public InvalidPortableViewFormatException(File mapFile, Throwable cause) {
90
        this(mapFile, "initializing problem", cause);
91
    }
92

  
93
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/map/PortableView.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
package org.gvsig.educa.portableview.map;
23

  
24
import java.io.IOException;
25

  
26
import org.gvsig.educa.portableview.PortableViewManager;
27
import org.gvsig.fmap.mapcontext.MapContext;
28
import org.gvsig.tools.dispose.Disposable;
29

  
30
/**
31
 * <i>Portable View</i> instance.
32
 * </p>
33
 * This class' instances contains information about a installed <i>Portable
34
 * View</i>
35
 *
36
 * @author <a href="http://www.disid.com">DiSiD Technologies S.L.</a>
37
 * @version $Rev$
38
 * @since {version}
39
 */
40
public interface PortableView extends Disposable {
41

  
42
    /**
43
     * Gets information about this <i>Portable View</i>
44
     *
45
     * @return
46
     */
47
    PortableViewInformation getInformation();
48

  
49
    /**
50
     * Opens this <i>Portable View</i>
51
     * </p>
52
     * This unzip <i>Portable View</i> contents into temporal folder (if it isn't
53
     * created yet)
54
     * and prepares data
55
     * </p>
56
     * unzip folder is defined in {@link PortableViewManager#getTemporalFolder()}
57
     * </p>
58
     *
59
     * @throws InvalidPortableViewFormatException
60
     * @throws CantLoadContextException
61
     * @throws IOException
62
     */
63
    void open() throws InvalidPortableViewFormatException,
64
        CantLoadContextException, IOException;
65

  
66
    /**
67
     * Informs if <i>Portable View</i> it's already opened or not
68
     *
69
     * @return if it's opened
70
     */
71
    boolean isOpen();
72

  
73
    /**
74
     * Unloads all data loaded in memory and cleans its temporal folder
75
     *
76
     * @throws IOException
77
     *             if any problem is found cleaning temporal folder
78
     *
79
     */
80
    void close() throws IOException;
81

  
82
    /**
83
     * Gets MapContext with <i>Portable View</i> representation
84
     *
85
     * @return MapContext instance
86
     * @throws IllegalStateException
87
     *             if {@link #isOpen()} == false
88
     */
89
    MapContext getMapContext();
90

  
91
    /**
92
     * Gets the file which PortableView data
93
     *
94
     * @return
95
     */
96
    String getSourceFilePath();
97

  
98
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/map/CantLoadContextException.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
package org.gvsig.educa.portableview.map;
23

  
24
import java.io.File;
25

  
26
import org.gvsig.educa.portableview.PortableViewException;
27

  
28
/**
29
 * Exception Throws when try to load the MapContext of a PortableView file
30
 *
31
 * @author gvSIG Team
32
 * @version $Id$
33
 *
34
 */
35
public class CantLoadContextException extends PortableViewException {
36

  
37
    /**
38
     *
39
     */
40
    private static final long serialVersionUID = -6565034273641780414L;
41

  
42
    private static final String MESSAGE =
43
        "Problem loading MapContext file [%(mapContextPath)] of a PortableView file [%(mapPath)]: %(info)";
44

  
45
    private static final String KEY = "_CantLoadContextException";
46

  
47
    /**
48
     * Cannot load mapContext from a Portable view file
49
     *
50
     * @param mapFile
51
     * @param mapContextFile
52
     * @param message
53
     *            problem description
54
     * @param cause
55
     */
56
    public CantLoadContextException(File mapFile, File mapContextFile,
57
        String message, Throwable cause) {
58
        super(MESSAGE, cause, KEY, serialVersionUID);
59
        setValue("info", message);
60
        setValue("mapPath", mapFile.getAbsolutePath());
61
        setValue("mapContextPath", mapContextFile.getAbsolutePath());
62
    }
63

  
64
    /**
65
     * Cannot load mapContext from a Portable view file
66
     *
67
     * @param mapFile
68
     * @param mapContextFile
69
     * @param cause
70
     */
71
    public CantLoadContextException(File mapFile, File mapContextFile,
72
        Throwable cause) {
73
        this(mapFile, mapContextFile, "loading problem", cause);
74
    }
75

  
76
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/map/InvalidInstalledPortableViewException.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
package org.gvsig.educa.portableview.map;
23

  
24
import java.io.File;
25

  
26
import org.gvsig.educa.portableview.PortableViewException;
27

  
28
/**
29
 * Exception Throws when try to open an installed PortableView folder with
30
 * invalid format (missing package.info file or no match data)
31
 *
32
 * @author gvSIG Team
33
 * @version $Id$
34
 *
35
 */
36
public class InvalidInstalledPortableViewException extends PortableViewException {
37

  
38
    /**
39
     *
40
     */
41
    private static final long serialVersionUID = 1L;
42

  
43
    private static final String MESSAGE =
44
        "Invalid format of an installed PortableView [%(folderPath)]: %(info)";
45

  
46
    private static final String KEY = "_InvalidInstalledPortableViewException";
47

  
48
    /**
49
     * Invalid format of an installed portable view folder by unspecified problem
50
     *
51
     * @param mapFile
52
     */
53
    public InvalidInstalledPortableViewException(File mapFolder) {
54
        this(mapFolder, "unspecified problem");
55
    }
56

  
57
    /**
58
     * Invalid format of a portable view file
59
     *
60
     * @param mapFile
61
     * @param message
62
     *            problem description
63
     */
64
    public InvalidInstalledPortableViewException(File mapFolder, String message) {
65
        super(MESSAGE, KEY, serialVersionUID);
66
        setValue("info", message);
67
        setValue("folderPath", mapFolder.getAbsolutePath());
68
    }
69

  
70
    /**
71
     * Invalid format of a portable view file
72
     *
73
     * @param mapFile
74
     * @param message
75
     *            problem description
76
     * @param cause
77
     */
78
    public InvalidInstalledPortableViewException(File mapFolder, String message,
79
        Throwable cause) {
80
        super(MESSAGE, cause, KEY, serialVersionUID);
81
        setValue("info", message);
82
        setValue("folderPath", mapFolder.getAbsolutePath());
83
    }
84

  
85
    /**
86
     * Invalid format of a portable view file
87
     *
88
     * @param mapFile
89
     */
90
    public InvalidInstalledPortableViewException(File mapFile, Throwable cause) {
91
        this(mapFile, "initializing problem", cause);
92
    }
93

  
94
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/map/PortableViewInformation.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
package org.gvsig.educa.portableview.map;
23

  
24
import java.util.Date;
25

  
26
import org.cresques.cts.IProjection;
27
import org.omg.CORBA.DynValue;
28

  
29
import org.gvsig.fmap.geom.primitive.Envelope;
30
import org.gvsig.tools.dynobject.DynObject;
31
import org.gvsig.tools.dynobject.DynStruct;
32

  
33
/**
34
 * Information about a <i>Portable View</i>:
35
 * <ul>
36
 * <li>Name and description</li>
37
 * <li>Author</li>
38
 * <li>License</li>
39
 * </ul>
40
 *
41
 * TODO Add more data
42
 *
43
 * @author <a href="http://www.disid.com">DiSiD Technologies S.L.</a>
44
 * @version $Rev$
45
 * @since {version}
46
 */
47
public interface PortableViewInformation {
48

  
49
    public static final String DYN_DEFINITION_NAME = "PortableViewInformation";
50

  
51
    /**
52
     * Gets <i>Portable View</i> identifier
53
     *
54
     * @return
55
     */
56
    String getId();
57

  
58
    /**
59
     * Gets <i>Portable View</i> name
60
     *
61
     * @return
62
     */
63
    String getName();
64

  
65
    /**
66
     * Gets <i>Portable View</i> description
67
     *
68
     * @return
69
     */
70
    String getDescription();
71

  
72
    /**
73
     * Gets <i>Portable View</i> version
74
     *
75
     * @return
76
     */
77
    int getVersion();
78

  
79
    /**
80
     * Gets <i>Portable View</i> build number
81
     *
82
     * @return
83
     */
84
    int getBuildNumber();
85

  
86
    /**
87
     * Gets <i>Portable View</i> creation timestamp
88
     *
89
     * @return
90
     */
91
    Date getCreationTimestamp();
92

  
93
    /**
94
     * Gets full envelope
95
     *
96
     * @return
97
     */
98
    Envelope getFullEnvelope();
99

  
100
    /**
101
     * Returns CRS
102
     *
103
     * @return
104
     */
105
    IProjection getCRS();
106

  
107
    /**
108
     * Returns {@link DynValue} definition
109
     *
110
     * @return
111
     */
112
    DynStruct getDynDefinition();
113

  
114
    /**
115
     * Returns {@link DynObject} description
116
     *
117
     * @return
118
     */
119
    DynObject getDynObject();
120
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.91/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/PortableViewManager.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
package org.gvsig.educa.portableview;
23

  
24
import java.io.File;
25
import java.io.IOException;
26
import java.util.List;
27

  
28
import org.gvsig.educa.portableview.compilation.PortableViewCompilation;
29
import org.gvsig.educa.portableview.compilation.PortableViewCompiler;
30
import org.gvsig.educa.portableview.map.CantLoadContextException;
31
import org.gvsig.educa.portableview.map.InvalidPortableViewFormatException;
32
import org.gvsig.educa.portableview.map.PortableView;
33
import org.gvsig.educa.portableview.map.PortableViewInformation;
34
import org.gvsig.tools.dispose.Disposable;
35

  
36
/**
37
 * Library Manager.
38
 * </p>
39
 * Expose main library's functionalities:
40
 * <ul>
41
 * <li>Set default folders configuration</li>
42
 * <li>Get installed <i>Portable View</i></li>
43
 * <li>Identify and get a <i>Portable View</i> from a file</li>
44
 * <li>Create a new {@link PortableViewCompilation} instance</li>
45
 * <li>Create a new {@link PortableViewCompiler} instance</li>
46
 * </ul>
47
 *
48
 * @author gvSIG team
49
 * @version $Id$
50
 */
51
public interface PortableViewManager extends Disposable {
52

  
53
    public static final String  INSTALLER_PROVIDER_NAME = "PortableView";
54
            
55
    /**
56
     * Gets default folder to locate installed <i>Portable View</i>
57
     *
58
     * @return default installation folder
59
     */
60
    String getInstallationMapFolder();
61

  
62
    /**
63
     * Sets default folder to locate installed <i>Portable View</i>
64
     *
65
     * @param folder
66
     * @throws IllegalArgumentException
67
     *             if <code>folder</code> is a file or can't read or not exists
68
     */
69
    void setInstallationMapFolder(String folder);
70

  
71
    /**
72
     * Gets the folder to use to <i>open</i> any <i>Portable
73
     * View</i> before access to the information contained in it.
74
     *
75
     * @return temporal folder
76
     */
77
    String getTemporalFolder();
78

  
79
    /**
80
     * Sets the folder to use to <i>open</i> any <i>Portable View</i>
81
     *
82
     * @param folder
83
     * @throws IllegalArgumentException
84
     *             if <code>folder</code> is a file or can't write
85
     */
86
    void setTemporalFolder(String folder);
87

  
88
    /**
89
     * Clear all data in temporal folder
90
     */
91
    void cleanAllTemporalData();
92

  
93
    /**
94
     * Returns all <i>Portable View</i> installed
95
     * </p>
96
     * Uses installation folder to locate them
97
     *
98
     * @return All <i>Portable View></i> installed
99
     */
100
    List<PortableView> getInstalledMaps();
101

  
102
    /**
103
     * Returns all <i>Portable View</i> installed into the specified folder
104
     * </p>
105
     * Uses installation folder to locate them
106
     *
107
     * @param folder
108
     *            to analyze
109
     * @return All <i>Portable View></i> installed
110
     * @throws IllegalArgumentException
111
     *             if folder is not valid (a readable folder)
112
     */
113
    List<PortableView> getInstalledMaps(String folder);
114

  
115
    /**
116
     * Gets a {@link PortableView} from a file
117
     * </p>
118
     *
119
     * @param file
120
     * @return the <i>Portable View</i>
121
     * @throws InvalidPortableViewFormatException
122
     */
123
    PortableView getMapFromFile(File file)
124
        throws InvalidPortableViewFormatException;
125

  
126
    /**
127
     * Gets a {@link PortableView} from intalledMaps
128
     * by its id
129
     * </p>
130
     *
131
     * @param mapid
132
     *            PortableView id
133
     * @return the <i>Portable View</i>
134
     */
135
    PortableView getMapById(String mapId);
136

  
137
    /**
138
     * Informs if a file is a valid <i>Portable View</i> file
139
     *
140
     * @param file
141
     * @return
142
     */
143
    boolean isMap(File file);
144

  
145
    /**
146
     * Informs if a folder is a valid <i>Portable View</i> installed folder
147
     *
148
     * @param file
149
     * @return
150
     */
151
    boolean isAPortableViewIntalledFolder(File folder);
152

  
153
    /**
154
     * Creates a new instance of a {@link PortableViewCompilation}
155
     *
156
     * @return
157
     */
158
    PortableViewCompilation createCompilationInstance();
159

  
160
    /**
161
     * Creates a new instance of a {@link PortableViewCompilation} based on
162
     * values <code>map</code>
163
     *
164
     * @param map
165
     *            to use as template
166
     * @return
167
     * @throws IOException
168
     * @throws CantLoadContextException
169
     * @throws InvalidPortableViewFormatException
170
     */
171
    PortableViewCompilation createCompilationInstanceFromMap(PortableView map)
172
        throws InvalidPortableViewFormatException, CantLoadContextException,
173
        IOException;
174

  
175
    /**
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff