Changeset: 6c74540a8e6b for monetdb-java
URL: http://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=6c74540a8e6b
Added Files:
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParserHelper.java
Modified Files:
src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
src/main/java/nl/cwi/monetdb/mcl/connection/helpers/BufferReallocator.java
src/main/java/nl/cwi/monetdb/mcl/connection/helpers/ChannelSecurity.java
src/main/java/nl/cwi/monetdb/mcl/connection/helpers/GregorianCalendarParser.java
src/main/java/nl/cwi/monetdb/mcl/connection/mapi/AbstractSocket.java
src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java
src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiServerResponseParser.java
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiStartOfHeaderParser.java
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTableHeaderParser.java
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiTupleLineParser.java
src/main/java/nl/cwi/monetdb/mcl/responses/AbstractDataBlockResponse.java
src/main/java/nl/cwi/monetdb/mcl/responses/ResultSetResponse.java
Branch: embedded
Log Message:
Following static methods naming conventions
diffs (truncated from 854 to 300 lines):
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
@@ -51,7 +51,7 @@ public abstract class MonetConnection ex
*
* @return The current sequence counter
*/
- public static int GetSeqCounter() {
+ public static int getSeqCounter() {
return SeqCounter;
}
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
+++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
@@ -69,7 +69,7 @@ public final class MonetDriver implement
/** MonetDB default port to connect to */
private static final String PORT = "@JDBC_DEF_PORT@";
- private static Class EmbeddedConnectionClass = null;
+ private static Class embeddedConnectionClass = null;
// initialize this class: register it at the DriverManager
// Chapter 9.2 from Sun JDBC 3.0 specification
@@ -413,13 +413,13 @@ public final class MonetDriver implement
if (directory == null || directory.trim().isEmpty())
throw new IllegalArgumentException("directory should not
be null or empty");
- if(EmbeddedConnectionClass == null) {
- EmbeddedConnectionClass =
Class.forName("nl.cwi.monetdb.embedded.jdbc.EmbeddedConnection");
- if(EmbeddedConnectionClass == null) { //if it's still null
then there is a problem
+ if(embeddedConnectionClass == null) {
+ embeddedConnectionClass =
Class.forName("nl.cwi.monetdb.embedded.jdbc.EmbeddedConnection");
+ if(embeddedConnectionClass == null) { //if it is still
null then there is a problem!
throw new SQLException("EmbeddedConnection Class not
found! Please add the MonetDBJavaEmbedded JAR to the Classpath!");
}
}
- res = (MonetConnection) EmbeddedConnectionClass
+ res = (MonetConnection) embeddedConnectionClass
.getDeclaredConstructor(Properties.class, String.class,
String.class, String.class)
.newInstance(props, hash, language, directory);
} catch (InvocationTargetException |
InstantiationException | IllegalAccessException |
diff --git
a/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/BufferReallocator.java
b/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/BufferReallocator.java
--- a/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/BufferReallocator.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/BufferReallocator.java
@@ -30,7 +30,7 @@ public final class BufferReallocator {
* @param buffer The buffer whose capacity will be expanded
* @return The buffer's new capacity
*/
- private static int GetNewCapacity(CharBuffer buffer) {
+ private static int getNewCapacity(CharBuffer buffer) {
int minCapacity = buffer.capacity() << 1;
int newCapacity = (buffer.capacity() << 1) + 2;
if (newCapacity - minCapacity < 0) {
@@ -53,8 +53,8 @@ public final class BufferReallocator {
* @param buffer The buffer whose capacity will be expanded
* @return The new buffer allocated
*/
- public static CharBuffer ReallocateBuffer(CharBuffer buffer) {
- int newCapacity = GetNewCapacity(buffer);
+ public static CharBuffer reallocateBuffer(CharBuffer buffer) {
+ int newCapacity = getNewCapacity(buffer);
CharBuffer newBuffer = CharBuffer.wrap(new char[newCapacity]);
buffer.flip();
newBuffer.put(buffer.array());
@@ -69,7 +69,7 @@ public final class BufferReallocator {
* @param capacityThreshold The capacity threshold to test
* @return The original buffer or the new one allocated
*/
- public static CharBuffer EnsureCapacity(CharBuffer buffer, int
capacityThreshold) {
+ public static CharBuffer ensureCapacity(CharBuffer buffer, int
capacityThreshold) {
if(capacityThreshold > buffer.capacity()) {
buffer = CharBuffer.wrap(new char[capacityThreshold]);
}
diff --git
a/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/ChannelSecurity.java
b/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/ChannelSecurity.java
--- a/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/ChannelSecurity.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/ChannelSecurity.java
@@ -18,7 +18,7 @@ import java.security.NoSuchAlgorithmExce
*/
public final class ChannelSecurity {
- private static char HexChar(int n) { return (n > 9) ? (char) ('a' + (n -
10)) : (char) ('0' + n); }
+ private static char hexChar(int n) { return (n > 9) ? (char) ('a' + (n -
10)) : (char) ('0' + n); }
/**
* Helper method to convert a byte string to a hexadecimal String
representation.
@@ -26,12 +26,12 @@ public final class ChannelSecurity {
* @param digest The byte array to convert
* @return The byte array as a hexadecimal string
*/
- private static String ToHex(byte[] digest) {
+ private static String toHex(byte[] digest) {
char[] result = new char[digest.length * 2];
int pos = 0;
for (byte aDigest : digest) {
- result[pos++] = HexChar((aDigest & 0xf0) >> 4);
- result[pos++] = HexChar(aDigest & 0x0f);
+ result[pos++] = hexChar((aDigest & 0xf0) >> 4);
+ result[pos++] = hexChar(aDigest & 0x0f);
}
return new String(result);
}
@@ -43,13 +43,13 @@ public final class ChannelSecurity {
* @param toDigests The Strings to digest
* @return The Strings digest as a hexadecimal string
*/
- public static String DigestStrings(String algorithm, byte[]... toDigests) {
+ public static String digestStrings(String algorithm, byte[]... toDigests) {
try {
MessageDigest md = MessageDigest.getInstance(algorithm);
for (byte[] str : toDigests) {
md.update(str);
}
- return ToHex(md.digest());
+ return toHex(md.digest());
} catch (NoSuchAlgorithmException e) {
throw new AssertionError("internal error: " + e.toString());
}
diff --git
a/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/GregorianCalendarParser.java
b/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/GregorianCalendarParser.java
---
a/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/GregorianCalendarParser.java
+++
b/src/main/java/nl/cwi/monetdb/mcl/connection/helpers/GregorianCalendarParser.java
@@ -44,8 +44,8 @@ public final class GregorianCalendarPars
}
}
- /** The time zone information, to be resused to avoid memory allocations */
- private static final TimeZone DefaultTimeZone = TimeZone.getDefault();
+ /** The time zone information, to be re-used to avoid memory allocations */
+ private static final TimeZone defaultTimeZone = TimeZone.getDefault();
/**
* Parses a date or time or timestamp MAPI String into a Java {@link
Calendar} instance.
@@ -57,14 +57,14 @@ public final class GregorianCalendarPars
* @param jdbcType The JDBC type of the column
* @return A {@link Calendar} instance of the parsed date
*/
- public static Calendar ParseDateString(MonetResultSet mrs, String toParse,
ParsePosition pos,
+ public static Calendar parseDateString(MonetResultSet mrs, String toParse,
ParsePosition pos,
SimpleDateFormat parser, int
jdbcType) {
pos.setIndex(0);
Calendar res = new GregorianCalendar();
if(jdbcType == Types.TIME || jdbcType == Types.TIMESTAMP || jdbcType
== Types.DATE) {
parser.setTimeZone(TimeZone.getTimeZone("GMT" +
toParse.substring(toParse.length() - 6)));
} else {
- parser.setTimeZone(DefaultTimeZone);
+ parser.setTimeZone(defaultTimeZone);
}
Date aux = parser.parse(toParse, pos);
@@ -123,7 +123,7 @@ public final class GregorianCalendarPars
* @return A {@link Calendar} instance of the parsed date
* @throws ProtocolException If the String could not be parsed
*/
- public static Calendar ParseDate(String toParse, ParsePosition pos,
SimpleDateFormat parser)
+ public static Calendar parseDate(String toParse, ParsePosition pos,
SimpleDateFormat parser)
throws ProtocolException {
pos.setIndex(0);
Calendar res = new GregorianCalendar();
@@ -146,13 +146,13 @@ public final class GregorianCalendarPars
* @return A {@link Calendar} instance of the parsed time
* @throws ProtocolException If the String could not be parsed
*/
- public static Calendar ParseTime(String toParse, ParsePosition pos,
SimpleDateFormat parser, boolean hasTimeZone)
+ public static Calendar parseTime(String toParse, ParsePosition pos,
SimpleDateFormat parser, boolean hasTimeZone)
throws ProtocolException {
pos.setIndex(0);
if(hasTimeZone) { // MonetDB/SQL99: Sign TwoDigitHours : Minutes
parser.setTimeZone(TimeZone.getTimeZone("GMT" +
toParse.substring(toParse.length() - 6)));
} else {
- parser.setTimeZone(DefaultTimeZone);
+ parser.setTimeZone(defaultTimeZone);
}
Calendar res = new GregorianCalendar();
@@ -175,13 +175,13 @@ public final class GregorianCalendarPars
* @return A {@link TimestampHelper} instance of the parsed timestamp with
nanos information
* @throws ProtocolException If the String could not be parsed
*/
- public static TimestampHelper ParseTimestamp(String toParse, ParsePosition
pos, SimpleDateFormat parser,
+ public static TimestampHelper parseTimestamp(String toParse, ParsePosition
pos, SimpleDateFormat parser,
boolean hasTimeZone) throws
ProtocolException {
pos.setIndex(0);
if(hasTimeZone) { // MonetDB/SQL99: Sign TwoDigitHours : Minutes
parser.setTimeZone(TimeZone.getTimeZone("GMT" +
toParse.substring(toParse.length() - 6)));
} else {
- parser.setTimeZone(DefaultTimeZone);
+ parser.setTimeZone(defaultTimeZone);
}
GregorianCalendar res = new GregorianCalendar();
diff --git
a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/AbstractSocket.java
b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/AbstractSocket.java
--- a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/AbstractSocket.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/AbstractSocket.java
@@ -184,7 +184,7 @@ public abstract class AbstractSocket imp
found = true;
} else {
if(destinationPosition + 1 >= destinationLimit) {
- lineBuffer =
BufferReallocator.ReallocateBuffer(lineBuffer);
+ lineBuffer =
BufferReallocator.reallocateBuffer(lineBuffer);
destinationArray = lineBuffer.array();
destinationLimit = lineBuffer.limit();
}
diff --git
a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java
b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java
--- a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java
@@ -57,7 +57,7 @@ public class MapiConnection extends Mone
public MapiConnection(Properties props, String hash, String language,
boolean blobIsBinary, boolean clobIsLongChar,
String hostname, int port, String database) throws
IOException {
- super(props, hash, MapiLanguage.GetLanguageFromString(language),
blobIsBinary, clobIsLongChar);
+ super(props, hash, MapiLanguage.getLanguageFromString(language),
blobIsBinary, clobIsLongChar);
this.hostname = hostname;
this.port = port;
this.database = database;
@@ -356,7 +356,7 @@ public class MapiConnection extends Mone
case "language":
tmp = arg.substring(pos + 1);
warns.add("redirect specifies use of
different language: " + tmp);
- this.language =
MapiLanguage.GetLanguageFromString(tmp);
+ this.language =
MapiLanguage.getLanguageFromString(tmp);
break;
case "user":
tmp = arg.substring(pos + 1);
@@ -481,7 +481,7 @@ public class MapiConnection extends Mone
throw new MCLException("Unsupported password hash: " +
chaltok[5]);
}
- password = ChannelSecurity.DigestStrings(algo,
password.getBytes("UTF-8"));
+ password = ChannelSecurity.digestStrings(algo,
password.getBytes("UTF-8"));
// proto 7 (finally) used the challenge and works with a
password hash. The supported implementations
// come from the server challenge. We chose the best hash we
can find, in the order SHA1, MD5, plain.
@@ -517,7 +517,7 @@ public class MapiConnection extends Mone
throw new MCLException("No supported password hashes in "
+ hashes);
}
- pwhash += ChannelSecurity.DigestStrings(algo,
password.getBytes("UTF-8"),
+ pwhash += ChannelSecurity.digestStrings(algo,
password.getBytes("UTF-8"),
challenge.getBytes("UTF-8"));
// generate response
diff --git a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java
b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java
--- a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java
@@ -61,7 +61,7 @@ public enum MapiLanguage implements IMon
return representation;
}
- public static MapiLanguage GetLanguageFromString(String language) {
+ public static MapiLanguage getLanguageFromString(String language) {
switch (language) {
case "sql":
return LANG_SQL;
diff --git
a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
--- a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
+++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
@@ -96,7 +96,7 @@ public class OldMapiProtocol extends Abs
if(this.lineBuffer.limit() == 0) {
throw new IOException("Connection to server lost!");
}
- this.currentServerResponseHeader =
OldMapiServerResponseParser.ParseOldMapiServerResponse(this);
+ this.currentServerResponseHeader =
OldMapiServerResponseParser.parseOldMapiServerResponse(this);
this.lineBuffer.position(0);
if (this.currentServerResponseHeader == ServerResponses.ERROR) {
this.lineBuffer.position(1);
@@ -118,7 +118,7 @@ public class OldMapiProtocol extends Abs
if(this.lineBuffer.limit() == 0) {
throw new IOException("Connection to server lost!");
}
- this.currentServerResponseHeader =
OldMapiServerResponseParser.ParseOldMapiServerResponse(this);
+ this.currentServerResponseHeader =
OldMapiServerResponseParser.parseOldMapiServerResponse(this);
if (this.currentServerResponseHeader == ServerResponses.ERROR &&
!this.lineBuffer.toString()
.matches("^[0-9A-Z]{5}!.+")) {
int limit = this.lineBuffer.limit();
@@ -139,7 +139,7 @@ public class OldMapiProtocol extends Abs
*/
@Override
public int getNextStarterHeader() {
- return OldMapiStartOfHeaderParser.GetNextStartHeaderOnOldMapi(this);
+ return OldMapiStartOfHeaderParser.getNextStartHeaderOnOldMapi(this);
}
/**
@@ -155,10 +155,10 @@ public class OldMapiProtocol extends Abs
@Override
public ResultSetResponse getNextResultSetResponse(MonetConnection con,
MonetConnection.ResponseList list, int seqnr,
int maxrows) throws
ProtocolException {
- int id = OldMapiStartOfHeaderParser.GetNextResponseDataAsInt(this);
//The order cannot be switched!!
- int tuplecount =
OldMapiStartOfHeaderParser.GetNextResponseDataAsInt(this);
- int columncount =
OldMapiStartOfHeaderParser.GetNextResponseDataAsInt(this);
- int rowcount =
OldMapiStartOfHeaderParser.GetNextResponseDataAsInt(this);
+ int id = OldMapiStartOfHeaderParser.getNextResponseDataAsInt(this);
//The order cannot be switched!!
+ int tuplecount =
OldMapiStartOfHeaderParser.getNextResponseDataAsInt(this);
+ int columncount =
OldMapiStartOfHeaderParser.getNextResponseDataAsInt(this);
+ int rowcount =
OldMapiStartOfHeaderParser.getNextResponseDataAsInt(this);
if (maxrows != 0 && tuplecount > maxrows) {
tuplecount = maxrows;
}
@@ -173,8 +173,8 @@ public class OldMapiProtocol extends Abs
*/
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list