Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

package org.apache.arrow.adapter.jdbc;

/**
* String constants used for metadata returned on Vectors.
*/
public class Constants {
private Constants() {}

public static final String SQL_CATALOG_NAME_KEY = "SQL_CATALOG_NAME";
public static final String SQL_TABLE_NAME_KEY = "SQL_TABLE_NAME";
Expand Down
9 changes: 9 additions & 0 deletions java/dev/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,15 @@
<property name="suppressLoadErrors" value="true"/>
<property name="ignoreMethodNamesRegex" value="main"/>
</module>
<module name="JavadocType">
<property name="scope" value="public"/>
</module>
<module name="JavadocType">
<property name="scope" value="protected"/>
</module>
<module name="JavadocType">
<property name="scope" value="package"/>
</module>
<module name="MethodName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
<message key="name.invalidPattern"
Expand Down
2 changes: 2 additions & 0 deletions java/dev/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<suppress checks="JavadocPackage" files=".*[\\/]examples[\\/].*"/>
<!-- Method javadoc not required in testing directories -->
<suppress checks="JavadocMethod" files=".*[\\/]src[\\/]test[\\/].*"/>
<!-- Class javadoc not required in testing directories -->
<suppress checks="JavadocType" files=".*[\\/]src[\\/]test[\\/].*"/>

<!-- suppress all checks in the generated directories -->
<suppress checks=".*" files=".+[\\/]generated[\\/].+\.java" />
Expand Down
5 changes: 5 additions & 0 deletions java/flight/src/main/java/org/apache/arrow/flight/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

import com.google.protobuf.ByteString;

/**
* An opaque action for the service to perform.
*
* <p>This is a POJO wrapper around the message of the same name in Flight.proto.
*/
public class Action {

private final String type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class ArrowMessage implements AutoCloseable {

private static Marshaller<FlightData> NO_BODY_MARSHALLER = ProtoUtils.marshaller(FlightData.getDefaultInstance());

/** Types of messages that can be sent. */
public static enum HeaderType {
NONE,
SCHEMA,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public <T extends AbstractStub<T>> T wrapStub(T stub) {
}
}

/**
* CallOptions specific to GRPC stubs.
*/
interface GrpcCallOption extends CallOption {
<T extends AbstractStub<T>> T wrapStub(T stub);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

import com.google.protobuf.ByteString;

/**
* An opaque object that can be used to filter a list of streams available from a server.
*
* <p>This is a POJO wrapper around the protobuf Criteria message.
*/
public class Criteria {

public static Criteria ALL = new Criteria((byte[]) null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ public PutResult getResult() {
}
}

/**
* Interface for subscribers to a stream returned by the server.
*/
public interface ClientStreamListener {

public void putNext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@

package org.apache.arrow.flight;

/**
* String constants relevant to flight implementations.
*/
public interface FlightConstants {

public static final String SERVICE = "arrow.flight.protocol.FlightService";
String SERVICE = "arrow.flight.protocol.FlightService";

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
import com.google.common.collect.ImmutableList;
import com.google.protobuf.ByteString;

/**
* An identifier for a particular set of data. This can either be an opaque command that generates
* the data or a static "path" to the data. This is a POJO wrapper around the protobuf message with
* the same name.
*/
public class FlightDescriptor {

private boolean isCmd;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,28 @@
*/
public interface FlightProducer {

public void getStream(CallContext context, Ticket ticket,
void getStream(CallContext context, Ticket ticket,
ServerStreamListener listener);

public void listFlights(CallContext context, Criteria criteria,
void listFlights(CallContext context, Criteria criteria,
StreamListener<FlightInfo> listener);

public FlightInfo getFlightInfo(CallContext context,
FlightInfo getFlightInfo(CallContext context,
FlightDescriptor descriptor);

public Callable<PutResult> acceptPut(CallContext context,
Callable<PutResult> acceptPut(CallContext context,
FlightStream flightStream);

public void doAction(CallContext context, Action action,
void doAction(CallContext context, Action action,
StreamListener<Result> listener);

public void listActions(CallContext context,
void listActions(CallContext context,
StreamListener<ActionType> listener);

public interface ServerStreamListener {
/**
* Listener for creating a stream on the server side.
*/
interface ServerStreamListener {

boolean isCancelled();

Expand All @@ -61,7 +64,12 @@ public interface ServerStreamListener {

}

public interface StreamListener<T> {
/**
* Callbacks for pushing objects to a receiver.
*
* @param <T> Type of the values in the stream.
*/
interface StreamListener<T> {

void onNext(T val);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
import io.netty.channel.EventLoopGroup;
import io.netty.channel.ServerChannel;

/**
* Generic server of flight data that is customized via construction with delegate classes for the
* actual logic. The server currently uses GRPC as its transport mechanism.
*/
public class FlightServer implements AutoCloseable {

private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(FlightServer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
import io.grpc.stub.ServerCallStreamObserver;
import io.grpc.stub.StreamObserver;

/**
* GRPC service implementation for a flight server.
*/
class FlightService extends FlightServiceImplBase {

private static final Logger logger = LoggerFactory.getLogger(FlightService.class);
Expand Down Expand Up @@ -188,6 +191,9 @@ public void getFlightInfo(Flight.FlightDescriptor request, StreamObserver<Flight
}
}

/**
* Call context for the service.
*/
static class CallContext implements FlightProducer.CallContext {

private final String peerIdentity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,19 @@ StreamObserver<ArrowMessage> asObserver() {
return new Observer();
}

/**
* Provides a callback to cancel a process that is in progress.
*/
public interface Cancellable {
void cancel(String message, Throwable exception);
}

/**
* Provides a interface to request more items from a stream producer.
*/
public interface Requestor {
/**
* Requests <code>count</code> more messages from the reuqestor.
* Requests <code>count</code> more messages from the instance of this object.
*/
void request(int count);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

package org.apache.arrow.flight;

/**
* Unused?.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what this is for and I don't see where it is used either, maybe @jacques-n can comment?

*/
class GenericOperation {

private final String type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

import org.apache.arrow.flight.impl.Flight.PutResult;

/**
* A {@link FlightProducer} that throws on all operations.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not sure why a noop producer throws on all operations :) should we change this (in another jira probably?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be changed later, but the Javadoc is fine. (It's just meant to provide default implementations - guess no-op is misleading for what it does though.)

*/
public class NoOpFlightProducer implements FlightProducer {

@Override
Expand Down
5 changes: 5 additions & 0 deletions java/flight/src/main/java/org/apache/arrow/flight/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

import com.google.protobuf.ByteString;

/**
* Opaque result returned after executing an action.
*
* <p>POJO wrapper around the Flight protocol buffer message sharing the same name.
*/
public class Result {

private final byte[] body;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import io.grpc.Metadata.Key;
import io.grpc.MethodDescriptor;

/**
* Constants used in authorization of flight connections.
*/
public final class AuthConstants {

public static final String HANDSHAKE_DESCRIPTOR_NAME = MethodDescriptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public BasicServerAuthHandler(BasicAuthValidator authValidator) {
this.authValidator = authValidator;
}

/**
* Interface that this handler delegates for determining if credentials are valid.
*/
public interface BasicAuthValidator {

public byte[] getToken(String username, String password) throws Exception;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import io.grpc.Metadata;
import io.grpc.MethodDescriptor;

/**
* GRPC client intercepter that handles authentication with the server.
*/
public class ClientAuthInterceptor implements ClientInterceptor {
private volatile ClientAuthHandler authHandler = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

import io.grpc.stub.StreamObserver;

/**
* Utility class for performing authorization over using a GRPC stub.
*/
public class ClientAuthWrapper {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import java.util.Iterator;
import java.util.Optional;

/**
* Interface for Server side authentication handlers.
*/
public interface ServerAuthHandler {

/**
Expand All @@ -37,11 +40,15 @@ public interface ServerAuthHandler {
*/
boolean authenticate(ServerAuthSender outgoing, Iterator<byte[]> incoming);

public interface ServerAuthSender {
/**
* Interface for an server implementations to send back authentication messages
* back to the client.
*/
interface ServerAuthSender {

public void send(byte[] payload);
void send(byte[] payload);

public void onError(String message, Throwable cause);
void onError(String message, Throwable cause);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import io.grpc.ServerInterceptor;
import io.grpc.Status;

/**
* GRPC Interceptor for performing authentication.
*/
public class ServerAuthInterceptor implements ServerInterceptor {

private final ServerAuthHandler authHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import io.grpc.Status;
import io.grpc.stub.StreamObserver;

/**
* Contains utility methods for integrating authorization into a GRPC stream.
*/
public class ServerAuthWrapper {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

/**
* Flight server for integration testing.
*/
class IntegrationTestServer {
private static final org.slf4j.Logger LOGGER = org.slf4j.LoggerFactory.getLogger(IntegrationTestServer.class);
private final Options options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@

import org.apache.arrow.vector.types.pojo.ArrowType.Decimal;

/**
* Utility methods for working with {@link Decimal} values.
*/
public class DecimalTypeUtil {
private DecimalTypeUtil() {}

/**
* Enum for supported mathematical operations.
*/
public enum OperationType {
ADD,
SUBTRACT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import io.netty.buffer.ArrowBuf;

/*
/**
* Selection vector with records of arrow type INT16.
*/
public class SelectionVectorInt16 extends SelectionVector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import io.netty.buffer.ArrowBuf;

/*
/**
* Selection vector with records of arrow type INT32.
*/
public class SelectionVectorInt32 extends SelectionVector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.arrow.gandiva.exceptions;

/** Indicates an attempted call to methods on a closed evaluator. */
public class EvaluatorClosedException extends GandivaException {
public EvaluatorClosedException() {
super("Cannot invoke methods on evaluator after closing it");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.arrow.gandiva.exceptions;

/** Base class for all specialized exceptions this package uses. */
public class GandivaException extends Exception {

public GandivaException(String msg) {
Expand Down
Loading