Revision 187
org.gvsig.xmlpull/library/trunk/org.gvsig.xmlpull/org.gvsig.xmlpull.lib/org.gvsig.xmlpull.lib.spi/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
|
|
3 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
4 |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 |
|
5 |
http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
6 |
<modelVersion>4.0.0</modelVersion> |
|
7 |
<groupId>org.gvsig</groupId> |
|
8 |
<artifactId>org.gvsig.xml.lib.spi</artifactId> |
|
9 |
<packaging>jar</packaging> |
|
10 |
<name>org.gvsig.xml.lib.spi</name> |
|
11 |
<description>XML library SPI</description> |
|
12 |
<parent> |
|
13 |
<groupId>org.gvsig</groupId> |
|
14 |
<artifactId>org.gvsig.xml.lib</artifactId> |
|
15 |
<version>2.0-SNAPSHOT</version> |
|
16 |
</parent> |
|
17 |
<dependencies> |
|
18 |
<dependency> |
|
19 |
<groupId>org.gvsig</groupId> |
|
20 |
<artifactId>org.gvsig.tools</artifactId> |
|
21 |
</dependency> |
|
22 |
<dependency> |
|
23 |
<groupId>org.gvsig</groupId> |
|
24 |
<artifactId>org.gvsig.xml.lib.api</artifactId> |
|
25 |
</dependency> |
|
26 |
</dependencies> |
|
27 |
<build> |
|
28 |
<plugins> |
|
29 |
<plugin> |
|
30 |
<groupId>org.apache.maven.plugins</groupId> |
|
31 |
<artifactId>maven-compiler-plugin</artifactId> |
|
32 |
<configuration> |
|
33 |
<source>1.4</source> |
|
34 |
<target>1.4</target> |
|
35 |
</configuration> |
|
36 |
</plugin> |
|
37 |
</plugins> |
|
38 |
</build> |
|
39 |
</project> |
|
0 | 40 |
org.gvsig.xmlpull/library/trunk/org.gvsig.xmlpull/org.gvsig.xmlpull.lib/org.gvsig.xmlpull.lib.spi/src/main/java/org/gvsig/xml/lib/spi/XMLProviderLocator.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 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.xml.lib.spi; |
|
29 |
|
|
30 |
import org.gvsig.tools.locator.AbstractLocator; |
|
31 |
import org.gvsig.tools.locator.Locator; |
|
32 |
import org.gvsig.tools.locator.LocatorException; |
|
33 |
import org.gvsig.xml.lib.api.XMLLocator; |
|
34 |
|
|
35 |
/** |
|
36 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
37 |
*/ |
|
38 |
public class XMLProviderLocator extends AbstractLocator { |
|
39 |
private static final String LOCATOR_NAME = "XMLProviderLocator"; |
|
40 |
|
|
41 |
/** |
|
42 |
* Unique instance. |
|
43 |
*/ |
|
44 |
private static final XMLProviderLocator instance = new XMLProviderLocator(); |
|
45 |
|
|
46 |
/* (non-Javadoc) |
|
47 |
* @see org.gvsig.tools.locator.Locator#getLocatorName() |
|
48 |
*/ |
|
49 |
public String getLocatorName() { |
|
50 |
return LOCATOR_NAME; |
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* Return a reference to {@link XMLProviderManager}. |
|
55 |
* |
|
56 |
* @return a reference to XMLProviderManager |
|
57 |
* @throws LocatorException |
|
58 |
* if there is no access to the class or the class cannot be |
|
59 |
* instantiated |
|
60 |
* @see Locator#get(String) |
|
61 |
*/ |
|
62 |
public static XMLProviderManager getXMLProviderManager() throws LocatorException { |
|
63 |
return (XMLProviderManager) getInstance().get(XMLLocator.XML_MANAGER_NAME); |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* Return the singleton instance. |
|
68 |
* |
|
69 |
* @return the singleton instance |
|
70 |
*/ |
|
71 |
public static XMLProviderLocator getInstance() { |
|
72 |
return instance; |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* Registers the Class implementing the {@link XMLProviderManager} interface. |
|
77 |
* |
|
78 |
* @param clazz |
|
79 |
* implementing the XMLProviderManager interface |
|
80 |
*/ |
|
81 |
public static void registerXMLProviderManager(Class clazz) { |
|
82 |
getInstance().register(XMLLocator.XML_MANAGER_NAME, |
|
83 |
"", |
|
84 |
clazz); |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
88 |
|
|
89 |
|
|
0 | 90 |
org.gvsig.xmlpull/library/trunk/org.gvsig.xmlpull/org.gvsig.xmlpull.lib/org.gvsig.xmlpull.lib.spi/src/main/java/org/gvsig/xml/lib/spi/XMLProviderLibrary.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 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.xml.lib.spi; |
|
29 |
|
|
30 |
import org.gvsig.tools.library.AbstractLibrary; |
|
31 |
import org.gvsig.tools.library.LibraryException; |
|
32 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
|
33 |
import org.gvsig.xml.lib.api.XMLLocator; |
|
34 |
|
|
35 |
/** |
|
36 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
37 |
*/ |
|
38 |
public class XMLProviderLibrary extends AbstractLibrary { |
|
39 |
|
|
40 |
protected void doInitialize() throws LibraryException { |
|
41 |
} |
|
42 |
|
|
43 |
protected void doPostInitialize() throws LibraryException { |
|
44 |
// Validate there is any implementation registered. |
|
45 |
XMLProviderManager xmlManager = XMLProviderLocator.getXMLProviderManager(); |
|
46 |
if (xmlManager == null) { |
|
47 |
throw new ReferenceNotRegisteredException( |
|
48 |
XMLLocator.XML_MANAGER_NAME, XMLProviderLocator.getInstance()); |
|
49 |
} |
|
50 |
} |
|
51 |
} |
|
52 |
|
|
0 | 53 |
org.gvsig.xmlpull/library/trunk/org.gvsig.xmlpull/org.gvsig.xmlpull.lib/org.gvsig.xmlpull.lib.spi/src/main/java/org/gvsig/xml/lib/spi/XMLProviderManager.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 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.xml.lib.spi; |
|
29 |
|
|
30 |
import org.gvsig.xml.lib.api.stream.IXmlStreamReaderFactory; |
|
31 |
import org.gvsig.xml.lib.api.stream.IXmlStreamWriterFactory; |
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
/** |
|
36 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
37 |
*/ |
|
38 |
public interface XMLProviderManager { |
|
39 |
|
|
40 |
public void registerXMLStreamReaderFactory(IXmlStreamReaderFactory xmlStreamReaderFactory); |
|
41 |
|
|
42 |
public void registerXMLStreamWriterFactory(IXmlStreamWriterFactory xmlStreamWriterFactory); |
|
43 |
} |
|
44 |
|
|
0 | 45 |
Also available in: Unified diff