Revision 578

View differences:

org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.58/README.txt
1
===============
2
gvSIG Educa
3
===============
4

  
5
---------------------
6
Portable View
7
---------------------
8

  
9
Description
10
==============
11

  
12
This folder contains the sources of the Portable View functionality.
13

  
14
Requirements
15
==============
16

  
17
* Maven 2.6 or higher
18

  
19
* Java JDK 1.5 or higher
20

  
21
For eclipse
22
-------------
23

  
24
See `developer guide at gvSIG.org <http://www.gvsig.org/plone/projects/gvsig-desktop/docs/devel/gvsig-devel-guide/2-1-0/introduccion>`_ and the file ``REAME-ECLIPSE.txt``
25

  
26

  
27
Contents
28
==========
29

  
30
org.gvsig.educa.portableview.lib
31
---------------------------------
32

  
33
Functionality sources. This project just contain the main process and the logic without any dependency with User Interface.
34

  
35
org.gvsig.educa.portableview.swing
36
-------------------------------------
37

  
38
User Interface components to access a manage the application services.
39

  
40
org.gvsig.educa.portableview.main
41
-----------------------------------
42

  
43
Little test application which allow run the main functionality of application.
44

  
45
See `Execute little test application`_ to know how run it.
46

  
47
pom.xml
48
---------
49

  
50
Maven project definition file
51

  
52
README.rst
53
--------------
54

  
55
This file (in reStructureText format, for more info this format look at `gvSIG portal <https://gvsig.org/web/projects/gvsig-desktop/docs/devel/guia-para-documentar/el-formato-restructuredtext>`_  or at `docUtils reference <http://docutils.sourceforge.net/rst.html>`_)
56

  
57

  
58
Compilation
59
================
60

  
61
From shell
62
------------
63

  
64
Execute this command::
65

  
66
    org.gvsig.educa.portableview$ mvn clean install
67

  
68

  
69
From eclipse
70
--------------
71

  
72
See `work in a proyect of the developer guide at gvSIG.org <https://gvsig.org/web/projects/gvsig-desktop/docs/devel/gvsig-devel-guide/2.0.0/trabajar-con-un-proyecto>`_
73

  
74
In some project, could be better use ``mvn eclipse:clean eclipse:eclipse``  than import project as a *Maven project*. Maven plugin of eclipse does not set classpath correctly in some project.
75

  
76

  
77
Packing
78
========
79

  
80
This functionality has no stand-alone packing process.
81

  
82
Version
83
---------------
84

  
85
To changes version number just set in in ``project/version`` tag of *pom.xml* in this folder. Sub-projects will inherit it.
86

  
87
Version polity is the standard in project. Changes in version number:
88

  
89
* third number: Bug fixes and minors improvements. API must have no changes from previous version.
90
* second number: Bug fixes and mayor improvements. API can have minor changes. Previously deprecated classes could be removed. No architectural changes.
91
* first number: Mayor changes.
92

  
93
Create a tag
94
------------------
95

  
96
TODO: use *maven release* plugin
97

  
98
Use svn copy command to copy version in server. Process could be like this:
99

  
100

  
101
#. Check that there ins no changes in workspace::
102

  
103
   svn up ; svn status
104

  
105
#. Check that project compiles and passes all test.
106

  
107
   mvn clean install
108

  
109
#. Update *pom.xml* to set version of tag (usually removing *-SNAPSHOT*)
110
#. create tag folder on server::
111

  
112
   svn mkdir -m "Create {version} tag folder" https://devel.gvsig.org/svn/gvsig-educa/org.gvsig.educa.portablewview/tags/{version}
113

  
114
#. Copy current workcopy to tag folder::
115

  
116
   svn copy -m "Create {version} tag" * https://devel.gvsig.org/svn/gvsig-educa/org.gvsig.educa.portablewview/tags/{version}
117

  
118
#. Update *pom.xml* to next version
119
#. Commit *pom.xml* changes::
120

  
121
   svn commit -m "Set new version {version}-SNAPSHOT" pom.xml
122

  
123

  
124
i18n
125
======
126

  
127
The files for internationalization can be found in this folders:
128

  
129
+ *org.gvsig.educa.portablewview.app.viewer/src/main/resources-plugin*
130
+ *org.gvsig.educa.portablewview.app.editor/src/main/resources-plugin*
131

  
132
The internationalization of this application is based on standard java resource bundle mechanism. So, to add a new language just add the file with the language code to every related folder.
133

  
134
Execute little test application
135
=================================
136

  
137
From shell
138
------------
139

  
140
After compile the application, execute this command::
141

  
142
    org.gvsig.educa.portablewview$ cd org.gvsig.educa.thematicmap.main
143
    org.gvsig.educa.portablewview/org.gvsig.educa.portablewview.main$ mvn exec:java
144

  
145
Form eclipse
146
------------------
147

  
148
Select ``org.gvsig.educa.portableview.main`` project in *Project tree* using *Java perspective*, click with right mouse button and select ``Run as.../Java application``. Select ``Main`` class for project.
149

  
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.58/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.58/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.58/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.educa.portableview.PortableViewLibrary
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.58/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.58/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.58/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.58/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.58/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.58/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.58/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
    /**
176
     * Create a new instance of a {@link PortableViewCompiler}
177
     *
178
     * @return
179
     */
180
    PortableViewCompiler createCompilerInstance();
181

  
182
    /**
183
     * Generates the base name for a PortableView file using its info data
184
     *
185
     * @param info
186
     * @return
187
     */
188
    String getBaseFileNameFromInfo(PortableViewInformation info);
189

  
190
    /**
191
     * Generates the base name for a PortableView file
192
     *
193
     * @param info
194
     * @return
195
     */
196
    String getBaseFileNameFromInfo(String id, String name, int version,
197
        int buildNumber);
198

  
199
    /**
200
     * Create a gvSIG package file (gvspkg) from a portableView
201
     *
202
     * @param mapId
203
     *            id of map to export
204
     * @param targetFolder
205
     *            where write package file
206
     * @return
207
     * @throws PortableViewException
208
     * @throws IOException
209
     */
210
    File generatePackageFile(String mapId, File targetFolder)
211
        throws PortableViewException, IOException;
212

  
213
    /**
214
     * Create a gvSIG package file (gvspkg) from a portableView installed folder
215
     *
216
     * @param portableViewIntallFolder
217
     *            folder of a installed PortableView
218
     * @param targetFolder
219
     *            where write package file
220
     * @return
221
     * @throws PortableViewException
222
     * @throws IOException
223
     */
224
    File generatePackageFile(File portableViewIntallFolder, File targetFolder)
225
        throws PortableViewException, IOException;
226

  
227
    /**
228
     * Returns the translation of a string.
229
     *
230
     * @param key
231
     *            String to translate
232
     * @return a String with the translation of the string passed by parameter
233
     */
234
    public String getTranslation(String key);
235
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.58/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/compilation/CompilationException.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.compilation;
23

  
24
import org.gvsig.educa.portableview.PortableViewException;
25

  
26
/**
27
 * Exception Throws in a PortableView compilation process
28
 *
29
 * @author gvSIG Team
30
 * @version $Id$
31
 *
32
 */
33
public class CompilationException extends PortableViewException {
34

  
35
    /**
36
     *
37
     */
38
    private static final long serialVersionUID = -1052257268555865780L;
39

  
40
    private static final String MESSAGE =
41
        "Problem found compiling Portable view [%(portableViewId)]: %(info)";
42

  
43
    private static final String KEY = "_CompilationException";
44

  
45
    /**
46
     * Invalid format of a portable view file
47
     *
48
     * @param mapFile
49
     * @param mapContextFile
50
     * @param message
51
     *            problem description
52
     * @param cause
53
     */
54
    public CompilationException(String portableViewId, String message,
55
        Throwable cause) {
56
        super(MESSAGE, cause, KEY, serialVersionUID);
57
        setValue("info", message);
58
        setValue("portableViewId", portableViewId);
59
    }
60

  
61
    /**
62
     * Invalid format of a portable view file
63
     *
64
     * @param mapFile
65
     * @param mapContextFile
66
     * @param cause
67
     */
68
    public CompilationException(String portableViewId, Throwable cause) {
69
        this(portableViewId, "compilation problem", cause);
70
    }
71

  
72
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.58/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/compilation/CompilationValidationMessage.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.compilation;
23

  
24
/**
25
 * @author gvSIG Team
26
 * @version $Id$
27
 * 
28
 */
29
public interface CompilationValidationMessage {
30

  
31
    public enum Type {
32
        MESSAGE, WARNING, ERROR
33
    };
34

  
35
    Type getType();
36

  
37
    String getMessage();
38

  
39
    String getSource();
40

  
41
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.58/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/compilation/PortableViewCompiler.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.compilation;
23

  
24
/**
25
 * Process to generate a file which will contains a <i>Portable View</i>
26
 *
27
 * @author <a href="http://www.disid.com">DiSiD Technologies S.L.</a>
28
 * @version $Id$
29
 */
30
public interface PortableViewCompiler {
31

  
32
    /**
33
     * Gets temporal folder used by the process to prepare file
34
     *
35
     * @return
36
     */
37
    String getWorkFolder();
38

  
39
    /**
40
     * Sets temporal folder used by the process to prepare file
41
     *
42
     * @param folder
43
     * @throws IllegalArgumentException
44
     *             if folder not exists or is not writable
45
     */
46
    void setWorkFolder(String folder);
47

  
48
    /**
49
     * Gets folder used to deploy generated file
50
     *
51
     * @return
52
     */
53
    String getTargetFolder();
54

  
55
    /**
56
     * Sets folder where deploy generated file
57
     *
58
     * @throws IllegalArgumentException
59
     *             if folder not exists or is not writable
60
     */
61
    void setTargetFolder(String folder);
62

  
63
    /**
64
     * Set the process listener
65
     *
66
     * @param listener
67
     */
68
    void setCompilerListener(PortableViewCompilerListener listener);
69

  
70
    /**
71
     * <p>
72
     * Process compilation to generate a <i>Portable View</i>
73
     * </p>
74
     * <p>
75
     * <code>compilation</code> data will be update at the end of process if
76
     * it's success (build number, creation stamp).
77
     * </p>
78
     *
79
     * @param compilation
80
     * @return
81
     * @throws IllegalArgumentException
82
     *             if targetFolder or workFolder are not set
83
     */
84
    PortableViewCompilerStatus compile(PortableViewCompilation compilation);
85

  
86
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.58/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/compilation/PortableViewCompilation.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.compilation;
23

  
24
import java.util.List;
25

  
26
import org.gvsig.fmap.mapcontext.MapContext;
27

  
28
/**
29
 * Interface for classes which contain all information needed to
30
 * generate a new Portable View file
31
 *
32
 * @author gvSIG Team
33
 * @version $Id$
34
 */
35
public interface PortableViewCompilation {
36

  
37
    /**
38
     * <p>
39
     * Gets object which contain PortableView information
40
     * </p>
41
     * <p>
42
     * Fill this object with the values of the information to target map
43
     * </p>
44
     *
45
     * @return
46
     */
47
    PortableViewCompilationInformation getInformation();
48

  
49
    /**
50
     * Gets current map context
51
     *
52
     * @return
53
     */
54
    MapContext getMapContext();
55

  
56
    /**
57
     * Sets map context for PortableView
58
     *
59
     * @param mapContext
60
     */
61
    void setMapContext(MapContext mapContext);
62

  
63
    /**
64
     * Validates compilation
65
     *
66
     * @param messages
67
     *            <i>output parameter</i> which will fill with validation
68
     *            messages
69
     * @return true is valid or false if any problems found (see
70
     *         <code>messages</code> parameter to get why)
71
     */
72
    boolean isValid(List<CompilationValidationMessage> messages);
73

  
74
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.58/org.gvsig.educa.portableview.lib/org.gvsig.educa.portableview.lib.api/src/main/java/org/gvsig/educa/portableview/compilation/PortableViewCompilerStatus.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.compilation;
23

  
24
import java.io.File;
25

  
26
import org.gvsig.tools.task.TaskStatus;
27

  
28
/**
29
 * Status of a Compiler process
30
 *
31
 * @author <a href="http://www.disid.com">DiSiD Technologies S.L.</a>
32
 * @version $Id$
33
 */
34
public interface PortableViewCompilerStatus extends TaskStatus {
35

  
36
    /**
37
     * Available status of a {@link PortableViewCompilerStatus}
38
     *
39
     * @author <a href="http://www.disid.com">DiSiD Technologies S.L.</a>
40
     * @version $Rev$
41
     * @since {version}
42
     */
43
    enum Status {
44
        preparing, processing, canceled, finished_ok, finished_fail, finished_error
45
    };
46

  
47
    /**
48
     * Gets current status
49
     *
50
     * @return
51
     */
52
    Status getStatus();
53

  
54
    /**
55
     * Current step
56
     *
57
     * @return
58
     */
59
    int getCurrentStep();
60

  
61
    /**
62
     * Total steps
63
     *
64
     * @return
65
     */
66
    int getTotalSteps();
67

  
68
    /**
69
     * Current step i18n description key
70
     *
71
     * @return
72
     */
73
    String getCurrentStepKey();
74

  
75
    /**
76
     * Gets message from current step
77
     */
78
    String getCurrentStepMessage();
79

  
80
    /**
81
     * Gets generated file (if {@link Status#finished_ok} )
82
     *
83
     * @return
84
     */
85
    File getGeneratedPortableViewFile();
86

  
87
    /**
88
     * Gets generated folder of installed portableView for gvSIG installer
89
     * integration (if {@link Status#finished_ok} )
90
     *
91
     * @return
92
     */
93
    File getGeneratedInstalationPortableViewFolder();
94

  
95
    /**
96
     * Gets message (if {@link Status#finished_fail} or
97
     * {@link Status#finished_error})
98
     *
99
     * @return
100
     */
101
    String getFailMessage();
102

  
103
    /**
104
     * Gets exception if any (if {@link Status#finished_error})
105
     *
106
     * @return
107
     */
108
    Throwable getException();
109

  
110
    /**
111
     * Gets result compilation (if {@link Status#finished_ok}) modified by the
112
     * process (updated buildNumber, creation timestamp, etc...)
113
     *
114
     * @return
115
     */
116
    PortableViewCompilation getResultCompilation();
117

  
118
}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff