Skip to content

Commit

Permalink
Rename proto to prism
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasHafner committed Mar 25, 2024
1 parent c62c182 commit eeb895f
Show file tree
Hide file tree
Showing 51 changed files with 432 additions and 451 deletions.
10 changes: 4 additions & 6 deletions src/main/java/org/polypheny/jdbc/BidirectionalScrollable.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
package org.polypheny.jdbc;

import java.sql.SQLException;

public interface BidirectionalScrollable<T> extends Scrollable<T> {

boolean absolute( int rowIndex ) throws ProtoInterfaceServiceException;
boolean absolute( int rowIndex ) throws PrismInterfaceServiceException;

boolean relative( int offset ) throws ProtoInterfaceServiceException;
boolean relative( int offset ) throws PrismInterfaceServiceException;

boolean previous() throws ProtoInterfaceServiceException;
boolean previous() throws PrismInterfaceServiceException;

void beforeFirst() throws ProtoInterfaceServiceException;
void beforeFirst() throws PrismInterfaceServiceException;

void afterLast();

Expand Down
20 changes: 10 additions & 10 deletions src/main/java/org/polypheny/jdbc/BidirectionalScroller.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class BidirectionalScroller implements BidirectionalScrollable<ArrayList<
int currentIndex;


public BidirectionalScroller( Frame frame, ProtoInterfaceClient client, int statementId, PolyphenyResultSetProperties properties, int fetchTimeout ) {
public BidirectionalScroller( Frame frame, PrismInterfaceClient client, int statementId, PolyphenyResultSetProperties properties, int fetchTimeout ) {
this.values = new ArrayList<>( TypedValueUtils.buildRows( frame.getRelationalFrame().getRowsList() ) );
if ( properties.getLargeMaxRows() != 0 && values.size() > properties.getLargeMaxRows() ) {
values.subList( longToInt( properties.getLargeMaxRows() ), values.size() ).clear();
Expand Down Expand Up @@ -67,7 +67,7 @@ private void fetchAll() throws InterruptedException {


@Override
public boolean absolute( int rowIndex ) throws ProtoInterfaceServiceException {
public boolean absolute( int rowIndex ) throws PrismInterfaceServiceException {
try {
if ( rowToIndex( rowIndex ) == currentIndex ) {
return true;
Expand Down Expand Up @@ -105,7 +105,7 @@ public boolean absolute( int rowIndex ) throws ProtoInterfaceServiceException {
currentRow = null;
return false;
} catch ( InterruptedException e ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.DRIVER_THREADING_ERROR, "Fetching of more rows failed", e );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.DRIVER_THREADING_ERROR, "Fetching of more rows failed", e );
}
}

Expand All @@ -121,7 +121,7 @@ private int indexToRow( int index ) {


@Override
public boolean relative( int offset ) throws ProtoInterfaceServiceException {
public boolean relative( int offset ) throws PrismInterfaceServiceException {
try {
if ( offset == 0 ) {
return currentRow != null;
Expand Down Expand Up @@ -150,20 +150,20 @@ public boolean relative( int offset ) throws ProtoInterfaceServiceException {
return false;
}
} catch ( InterruptedException e ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.DRIVER_THREADING_ERROR, "Fetching more rows failed.", e );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.DRIVER_THREADING_ERROR, "Fetching more rows failed.", e );
}
throw new ProtoInterfaceServiceException( "Should never be thrown!" );
throw new PrismInterfaceServiceException( "Should never be thrown!" );
}


@Override
public boolean previous() throws ProtoInterfaceServiceException {
public boolean previous() throws PrismInterfaceServiceException {
return relative( -1 );
}


@Override
public void beforeFirst() throws ProtoInterfaceServiceException {
public void beforeFirst() throws PrismInterfaceServiceException {
absolute( 0 );
}

Expand Down Expand Up @@ -206,7 +206,7 @@ public boolean last() throws InterruptedException {


@Override
public boolean next() throws ProtoInterfaceServiceException {
public boolean next() throws PrismInterfaceServiceException {
try {
considerPrefetch();
syncFetch();
Expand All @@ -217,7 +217,7 @@ public boolean next() throws ProtoInterfaceServiceException {
}
return true;
} catch ( InterruptedException e ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.DRIVER_THREADING_ERROR, "Fetching mor rows from server failed.", e );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.DRIVER_THREADING_ERROR, "Fetching mor rows from server failed.", e );
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/polypheny/jdbc/ConnectionString.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ private HashMap<String, String> importPropertiesMap( Properties properties ) {

private void parseUrl( String url ) throws SQLException {
if ( url == null ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.URL_PARSING_INVALID, "URL must no be null." );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.URL_PARSING_INVALID, "URL must no be null." );
}
if ( !url.startsWith( DriverProperties.getDRIVER_URL_SCHEMA() ) ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.URL_PARSING_INVALID, "Invalid driver schema." );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.URL_PARSING_INVALID, "Invalid driver schema." );
}
log.debug( "Parsing url: \"" + url + "\"" );
/*
Expand All @@ -71,7 +71,7 @@ private void parseUrl( String url ) throws SQLException {
*/
final int schemeSpecificPartStartIndex = url.indexOf( "//" );
if ( schemeSpecificPartStartIndex == -1 ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.URL_PARSING_INVALID, "Invalid url format." );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.URL_PARSING_INVALID, "Invalid url format." );
}
// + 1 removes the second / in //
//url = substringAfter( schemeSpecificPartStartIndex + 1, url )
Expand Down Expand Up @@ -106,7 +106,7 @@ private void parseUrl( String url ) throws SQLException {
this.parameters.put( PropertyUtils.getNAMESPACE_KEY(), uri.getPath().substring( 1 ) ); // Leading /
}
} catch ( URISyntaxException e ) {
throw new ProtoInterfaceServiceException( e );
throw new PrismInterfaceServiceException( e );
}
/*
final int authorityStartIndex = url.indexOf( "@" );
Expand Down Expand Up @@ -193,10 +193,10 @@ private void parseParameters( String parameters ) throws SQLException {
while ( tokenizer.hasMoreTokens() ) {
keyValuePair = tokenizer.nextToken().split( "=" );
if ( keyValuePair.length != 2 ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.URL_PARSING_INVALID, "Invalid parameter format." );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.URL_PARSING_INVALID, "Invalid parameter format." );
}
if ( keyValuePair[0].isEmpty() || keyValuePair[1].isEmpty() ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.URL_PARSING_INVALID, "Invalid parameter format." );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.URL_PARSING_INVALID, "Invalid parameter format." );
}
try {
String value = URLDecoder.decode( keyValuePair[1], StandardCharsets.UTF_8.name() );
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/polypheny/jdbc/ForwardOnlyScroller.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class ForwardOnlyScroller implements Scrollable<ArrayList<TypedValue>> {
private int baseIndex;


public ForwardOnlyScroller( Frame frame, ProtoInterfaceClient client, int statementId, PolyphenyResultSetProperties properties, int fetchTimeout ) {
public ForwardOnlyScroller( Frame frame, PrismInterfaceClient client, int statementId, PolyphenyResultSetProperties properties, int fetchTimeout ) {
this.values = new LinkedList<>( TypedValueUtils.buildRows( frame.getRelationalFrame().getRowsList() ) );
if ( properties.getLargeMaxRows() != 0 && values.size() > properties.getLargeMaxRows() ) {
values.subList( longToInt( properties.getLargeMaxRows() ), values.size() ).clear();
Expand Down Expand Up @@ -57,7 +57,7 @@ public void fetchAllAndSync() throws InterruptedException {


@Override
public boolean next() throws ProtoInterfaceServiceException {
public boolean next() throws PrismInterfaceServiceException {
try {
considerPrefetch();
syncFetchIfEmpty();
Expand All @@ -68,7 +68,7 @@ public boolean next() throws ProtoInterfaceServiceException {
baseIndex++;
return true;
} catch ( InterruptedException e ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.DRIVER_THREADING_ERROR, "Fetching more columns from server filed.", e );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.DRIVER_THREADING_ERROR, "Fetching more columns from server filed.", e );
}
}

Expand Down
22 changes: 11 additions & 11 deletions src/main/java/org/polypheny/jdbc/PolyConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class PolyConnection implements Connection {

private void throwIfClosed() throws SQLException {
if ( isClosed ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.CONNECTION_LOST, "Illegal operation on closed connection." );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.CONNECTION_LOST, "Illegal operation on closed connection." );
}
}

Expand All @@ -61,14 +61,14 @@ private void throwIfAutoCommit() throws SQLException {
return;
}
if ( properties.isAutoCommit() ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.OPERATION_ILLEGAL, "Illegal operation on auto committing connection." );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.OPERATION_ILLEGAL, "Illegal operation on auto committing connection." );
}
}


private void throwIfRunningTransaction() throws SQLException {
if ( hasRunningTransaction ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.OPERATION_ILLEGAL, "Illegal operation during running transaction." );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.OPERATION_ILLEGAL, "Illegal operation during running transaction." );
}
}

Expand Down Expand Up @@ -131,8 +131,8 @@ public int getTimeout() {
}


public ProtoInterfaceClient getProtoInterfaceClient() {
return properties.getProtoInterfaceClient();
public PrismInterfaceClient getProtoInterfaceClient() {
return properties.getPrismInterfaceClient();
}


Expand Down Expand Up @@ -421,7 +421,7 @@ public CallableStatement prepareCall( String sql, int resultSetType, int resultS
public PreparedStatement prepareStatement( String sql, int autoGeneratedKeys ) throws SQLException {
throwIfClosed();
if ( !PropertyUtils.isValidAutogeneratedKeys( autoGeneratedKeys ) ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.VALUE_ILLEGAL, "Illegal argument for autogenerated keys" );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.VALUE_ILLEGAL, "Illegal argument for autogenerated keys" );
}
throw new SQLFeatureNotSupportedException();
}
Expand Down Expand Up @@ -471,7 +471,7 @@ public SQLXML createSQLXML() throws SQLException {
@Override
public boolean isValid( int timeout ) throws SQLException {
if ( timeout < 0 ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.VALUE_ILLEGAL, "Illegal argument for timeout" );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.VALUE_ILLEGAL, "Illegal argument for timeout" );
}
// the proto-interface uses milliseconds for timeouts, jdbc uses seconds
return getProtoInterfaceClient().checkConnection( timeout * 1000 );
Expand All @@ -484,7 +484,7 @@ public void setClientInfo( String name, String value ) throws SQLClientInfoExcep
clientInfoProperties.setProperty( name, value );
try {
getProtoInterfaceClient().setClientInfoProperties( clientInfoProperties, properties.getNetworkTimeout() );
} catch ( ProtoInterfaceServiceException e ) {
} catch ( PrismInterfaceServiceException e ) {
throw new SQLClientInfoException( e.getMessage(), e.getSQLState(), e.getErrorCode(), new HashMap<String, ClientInfoStatus>(), e );
}
}
Expand All @@ -494,7 +494,7 @@ public void setClientInfo( String name, String value ) throws SQLClientInfoExcep
public void setClientInfo( Properties clientInfoProperties ) throws SQLClientInfoException {
try {
getProtoInterfaceClient().setClientInfoProperties( clientInfoProperties, properties.getNetworkTimeout() );
} catch ( ProtoInterfaceServiceException e ) {
} catch ( PrismInterfaceServiceException e ) {
HashMap<String, ClientInfoStatus> failedOptions = new HashMap<>();
throw new SQLClientInfoException( e.getMessage(), e.getSQLState(), e.getErrorCode(), new HashMap<>(), e );
}
Expand Down Expand Up @@ -558,7 +558,7 @@ public void abort( Executor executor ) throws SQLException {
public void setNetworkTimeout( Executor executor, int milliseconds ) throws SQLException {
throwIfClosed();
if ( milliseconds < 0 ) {
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.VALUE_ILLEGAL, "Illegal argument for timeout" );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.VALUE_ILLEGAL, "Illegal argument for timeout" );
}
properties.setNetworkTimeout( milliseconds );
}
Expand All @@ -577,7 +577,7 @@ public <T> T unwrap( Class<T> aClass ) throws SQLException {
if ( aClass.isInstance( this ) ) {
return aClass.cast( this );
}
throw new ProtoInterfaceServiceException( ProtoInterfaceErrors.WRAPPER_INCORRECT_TYPE, "Not a wrapper for " + aClass );
throw new PrismInterfaceServiceException( PrismInterfaceErrors.WRAPPER_INCORRECT_TYPE, "Not a wrapper for " + aClass );
}


Expand Down
Loading

0 comments on commit eeb895f

Please sign in to comment.