Skip to content

Commit

Permalink
feat(java): add module-info.java
Browse files Browse the repository at this point in the history
Blocked by apache/arrow-java#466.

Fixes #2397.
  • Loading branch information
lidavidm committed Dec 26, 2024
1 parent ff10fc9 commit 62f6aa2
Show file tree
Hide file tree
Showing 14 changed files with 275 additions and 3 deletions.
23 changes: 23 additions & 0 deletions java/core/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module adbc.core {
requires org.apache.arrow.vector;
requires org.checkerframework.checker.qual;

exports org.apache.arrow.adbc.core;
}
26 changes: 26 additions & 0 deletions java/driver-manager/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module adbc.driver.manager {
requires adbc.core;
requires org.apache.arrow.memory.core;
requires org.checkerframework.checker.qual;

uses org.apache.arrow.adbc.drivermanager.AdbcDriverFactory;

exports org.apache.arrow.adbc.drivermanager;
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public AdbcDatabase connect(
* fully-qualified class name of an AdbcDriverFactory class.
* @return A function to construct an AdbcDriver from a BufferAllocator, or null if not found.
*/
@Nullable Function<BufferAllocator, AdbcDriver> lookupDriver(String driverFactoryName) {
public @Nullable Function<BufferAllocator, AdbcDriver> lookupDriver(String driverFactoryName) {
return driverFactoryFunctions.get(driverFactoryName);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* The ADBC driver manager, analogously to the JDBC driver manager, manages dynamic discovery and
* loading of ADBC drivers. It is not required to use ADBC; you can always directly reference a
* {@link org.apache.arrow.adbc.core.AdbcDriver} implementation.
*/
package org.apache.arrow.adbc.drivermanager;
31 changes: 31 additions & 0 deletions java/driver-manager/src/test/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module adbc.driver.manager.tests {
requires adbc.core;
requires adbc.driver.manager;
requires org.apache.arrow.memory.core;
requires org.assertj.core;
requires org.junit.jupiter.api;

uses org.apache.arrow.adbc.drivermanager.AdbcDriverFactory;

exports org.apache.arrow.adbc.drivermanagertest;

provides org.apache.arrow.adbc.drivermanager.AdbcDriverFactory with
org.apache.arrow.adbc.test.TestDriverFactory;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
* limitations under the License.
*/

package org.apache.arrow.adbc.drivermanager;
package org.apache.arrow.adbc.drivermanagertest;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.function.Function;
import org.apache.arrow.adbc.core.AdbcDriver;
import org.apache.arrow.adbc.drivermanager.AdbcDriverManager;
import org.apache.arrow.adbc.test.TestDriver;
import org.apache.arrow.adbc.test.TestDriverFactory;
import org.apache.arrow.memory.BufferAllocator;
Expand All @@ -34,6 +35,8 @@ public void testDriverFromServiceLoader() {
final Function<BufferAllocator, AdbcDriver> driverFactoryFunction =
AdbcDriverManager.getInstance().lookupDriver(TestDriverFactory.class.getCanonicalName());

assertThat(driverFactoryFunction).isNotNull();

try (BufferAllocator allocator = new RootAllocator()) {
final AdbcDriver driverInstance = driverFactoryFunction.apply(allocator);
assertThat(driverInstance.getClass()).isEqualTo(TestDriver.class);
Expand Down
32 changes: 32 additions & 0 deletions java/driver/flight-sql/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module adbc.driver.flight.sql {
requires adbc.core;
requires adbc.driver.manager;
requires adbc.sql;
requires com.github.benmanes.caffeine;
requires flight.sql.jdbc.core;
requires java.sql;
requires org.apache.arrow.flight.core;
requires org.apache.arrow.flight.sql;
requires org.apache.arrow.memory.core;
requires org.apache.arrow.vector;
requires org.checkerframework.checker.qual;

exports org.apache.arrow.adbc.driver.flightsql;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/** A Flight SQL driver for ADBC. */
package org.apache.arrow.adbc.driver.flightsql;
29 changes: 29 additions & 0 deletions java/driver/jdbc/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module adbc.driver.jdbc {
requires adbc.core;
requires adbc.driver.manager;
requires adbc.sql;
requires java.sql;
requires org.apache.arrow.adapter.jdbc;
requires org.apache.arrow.memory.core;
requires org.apache.arrow.vector;
requires org.checkerframework.checker.qual;

exports org.apache.arrow.adbc.driver.jdbc;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/** An adapter that enables use of JDBC drivers through the ADBC interface. */
package org.apache.arrow.adbc.driver.jdbc;
25 changes: 25 additions & 0 deletions java/driver/validation/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module adbc.driver.validation {
requires adbc.core;
requires org.apache.arrow.vector;
requires org.assertj.core;
requires org.junit.jupiter.api;

exports org.apache.arrow.adbc.driver.testsuite;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/** A common base testsuite for ADBC drivers. */
package org.apache.arrow.adbc.driver.testsuite;
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>--add-opens=java.base/java.nio=ALL-UNNAMED</argLine>
<argLine>--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
</configuration>
</plugin>

Expand Down
23 changes: 23 additions & 0 deletions java/sql/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

module adbc.sql {
requires org.apache.arrow.vector;
requires org.checkerframework.checker.qual;

exports org.apache.arrow.adbc.sql;
}

0 comments on commit 62f6aa2

Please sign in to comment.