Skip to content

Commit

Permalink
GH-2710 moved transaction stuff and annotations to commons modules
Browse files Browse the repository at this point in the history
  • Loading branch information
abrokenjester committed Jul 24, 2021
1 parent 128e5e0 commit 8d7c35d
Show file tree
Hide file tree
Showing 148 changed files with 249 additions and 284 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

import java.io.StringReader;

import org.eclipse.rdf4j.IsolationLevel;
import org.eclipse.rdf4j.RDF4JException;
import org.eclipse.rdf4j.common.transaction.IsolationLevel;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.query.QueryLanguage;
import org.eclipse.rdf4j.query.Update;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import static org.junit.Assert.fail;

import org.eclipse.rdf4j.IsolationLevel;
import org.eclipse.rdf4j.RDF4JException;
import org.eclipse.rdf4j.common.transaction.IsolationLevel;
import org.eclipse.rdf4j.repository.RDFSchemaRepositoryConnectionTest;
import org.eclipse.rdf4j.repository.Repository;
import org.eclipse.rdf4j.repository.RepositoryConnectionTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import java.lang.reflect.Field;
import java.util.List;

import org.eclipse.rdf4j.IsolationLevel;
import org.eclipse.rdf4j.RDF4JException;
import org.eclipse.rdf4j.common.iteration.Iterations;
import org.eclipse.rdf4j.common.transaction.IsolationLevel;
import org.eclipse.rdf4j.http.protocol.Protocol;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Statement;
Expand Down
23 changes: 23 additions & 0 deletions core/common/annotation/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.rdf4j</groupId>
<artifactId>rdf4j-common</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>rdf4j-common-annotation</artifactId>
<name>RDF4J: common annotation</name>
<description>RDF4J common annotation classes</description>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
37 changes: 1 addition & 36 deletions core/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,12 @@
<name>RDF4J: common</name>
<description>RDF4J common: shared classes</description>
<modules>
<module>annotation</module>
<module>io</module>
<module>iterator</module>
<module>text</module>
<module>transaction</module>
<module>util</module>
<module>xml</module>
</modules>
<!--
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rdf4j-model-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmhVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmhVersion}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
-->
</project>
4 changes: 1 addition & 3 deletions core/common/text/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.rdf4j</groupId>
Expand Down
6 changes: 2 additions & 4 deletions core/common/transaction/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.rdf4j</groupId>
Expand All @@ -14,7 +12,7 @@
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rdf4j-model-api</artifactId>
<artifactId>rdf4j-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*******************************************************************************/
package org.eclipse.rdf4j;

import org.eclipse.rdf4j.common.transaction.TransactionSetting;
import org.eclipse.rdf4j.model.IRI;
package org.eclipse.rdf4j.common.transaction;

/**
* A Transaction Isolation Level. Default levels supported by RDF4J are provided by {@link IsolationLevels}, third-party
Expand All @@ -34,16 +31,6 @@ public interface IsolationLevel extends TransactionSetting {
*/
boolean isCompatibleWith(IsolationLevel otherLevel);

/**
* Get a URI uniquely representing this isolation level.
*
* @deprecated use getName() and getValue() instead.
*
* @return a URI that uniquely represents this isolation level.
*/
@Deprecated
IRI getURI();

@Override
default String getName() {
return NAME;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*******************************************************************************/
package org.eclipse.rdf4j;
package org.eclipse.rdf4j.common.transaction;

import java.util.Arrays;
import java.util.List;

import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.model.vocabulary.SESAME;

/**
* Enumeration of Transaction {@link IsolationLevel}s supported by Sesame. Note that Sesame stores are not required to
* support all levels, consult the documentatation for the specific SAIL implementation you are using to find out which
Expand Down Expand Up @@ -108,10 +103,4 @@ public static IsolationLevel getCompatibleIsolationLevel(IsolationLevel level,
return level;
}
}

@Override
public IRI getURI() {
final ValueFactory f = SimpleValueFactory.getInstance();
return f.createIRI(SESAME.NAMESPACE, this.name());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*******************************************************************************/
package org.eclipse.rdf4j;
package org.eclipse.rdf4j.common.transaction;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand All @@ -25,7 +25,9 @@
public class IsolationLevelsTest {

/**
* Test method for {@link org.eclipse.rdf4j.IsolationLevels#isCompatibleWith(org.eclipse.rdf4j.IsolationLevel)} .
* Test method for
* {@link org.eclipse.rdf4j.common.transaction.IsolationLevels#isCompatibleWith(org.eclipse.rdf4j.common.transaction.IsolationLevel)}
* .
*/
@Test
public void testIsCompatibleWith() {
Expand All @@ -37,7 +39,7 @@ public void testIsCompatibleWith() {

/**
* Test method for
* {@link org.eclipse.rdf4j.IsolationLevels#getCompatibleIsolationLevel(org.eclipse.rdf4j.IsolationLevel, java.util.List)}
* {@link org.eclipse.rdf4j.common.transaction.IsolationLevels#getCompatibleIsolationLevel(org.eclipse.rdf4j.common.transaction.IsolationLevel, java.util.List)}
* .
*/
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

package org.eclipse.rdf4j.common.xml;

import org.eclipse.rdf4j.common.text.StringUtil;

/**
* Utility methods for handling and processing XML data.
*/
Expand All @@ -21,10 +19,10 @@ public class XMLUtil {
* return (\r)</tt>.
*/
public static String escapeCharacterData(String text) {
text = StringUtil.gsub("&", "&amp;", text);
text = StringUtil.gsub("<", "&lt;", text);
text = StringUtil.gsub(">", "&gt;", text);
text = StringUtil.gsub("\r", "&#xD;", text);
text = text.replace("&", "&amp;");
text = text.replace("<", "&lt;");
text = text.replace(">", "&gt;");
text = text.replace("\r", "&#xD;");
return text;
}

Expand All @@ -35,7 +33,7 @@ public static String escapeCharacterData(String text) {
*/
public static String escapeDoubleQuotedAttValue(String value) {
value = _escapeAttValue(value);
value = StringUtil.gsub("\"", "&quot;", value);
value = value.replace("\"", "&quot;");
return value;
}

Expand All @@ -46,17 +44,17 @@ public static String escapeDoubleQuotedAttValue(String value) {
*/
public static String escapeSingleQuotedAttValue(String value) {
value = _escapeAttValue(value);
value = StringUtil.gsub("'", "&apos;", value);
value = value.replace("'", "&apos;");
return value;
}

private static String _escapeAttValue(String value) {
value = StringUtil.gsub("&", "&amp;", value);
value = StringUtil.gsub("<", "&lt;", value);
value = StringUtil.gsub(">", "&gt;", value);
value = StringUtil.gsub("\t", "&#x9;", value);
value = StringUtil.gsub("\n", "&#xA;", value);
value = StringUtil.gsub("\r", "&#xD;", value);
value = value.replace("&", "&amp;");
value = value.replace("<", "&lt;");
value = value.replace(">", "&gt;");
value = value.replace("\t", "&#x9;");
value = value.replace("\n", "&#xA;");
value = value.replace("\r", "&#xD;");
return value;
}

Expand Down Expand Up @@ -217,11 +215,11 @@ public static final boolean isNCNameChar(char c) {
* @see #resolveEntities
*/
public static String escapeAttributeValue(String value) {
String result = StringUtil.gsub("&", "&amp;", value);
result = StringUtil.gsub("<", "&lt;", result);
result = StringUtil.gsub(">", "&gt;", result);
result = StringUtil.gsub("\"", "&quot;", result);
result = StringUtil.gsub("'", "&apos;", result);
String result = value.replace("&", "&amp;");
result = result.replace("<", "&lt;");
result = result.replace(">", "&gt;");
result = result.replace("\"", "&quot;");
result = result.replace("'", "&apos;");
return result;
}

Expand All @@ -232,9 +230,9 @@ public static String escapeAttributeValue(String value) {
* @see #resolveEntities
*/
public static String escapeText(String text) {
String result = StringUtil.gsub("&", "&amp;", text);
result = StringUtil.gsub("<", "&lt;", result);
result = StringUtil.gsub(">", "&gt;", result);
String result = text.replace("&", "&amp;");
result = result.replace("<", "&lt;");
result = result.replace(">", "&gt;");
return result;
}

Expand Down
9 changes: 8 additions & 1 deletion core/http/client/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.rdf4j</groupId>
Expand All @@ -10,6 +12,11 @@
<name>RDF4J: HTTP client</name>
<description>Client functionality for communicating with an RDF4J server over HTTP.</description>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rdf4j-common-transaction</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rdf4j-http-protocol</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand All @@ -56,10 +54,10 @@
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.eclipse.rdf4j.IsolationLevel;
import org.eclipse.rdf4j.OpenRDFUtil;
import org.eclipse.rdf4j.RDF4JException;
import org.eclipse.rdf4j.common.io.IOUtil;
import org.eclipse.rdf4j.common.transaction.IsolationLevel;
import org.eclipse.rdf4j.common.transaction.TransactionSetting;
import org.eclipse.rdf4j.http.protocol.Protocol;
import org.eclipse.rdf4j.http.protocol.Protocol.Action;
Expand Down Expand Up @@ -653,13 +651,6 @@ public synchronized void beginTransaction(TransactionSetting... transactionSetti
if (transactionSetting == null) {
continue;
}
if (transactionSetting instanceof IsolationLevel) {
// also send isolation level with dedicated parameter for backward compatibility with older RDF4J
// Server
IsolationLevel isolationLevel = (IsolationLevel) transactionSetting;
params.add(new BasicNameValuePair(Protocol.ISOLATION_LEVEL_PARAM_NAME,
isolationLevel.getURI().stringValue()));
}
params.add(
new BasicNameValuePair(
TRANSACTION_SETTINGS_PREFIX + transactionSetting.getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.apache.http.Header;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.message.BasicHeader;
import org.eclipse.rdf4j.IsolationLevels;
import org.eclipse.rdf4j.common.transaction.IsolationLevels;
import org.eclipse.rdf4j.http.protocol.Protocol;
import org.eclipse.rdf4j.query.resultio.TupleQueryResultFormat;
import org.eclipse.rdf4j.repository.config.RepositoryConfig;
Expand Down
11 changes: 10 additions & 1 deletion core/model-api/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.rdf4j</groupId>
Expand All @@ -9,6 +11,13 @@
<artifactId>rdf4j-model-api</artifactId>
<name>RDF4J: Model API</name>
<description>RDF model interfaces.</description>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rdf4j-common-annotation</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
Expand Down
Loading

0 comments on commit 8d7c35d

Please sign in to comment.