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 2016/08/31 09:28:19 UTC
svn commit: r1758562 [9/9] - in /sis/trunk: ./ core/
core/sis-feature/src/main/java/org/apache/sis/feature/
core/sis-feature/src/main/java/org/apache/sis/feature/builder/
core/sis-feature/src/test/java/org/apache/sis/feature/
core/sis-feature/src/test/...
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelDataInput.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelDataInput.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelDataInput.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ChannelDataInput.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -76,12 +76,12 @@ public class ChannelDataInput extends Ch
* If the buffer already contains some data, then the {@code filled} argument shall be {@code true}.
* Otherwise (e.g. if it is a newly created buffer), then {@code filled} shall be {@code false}.
*
- * @param filename A file identifier used only for formatting error message.
- * @param channel The channel from where data are read.
- * @param buffer The buffer where to copy the data.
- * @param filled {@code true} if the buffer already contains data, or {@code false} if it needs
- * to be initially filled with some content read from the channel.
- * @throws IOException If an error occurred while reading the channel.
+ * @param filename a file identifier used only for formatting error message.
+ * @param channel the channel from where data are read.
+ * @param buffer the buffer where to copy the data.
+ * @param filled {@code true} if the buffer already contains data, or {@code false} if it needs
+ * to be initially filled with some content read from the channel.
+ * @throws IOException if an error occurred while reading the channel.
*/
public ChannelDataInput(final String filename, final ReadableByteChannel channel, final ByteBuffer buffer,
final boolean filled) throws IOException
@@ -101,8 +101,8 @@ public class ChannelDataInput extends Ch
* <cite>end of stream</cite>. Otherwise this method reads an arbitrary amount of bytes not greater
* than the space available in the buffer, and returns the amount bytes actually read.
*
- * @return The number of bytes read, or -2 if the buffer is full, or -1 on <cite>end of stream</cite>.
- * @throws IOException If an error occurred while reading the bytes.
+ * @return the number of bytes read, or -2 if the buffer is full, or -1 on <cite>end of stream</cite>.
+ * @throws IOException if an error occurred while reading the bytes.
*
* @since 0.4
*/
@@ -130,7 +130,7 @@ public class ChannelDataInput extends Ch
* the channel has reached the end of stream, then this method returns {@code false}.
*
* @return {@code true} if the buffer contains at least one remaining byte.
- * @throws IOException If it was necessary to read from the channel and this operation failed.
+ * @throws IOException if it was necessary to read from the channel and this operation failed.
*/
public final boolean hasRemaining() throws IOException {
if (buffer.hasRemaining()) {
@@ -152,9 +152,9 @@ public class ChannelDataInput extends Ch
* It is caller's responsibility to ensure that the given number of bytes is
* not greater than the {@linkplain ByteBuffer#capacity() buffer capacity}.
*
- * @param n The minimal number of bytes needed in the {@linkplain #buffer buffer}.
- * @throws EOFException If the channel has reached the end of stream.
- * @throws IOException If an other kind of error occurred while reading.
+ * @param n the minimal number of bytes needed in the {@linkplain #buffer buffer}.
+ * @throws EOFException if the channel has reached the end of stream.
+ * @throws IOException if an other kind of error occurred while reading.
*/
public final void ensureBufferContains(int n) throws EOFException, IOException {
assert n >= 0 && n <= buffer.capacity() : n;
@@ -179,8 +179,8 @@ public class ChannelDataInput extends Ch
/**
* Makes sure that the buffer contains at least one remaining byte.
*
- * @throws EOFException If the channel has reached the end of stream.
- * @throws IOException If an other kind of error occurred while reading.
+ * @throws EOFException if the channel has reached the end of stream.
+ * @throws IOException if an other kind of error occurred while reading.
*/
private void ensureNonEmpty() throws IOException {
if (!hasRemaining()) {
@@ -207,8 +207,8 @@ public class ChannelDataInput extends Ch
* Reads a single bit from the stream. The bit to be read depends on the
* {@linkplain #getBitOffset() current bit offset}.
*
- * @return The value of the next bit from the stream.
- * @throws IOException If an error occurred while reading (including EOF).
+ * @return the value of the next bit from the stream.
+ * @throws IOException if an error occurred while reading (including EOF).
*/
public final int readBit() throws IOException {
return (int) readBits(1);
@@ -218,9 +218,9 @@ public class ChannelDataInput extends Ch
* Reads many bits from the stream. The first bit to be read depends on the
* {@linkplain #getBitOffset() current bit offset}.
*
- * @param numBits The number of bits to read.
- * @return The value of the next bits from the stream.
- * @throws IOException If an error occurred while reading (including EOF).
+ * @param numBits the number of bits to read.
+ * @return the value of the next bits from the stream.
+ * @throws IOException if an error occurred while reading (including EOF).
*/
public final long readBits(int numBits) throws IOException {
ensureBetween("numBits", 0, Long.SIZE, numBits);
@@ -253,8 +253,8 @@ public class ChannelDataInput extends Ch
* least 1 byte remaining in the buffer, reading new bytes from the channel if necessary,
* then delegates to {@link ByteBuffer#get()}.
*
- * @return The value of the next byte from the stream.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the value of the next byte from the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final byte readByte() throws IOException {
ensureBufferContains(Byte.SIZE / Byte.SIZE);
@@ -269,8 +269,8 @@ public class ChannelDataInput extends Ch
* return Byte.toUnsignedInt(readByte());
* }
*
- * @return The value of the next unsigned byte from the stream.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the value of the next unsigned byte from the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final int readUnsignedByte() throws IOException {
return readByte() & 0xFF;
@@ -281,8 +281,8 @@ public class ChannelDataInput extends Ch
* least 2 bytes remaining in the buffer, reading new bytes from the channel if necessary,
* then delegates to {@link ByteBuffer#getShort()}.
*
- * @return The value of the next short from the stream.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the value of the next short from the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final short readShort() throws IOException {
ensureBufferContains(Short.SIZE / Byte.SIZE);
@@ -297,8 +297,8 @@ public class ChannelDataInput extends Ch
* return Short.toUnsignedInt(readShort());
* }
*
- * @return The value of the next unsigned short from the stream.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the value of the next unsigned short from the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final int readUnsignedShort() throws IOException {
return readShort() & 0xFFFF;
@@ -309,8 +309,8 @@ public class ChannelDataInput extends Ch
* least 2 bytes remaining in the buffer, reading new bytes from the channel if necessary,
* then delegates to {@link ByteBuffer#getChar()}.
*
- * @return The value of the next character from the stream.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the value of the next character from the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final char readChar() throws IOException {
ensureBufferContains(Character.SIZE / Byte.SIZE);
@@ -322,8 +322,8 @@ public class ChannelDataInput extends Ch
* least 4 bytes remaining in the buffer, reading new bytes from the channel if necessary, then
* delegates to {@link ByteBuffer#getInt()}.
*
- * @return The value of the next integer from the stream.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the value of the next integer from the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final int readInt() throws IOException {
ensureBufferContains(Integer.SIZE / Byte.SIZE);
@@ -338,8 +338,8 @@ public class ChannelDataInput extends Ch
* return Integer.toUnsignedLong(readInt());
* }
*
- * @return The value of the next unsigned integer from the stream.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the value of the next unsigned integer from the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final long readUnsignedInt() throws IOException {
return readInt() & 0xFFFFFFFFL;
@@ -350,8 +350,8 @@ public class ChannelDataInput extends Ch
* least 8 bytes remaining in the buffer, reading new bytes from the channel if necessary,
* then delegates to {@link ByteBuffer#getLong()}.
*
- * @return The value of the next integer from the stream.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the value of the next integer from the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final long readLong() throws IOException {
ensureBufferContains(Long.SIZE / Byte.SIZE);
@@ -363,8 +363,8 @@ public class ChannelDataInput extends Ch
* least 4 bytes remaining in the buffer, reading new bytes from the channel if necessary,
* then delegates to {@link ByteBuffer#getFloat()}.
*
- * @return The value of the next float from the stream.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the value of the next float from the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final float readFloat() throws IOException {
ensureBufferContains(Float.SIZE / Byte.SIZE);
@@ -376,8 +376,8 @@ public class ChannelDataInput extends Ch
* least 8 bytes remaining in the buffer, reading new bytes from the channel if necessary,
* then delegates to {@link ByteBuffer#getDouble()}.
*
- * @return The value of the next double from the stream.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the value of the next double from the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final double readDouble() throws IOException {
ensureBufferContains(Double.SIZE / Byte.SIZE);
@@ -389,8 +389,8 @@ public class ChannelDataInput extends Ch
* This is a convenience method for {@link #readFully(byte[], int, int)} with a new array.
*
* @param length The number of bytes to read.
- * @return The next bytes in a newly allocated array of the given length.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the next bytes in a newly allocated array of the given length.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final byte[] readBytes(final int length) throws IOException {
final byte[] array = new byte[length];
@@ -403,8 +403,8 @@ public class ChannelDataInput extends Ch
* This is a convenience method for {@link #readFully(char[], int, int)} with a new array.
*
* @param length The number of characters to read.
- * @return The next characters in a newly allocated array of the given length.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the next characters in a newly allocated array of the given length.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final char[] readChars(final int length) throws IOException {
final char[] array = new char[length];
@@ -417,8 +417,8 @@ public class ChannelDataInput extends Ch
* This is a convenience method for {@link #readFully(short[], int, int)} with a new array.
*
* @param length The number of shorts to read.
- * @return The next shorts in a newly allocated array of the given length.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the next shorts in a newly allocated array of the given length.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final short[] readShorts(final int length) throws IOException {
final short[] array = new short[length];
@@ -431,8 +431,8 @@ public class ChannelDataInput extends Ch
* This is a convenience method for {@link #readFully(int[], int, int)} with a new array.
*
* @param length The number of integers to read.
- * @return The next integers in a newly allocated array of the given length.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the next integers in a newly allocated array of the given length.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final int[] readInts(final int length) throws IOException {
final int[] array = new int[length];
@@ -445,8 +445,8 @@ public class ChannelDataInput extends Ch
* This is a convenience method for {@link #readFully(long[], int, int)} with a new array.
*
* @param length The number of longs to read.
- * @return The next longs in a newly allocated array of the given length.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the next longs in a newly allocated array of the given length.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final long[] readLongs(final int length) throws IOException {
final long[] array = new long[length];
@@ -459,8 +459,8 @@ public class ChannelDataInput extends Ch
* This is a convenience method for {@link #readFully(float[], int, int)} with a new array.
*
* @param length The number of floats to read.
- * @return The next floats in a newly allocated array of the given length.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the next floats in a newly allocated array of the given length.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final float[] readFloats(final int length) throws IOException {
final float[] array = new float[length];
@@ -473,8 +473,8 @@ public class ChannelDataInput extends Ch
* This is a convenience method for {@link #readFully(double[], int, int)} with a new array.
*
* @param length The number of doubles to read.
- * @return The next doubles in a newly allocated array of the given length.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @return the next doubles in a newly allocated array of the given length.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final double[] readDoubles(final int length) throws IOException {
final double[] array = new double[length];
@@ -491,7 +491,7 @@ public class ChannelDataInput extends Ch
* }
*
* @param dest An array of bytes to be written to.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final void readFully(final byte[] dest) throws IOException {
readFully(dest, 0, dest.length);
@@ -501,10 +501,10 @@ public class ChannelDataInput extends Ch
* Reads {@code length} bytes from the stream, and stores them into
* {@code dest} starting at index {@code offset}.
*
- * @param dest An array of bytes to be written to.
- * @param offset The starting position within {@code dest} to write.
- * @param length The number of bytes to read.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @param dest an array of bytes to be written to.
+ * @param offset the starting position within {@code dest} to write.
+ * @param length the number of bytes to read.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final void readFully(final byte[] dest, int offset, int length) throws IOException {
while (length != 0) {
@@ -567,9 +567,9 @@ public class ChannelDataInput extends Ch
* the full content of {@link ChannelDataInput#buffer} (i.e. the view element at index 0 shall be
* defined by the buffer elements starting at index 0).</p>
*
- * @param view Existing buffer to use as a view over {@link ChannelDataInput#buffer}, or {@code null}.
- * @param offset The starting position within {@code dest} to write.
- * @param length The number of values to read.
+ * @param view existing buffer to use as a view over {@link ChannelDataInput#buffer}, or {@code null}.
+ * @param offset the starting position within {@code dest} to write.
+ * @param length the number of values to read.
* @throws IOException if an error (including EOF) occurred while reading the stream.
*/
@Override
@@ -738,7 +738,7 @@ public class ChannelDataInput extends Ch
* @param dest An array of characters to be written to.
* @param offset The starting position within {@code dest} to write.
* @param length The number of characters to read.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final void readFully(final char[] dest, final int offset, final int length) throws IOException {
new CharsReader(dest).readFully(null, offset, length);
@@ -751,7 +751,7 @@ public class ChannelDataInput extends Ch
* @param dest An array of short integers to be written to.
* @param offset The starting position within {@code dest} to write.
* @param length The number of short integers to read.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final void readFully(final short[] dest, final int offset, final int length) throws IOException {
new ShortsReader(dest).readFully(null, offset, length);
@@ -761,10 +761,10 @@ public class ChannelDataInput extends Ch
* Reads {@code length} integers from the stream, and stores them into
* {@code dest} starting at index {@code offset}.
*
- * @param dest An array of integers to be written to.
- * @param offset The starting position within {@code dest} to write.
- * @param length The number of integers to read.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @param dest an array of integers to be written to.
+ * @param offset the starting position within {@code dest} to write.
+ * @param length the number of integers to read.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final void readFully(final int[] dest, final int offset, final int length) throws IOException {
new IntsReader(dest).readFully(null, offset, length);
@@ -774,10 +774,10 @@ public class ChannelDataInput extends Ch
* Reads {@code length} long integers from the stream, and stores them into
* {@code dest} starting at index {@code offset}.
*
- * @param dest An array of long integers to be written to.
- * @param offset The starting position within {@code dest} to write.
- * @param length The number of long integers to read.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @param dest an array of long integers to be written to.
+ * @param offset the starting position within {@code dest} to write.
+ * @param length the number of long integers to read.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final void readFully(final long[] dest, final int offset, final int length) throws IOException {
new LongsReader(dest).readFully(null, offset, length);
@@ -787,10 +787,10 @@ public class ChannelDataInput extends Ch
* Reads {@code length} floats from the stream, and stores them into
* {@code dest} starting at index {@code offset}.
*
- * @param dest An array of floats to be written to.
- * @param offset The starting position within {@code dest} to write.
- * @param length The number of floats to read.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @param dest an array of floats to be written to.
+ * @param offset the starting position within {@code dest} to write.
+ * @param length the number of floats to read.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final void readFully(final float[] dest, final int offset, final int length) throws IOException {
new FloatsReader(dest).readFully(null, offset, length);
@@ -800,10 +800,10 @@ public class ChannelDataInput extends Ch
* Reads {@code length} doubles from the stream, and stores them into
* {@code dest} starting at index {@code offset}.
*
- * @param dest An array of doubles to be written to.
- * @param offset The starting position within {@code dest} to write.
- * @param length The number of doubles to read.
- * @throws IOException If an error (including EOF) occurred while reading the stream.
+ * @param dest an array of doubles to be written to.
+ * @param offset the starting position within {@code dest} to write.
+ * @param length the number of doubles to read.
+ * @throws IOException if an error (including EOF) occurred while reading the stream.
*/
public final void readFully(final double[] dest, final int offset, final int length) throws IOException {
new DoublesReader(dest).readFully(null, offset, length);
@@ -817,10 +817,10 @@ public class ChannelDataInput extends Ch
* to decode, for example attribute values in the file header. For large amount of data, consider using
* {@link java.nio.charset.CharsetDecoder} instead.</p>
*
- * @param length Number of bytes to read.
- * @param encoding The character encoding.
- * @return The string decoded from the {@code length} next bytes.
- * @throws IOException If an error occurred while reading the bytes, or if the given encoding is invalid.
+ * @param length number of bytes to read.
+ * @param encoding the character encoding.
+ * @return the string decoded from the {@code length} next bytes.
+ * @throws IOException if an error occurred while reading the bytes, or if the given encoding is invalid.
*/
public final String readString(final int length, final String encoding) throws IOException {
if (buffer.hasArray() && length <= buffer.capacity()) {
@@ -836,8 +836,8 @@ public class ChannelDataInput extends Ch
/**
* Moves to the given position in the stream, relative to the stream position at construction time.
*
- * @param position The position where to move.
- * @throws IOException If the stream can not be moved to the given position.
+ * @param position the position where to move.
+ * @throws IOException if the stream can not be moved to the given position.
*/
@Override
public final void seek(final long position) throws IOException {
@@ -878,8 +878,7 @@ public class ChannelDataInput extends Ch
buffer.position((int) p);
} else {
/*
- * Requested position is before the current buffer limits
- * and we can not seek.
+ * Requested position is before the current buffer limits and we can not seek.
*/
throw new IOException(Errors.format(Errors.Keys.StreamIsForwardOnly_1, filename));
}
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/HyperRectangleReader.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/HyperRectangleReader.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/HyperRectangleReader.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/HyperRectangleReader.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -22,6 +22,7 @@ import java.io.IOException;
import org.apache.sis.util.Numbers;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.storage.DataStoreContentException;
import org.apache.sis.util.Debug;
@@ -33,7 +34,7 @@ import org.apache.sis.util.Debug;
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
public final class HyperRectangleReader {
@@ -66,7 +67,7 @@ public final class HyperRectangleReader
case Numbers.LONG: reader = input.new LongsReader ((long[]) null); break;
case Numbers.FLOAT: reader = input.new FloatsReader ((float[]) null); break;
case Numbers.DOUBLE: reader = input.new DoublesReader((double[]) null); break;
- default: throw new DataStoreException(Errors.format(Errors.Keys.UnknownType_1, dataType));
+ default: throw new DataStoreContentException(Errors.format(Errors.Keys.UnknownType_1, dataType));
}
this.origin = origin;
final ByteBuffer buffer = input.buffer;
Copied: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java (from r1758410, sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java)
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java?p2=sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java&p1=sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java&r1=1758410&r2=1758562&rev=1758562&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -48,6 +48,7 @@ import org.apache.sis.util.iso.Types;
// Branch-dependent imports
import org.apache.sis.internal.jdk7.JDK7;
import org.apache.sis.internal.jdk8.LocalDate;
+import org.apache.sis.metadata.iso.citation.DefaultResponsibleParty;
/**
@@ -79,7 +80,7 @@ public class MetadataBuilder {
/**
* Part of the responsible party of the {@linkplain #citation}, or {@code null} if none.
*/
- private DefaultResponsibility responsibility;
+ private DefaultResponsibleParty responsibility;
/**
* Part of the responsible party of the {@linkplain #citation}, or {@code null} if none.
@@ -190,7 +191,7 @@ public class MetadataBuilder {
format = null;
}
if (distribution != null) {
- metadata().getDistributionInfo().add(distribution);
+ metadata().setDistributionInfo(distribution);
distribution = null;
}
}
@@ -238,7 +239,7 @@ public class MetadataBuilder {
*/
private DefaultResponsibility responsibility() {
if (responsibility == null) {
- responsibility = new DefaultResponsibility();
+ responsibility = new DefaultResponsibleParty();
}
return responsibility;
}
@@ -647,12 +648,15 @@ parse: for (int i = 0; i < length;)
final DefaultCitation c = new DefaultCitation(notice);
if (year != 0) {
final Date date = new Date(LocalDate.of(year, 1, 1).toEpochDay() * (24*60*60*1000L));
- c.setDates(Collections.singleton(new DefaultCitationDate(date, DateType.IN_FORCE)));
+ c.setDates(Collections.singleton(new DefaultCitationDate(date, DateType.valueOf("IN_FORCE"))));
}
if (i != 0) {
buffer.setLength(i);
- c.setCitedResponsibleParties(Collections.singleton(new DefaultResponsibility(Role.OWNER, null,
- new AbstractParty(buffer, null)))); // Same limitation than MetadataBuilder.party().
+ // Same limitation than MetadataBuilder.party().
+ final AbstractParty party = new AbstractParty(buffer, null);
+ final DefaultResponsibleParty p = new DefaultResponsibleParty(Role.OWNER);
+ p.setParties(Collections.singleton(party));
+ c.setCitedResponsibleParties(Collections.singleton(p));
}
constraints.getReferences().add(c);
}
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -29,6 +29,7 @@ import java.io.BufferedReader;
import java.io.LineNumberReader;
import java.io.IOException;
import java.net.URI;
+import java.nio.charset.Charset;
import javax.measure.unit.Unit;
import javax.measure.unit.SI;
import javax.measure.unit.NonSI;
@@ -43,11 +44,12 @@ import org.apache.sis.feature.DefaultFea
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.internal.referencing.GeodeticObjectBuilder;
-import org.apache.sis.internal.storage.MetadataHelper;
+import org.apache.sis.internal.storage.MetadataBuilder;
import org.apache.sis.geometry.GeneralEnvelope;
import org.apache.sis.metadata.iso.DefaultMetadata;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.storage.DataStoreContentException;
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.CharSequences;
@@ -60,6 +62,7 @@ import org.apache.sis.util.resources.Ind
import org.apache.sis.internal.jdk8.Instant;
import org.apache.sis.feature.AbstractFeature;
import org.apache.sis.feature.AbstractIdentifiedType;
+import org.apache.sis.setup.OptionKey;
/**
@@ -68,7 +71,7 @@ import org.apache.sis.feature.AbstractId
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
public final class Store extends DataStore {
@@ -115,9 +118,14 @@ public final class Store extends DataSto
private BufferedReader source;
/**
- * The metadata object. Initialized to a minimal amount of information, then completed when first needed.
+ * The character encoding, or {@code null} if unspecified (in which case the platform default is assumed).
*/
- private final DefaultMetadata metadata;
+ private final Charset encoding;
+
+ /**
+ * The metadata object, or {@code null} if not yet created.
+ */
+ private transient DefaultMetadata metadata;
/**
* The three- or four-dimensional envelope together with the CRS.
@@ -195,13 +203,13 @@ public final class Store extends DataSto
final String k = keyword.toLowerCase(Locale.US);
if (k.equals("@stboundedby")) {
if (envelope != null) {
- throw new DataStoreException(duplicated("@stboundedby"));
+ throw new DataStoreContentException(duplicated("@stboundedby"));
}
envelope = parseEnvelope(elements);
}
else if (k.equals("@columns")) {
if (featureType != null) {
- throw new DataStoreException(duplicated("@columns"));
+ throw new DataStoreContentException(duplicated("@columns"));
}
featureType = parseFeatureType(elements);
if (foliation == null) {
@@ -210,7 +218,7 @@ public final class Store extends DataSto
}
else if (k.equals("@foliation")) {
if (foliation != null) {
- throw new DataStoreException(duplicated("@foliation"));
+ throw new DataStoreContentException(duplicated("@foliation"));
}
foliation = parseFoliation(elements);
}
@@ -228,10 +236,10 @@ public final class Store extends DataSto
} catch (Exception e) { // This is a multi-catch on the JDK7 branch.
throw new DataStoreException(errors().getString(Errors.Keys.CanNotParseFile_2, "CSV", name), e);
}
+ this.encoding = connector.getOption(OptionKey.ENCODING);
this.envelope = envelope;
this.featureType = featureType;
this.foliation = foliation;
- this.metadata = MetadataHelper.createForTextFile(connector);
this.features = new ArrayList<AbstractFeature>();
}
@@ -273,7 +281,7 @@ public final class Store extends DataSto
} else if (k.equals("absolute")) {
isTimeAbsolute = true;
} else {
- throw new DataStoreException(errors().getString(Errors.Keys.UnknownUnit_1, unit));
+ throw new DataStoreContentException(errors().getString(Errors.Keys.UnknownUnit_1, unit));
}
}
// Fall through
@@ -289,7 +297,7 @@ public final class Store extends DataSto
} else if (k.equals("3D")) {
is3D = true;
} else {
- throw new DataStoreException(errors().getString(
+ throw new DataStoreContentException(errors().getString(
Errors.Keys.IllegalCoordinateSystem_1, dimension));
}
}
@@ -341,7 +349,7 @@ public final class Store extends DataSto
if ((dim = lowerCorner.length) != spatialDimension ||
(dim = upperCorner.length) != spatialDimension)
{
- throw new DataStoreException(errors().getString(
+ throw new DataStoreContentException(errors().getString(
Errors.Keys.MismatchedDimension_2, dim, spatialDimension));
}
for (int i=0; i<spatialDimension; i++) {
@@ -392,7 +400,7 @@ public final class Store extends DataSto
} else if (st.equals("anyuri")) {
type = URI.class;
} else {
- throw new DataStoreException(errors().getString(Errors.Keys.UnknownType_1, tn));
+ throw new DataStoreContentException(errors().getString(Errors.Keys.UnknownType_1, tn));
}
}
}
@@ -467,13 +475,15 @@ public final class Store extends DataSto
*/
@Override
public Metadata getMetadata() throws DataStoreException {
- if (metadata.isModifiable()) {
+ if (metadata == null) {
+ final MetadataBuilder builder = new MetadataBuilder();
+ builder.add(encoding);
try {
- MetadataHelper.add(metadata, envelope);
+ builder.add(envelope);
} catch (TransformException e) {
- throw new DataStoreException(errors().getString(Errors.Keys.CanNotParseFile_2, "CSV", name), e);
+ throw new DataStoreContentException(errors().getString(Errors.Keys.CanNotParseFile_2, "CSV", name), e);
}
- metadata.freeze();
+ metadata = builder.result();
}
return metadata;
}
@@ -526,7 +536,7 @@ public final class Store extends DataSto
* Column 1 is the start time.
* Column 2 is the end time.
* Column 3 is the trajectory.
- * Columns 4+ are custum attributes.
+ * Columns 4+ are custom attributes.
*
* TODO: we should replace that switch case by custom ObjectConverter.
*/
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/Store.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -32,6 +32,7 @@ import org.apache.sis.io.wkt.Warnings;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.StorageConnector;
import org.apache.sis.storage.DataStoreException;
+import org.apache.sis.storage.DataStoreContentException;
import org.apache.sis.metadata.iso.DefaultMetadata;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.CharSequences;
@@ -44,7 +45,7 @@ import org.apache.sis.referencing.CRS;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
final class Store extends DataStore {
@@ -72,8 +73,8 @@ final class Store extends DataStore {
/**
* Creates a new WKT store from the given file, URL or stream.
*
- * @param connector Information about the storage (URL, stream, <i>etc</i>).
- * @throws DataStoreException If an error occurred while opening the stream.
+ * @param connector information about the storage (URL, stream, <i>etc</i>).
+ * @throws DataStoreException if an error occurred while opening the stream.
*/
public Store(final StorageConnector connector) throws DataStoreException {
objects = new ArrayList<Object>();
@@ -97,13 +98,13 @@ final class Store extends DataStore {
source = null; // Cleared first in case of error.
final String wkt;
try {
- char[] buffer = new char[StoreProvider.READ_AHEAD_LIMIT];
+ char[] buffer = new char[FirstKeywordPeek.READ_AHEAD_LIMIT];
int length = 0;
int n;
while ((n = in.read(buffer, length, buffer.length - length)) >= 0) {
if ((length += n) >= buffer.length) {
if (n >= Integer.MAX_VALUE / 1024) { // Arbitrary size limit.
- throw new DataStoreException(Errors.format(Errors.Keys.ExcessiveStringSize));
+ throw new DataStoreContentException(Errors.format(Errors.Keys.ExcessiveStringSize));
}
buffer = Arrays.copyOf(buffer, n << 1);
}
@@ -137,7 +138,7 @@ final class Store extends DataStore {
* The current implementation retains only instances of {@link ReferenceSystem}
* and ignore other cases.
*
- * @return The metadata associated to the parsed object, or {@code null} if none.
+ * @return the metadata associated to the parsed object, or {@code null} if none.
* @throws DataStoreException if an error occurred during the parsing process.
*/
@Override
@@ -159,7 +160,7 @@ final class Store extends DataStore {
/**
* Closes this data store and releases any underlying resources.
*
- * @throws DataStoreException If an error occurred while closing this data store.
+ * @throws DataStoreException if an error occurred while closing this data store.
*/
@Override
public void close() throws DataStoreException {
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreProvider.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -16,11 +16,9 @@
*/
package org.apache.sis.internal.storage.wkt;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
-import java.io.Reader;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.DataStoreProvider;
import org.apache.sis.storage.DataStoreException;
@@ -35,7 +33,7 @@ import org.apache.sis.util.Version;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
public class StoreProvider extends DataStoreProvider {
@@ -45,80 +43,103 @@ public class StoreProvider extends DataS
public static final String MIME_TYPE = "application/wkt";
/**
- * The read-ahead limit when reading the WKT from a {@link Reader}.
+ * The object to use for verifying if the first keyword is a WKT one.
+ * This object contains the set of recognized WKT keywords.
*/
- static final int READ_AHEAD_LIMIT = 2048;
+ static final class Peek extends FirstKeywordPeek {
+ /**
+ * The unique instance.
+ */
+ static final Peek INSTANCE = new Peek();
- /**
- * Length of the shortest WKT keyword.
- */
- static final int MIN_LENGTH = 6;
+ /**
+ * Length of the shortest keyword.
+ */
+ static final int MIN_LENGTH = 6;
- /**
- * Length of the longest WKT keyword.
- */
- static final int MAX_LENGTH = 14;
+ /**
+ * The set of WKT keywords.
+ */
+ private final Set<String> keywords;
- /**
- * The set of WKT keywords.
- */
- private static final Set<String> KEYWORDS = keywords();
- static Set<String> keywords() {
- final Set<String> s = new HashSet<String>(22);
- s.add(WKTKeywords.GeodeticCRS);
- s.add(WKTKeywords.GeodCRS);
- s.add(WKTKeywords.GeogCS);
- s.add(WKTKeywords.GeocCS);
- s.add(WKTKeywords.VerticalCRS);
- s.add(WKTKeywords.VertCRS);
- s.add(WKTKeywords.Vert_CS);
- s.add(WKTKeywords.TimeCRS);
- s.add(WKTKeywords.ImageCRS);
- s.add(WKTKeywords.EngineeringCRS);
- s.add(WKTKeywords.EngCRS);
- s.add(WKTKeywords.Local_CS);
- s.add(WKTKeywords.CompoundCRS);
- s.add(WKTKeywords.Compd_CS);
- s.add(WKTKeywords.ProjectedCRS);
- s.add(WKTKeywords.ProjCRS);
- s.add(WKTKeywords.ProjCS);
- s.add(WKTKeywords.Fitted_CS);
- s.add(WKTKeywords.BoundCRS);
- return s;
- }
+ /**
+ * Creates the unique instance.
+ */
+ private Peek() {
+ super(14);
+ final Set<String> s = new HashSet<String>(22);
+ s.add(WKTKeywords.GeodeticCRS);
+ s.add(WKTKeywords.GeodCRS);
+ s.add(WKTKeywords.GeogCS);
+ s.add(WKTKeywords.GeocCS);
+ s.add(WKTKeywords.VerticalCRS);
+ s.add(WKTKeywords.VertCRS);
+ s.add(WKTKeywords.Vert_CS);
+ s.add(WKTKeywords.TimeCRS);
+ s.add(WKTKeywords.ImageCRS);
+ s.add(WKTKeywords.EngineeringCRS);
+ s.add(WKTKeywords.EngCRS);
+ s.add(WKTKeywords.Local_CS);
+ s.add(WKTKeywords.CompoundCRS);
+ s.add(WKTKeywords.Compd_CS);
+ s.add(WKTKeywords.ProjectedCRS);
+ s.add(WKTKeywords.ProjCRS);
+ s.add(WKTKeywords.ProjCS);
+ s.add(WKTKeywords.Fitted_CS);
+ s.add(WKTKeywords.BoundCRS);
+ keywords = s;
+ }
- /**
- * Creates a new provider.
- */
- public StoreProvider() {
- }
+ /**
+ * Returns the keywords for test purpose.
+ */
+ final Set<String> keywords() {
+ return Collections.unmodifiableSet(keywords);
+ }
- /**
- * Returns the next character which is not a white space, or -1 if the end of stream is reached.
- * Exactly one of {@code buffer} and {@code reader} shall be non-null.
- */
- private static int nextAfterSpaces(final ByteBuffer buffer, final Reader reader) throws IOException {
- if (buffer != null) {
- while (buffer.hasRemaining()) {
- final char c = (char) buffer.get();
- if (!Character.isWhitespace(c)) {
- return c;
+ /**
+ * Returns {@code true} if the given first non-white character after the keyword
+ * is one of the expected characters.
+ */
+ @Override
+ protected boolean isPostKeyword(final int c) {
+ return c == '[' || c == '(';
+ }
+
+ /**
+ * Returns the value to be returned by {@link StoreProvider#probeContent(StorageConnector)}
+ * for the given WKT keyword. This method changes the case to match the one used in the keywords map,
+ * then verify if the keyword that we found is one of the known WKT keywords. Keywords with the "CRS"
+ * suffix are WKT 2 while keywords with the "CS" suffix are WKT 1.
+ */
+ @Override
+ protected ProbeResult forKeyword(final char[] keyword, final int length) {
+ if (length >= MIN_LENGTH) {
+ int pos = length;
+ int version = 1;
+ keyword[ 0] &= ~0x20; // Make upper-case (valid only for characters in the a-z range).
+ keyword[--pos] &= ~0x20;
+ if ((keyword[--pos] &= ~0x20) == 'R') {
+ keyword[--pos] &= ~0x20; // Make "CRS" suffix in upper case (otherwise, was "CS" suffix)
+ version = 2;
+ }
+ while (--pos != 0) {
+ if (keyword[pos] != '_') {
+ keyword[pos] |= 0x20; // Make lower-case.
+ }
+ }
+ if (keywords.contains(String.valueOf(keyword, 0, length))) {
+ return new ProbeResult(true, MIME_TYPE, Version.valueOf(version));
}
}
- return -1;
- }
- int c;
- while ((c = reader.read()) >= 0) {
- if (!Character.isWhitespace(c)) break;
+ return ProbeResult.UNSUPPORTED_STORAGE;
}
- return c;
}
/**
- * Returns {@code true} if the given character is valid for a WKT keyword.
+ * Creates a new provider.
*/
- private static boolean isValidChar(final int c) {
- return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '_');
+ public StoreProvider() {
}
/**
@@ -131,92 +152,19 @@ public class StoreProvider extends DataS
* @throws DataStoreException if an I/O or SQL error occurred.
*/
@Override
- @SuppressWarnings("null")
- public ProbeResult probeContent(final StorageConnector storage) throws DataStoreException {
- char[] keyword = null;
- int pos = 0;
- try {
- final ByteBuffer buffer = storage.getStorageAs(ByteBuffer.class);
- final Reader reader;
- if (buffer != null) {
- buffer.mark();
- reader = null;
- } else {
- // User gave us explicitely a Reader (e.g. a StringReader wrapping a String instance).
- reader = storage.getStorageAs(Reader.class);
- if (reader == null) {
- return ProbeResult.UNSUPPORTED_STORAGE;
- }
- reader.mark(READ_AHEAD_LIMIT);
- }
- /*
- * Ignore leading spaces if any, then get a keyword no longer than LENGTH.
- * That keyword shall be followed by [ or (, ignoring whitespaces.
- */
- int c = nextAfterSpaces(buffer, reader);
- if (isValidChar(c)) {
- keyword = new char[MAX_LENGTH];
- do {
- if (pos >= MAX_LENGTH) {
- keyword = null; // Keyword too long.
- break;
- }
- keyword[pos++] = (char) c;
- c = (buffer == null) ? reader.read() : buffer.hasRemaining() ? (char) buffer.get() : -1;
- } while (isValidChar(c));
- if (Character.isWhitespace(c)) {
- c = nextAfterSpaces(buffer, reader);
- }
- if (c != '[' && c != '(') {
- keyword = null;
- }
- }
- if (buffer != null) {
- buffer.reset();
- } else {
- reader.reset();
- }
- if (c < 0) {
- return ProbeResult.INSUFFICIENT_BYTES;
- }
- } catch (IOException e) {
- throw new DataStoreException(e);
- }
- /*
- * At this point we got the first keyword. Change the case to match the one used in the KEYWORDS map,
- * then verify if the keyword that we found is one of the known WKT keywords. Keywords with the "CRS"
- * suffix are WKT 2 while keywords with the "CS" suffix are WKT 1.
- */
- final int length = pos;
- if (pos >= MIN_LENGTH) {
- int version = 1;
- keyword[ 0] &= ~0x20; // Make upper-case (valid only for characters in the a-z range).
- keyword[--pos] &= ~0x20;
- if ((keyword[--pos] &= ~0x20) == 'R') {
- keyword[--pos] &= ~0x20; // Make "CRS" suffix in upper case (otherwise, was "CS" suffix)
- version = 2;
- }
- while (--pos != 0) {
- if (keyword[pos] != '_') {
- keyword[pos] |= 0x20; // Make lower-case.
- }
- }
- if (KEYWORDS.contains(String.valueOf(keyword, 0, length))) {
- return new ProbeResult(true, MIME_TYPE, Version.valueOf(version));
- }
- }
- return ProbeResult.UNSUPPORTED_STORAGE;
+ public ProbeResult probeContent(final StorageConnector connector) throws DataStoreException {
+ return Peek.INSTANCE.probeContent(connector);
}
/**
* Returns a {@link Store} implementation associated with this provider.
*
- * @param storage Information about the storage (URL, stream, <i>etc</i>).
- * @return A data store implementation associated with this provider for the given storage.
- * @throws DataStoreException If an error occurred while creating the data store instance.
+ * @param connector information about the storage (URL, stream, <i>etc</i>).
+ * @return a data store implementation associated with this provider for the given storage.
+ * @throws DataStoreException if an error occurred while creating the data store instance.
*/
@Override
- public DataStore open(final StorageConnector storage) throws DataStoreException {
- return new Store(storage);
+ public DataStore open(final StorageConnector connector) throws DataStoreException {
+ return new Store(connector);
}
}
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/MimeTypeDetector.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -105,7 +105,7 @@ abstract class MimeTypeDetector {
* to read. We are typically not allowed to read the full stream because only a limited amount of bytes is
* cached.
*
- * @return The character, or -1 on EOF.
+ * @return the character, or -1 on EOF.
* @throws IOException if an error occurred while reading the byte or character.
*/
abstract int read() throws IOException;
@@ -114,8 +114,8 @@ abstract class MimeTypeDetector {
* Skips all bytes or characters up to {@code search}, then returns the character after it.
* Characters inside quotes will be ignored.
*
- * @param search The byte or character to skip.
- * @return The byte or character after {@code search}, or -1 on EOF.
+ * @param search the byte or character to skip.
+ * @return the byte or character after {@code search}, or -1 on EOF.
* @throws IOException if an error occurred while reading the bytes or characters.
*/
private int readAfter(final int search) throws IOException {
@@ -139,7 +139,7 @@ abstract class MimeTypeDetector {
* and all control characters (character below 32, which include tabulations and line feeds).
* This is the same criterion than {@link String#trim()}, but is not Unicode spaces.</p>
*
- * @return The first non-space character, or -1 on EOF.
+ * @return the first non-space character, or -1 on EOF.
* @throws IOException if an error occurred while reading the bytes or characters.
*/
private int afterSpaces(int c) throws IOException {
@@ -154,9 +154,9 @@ abstract class MimeTypeDetector {
* After this method class, the stream position is on the first character after the separator if
* a match has been found, or after the first unknown character otherwise.
*
- * @param word The word to search, as US-ASCII characters.
- * @param n Number of valid characters in {@code word}.
- * @param separator The {@code ':'} or {@code '='} character.
+ * @param word the word to search, as US-ASCII characters.
+ * @param n number of valid characters in {@code word}.
+ * @param separator the {@code ':'} or {@code '='} character.
* @return 1 if a match is found, 0 if no match, or -1 on EOF.
* @throws IOException if an error occurred while reading the bytes or characters.
*/
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -80,7 +80,7 @@ final class Store extends DataStore {
/**
* Creates a new XML store from the given file, URL or stream.
*
- * @param connector Information about the storage (URL, stream, <i>etc</i>).
+ * @param connector information about the storage (URL, stream, <i>etc</i>).
* @throws DataStoreException if an error occurred while opening the stream.
*/
public Store(final StorageConnector connector) throws DataStoreException {
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/StoreProvider.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -68,11 +68,11 @@ public class StoreProvider extends DataS
* @throws DataStoreException if an I/O or SQL error occurred.
*/
@Override
- public ProbeResult probeContent(final StorageConnector storage) throws DataStoreException {
+ public ProbeResult probeContent(final StorageConnector connector) throws DataStoreException {
/*
* Usual case. This include InputStream, DataInput, File, Path, URL, URI.
*/
- final ByteBuffer buffer = storage.getStorageAs(ByteBuffer.class);
+ final ByteBuffer buffer = connector.getStorageAs(ByteBuffer.class);
if (buffer != null) {
if (buffer.remaining() < HEADER.length) {
return ProbeResult.INSUFFICIENT_BYTES;
@@ -101,7 +101,7 @@ public class StoreProvider extends DataS
* We should enter in this block only if the user gave us explicitely a Reader.
* A common case is a StringReader wrapping a String object.
*/
- final Reader reader = storage.getStorageAs(Reader.class);
+ final Reader reader = connector.getStorageAs(Reader.class);
if (reader != null) try {
// Quick check for "<?xml " header.
reader.mark(HEADER.length + READ_AHEAD_LIMIT);
@@ -129,12 +129,12 @@ public class StoreProvider extends DataS
/**
* Returns a {@link Store} implementation associated with this provider.
*
- * @param storage Information about the storage (URL, stream, <i>etc</i>).
- * @return A data store implementation associated with this provider for the given storage.
- * @throws DataStoreException If an error occurred while creating the data store instance.
+ * @param connector information about the storage (URL, stream, <i>etc</i>).
+ * @return a data store implementation associated with this provider for the given storage.
+ * @throws DataStoreException if an error occurred while creating the data store instance.
*/
@Override
- public DataStore open(final StorageConnector storage) throws DataStoreException {
- return new Store(storage);
+ public DataStore open(final StorageConnector connector) throws DataStoreException {
+ return new Store(connector);
}
}
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreException.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -41,7 +41,7 @@ public class DataStoreException extends
/**
* Creates an exception with the specified details message.
*
- * @param message The detail message.
+ * @param message the detail message.
*/
public DataStoreException(final String message) {
super(message);
@@ -50,7 +50,7 @@ public class DataStoreException extends
/**
* Creates an exception with the specified cause and no details message.
*
- * @param cause The cause for this exception.
+ * @param cause the cause for this exception.
*/
public DataStoreException(final Throwable cause) {
super(cause);
@@ -59,8 +59,8 @@ public class DataStoreException extends
/**
* Creates an exception with the specified details message and cause.
*
- * @param message The detail message.
- * @param cause The cause for this exception.
+ * @param message the detail message.
+ * @param cause the cause for this exception.
*/
public DataStoreException(final String message, final Throwable cause) {
super(message, cause);
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -104,13 +104,13 @@ public abstract class DataStoreProvider
* }
* </div>
*
- * @param storage Information about the storage (URL, stream, JDBC connection, <i>etc</i>).
+ * @param connector information about the storage (URL, stream, JDBC connection, <i>etc</i>).
* @return {@link ProbeResult#SUPPORTED} if the given storage seems to be readable by the {@code DataStore}
* instances created by this provider.
* @throws DataStoreException if an I/O or SQL error occurred. The error shall be unrelated to the logical
* structure of the storage.
*/
- public abstract ProbeResult probeContent(StorageConnector storage) throws DataStoreException;
+ public abstract ProbeResult probeContent(StorageConnector connector) throws DataStoreException;
/**
* Returns a data store implementation associated with this provider.
@@ -119,9 +119,9 @@ public abstract class DataStoreProvider
* Implementors shall invoke {@link StorageConnector#closeAllExcept(Object)} after {@code DataStore}
* creation, keeping open only the needed resource.
*
- * @param storage Information about the storage (URL, stream, JDBC connection, <i>etc</i>).
- * @return A data store implementation associated with this provider for the given storage.
- * @throws DataStoreException If an error occurred while creating the data store instance.
+ * @param storage information about the storage (URL, stream, JDBC connection, <i>etc</i>).
+ * @return a data store implementation associated with this provider for the given storage.
+ * @throws DataStoreException if an error occurred while creating the data store instance.
*
* @see DataStores#open(Object)
*/
Modified: sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/main/java/org/apache/sis/storage/UnsupportedStorageException.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -41,7 +41,7 @@ public class UnsupportedStorageException
/**
* Creates an exception with the specified details message.
*
- * @param message The detail message.
+ * @param message the detail message.
*/
public UnsupportedStorageException(final String message) {
super(message);
@@ -50,7 +50,7 @@ public class UnsupportedStorageException
/**
* Creates an exception with the specified cause and no details message.
*
- * @param cause The cause for this exception.
+ * @param cause the cause for this exception.
*/
public UnsupportedStorageException(final Throwable cause) {
super(cause);
@@ -59,8 +59,8 @@ public class UnsupportedStorageException
/**
* Creates an exception with the specified details message and cause.
*
- * @param message The detail message.
- * @param cause The cause for this exception.
+ * @param message the detail message.
+ * @param cause the cause for this exception.
*/
public UnsupportedStorageException(final String message, final Throwable cause) {
super(message, cause);
Copied: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/MetadataBuilderTest.java (from r1758410, sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/MetadataBuilderTest.java)
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/MetadataBuilderTest.java?p2=sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/MetadataBuilderTest.java&p1=sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/MetadataBuilderTest.java&r1=1758410&r2=1758562&rev=1758562&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/MetadataBuilderTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/MetadataBuilderTest.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -16,9 +16,10 @@
*/
package org.apache.sis.internal.storage;
-import org.opengis.metadata.constraint.LegalConstraints;
import org.opengis.metadata.constraint.Restriction;
import org.opengis.metadata.citation.Citation;
+import org.apache.sis.metadata.iso.citation.DefaultCitation;
+import org.apache.sis.metadata.iso.constraint.DefaultLegalConstraints;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -71,13 +72,13 @@ public final strictfp class MetadataBuil
private static void verifyCopyrightParsing(final String notice) {
final MetadataBuilder builder = new MetadataBuilder();
builder.parseLegalNotice(notice);
- final LegalConstraints constraints = (LegalConstraints) getSingleton(getSingleton(
+ final DefaultLegalConstraints constraints = (DefaultLegalConstraints) getSingleton(getSingleton(
builder.result().getIdentificationInfo()).getResourceConstraints());
assertEquals("useConstraints", Restriction.COPYRIGHT, getSingleton(constraints.getUseConstraints()));
final Citation ref = getSingleton(constraints.getReferences());
assertTitleEquals("reference.title", notice, ref);
- assertPartyNameEquals("reference.citedResponsibleParty", "John Smith", ref);
+ assertPartyNameEquals("reference.citedResponsibleParty", "John Smith", (DefaultCitation) ref);
assertEquals("date", date("1992-01-01 00:00:00"), getSingleton(ref.getDates()).getDate());
}
}
Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreProviderTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreProviderTest.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreProviderTest.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/wkt/StoreProviderTest.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -32,7 +32,7 @@ import static org.junit.Assert.*;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.7
- * @version 0.7
+ * @version 0.8
* @module
*/
@DependsOn(org.apache.sis.storage.StorageConnectorTest.class)
@@ -45,13 +45,13 @@ public final strictfp class StoreProvide
public void testKeywordsMap() {
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
- for (final String keyword : StoreProvider.keywords()) {
+ for (final String keyword : StoreProvider.Peek.INSTANCE.keywords()) {
final int length = keyword.length();
if (length < min) min = length;
if (length > max) max = length;
}
- assertEquals("MIN_LENGTH", min, StoreProvider.MIN_LENGTH);
- assertEquals("MAX_LENGTH", max, StoreProvider.MAX_LENGTH);
+ assertEquals("MIN_LENGTH", min, StoreProvider.Peek.MIN_LENGTH);
+ assertEquals("MAX_LENGTH", max, StoreProvider.Peek.INSTANCE.maxLength);
}
/**
Modified: sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java
URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java?rev=1758562&r1=1758561&r2=1758562&view=diff
==============================================================================
--- sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java [UTF-8] (original)
+++ sis/trunk/storage/sis-storage/src/test/java/org/apache/sis/test/suite/StorageTestSuite.java [UTF-8] Wed Aug 31 09:28:16 2016
@@ -37,6 +37,7 @@ import org.junit.BeforeClass;
org.apache.sis.internal.storage.ChannelImageInputStreamTest.class,
org.apache.sis.internal.storage.ChannelImageOutputStreamTest.class,
org.apache.sis.internal.storage.HyperRectangleReaderTest.class,
+ org.apache.sis.internal.storage.MetadataBuilderTest.class,
org.apache.sis.storage.ProbeResultTest.class,
org.apache.sis.storage.StorageConnectorTest.class,
org.apache.sis.internal.storage.xml.MimeTypeDetectorTest.class,