You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2014/10/24 19:11:17 UTC
svn commit: r1634098 [1/4] - in /sis/branches/JDK7: ./
core/sis-build-helper/src/main/java/org/apache/sis/util/resources/
core/sis-build-helper/src/test/
core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/
core/sis-metadata/src/test/java/org/a...
Author: desruisseaux
Date: Fri Oct 24 17:11:16 2014
New Revision: 1634098
URL: http://svn.apache.org/r1634098
Log:
Merge from the JDK8 branch.
Added:
sis/branches/JDK7/core/sis-build-helper/src/test/
- copied from r1634096, sis/branches/JDK8/core/sis-build-helper/src/test/
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Resources.java
- copied unchanged from r1634096, sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Resources.java
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Resources.properties
- copied unchanged from r1634096, sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Resources.properties
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Resources_fr.properties
- copied unchanged from r1634096, sis/branches/JDK8/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/Resources_fr.properties
sis/branches/JDK7/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSetTest.java
- copied unchanged from r1634096, sis/branches/JDK8/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSetTest.java
Removed:
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/InvalidDbaseFileFormatException.java
sis/branches/JDK7/storage/sis-shapefile/src/main/resources/
sis/branches/JDK7/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ConnectionTest.java
sis/branches/JDK7/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/ResultSetTest.java
Modified:
sis/branches/JDK7/ (props changed)
sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataScope.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PrunerTest.java
sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java
sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java
sis/branches/JDK7/ide-project/NetBeans/build.xml
sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties
sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java
sis/branches/JDK7/storage/sis-shapefile/pom.xml
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractConnection.java
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractJDBC.java
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractResultSet.java
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractStatement.java
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFConnection.java
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFDriver.java
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFResultSet.java
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/DBFStatement.java
sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/package-info.java
sis/branches/JDK7/storage/sis-shapefile/src/test/java/org/apache/sis/test/suite/ShapefileTestSuite.java
sis/branches/JDK7/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/xml/XMLStoreTest.java
Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
Merged /sis/branches/JDK8:r1633643-1634096
Modified: sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ResourceCompilerMojo.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -18,6 +18,7 @@ package org.apache.sis.util.resources;
import java.io.File;
import java.io.FilenameFilter;
+import java.util.Arrays;
import java.util.List;
import org.apache.maven.model.Resource;
@@ -27,6 +28,9 @@ import org.apache.maven.project.MavenPro
import org.codehaus.plexus.util.Scanner;
import org.sonatype.plexus.build.incremental.BuildContext;
+import static org.apache.sis.util.resources.IndexedResourceCompiler.JAVA_EXT;
+import static org.apache.sis.util.resources.IndexedResourceCompiler.PROPERTIES_EXT;
+
/**
* Compiles the international resources that are found in the module from which this mojo is invoked.
@@ -35,7 +39,7 @@ import org.sonatype.plexus.build.increme
* @author Martin Desruisseaux (Geomatys)
* @author Olivier Nouguier (Geomatys)
* @since 0.3 (derived from geotk-3.00)
- * @version 0.4
+ * @version 0.5
* @module
*
* @goal compile-resources
@@ -96,6 +100,12 @@ public class ResourceCompilerMojo extend
private File javaDirectoryFile;
/**
+ * Constructs a new resource compiler MOJO.
+ */
+ public ResourceCompilerMojo() {
+ }
+
+ /**
* Executes the mojo.
*
* @throws MojoExecutionException if the plugin execution failed.
@@ -146,8 +156,8 @@ public class ResourceCompilerMojo extend
}
/**
- * Recursively scans the directories for a sub-package named "resources",
- * then invokes the resource compiler for that directory.
+ * Recursively scans the directories and find all Java classes having a property files of the same name.
+ * Then invokes the resource compiler for those files.
*/
private int processAllResourceDirectories(final File directory) throws ResourceCompilerException {
int errors = 0;
@@ -155,14 +165,16 @@ public class ResourceCompilerMojo extend
if (subdirs != null) { // Appears to be sometime null with auto-generated sub-directories.
for (final File subdir : subdirs) {
if (subdir.isDirectory()) {
- if (subdir.getName().equals("resources")) {
- final File[] resourcesToProcess = subdir.listFiles(this);
- if (resourcesToProcess != null && resourcesToProcess.length != 0) {
+ File[] resourcesToProcess = subdir.listFiles(this);
+ int count = filterLanguages(resourcesToProcess);
+ if (count != 0) {
+ count = toJavaSourceFiles(resourcesToProcess, count);
+ if (count != 0) {
+ resourcesToProcess = Arrays.copyOf(resourcesToProcess, count);
errors += new Compiler(resourcesToProcess).run();
}
- } else {
- errors += processAllResourceDirectories(subdir);
}
+ errors += processAllResourceDirectories(subdir);
}
}
}
@@ -170,22 +182,84 @@ public class ResourceCompilerMojo extend
}
/**
- * Returns {@code true} if the given file is the source code for a resources bundle.
- * This method returns {@code true} if the given file is a Java source file and if a
- * properties file of the same name exists.
+ * Accepts all {@code "*.properties"} files.
*
* @param directory The directory.
* @param name The file name.
* @return {@code true} if the given file is a property file.
*/
@Override
- public final boolean accept(final File directory, String name) {
- if (!name.endsWith(IndexedResourceCompiler.JAVA_EXT)) {
- return false;
- }
- name = name.substring(0, name.length() - IndexedResourceCompiler.JAVA_EXT.length());
- name += IndexedResourceCompiler.PROPERTIES_EXT;
- return new File(directory, name).isFile();
+ public final boolean accept(final File directory, final String name) {
+ return name.endsWith(PROPERTIES_EXT);
+ }
+
+ /**
+ * Retains only the properties files which seems to be about internationalized resources.
+ * For example if the given array contains the following files:
+ * <ul>
+ * <li>{@code "Errors.properties"}</li>
+ * <li>{@code "Errors_en.properties"}</li>
+ * <li>{@code "Errors_fr.properties"}</li>
+ * <li>{@code "Messages.properties"}</li>
+ * <li>{@code "Messages_en.properties"}</li>
+ * <li>{@code "Messages_fr.properties"}</li>
+ * <li>{@code "NotAnInternationalResource.properties"}</li>
+ * </ul>
+ *
+ * Then this method will retain the following files:
+ * <ul>
+ * <li>{@code "Errors.properties"}</li>
+ * <li>{@code "Messages.properties"}</li>
+ * </ul>
+ *
+ * @param resourcesToProcess The files to filter. This array will be overwritten in-place.
+ * @return Number of valid elements in the {@code resourcesToProcess} after this method completion.
+ */
+ static int filterLanguages(final File[] resourcesToProcess) {
+ int count = 0;
+ if (resourcesToProcess != null) {
+ Arrays.sort(resourcesToProcess);
+ for (int i=0; i<resourcesToProcess.length;) {
+ final File file = resourcesToProcess[i];
+ String name = file.getName();
+ name = name.substring(0, name.length() - PROPERTIES_EXT.length()) + '_';
+ final int fileIndex = i;
+ while (++i < resourcesToProcess.length) {
+ if (!resourcesToProcess[i].getName().startsWith(name)) {
+ break;
+ }
+ }
+ // Accepts the property file only if we found at least one language.
+ // Example: "Messages.properties" and "Messages_en.properties".
+ if (i - fileIndex >= 2) {
+ resourcesToProcess[count++] = file;
+ }
+ }
+ }
+ return count;
+ }
+
+ /**
+ * Converts the given property files into Java source file, provided that the later exists.
+ * The given array is overwritten in place.
+ *
+ * @param resourcesToProcess The filtered resource files, as returned by {@link #filterLanguages(File[])}.
+ * @param count Number of valid elements in {@code resourcesToProcess}.
+ * @return Number of valid elements after this method completion.
+ */
+ private static int toJavaSourceFiles(final File[] resourcesToProcess, final int count) {
+ int n = 0;
+ for (int i=0; i<count; i++) {
+ File file = resourcesToProcess[i];
+ String name = file.getName();
+ name = name.substring(0, name.length() - PROPERTIES_EXT.length());
+ name += JAVA_EXT;
+ file = new File(file.getParentFile(), name);
+ if (file.isFile()) {
+ resourcesToProcess[n++] = file;
+ }
+ }
+ return n;
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -659,7 +659,7 @@ public class DefaultMetadata extends ISO
return new MetadataScopeAdapter<ScopeCode>(getMetadataScopes()) {
/** Stores a legacy value into the new kind of value. */
@Override protected MetadataScope wrap(final ScopeCode value) {
- return new DefaultMetadataScope(value);
+ return new DefaultMetadataScope(value, null);
}
/** Extracts the legacy value from the new kind of value. */
@@ -683,8 +683,8 @@ public class DefaultMetadata extends ISO
*
* @param newValues The new hierarchy levels.
*
- * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataScopes()}
- * followed by {@link DefaultMetadataScope#setResourceScope(ScopeCode)}.
+ * @deprecated As of ISO 19115:2014, replaced by {@link #setMetadataScopes(Collection)}
+ * and {@link DefaultMetadataScope#setResourceScope(ScopeCode)}.
*/
@Deprecated
public final void setHierarchyLevels(final Collection<? extends ScopeCode> newValues) {
@@ -707,9 +707,7 @@ public class DefaultMetadata extends ISO
return new MetadataScopeAdapter<String>(getMetadataScopes()) {
/** Stores a legacy value into the new kind of value. */
@Override protected MetadataScope wrap(final String value) {
- final DefaultMetadataScope scope = new DefaultMetadataScope();
- scope.setName(new SimpleInternationalString(value));
- return scope;
+ return new DefaultMetadataScope(null, value);
}
/** Extracts the legacy value from the new kind of value. */
@@ -734,8 +732,8 @@ public class DefaultMetadata extends ISO
*
* @param newValues The new hierarchy level names.
*
- * @deprecated As of ISO 19115:2014, replaced by {@link #getMetadataScopes()}
- * followed by {@link DefaultMetadataScope#setName(InternationalString)}.
+ * @deprecated As of ISO 19115:2014, replaced by {@link #setMetadataScopes(Collection)}
+ * and {@link DefaultMetadataScope#setName(InternationalString)}.
*/
@Deprecated
public final void setHierarchyLevelNames(final Collection<? extends String> newValues) {
Modified: sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataScope.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataScope.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataScope.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadataScope.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -20,6 +20,7 @@ import javax.xml.bind.annotation.XmlType
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.util.InternationalString;
+import org.apache.sis.util.iso.Types;
import org.opengis.metadata.MetadataScope;
import org.opengis.metadata.maintenance.ScopeCode;
@@ -73,9 +74,11 @@ public class DefaultMetadataScope extend
* Constructs a metadata scope initialized to the given value.
*
* @param resourceScope code for the scope.
+ * @param name Description of the scope, or {@code null} if none.
*/
- public DefaultMetadataScope(final ScopeCode resourceScope) {
+ public DefaultMetadataScope(final ScopeCode resourceScope, final CharSequence name) {
this.resourceScope = resourceScope;
+ this.name = Types.toInternationalString(name);
}
/**
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/code/CodeListMarshallingTest.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -24,7 +24,7 @@ import javax.xml.bind.JAXBException;
import org.opengis.metadata.citation.Role;
import org.opengis.metadata.citation.DateType;
import org.opengis.metadata.citation.CitationDate;
-import org.opengis.metadata.citation.ResponsibleParty;
+import org.opengis.metadata.citation.Responsibility;
import org.opengis.metadata.identification.TopicCategory;
import org.apache.sis.metadata.iso.identification.DefaultDataIdentification;
import org.apache.sis.internal.jaxb.Schemas;
@@ -86,7 +86,7 @@ public final strictfp class CodeListMars
@Test
public void testDefaultURL() throws JAXBException {
final String expected = getResponsiblePartyXML(Schemas.METADATA_ROOT);
- final ResponsibleParty rp = (ResponsibleParty) XML.unmarshal(expected);
+ final Responsibility rp = (Responsibility) XML.unmarshal(expected);
assertEquals(Role.PRINCIPAL_INVESTIGATOR, rp.getRole());
/*
* Use the convenience method in order to avoid the effort of creating
@@ -104,7 +104,7 @@ public final strictfp class CodeListMars
@Test
public void testISO_URL() throws JAXBException {
final String expected = getResponsiblePartyXML(Schemas.ISO_19139_ROOT);
- final ResponsibleParty rp = (ResponsibleParty) XML.unmarshal(expected);
+ final Responsibility rp = (Responsibility) XML.unmarshal(expected);
assertEquals(Role.PRINCIPAL_INVESTIGATOR, rp.getRole());
final MarshallerPool pool = getMarshallerPool();
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PrunerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PrunerTest.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PrunerTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/PrunerTest.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -22,6 +22,7 @@ import org.apache.sis.metadata.iso.exten
import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
import org.apache.sis.metadata.iso.identification.DefaultDataIdentification;
import org.apache.sis.metadata.iso.acquisition.DefaultAcquisitionInformation;
+import org.apache.sis.internal.simple.SimpleIdentifier;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
@@ -37,7 +38,7 @@ import static org.apache.sis.metadata.Va
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.20)
- * @version 0.3
+ * @version 0.5
* @module
*/
@DependsOn(ValueMapTest.class)
@@ -98,7 +99,7 @@ public final strictfp class PrunerTest e
/*
* Set a non-empty metadata info.
*/
- metadata.setFileIdentifier("A file identifiers");
+ metadata.setMetadataIdentifier(new SimpleIdentifier(null, "A file identifiers"));
assertTrue ("GeographicBoundingBox", bbox.isEmpty());
assertTrue ("Extent", extent.isEmpty());
assertFalse("DataIdentification", identification.isEmpty());
@@ -114,7 +115,7 @@ public final strictfp class PrunerTest e
/*
* Set an empty string in an element.
*/
- metadata.setFileIdentifier(" ");
+ metadata.setMetadataIdentifier(new SimpleIdentifier(null, " "));
assertTrue("Metadata", metadata.isEmpty());
}
@@ -146,9 +147,9 @@ public final strictfp class PrunerTest e
@Test
@DependsOnMethod("testIsEmpty")
public void testPrune() {
- metadata.setFileIdentifier("A file identifiers");
+ metadata.setMetadataIdentifier(new SimpleIdentifier(null, "A file identifiers"));
identification.setCitation(new DefaultCitation("A citation title"));
- assertFalse(isNullOrEmpty(metadata.getFileIdentifier()));
+ assertFalse(isNullOrEmpty(metadata.getMetadataIdentifier()));
assertFalse(isNullOrEmpty(identification.getCitation()));
assertEquals(1, metadata.getIdentificationInfo().size());
assertEquals(1, identification.getExtents().size());
@@ -156,19 +157,19 @@ public final strictfp class PrunerTest e
assertFalse(metadata.isEmpty());
metadata.prune();
- assertFalse(isNullOrEmpty(metadata.getFileIdentifier()));
+ assertFalse(isNullOrEmpty(metadata.getMetadataIdentifier()));
assertFalse(isNullOrEmpty(identification.getCitation()));
assertEquals(1, metadata.getIdentificationInfo().size());
assertEquals(0, identification.getExtents().size());
assertEquals(0, extent.getGeographicElements().size());
assertFalse(metadata.isEmpty());
- metadata.setFileIdentifier(" ");
+ metadata.setMetadataIdentifier(new SimpleIdentifier(null, " "));
identification.setCitation(new DefaultCitation(" "));
- assertNotNull(metadata.getFileIdentifier());
+ assertNotNull(metadata.getMetadataIdentifier());
metadata.prune();
- assertNull(metadata.getFileIdentifier());
+ assertNull(metadata.getMetadataIdentifier());
assertNull(identification.getCitation());
assertTrue(metadata.getIdentificationInfo().isEmpty());
assertTrue(identification.getExtents().isEmpty());
Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -260,8 +260,9 @@ public final strictfp class DefaultMetad
*/
it.remove();
assertFalse(it.hasNext());
- final DefaultMetadataScope c = new DefaultMetadataScope(levels[1] = ScopeCode.ATTRIBUTE_TYPE);
- c.setName(new SimpleInternationalString(names[1] = "Clearance"));
+ final DefaultMetadataScope c = new DefaultMetadataScope(
+ levels[1] = ScopeCode.ATTRIBUTE_TYPE,
+ names [1] = "Clearance");
assertTrue(scopes.add(c));
assertArrayEquals("hierarchyLevelNames", names, metadata.getHierarchyLevelNames().toArray());
assertArrayEquals("hierarchyLevels", levels, metadata.getHierarchyLevels().toArray());
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -20,6 +20,8 @@ import java.net.URI;
import java.net.URL;
import java.util.Arrays;
import java.util.Locale;
+import java.io.StringWriter;
+import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.JAXBException;
import javax.measure.unit.SI;
@@ -50,11 +52,12 @@ import org.apache.sis.internal.jaxb.gmx.
import org.apache.sis.referencing.NamedIdentifier;
import org.apache.sis.util.iso.SimpleInternationalString;
import org.apache.sis.util.ComparisonMode;
+import org.apache.sis.xml.Namespaces;
import org.apache.sis.xml.MarshallerPool;
import org.apache.sis.test.TestUtilities;
+import org.apache.sis.test.XMLComparator;
import org.apache.sis.test.XMLTestCase;
import org.apache.sis.test.DependsOn;
-import org.junit.Ignore;
import org.junit.Test;
import static org.apache.sis.test.Assert.*;
@@ -96,20 +99,23 @@ public strictfp class DefaultMetadataTes
/**
* Programmatically creates the metadata to marshall, or to compare against the unmarshalled metadata.
+ *
+ * @return The hard-coded representation of {@code "Metadata.xml"} content.
*/
private DefaultMetadata createHardCoded() {
final DefaultMetadata metadata = new DefaultMetadata();
- metadata.setFileIdentifier("Apache SIS/Metadata test");
- metadata.setLanguage(Locale.ENGLISH);
- metadata.setCharacterSet(StandardCharsets.UTF_8);
- metadata.setHierarchyLevels(singleton(ScopeCode.DATASET));
- metadata.setHierarchyLevelNames(singleton("Common Data Index record"));
- metadata.setDateStamp(TestUtilities.date("2009-01-01 04:00:00"));
+ metadata.setMetadataIdentifier(new DefaultIdentifier("Apache SIS/Metadata test"));
+ metadata.setLanguages(singleton(Locale.ENGLISH));
+ metadata.setCharacterSets(singleton(StandardCharsets.UTF_8));
+ metadata.setMetadataScopes(singleton(new DefaultMetadataScope(ScopeCode.DATASET, "Common Data Index record")));
+ metadata.setDates(singleton(new DefaultCitationDate(TestUtilities.date("2009-01-01 04:00:00"), DateType.CREATION)));
/*
- * Contact information for the author. The same party will be used
- * for custodian and distributor, with only the role changed.
+ * Contact information for the author. The same party will be used for custodian and distributor,
+ * with only the role changed. Note that we need to create an instance of the deprecated class,
+ * because this is what will be unmarshalled from the XML document.
*/
- final DefaultResponsibleParty author = new DefaultResponsibleParty(Role.AUTHOR);
+ @SuppressWarnings("deprecation")
+ final DefaultResponsibility author = new DefaultResponsibleParty(Role.AUTHOR);
final Anchor country = new Anchor(URI.create("SDN:C320:2:FR"), "France"); // Non-public SIS class.
{
final DefaultOnlineResource online = new DefaultOnlineResource(URI.create("http://www.ifremer.fr/sismer/"));
@@ -141,7 +147,8 @@ public strictfp class DefaultMetadataTes
new DefaultCitationDate(TestUtilities.date("1990-06-04 22:00:00"), DateType.REVISION),
new DefaultCitationDate(TestUtilities.date("1979-08-02 22:00:00"), DateType.CREATION)));
{
- final DefaultResponsibleParty originator = new DefaultResponsibleParty(Role.ORIGINATOR);
+ @SuppressWarnings("deprecation")
+ final DefaultResponsibility originator = new DefaultResponsibleParty(Role.ORIGINATOR);
final DefaultOnlineResource online = new DefaultOnlineResource(URI.create("http://www.com.univ-mrs.fr/LOB/"));
online.setProtocol("http");
final DefaultContact contact = new DefaultContact(online);
@@ -166,7 +173,8 @@ public strictfp class DefaultMetadataTes
Locale.ENGLISH, // Language,
TopicCategory.OCEANS); // Topic category
{
- final DefaultResponsibleParty custodian = new DefaultResponsibleParty(author);
+ @SuppressWarnings("deprecation")
+ final DefaultResponsibility custodian = new DefaultResponsibleParty(author);
custodian.setRole(Role.CUSTODIAN);
identification.setPointOfContacts(singleton(custodian));
}
@@ -205,14 +213,15 @@ public strictfp class DefaultMetadataTes
* Data indentification / Aggregate information.
*/
{
- final DefaultAggregateInformation aggregateInfo = new DefaultAggregateInformation();
+ @SuppressWarnings("deprecation")
+ final DefaultAssociatedResource aggregateInfo = new DefaultAggregateInformation();
final DefaultCitation name = new DefaultCitation("MEDIPROD VI");
name.setAlternateTitles(singleton(new SimpleInternationalString("90008411")));
name.setDates(singleton(new DefaultCitationDate(TestUtilities.date("1990-06-04 22:00:00"), DateType.REVISION)));
- aggregateInfo.setAggregateDataSetName(name);
+ aggregateInfo.setName(name);
aggregateInfo.setInitiativeType(InitiativeType.CAMPAIGN);
aggregateInfo.setAssociationType(AssociationType.LARGER_WORD_CITATION);
- identification.setAggregationInfo(singleton(aggregateInfo));
+ identification.setAssociatedResources(singleton(aggregateInfo));
}
/*
* Data indentification / Extent.
@@ -291,8 +300,9 @@ public strictfp class DefaultMetadataTes
* Distribution information.
*/
{
+ @SuppressWarnings("deprecation")
+ final DefaultResponsibility distributor = new DefaultResponsibleParty(author);
final DefaultDistribution distributionInfo = new DefaultDistribution();
- DefaultResponsibleParty distributor = new DefaultResponsibleParty(author);
distributor.setRole(Role.DISTRIBUTOR);
distributionInfo.setDistributors(singleton(new DefaultDistributor(distributor)));
distributionInfo.setDistributionFormats(singleton(
@@ -313,6 +323,8 @@ public strictfp class DefaultMetadataTes
/**
* Returns the URL to the {@code "Metadata.xml"} file to use for this test.
+ *
+ * @return The URL to {@code "Metadata.xml"} test file.
*/
private URL getResource() {
return DefaultMetadataTest.class.getResource("Metadata.xml");
@@ -321,13 +333,52 @@ public strictfp class DefaultMetadataTes
/**
* Tests marshalling of a XML document.
*
- * @throws JAXBException If an error occurred during marshalling.
+ * @throws Exception If an error occurred during marshalling.
*/
@Test
- @Ignore("Need to investigate why anchors are lost at marshalling time.")
- public void testMarshalling() throws JAXBException {
- final String xml = marshal(createHardCoded());
- assertXmlEquals(getResource(), xml, "xmlns:*", "xsi:schemaLocation");
+ public void testMarshalling() throws Exception {
+ final MarshallerPool pool = getMarshallerPool();
+ final Marshaller ms = pool.acquireMarshaller();
+ final StringWriter writer = new StringWriter(25000);
+ ms.marshal(createHardCoded(), writer);
+ pool.recycle(ms);
+ /*
+ * Apache SIS can marshal CharSequence as Anchor only if the property type is InternationalString.
+ * But the 'Metadata.hierarchyLevelName' and 'Identifier.code' properties are String, which we can
+ * not subclass. Concequently SIS currently marshals them as plain string. Replace those strings
+ * by the anchor version so we can compare the XML with the "Metadata.xml" file content.
+ */
+ final StringBuffer xml = writer.getBuffer();
+ replace(xml, "<gco:CharacterString>Common Data Index record</gco:CharacterString>",
+ "<gmx:Anchor xlink:href=\"SDN:L231:3:CDI\">Common Data Index record</gmx:Anchor>");
+ replace(xml, "<gco:CharacterString>EPSG:4326</gco:CharacterString>",
+ "<gmx:Anchor xlink:href=\"SDN:L101:2:4326\">EPSG:4326</gmx:Anchor>");
+ /*
+ * The <gmd:EX_TemporalExtent> block can not be marshalled yet, since it requires the sis-temporal module.
+ * We need to instruct the XML comparator to ignore this block during the comparison. We also ignore for
+ * now the "gml:id" attribute since SIS generates different values than the ones in oyr test XML file,
+ * and those values may change in future SIS version.
+ */
+ final XMLComparator comparator = new XMLComparator(getResource(), xml.toString());
+ comparator.ignoredNodes.add(Namespaces.GMD + ":temporalElement");
+ comparator.ignoredAttributes.add("http://www.w3.org/2000/xmlns:*");
+ comparator.ignoredAttributes.add(Namespaces.XSI + ":schemaLocation");
+ comparator.ignoredAttributes.add(Namespaces.GML + ":id");
+ comparator.ignoreComments = true;
+ comparator.compare();
+ }
+
+ /**
+ * Replaces the first occurrence of the given string by an other one.
+ *
+ * @param buffer The buffer in which to perform the replacement.
+ * @param toSearch The string to search.
+ * @param replaceBy The value to use as a replacement.
+ */
+ private static void replace(final StringBuffer buffer, final String toSearch, final String replaceBy) {
+ final int i = buffer.indexOf(toSearch);
+ assertTrue("String to replace not found.", i >= 0);
+ buffer.replace(i, i+toSearch.length(), replaceBy);
}
/**
Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ReferencingInMetadataTest.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -20,11 +20,7 @@ import java.net.URI;
import java.util.Locale;
import javax.xml.bind.JAXBException;
import org.opengis.metadata.Metadata;
-import org.opengis.metadata.citation.Citation;
-import org.opengis.metadata.citation.OnLineFunction;
-import org.opengis.metadata.citation.OnlineResource;
-import org.opengis.metadata.citation.ResponsibleParty;
-import org.opengis.metadata.citation.Role;
+import org.opengis.metadata.citation.*;
import org.opengis.metadata.extent.Extent;
import org.opengis.metadata.extent.GeographicBoundingBox;
import org.opengis.metadata.extent.VerticalExtent;
@@ -83,10 +79,10 @@ public final strictfp class ReferencingI
@Test
public void testMetadataWithVerticalCRS() throws JAXBException {
final Metadata metadata = unmarshalFile(Metadata.class, VERTICAL_CRS_XML);
- assertEquals("fileIdentifier", "20090901", metadata.getFileIdentifier());
- assertEquals("language", Locale.ENGLISH, metadata.getLanguage());
- assertEquals("characterSet", StandardCharsets.UTF_8, metadata.getCharacterSet());
- assertEquals("dateStamp", xmlDate("2014-01-04 00:00:00"), metadata.getDateStamp());
+ assertEquals("fileIdentifier", "20090901", metadata.getMetadataIdentifier().getCode());
+ assertEquals("language", Locale.ENGLISH, getSingleton(metadata.getLanguages()));
+ assertEquals("characterSet", StandardCharsets.UTF_8, getSingleton(metadata.getCharacterSets()));
+ assertEquals("dateStamp", xmlDate("2014-01-04 00:00:00"), getSingleton(metadata.getDates()).getDate());
/*
* <gmd:contact>
* <gmd:CI_ResponsibleParty>
@@ -94,10 +90,13 @@ public final strictfp class ReferencingI
* </gmd:CI_ResponsibleParty>
* </gmd:contact>
*/
- final ResponsibleParty contact = (ResponsibleParty) getSingleton(metadata.getContacts());
- final OnlineResource onlineResource = contact.getContactInfo().getOnlineResource();
+ final Responsibility contact = getSingleton(metadata .getContacts());
+ final Party party = getSingleton(contact .getParties());
+ final Contact contactInfo = getSingleton(party .getContactInfo());
+ final OnlineResource onlineResource = getSingleton(contactInfo.getOnlineResources());
+ assertInstanceOf("party", Organisation.class, party);
assertNotNull("onlineResource", onlineResource);
- assertEquals("organisationName", "Apache SIS", contact.getOrganisationName().toString());
+ assertEquals("organisationName", "Apache SIS", party.getName().toString());
assertEquals("linkage", URI.create("http://sis.apache.org"), onlineResource.getLinkage());
assertEquals("function", OnLineFunction.INFORMATION, onlineResource.getFunction());
assertEquals("role", Role.PRINCIPAL_INVESTIGATOR, contact.getRole());
Modified: sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/resources/org/apache/sis/test/integration/Metadata.xml Fri Oct 24 17:11:16 2014
@@ -97,7 +97,7 @@
</gmd:CI_ResponsibleParty>
</gmd:contact>
<gmd:dateStamp>
- <gco:DateTime>2009-01-01T06:00:00+02:00</gco:DateTime>
+ <gco:DateTime>2009-01-01T05:00:00+01:00</gco:DateTime>
</gmd:dateStamp>
<gmd:spatialRepresentationInfo>
<gmd:MD_VectorSpatialRepresentation>
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/system/Modules.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -24,7 +24,7 @@ package org.apache.sis.internal.system;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.4
+ * @version 0.5
* @module
*/
public final class Modules {
@@ -54,6 +54,20 @@ public final class Modules {
public static final String NETCDF = "org.apache.sis.storage.netcdf";
/**
+ * The major version number of all Apache SIS modules.
+ *
+ * @see org.apache.sis.util.Version
+ */
+ public static final int MAJOR_VERSION = 0;
+
+ /**
+ * The minor version number of all Apache SIS modules.
+ *
+ * @see org.apache.sis.util.Version
+ */
+ public static final int MINOR_VERSION = 5;
+
+ /**
* Do not allows instantiation of this class.
*/
private Modules() {
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Version.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Version.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Version.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Version.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -20,6 +20,9 @@ import java.io.Serializable;
import java.util.StringTokenizer;
import org.apache.sis.util.resources.Errors;
+import static org.apache.sis.internal.system.Modules.MAJOR_VERSION;
+import static org.apache.sis.internal.system.Modules.MINOR_VERSION;
+
/**
* Holds a version number as a sequence of strings separated by either a dot or a dash.
@@ -57,7 +60,7 @@ public class Version implements CharSequ
/**
* The version of this Apache SIS distribution.
*/
- public static final Version SIS = new Version("0.5-SNAPSHOT");
+ public static final Version SIS = new Version(MAJOR_VERSION + "." + MINOR_VERSION + "-SNAPSHOT");
/**
* A few commonly used version numbers. This list is based on SIS needs, e.g. in {@code DataStore}
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -165,6 +165,11 @@ public final class Errors extends Indexe
public static final short DeadThread_1 = 15;
/**
+ * The “{0}” file points to a directory instead of a regular file.
+ */
+ public static final short DirectoryNotExpected_1 = 165;
+
+ /**
* Element “{0}” is duplicated.
*/
public static final short DuplicatedElement_1 = 16;
@@ -230,6 +235,11 @@ public final class Errors extends Indexe
public static final short ExcessiveStringSize = 153;
/**
+ * File “{0}” has not been found.
+ */
+ public static final short FileNotFound_1 = 166;
+
+ /**
* Attribute “{0}” is not allowed for an object of type ‘{1}’.
*/
public static final short ForbiddenAttribute_2 = 26;
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Fri Oct 24 17:11:16 2014
@@ -44,6 +44,7 @@ ClassNotFinal_1 = Clas
CloneNotSupported_1 = Can not clone an object of type \u2018{0}\u2019.
ColinearAxisDirections_2 = Axis directions {0} and {1} are colinear.
DeadThread_1 = Thread \u201c{0}\u201d is dead.
+DirectoryNotExpected_1 = The \u201c{0}\u201d file points to a directory instead of a regular file.
DuplicatedElement_1 = Element \u201c{0}\u201d is duplicated.
DuplicatedIdentifier_1 = Identifier \u201c{0}\u201d is duplicated.
DuplicatedOption_1 = Option \u201c{0}\u201d is duplicated.
@@ -57,6 +58,7 @@ EmptyProperty_1 = Prop
ExcessiveArgumentSize_3 = Argument \u2018{0}\u2019 shall not contain more than {1} elements. A number of {2} is excessive.
ExcessiveListSize_2 = A size of {1} elements is excessive for the \u201c{0}\u201d list.
ExcessiveStringSize = The character string is too long.
+FileNotFound_1 = File \u201c{0}\u201d has not been found.
ForbiddenAttribute_2 = Attribute \u201c{0}\u201d is not allowed for an object of type \u2018{1}\u2019.
ForbiddenProperty_1 = Property \u201c{0}\u201d is not allowed.
IllegalArgumentClass_2 = Argument \u2018{0}\u2019 can not be an instance of \u2018{1}\u2019.
Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Fri Oct 24 17:11:16 2014
@@ -34,6 +34,7 @@ ClassNotFinal_1 = La c
CloneNotSupported_1 = Un objet de type \u2018{0}\u2019 ne peut pas \u00eatre clon\u00e9.
ColinearAxisDirections_2 = Les directions d\u2019axes {0} et {1} sont colin\u00e9aires.
DeadThread_1 = La t\u00e2che \u00ab\u202f{0}\u202f\u00bb est morte.
+DirectoryNotExpected_1 = Le fichier \u00ab\u202f{0}\u202f\u00bb d\u00e9signe un r\u00e9pertoire plut\u00f4t qu\u2019un fichier r\u00e9gulier.
DuplicatedElement_1 = L\u2019\u00e9lement \u00ab\u202f{0}\u202f\u00bb est dupliqu\u00e9.
DuplicatedIdentifier_1 = L\u2019identifiant \u00ab\u202f{0}\u202f\u00bb est dupliqu\u00e9.
DuplicatedOption_1 = L\u2019option \u00ab\u202f{0}\u202f\u00bb est dupliqu\u00e9e.
@@ -47,6 +48,7 @@ EmptyProperty_1 = La p
ExcessiveArgumentSize_3 = L\u2019argument \u2018{0}\u2019 ne peut pas contenir plus de {1} \u00e9l\u00e9ments. Un nombre de {2} est excessif.
ExcessiveListSize_2 = Une taille de {1} \u00e9l\u00e9ments est excessive pour la liste \u00ab\u202f{0}\u202f\u00bb.
ExcessiveStringSize = La cha\u00eene de caract\u00e8res est trop longue.
+FileNotFound_1 = Le fichier \u00ab\u202f{0}\u202f\u00bb n\u2019a pas \u00e9t\u00e9 trouv\u00e9.
ForbiddenAttribute_2 = L\u2019attribut \u00ab\u202f{0}\u202f\u00bb n\u2019est pas autoris\u00e9 pour un objet de type \u2018{1}\u2019.
ForbiddenProperty_1 = La propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb n\u2019est pas autoris\u00e9e.
IllegalArgumentClass_2 = L\u2019argument \u2018{0}\u2019 ne peut pas \u00eatre de type \u2018{1}\u2019.
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -36,6 +36,7 @@ import org.junit.AfterClass;
import org.junit.Test;
import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.TestUtilities.getSingleton;
/**
@@ -155,7 +156,7 @@ public final strictfp class LanguageCode
final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
final String xml = getMetadataXML(LANGUAGE_CODE);
final Metadata metadata = (Metadata) unmarshal(unmarshaller, xml);
- assertEquals(Locale.JAPANESE, metadata.getLanguage());
+ assertEquals(Locale.JAPANESE, getSingleton(metadata.getLanguages()));
}
/**
@@ -178,7 +179,7 @@ public final strictfp class LanguageCode
final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
final String xml = getMetadataXML(LANGUAGE_CODE_WITHOUT_ATTRIBUTE);
final Metadata metadata = (Metadata) unmarshal(unmarshaller, xml);
- assertEquals(Locale.JAPANESE, metadata.getLanguage());
+ assertEquals(Locale.JAPANESE, getSingleton(metadata.getLanguages()));
pool.recycle(unmarshaller);
}
@@ -219,7 +220,7 @@ public final strictfp class LanguageCode
final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
final String xml = getMetadataXML(CHARACTER_STRING);
final Metadata metadata = (Metadata) unmarshal(unmarshaller, xml);
- assertEquals(Locale.JAPANESE, metadata.getLanguage());
+ assertEquals(Locale.JAPANESE, getSingleton(metadata.getLanguages()));
pool.recycle(unmarshaller);
}
}
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -294,6 +294,7 @@ public strictfp class XMLComparator {
protected void compareNode(final Node expected, final Node actual) {
if (expected == null || actual == null) {
fail(formatErrorMessage(expected, actual));
+ return;
}
/*
* Check text value for types:
@@ -460,6 +461,7 @@ public strictfp class XMLComparator {
* @param expected The node having the expected attributes.
* @param actual The node to compare.
*/
+ @SuppressWarnings("null")
protected void compareAttributes(final Node expected, final Node actual) {
final NamedNodeMap expectedAttributes = expected.getAttributes();
final NamedNodeMap actualAttributes = actual.getAttributes();
@@ -542,7 +544,8 @@ public strictfp class XMLComparator {
* Check if the fully qualified attribute name is one of the attributes to ignore.
* Typical example: "http://www.w3.org/2001/XMLSchema-instance:schemaLocation"
*/
- if (ignored.contains(buffer.append(':').append(name).toString())) {
+ buffer.append(':').append(name, name.indexOf(':') + 1, name.length());
+ if (ignored.contains(buffer.toString())) {
return true;
}
/*
@@ -738,6 +741,7 @@ public strictfp class XMLComparator {
* @param node The node to format.
* @param lineSeparator The platform-specific line separator.
*/
+ @SuppressWarnings("null")
private static void formatNode(final StringBuilder buffer, final Node node, final String lineSeparator) {
if (node == null) {
buffer.append("(no node)").append(lineSeparator);
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/mock/MetadataMock.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -19,6 +19,7 @@ package org.apache.sis.test.mock;
import java.util.Date;
import java.util.Locale;
import java.util.Collection;
+import java.util.Collections;
import java.nio.charset.Charset;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@@ -102,12 +103,13 @@ public final strictfp class MetadataMock
}
/**
- * Undefined property.
- * @return {@code null}.
+ * Returns {@link #language} in a singleton set or an empty set.
+ *
+ * @return {@link #language}
*/
@Override
public Collection<Locale> getLanguages() {
- return null;
+ return (language != null) ? Collections.<Locale>singleton(language) : Collections.<Locale>emptySet();
}
/**
Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -19,7 +19,7 @@ package org.apache.sis.xml;
import java.net.URISyntaxException;
import org.opengis.util.InternationalString;
import org.opengis.metadata.citation.Citation;
-import org.opengis.metadata.citation.ResponsibleParty;
+import org.opengis.metadata.citation.Responsibility;
import org.apache.sis.util.LenientComparable;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.ArraysExt;
@@ -288,7 +288,7 @@ public final strictfp class NilReasonTes
assertTrue (c.equals(e2, ComparisonMode.DEBUG));
// Following object should alway be different because it does not implement the same interface.
- final ResponsibleParty r1 = NilReason.TEMPLATE.createNilObject(ResponsibleParty.class);
+ final Responsibility r1 = NilReason.TEMPLATE.createNilObject(Responsibility.class);
assertFalse(c.equals(r1, ComparisonMode.STRICT));
assertFalse(c.equals(r1, ComparisonMode.BY_CONTRACT));
assertFalse(c.equals(r1, ComparisonMode.IGNORE_METADATA));
Modified: sis/branches/JDK7/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/build.xml?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/build.xml (original)
+++ sis/branches/JDK7/ide-project/NetBeans/build.xml Fri Oct 24 17:11:16 2014
@@ -37,6 +37,11 @@
<include name="*.utf"/>
</fileset>
</copy>
+ <copy todir="${build.classes.dir}/org/apache/sis/internal/shapefile/jdbc">
+ <fileset dir="${project.root}/storage/sis-shapefile/target/generated-resources/org/apache/sis/internal/shapefile/jdbc">
+ <include name="*.utf"/>
+ </fileset>
+ </copy>
<!-- Following are classical properties resources files. -->
<copy todir="${build.classes.dir}">
Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Fri Oct 24 17:11:16 2014
@@ -143,7 +143,7 @@ debug.test.classpath=\
#
# Build configuration and destination directories.
#
-javac.compilerargs = -Xdoclint:all,-reference
+javac.compilerargs = -Xdoclint:syntax,html,missing/protected,accessibility/protected
javac.deprecation = true
javadoc.windowtitle = Apache SIS
javadoc.encoding = ${source.encoding}
Modified: sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -880,13 +880,11 @@ final class MetadataReader {
if (creation != null) {
metadata.setDates(singleton(new DefaultCitationDate(creation, DateType.CREATION)));
}
- metadata.setMetadataScopes(singleton(new DefaultMetadataScope(ScopeCode.DATASET)));
+ metadata.setMetadataScopes(singleton(new DefaultMetadataScope(ScopeCode.DATASET, null)));
for (final String service : SERVICES) {
final String name = decoder.stringValue(service);
if (name != null) {
- final DefaultMetadataScope scope = new DefaultMetadataScope(ScopeCode.SERVICE);
- scope.setName(new SimpleInternationalString(name));
- metadata.getMetadataScopes().add(scope);
+ addIfAbsent(metadata.getMetadataScopes(), new DefaultMetadataScope(ScopeCode.SERVICE, name));
}
}
/*
Modified: sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/ConformanceTest.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -17,8 +17,6 @@
package org.apache.sis.storage.netcdf;
import java.util.Map;
-import java.util.Arrays;
-import java.util.HashSet;
import java.io.IOException;
import ucar.nc2.NetcdfFile;
import org.opengis.metadata.Metadata;
@@ -27,6 +25,7 @@ import org.opengis.metadata.extent.Tempo
import org.opengis.metadata.identification.DataIdentification;
import org.opengis.metadata.maintenance.ScopeCode;
import org.opengis.wrapper.netcdf.NetcdfMetadataTest;
+import org.apache.sis.metadata.iso.DefaultMetadataScope;
import org.apache.sis.internal.netcdf.Decoder;
import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
import org.apache.sis.internal.netcdf.TestCase;
@@ -111,8 +110,11 @@ public final strictfp class ConformanceT
assertNull(expected.put("identificationInfo.citation.identifier.code", "crm_v1"));
assertNull(expected.put("contentInfo.dimension.sequenceIdentifier", "z"));
super.testTHREDDS();
- assertEquals("hierarchyLevel", new HashSet<>(Arrays.asList(ScopeCode.DATASET, ScopeCode.SERVICE)),
- new HashSet<>(metadata.getHierarchyLevels()));
+ assertArrayEquals("metadataScopes", new DefaultMetadataScope[] {
+ new DefaultMetadataScope(ScopeCode.DATASET, null),
+ new DefaultMetadataScope(ScopeCode.SERVICE, "http://localhost:8080//thredds/wms/crm/crm_vol9.nc"),
+ new DefaultMetadataScope(ScopeCode.SERVICE, "http://localhost:8080//thredds/wcs/crm/crm_vol9.nc")},
+ metadata.getMetadataScopes().toArray());
/*
* In the SIS case, the Metadata/Contact and Metadata/Identification/PointOfContact
* proprties are not just equals - they are expected to be the exact same instance.
@@ -138,7 +140,7 @@ public final strictfp class ConformanceT
public void testNCEP() throws IOException {
addCommonProperties(expectedProperties, true);
super.testNCEP();
- assertSame("hierarchyLevel", ScopeCode.DATASET, getSingleton(metadata.getHierarchyLevels()));
+ assertSame("metadataScope", ScopeCode.DATASET, getSingleton(metadata.getMetadataScopes()).getResourceScope());
/*
* In the SIS case, the Metadata/Contact and Metadata/Identification/PointOfContact
* proprties are not just equals - they are expected to be the exact same instance.
@@ -166,7 +168,7 @@ public final strictfp class ConformanceT
public void testLandsat() throws IOException {
addCommonProperties(expectedProperties, false);
super.testLandsat();
- assertSame("hierarchyLevel", ScopeCode.DATASET, getSingleton(metadata.getHierarchyLevels()));
+ assertSame("metadataScope", ScopeCode.DATASET, getSingleton(metadata.getMetadataScopes()).getResourceScope());
assertEmpty(expectedProperties);
assertEmpty(actualProperties);
@@ -183,7 +185,7 @@ public final strictfp class ConformanceT
final Map<String,Object> expected = expectedProperties;
addCommonProperties(expected, true);
super.testCIP();
- assertSame("hierarchyLevel", ScopeCode.DATASET, getSingleton(metadata.getHierarchyLevels()));
+ assertSame("metadataScope", ScopeCode.DATASET, getSingleton(metadata.getMetadataScopes()).getResourceScope());
/*
* In the SIS case, the Metadata/Contact and Metadata/Identification/PointOfContact
* proprties are not just equals - they are expected to be the exact same instance.
Modified: sis/branches/JDK7/storage/sis-shapefile/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-shapefile/pom.xml?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-shapefile/pom.xml (original)
+++ sis/branches/JDK7/storage/sis-shapefile/pom.xml Fri Oct 24 17:11:16 2014
@@ -66,6 +66,22 @@ Read and write files in the Shapefile fo
=========================================================== -->
<build>
<plugins>
+
+ <!-- Compile properties files into resources UTF files. -->
+ <plugin>
+ <groupId>org.apache.sis.core</groupId>
+ <artifactId>sis-build-helper</artifactId>
+ <version>${sis.plugin.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile-resources</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Package as OSGi bundle -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
Modified: sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractConnection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractConnection.java?rev=1634098&r1=1634097&r2=1634098&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractConnection.java [UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/jdbc/AbstractConnection.java [UTF-8] Fri Oct 24 17:11:16 2014
@@ -16,425 +16,425 @@
*/
package org.apache.sis.internal.shapefile.jdbc;
-import static java.util.logging.Level.*;
-
import java.sql.*;
-import java.util.*;
-import java.util.concurrent.*;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Collections;
+import java.util.concurrent.Executor;
+
/**
- * This base class holds all the unimplemented feature of a Connection.
- * (In order to avoid having a Connection implementation of thousand lines and unreadable).
+ * This base class holds most of the unimplemented feature of a {@code Connection}.
+ * This is used in order to avoid having a Connection implementation of thousand lines and unreadable.
+ *
+ * <table class="sis">
+ * <caption>Connection default values</caption>
+ * <tr><th>Property</th> <th>Value</th></tr>
+ * <tr><td>{@link #isReadOnly()}</td> <td>{@code false}</td></tr>
+ * <tr><td>{@link #getAutoCommit()}</td> <td>{@code true}</td></tr>
+ * <tr><td>{@link #getNetworkTimeout()}</td> <td>0</td></tr>
+ * <tr><td>{@link #getTransactionIsolation()}</td> <td>{@link #TRANSACTION_NONE}</td></tr>
+ * <tr><td>{@link #getTypeMap()}</td> <td>Empty map</td></tr>
+ * <tr><td>{@link #nativeSQL(String)}</td> <td>No change</td></tr>
+ * <tr><td>{@link #getWarnings()}</td> <td>{@code null}</td></tr>
+ * <tr><td>{@link #clearWarnings()}</td> <td>Ignored</td></tr>
+ * </table>
*
* @author Marc Le Bihan
+ * @author Martin Desruisseaux (Geomatys)
* @version 0.5
* @since 0.5
* @module
*/
-abstract public class AbstractConnection extends AbstractJDBC implements Connection {
+@SuppressWarnings("unused")
+abstract class AbstractConnection extends AbstractJDBC implements Connection {
/**
- * @see java.sql.Wrapper#unwrap(java.lang.Class)
+ * Constructs a new {@code Connection} instance.
*/
- @Override
- public <T> T unwrap(@SuppressWarnings("unused") Class<T> iface) throws SQLException {
- throw unsupportedOperation(Connection.class, "unwrap(..)");
+ AbstractConnection() {
}
/**
- * No non-standard features are currently handled.
- * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
+ * Returns the JDBC interface implemented by this class.
+ * This is used for formatting error messages.
*/
@Override
- public boolean isWrapperFor(@SuppressWarnings("unused") Class<?> iface) {
- return false;
+ final Class<?> getInterface() {
+ return Connection.class;
}
/**
- * @see java.sql.Connection#prepareCall(java.lang.String)
+ * Unsupported by default.
*/
@Override
- public CallableStatement prepareCall(@SuppressWarnings("unused") String sql) throws SQLException {
- throw unsupportedOperation(Connection.class, "prepareCall");
- }
-
- /**
- * @see java.sql.Connection#nativeSQL(java.lang.String)
- */
- @Override
- public String nativeSQL(String sql) {
- return sql; // We do nothing at the moment.
+ public DatabaseMetaData getMetaData() throws SQLException {
+ throw unsupportedOperation("getMetaData");
}
/**
- * Commit / rollback are currently ignored (autocommit = true).
- * @see java.sql.Connection#setAutoCommit(boolean)
+ * Unsupported by default.
*/
@Override
- public void setAutoCommit(boolean autoCommit){
- format(WARNING, "log.autocommit_ignored", autoCommit);
+ public String getCatalog() throws SQLException {
+ throw unsupportedOperation("getCatalog");
}
/**
- * Currently the autocommit state is not handled : always true.
- * @see java.sql.Connection#getAutoCommit()
+ * Unsupported by default.
*/
@Override
- public boolean getAutoCommit() {
- return true;
+ public void setCatalog(String catalog) {
+ logUnsupportedOperation("setCatalog");
}
/**
- * @see java.sql.Connection#commit()
+ * Unsupported by default.
*/
@Override
- public void commit() {
- format(WARNING, "log.commit_rollback_ignored");
+ public String getSchema() throws SQLException {
+ throw unsupportedOperation("getSchema");
}
/**
- * @see java.sql.Connection#rollback()
+ * Unsupported by default.
*/
@Override
- public void rollback() {
- format(WARNING, "log.commit_rollback_ignored");
+ public void setSchema(String schema) throws SQLException {
+ throw unsupportedOperation("setSchema");
}
/**
- * @see java.sql.Connection#getMetaData()
+ * Unsupported by default.
*/
@Override
- public DatabaseMetaData getMetaData() throws SQLException {
- throw unsupportedOperation(Connection.class, "getMetaData()");
+ public Map<String, Class<?>> getTypeMap() {
+ return Collections.emptyMap();
}
/**
- * @see java.sql.Connection#setReadOnly(boolean)
+ * Unsupported by default.
*/
@Override
- public void setReadOnly(@SuppressWarnings("unused") boolean readOnly) {
- logUnsupportedOperation(WARNING, Connection.class, "setReadOnly(..)");
+ public void setTypeMap(Map<String, Class<?>> map) {
+ if (!map.isEmpty()) {
+ throw new UnsupportedOperationException("setTypeMap");
+ }
}
/**
- * @see java.sql.Connection#isReadOnly()
+ * Returns {@code true} by default, assuming a driver without write capabilities.
*/
@Override
public boolean isReadOnly() {
- return false;
+ return true;
}
/**
- * @see java.sql.Connection#setCatalog(java.lang.String)
+ * Unsupported by default.
*/
@Override
- public void setCatalog(@SuppressWarnings("unused") String catalog) {
- logUnsupportedOperation(WARNING, Connection.class, "setCatalog(..)");
+ public void setReadOnly(boolean readOnly) {
+ if (!readOnly) {
+ throw new UnsupportedOperationException("setReadOnly");
+ }
}
/**
- * @see java.sql.Connection#getCatalog()
+ * Defaults to {@link #TRANSACTION_NONE}.
*/
@Override
- public String getCatalog() throws SQLException {
- throw unsupportedOperation(Connection.class, "getCatalog()");
+ public int getTransactionIsolation() {
+ return TRANSACTION_NONE; // No guarantees of anything.
}
/**
- * @see java.sql.Connection#setTransactionIsolation(int)
+ * Unsupported by default.
*/
@Override
- public void setTransactionIsolation(@SuppressWarnings("unused") int level) {
- logUnsupportedOperation(WARNING, Connection.class, "transaction isolation");
+ public void setTransactionIsolation(int level) {
+ if (level != TRANSACTION_NONE) {
+ throw new UnsupportedOperationException("setTransactionIsolation");
+ }
}
/**
- * @see java.sql.Connection#getTransactionIsolation()
+ * Defaults to {@code true}, assuming that auto-commit state is not handled.
*/
@Override
- public int getTransactionIsolation() {
- return 0; // No guarantees of anything.
+ public boolean getAutoCommit() {
+ return true;
}
/**
- * @see java.sql.Connection#getWarnings()
+ * Defaults to ignoring the commit / rollback.
+ * The auto-commit mode is assumed fixed to {@code true}.
*/
@Override
- public SQLWarning getWarnings() {
- logUnsupportedOperation(WARNING, Connection.class, "returning SQL warnings");
- return null;
+ public void setAutoCommit(boolean autoCommit) {
+ logWarning("setAutoCommit", Resources.Keys.AutoCommitIgnored_1, autoCommit);
}
/**
- * @see java.sql.Connection#clearWarnings()
+ * Unsupported by default.
*/
@Override
- public void clearWarnings() {
- logUnsupportedOperation(WARNING, Connection.class, "clearing SQL warnings");
+ public void commit() {
+ logWarning("commit", Resources.Keys.CommitRollbackIgnored, (Object[]) null);
}
/**
- * @see java.sql.Connection#prepareCall(java.lang.String, int, int)
+ * Unsupported by default.
*/
@Override
- public CallableStatement prepareCall(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") int resultSetType, @SuppressWarnings("unused") int resultSetConcurrency) throws SQLException {
- throw unsupportedOperation(Connection.class, "stored procedures (prepareCall(..))");
+ public void rollback() {
+ logWarning("commit", Resources.Keys.CommitRollbackIgnored, (Object[]) null);
}
/**
- * @see java.sql.Connection#getTypeMap()
+ * Unsupported by default.
*/
@Override
- public Map<String, Class<?>> getTypeMap() {
- logUnsupportedOperation(WARNING, Connection.class, "getTypeMap()");
- return new HashMap<>();
+ public void rollback(Savepoint savepoint) throws SQLException {
+ throw unsupportedOperation("rollback");
}
/**
- * @see java.sql.Connection#setTypeMap(java.util.Map)
+ * Unsupported by default.
*/
@Override
- public void setTypeMap(@SuppressWarnings("unused") Map<String, Class<?>> map) {
- logUnsupportedOperation(WARNING, Connection.class, "setTypeMap(..)");
+ public Savepoint setSavepoint() throws SQLException {
+ throw unsupportedOperation("setSavepoint");
}
/**
- * @see java.sql.Connection#prepareStatement(java.lang.String, int, int)
+ * Unsupported by default.
*/
@Override
- public PreparedStatement prepareStatement(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") int resultSetType, @SuppressWarnings("unused") int resultSetConcurrency) throws SQLException {
- throw unsupportedOperation(Connection.class, "prepareStatement(String sql, int resultSetType, int resultSetConcurrency)");
+ public Savepoint setSavepoint(String name) throws SQLException {
+ throw unsupportedOperation("setSavepoint");
}
/**
- * @see java.sql.Connection#setHoldability(int)
+ * Unsupported by default.
*/
@Override
- public void setHoldability(@SuppressWarnings("unused") int holdability) {
- logUnsupportedOperation(WARNING, Connection.class, "setHoldability(..)");
+ public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+ throw unsupportedOperation("releaseSavepoint");
}
/**
- * @see java.sql.Connection#getHoldability()
+ * Unsupported by default.
*/
@Override
public int getHoldability() throws SQLException {
- throw unsupportedOperation(Connection.class, "getHoldability()");
+ throw unsupportedOperation("getHoldability");
}
/**
- * @see java.sql.Connection#setSavepoint()
+ * Unsupported by default.
*/
@Override
- public Savepoint setSavepoint() throws SQLException {
- throw unsupportedOperation(Connection.class, "setSavepoint()");
+ public void setHoldability(int holdability) {
+ logUnsupportedOperation("setHoldability");
}
/**
- * @see java.sql.Connection#setSavepoint(java.lang.String)
+ * Returns the given string unchanged by default.
*/
@Override
- public Savepoint setSavepoint(@SuppressWarnings("unused") String name) throws SQLException {
- throw unsupportedOperation(Connection.class, "setSavepoint(..)");
+ public String nativeSQL(String sql) {
+ return sql; // We do nothing at the moment.
}
/**
- * @see java.sql.Connection#rollback(java.sql.Savepoint)
+ * Unsupported by default.
*/
@Override
- public void rollback(@SuppressWarnings("unused") Savepoint savepoint) throws SQLException {
- throw unsupportedOperation(Connection.class, "rollback(Savepoint)");
+ public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
+ throw unsupportedOperation("createStatement");
}
/**
- * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint)
+ * Unsupported by default.
*/
@Override
- public void releaseSavepoint(@SuppressWarnings("unused") Savepoint savepoint) throws SQLException {
- throw unsupportedOperation(Connection.class, "releaseSavepoint(Savepoint)");
+ public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+ throw unsupportedOperation("createStatement");
}
/**
- * @see java.sql.Connection#createStatement(int, int, int)
+ * Unsupported by default.
*/
@Override
- public Statement createStatement(@SuppressWarnings("unused") int resultSetType, @SuppressWarnings("unused") int resultSetConcurrency, @SuppressWarnings("unused") int resultSetHoldability) throws SQLException {
- throw unsupportedOperation(Connection.class, "createStatement(int, int, int)");
+ public PreparedStatement prepareStatement(String sql) throws SQLException {
+ throw unsupportedOperation("prepareStatement");
}
/**
- * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int)
+ * Unsupported by default.
*/
@Override
- public PreparedStatement prepareStatement(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") int resultSetType, @SuppressWarnings("unused") int resultSetConcurrency, @SuppressWarnings("unused") int resultSetHoldability) throws SQLException {
- throw unsupportedOperation(Connection.class, "prepareStatement(String, int, int, int)");
+ public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+ throw unsupportedOperation("prepareStatement");
}
/**
- * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int)
+ * Unsupported by default.
*/
@Override
- public CallableStatement prepareCall(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") int resultSetType, @SuppressWarnings("unused") int resultSetConcurrency, @SuppressWarnings("unused") int resultSetHoldability) throws SQLException {
- throw unsupportedOperation(Connection.class, "stored procedures (prepareCall(String, int, int, int))");
+ public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+ throw unsupportedOperation("prepareStatement");
}
/**
- * @see java.sql.Connection#prepareStatement(java.lang.String)
+ * Unsupported by default.
*/
@Override
- public PreparedStatement prepareStatement(@SuppressWarnings("unused") String sql) throws SQLException {
- throw unsupportedOperation(Connection.class, "prepareStatement(String sql)");
+ public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
+ throw unsupportedOperation("prepareCall");
}
/**
- * @see java.sql.Connection#prepareStatement(java.lang.String, int)
+ * Unsupported by default.
*/
@Override
- public PreparedStatement prepareStatement(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") int autoGeneratedKeys) throws SQLException {
- throw unsupportedOperation(Connection.class, "prepareStatement with autogenerated keys (prepareStatement(String, int))");
+ public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
+ throw unsupportedOperation("prepareStatement");
}
/**
- * @see java.sql.Connection#prepareStatement(java.lang.String, int[])
+ * Unsupported by default.
*/
@Override
- public PreparedStatement prepareStatement(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") int[] columnIndexes) throws SQLException {
- throw unsupportedOperation(Connection.class, "prepareStatement with autogenerated keys (prepareStatement(String, int[]))");
+ public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
+ throw unsupportedOperation("prepareStatement");
}
/**
- * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[])
+ * Unsupported by default.
*/
@Override
- public PreparedStatement prepareStatement(@SuppressWarnings("unused") String sql, @SuppressWarnings("unused") String[] columnNames) throws SQLException {
- throw unsupportedOperation(Connection.class, "prepareStatement with autogenerated keys (prepareStatement(String, String[]))");
+ public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
+ throw unsupportedOperation("prepareStatement");
}
/**
- * @see java.sql.Connection#createClob()
+ * Unsupported by default.
*/
@Override
- public Clob createClob() throws SQLException {
- throw unsupportedOperation(Connection.class, "createClob()");
+ public CallableStatement prepareCall(String sql) throws SQLException {
+ throw unsupportedOperation("prepareCall");
}
/**
- * @see java.sql.Connection#createBlob()
+ * Unsupported by default.
*/
@Override
- public Blob createBlob() throws SQLException {
- throw unsupportedOperation(Connection.class, "createBlob()");
+ public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
+ throw unsupportedOperation("prepareCall");
}
/**
- * @see java.sql.Connection#createNClob()
+ * Unsupported by default.
*/
@Override
- public NClob createNClob() throws SQLException {
- throw unsupportedOperation(Connection.class, "createNClob()");
- }
-
- /**
- * @see java.sql.Connection#createSQLXML()
- */
- @Override
- public SQLXML createSQLXML() throws SQLException {
- throw unsupportedOperation(Connection.class, "createSQLXML()");
+ public Clob createClob() throws SQLException {
+ throw unsupportedOperation("createClob");
}
/**
- * @see java.sql.Connection#setClientInfo(java.lang.String, java.lang.String)
+ * Unsupported by default.
*/
@Override
- public void setClientInfo(@SuppressWarnings("unused") String name, @SuppressWarnings("unused") String value) {
- logUnsupportedOperation(WARNING, Connection.class, "setClientInfo(..)");
+ public Blob createBlob() throws SQLException {
+ throw unsupportedOperation("createBlob");
}
/**
- * @see java.sql.Connection#setClientInfo(java.util.Properties)
+ * Unsupported by default.
*/
@Override
- public void setClientInfo(@SuppressWarnings("unused") Properties properties) {
- logUnsupportedOperation(WARNING, Connection.class, "setClientInfo(Properties)");
+ public NClob createNClob() throws SQLException {
+ throw unsupportedOperation("createNClob");
}
/**
- * @see java.sql.Connection#getClientInfo(java.lang.String)
+ * Unsupported by default.
*/
@Override
- public String getClientInfo(@SuppressWarnings("unused") String name) throws SQLException {
- throw unsupportedOperation(Connection.class, "getClientInfo(String name)");
+ public SQLXML createSQLXML() throws SQLException {
+ throw unsupportedOperation("createSQLXML");
}
/**
- * @see java.sql.Connection#getClientInfo()
+ * Unsupported by default.
*/
@Override
- public Properties getClientInfo() throws SQLException {
- throw unsupportedOperation(Connection.class, "getClientInfo()");
+ public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
+ throw unsupportedOperation("createArrayOf");
}
/**
- * @see java.sql.Connection#createArrayOf(java.lang.String, java.lang.Object[])
+ * Unsupported by default.
*/
@Override
- public Array createArrayOf(@SuppressWarnings("unused") String typeName, @SuppressWarnings("unused") Object[] elements) throws SQLException {
- throw unsupportedOperation(Connection.class, "createArrayOf(String typeName, Object[] elements)");
+ public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
+ throw unsupportedOperation("createStruct");
}
/**
- * @see java.sql.Connection#createStruct(java.lang.String, java.lang.Object[])
+ * Unsupported by default.
*/
@Override
- public Struct createStruct(@SuppressWarnings("unused") String typeName, @SuppressWarnings("unused") Object[] attributes) throws SQLException {
- throw unsupportedOperation(Connection.class, "createStruct(String typeName, Object[] attributes)");
+ public String getClientInfo(String name) throws SQLException {
+ throw unsupportedOperation("getClientInfo");
}
/**
- * @see java.sql.Connection#setSchema(java.lang.String)
+ * Unsupported by default.
*/
@Override
- public void setSchema(@SuppressWarnings("unused") String schema) throws SQLException {
- throw unsupportedOperation(Connection.class, "setSchema(String schema)");
+ public Properties getClientInfo() throws SQLException {
+ throw unsupportedOperation("getClientInfo");
}
/**
- * @see java.sql.Connection#getSchema()
+ * Unsupported by default.
*/
@Override
- public String getSchema() throws SQLException {
- throw unsupportedOperation(Connection.class, "getSchema()");
+ public void setClientInfo(String name, String value) {
+ logUnsupportedOperation("setClientInfo");
}
/**
- * @see java.sql.Connection#abort(java.util.concurrent.Executor)
+ * Unsupported by default.
*/
@Override
- public void abort(@SuppressWarnings("unused") Executor executor) throws SQLException {
- throw unsupportedOperation(Connection.class, "abort(Executor executor)");
+ public void setClientInfo(Properties properties) {
+ logUnsupportedOperation("setClientInfo");
}
/**
- * @see java.sql.Connection#setNetworkTimeout(java.util.concurrent.Executor, int)
+ * Defaults to 0, which means there is no limit.
*/
@Override
- public void setNetworkTimeout(@SuppressWarnings("unused") Executor executor, @SuppressWarnings("unused") int milliseconds) {
- logUnsupportedOperation(WARNING, Connection.class, "setNetworkTimeout(Executor executor, int milliseconds)");
+ public int getNetworkTimeout() {
+ return 0; // Means there is no limt.
}
/**
- * @see java.sql.Connection#getNetworkTimeout()
+ * Unsupported by default.
*/
@Override
- public int getNetworkTimeout() {
- logUnsupportedOperation(WARNING, Connection.class, "getNetworkTimeout()");
- return 0;
+ public void setNetworkTimeout(Executor executor, int milliseconds) {
+ logUnsupportedOperation("setNetworkTimeout");
}
/**
- * @see java.sql.Connection#createStatement(int, int)
+ * Unsupported by default.
*/
@Override
- public Statement createStatement(@SuppressWarnings("unused") int resultSetType, @SuppressWarnings("unused") int resultSetConcurrency) throws SQLException {
- throw unsupportedOperation(Connection.class, "createStatement(int resultSetType, int resultSetConcurrency)");
+ public void abort(Executor executor) throws SQLException {
+ throw unsupportedOperation("abort");
}
}