Github user rvesse commented on a diff in the pull request: https://github.com/apache/jena/pull/197#discussion_r92841987 --- Diff: jena-rdfconnection/src/main/java/org/apache/jena/rdfconnection/RDFConnectionRemote.java --- @@ -0,0 +1,478 @@ +/* + * 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. + */ + +package org.apache.jena.rdfconnection; + +import static java.util.Objects.requireNonNull ; + +import java.io.File ; +import java.io.InputStream ; +import java.util.concurrent.locks.ReentrantLock ; +import java.util.function.Supplier ; + +import org.apache.http.HttpEntity ; +import org.apache.http.client.HttpClient ; +import org.apache.http.entity.EntityTemplate ; +import org.apache.http.protocol.HttpContext ; +import org.apache.jena.atlas.io.IO ; +import org.apache.jena.atlas.web.HttpException ; +import org.apache.jena.atlas.web.TypedInputStream ; +import org.apache.jena.graph.Graph ; +import org.apache.jena.query.* ; +import org.apache.jena.rdf.model.Model ; +import org.apache.jena.rdf.model.ModelFactory ; +import org.apache.jena.riot.* ; +import org.apache.jena.riot.web.HttpCaptureResponse ; +import org.apache.jena.riot.web.HttpOp ; +import org.apache.jena.riot.web.HttpResponseLib ; +import org.apache.jena.sparql.ARQException ; +import org.apache.jena.sparql.core.DatasetGraph ; +import org.apache.jena.sparql.core.Transactional ; +import org.apache.jena.system.Txn ; +import org.apache.jena.update.UpdateExecutionFactory ; +import org.apache.jena.update.UpdateProcessor ; +import org.apache.jena.update.UpdateRequest ; +import org.apache.jena.web.HttpSC ; + +/** + * + */ +public class RDFConnectionRemote implements RDFConnection { + private static final String fusekiDftSrvQuery = "sparql" ; + private static final String fusekiDftSrvUpdate = "update" ; + private static final String fusekiDftSrvGSP = "data" ; + + private boolean isOpen = true ; + private final String destination ; + private final String svcQuery ; + private final String svcUpdate ; + private final String svcGraphStore ; + private HttpClient httpClient ; + private HttpContext httpContext = null ; + + // Builder? + // HttpContext, HttpClient. + // Statics for "query", "query+update" : SparqlQueryConnectionRemote > SparqlUpdateConnectionRemote > RDFConnectionRemote + // XXX Very long "HttpOp.execHttpPost" + + /** Create connection that wil use the {@link HttpClient} using URL of the dataset and default service names */ + public RDFConnectionRemote(HttpClient httpClient, String destination) { + this(httpClient, + requireNonNull(destination), + fusekiDftSrvQuery, + fusekiDftSrvUpdate, + fusekiDftSrvGSP) ; + } + + + /** Create connection, using URL of the dataset and default service names */ + public RDFConnectionRemote(String destination) { + this(requireNonNull(destination), + fusekiDftSrvQuery, + fusekiDftSrvUpdate, + fusekiDftSrvGSP) ; + } + + // ?? + /** Create connection, using full URLs for services. Pass a null for "no service endpoint". */ + public RDFConnectionRemote(String sQuery, String sUpdate, String sGSP) { + this(null, sQuery, sUpdate, sGSP) ; + } + + /** Create connection, using URL of the dataset and short names for the services */ + public RDFConnectionRemote(String destination, String sQuery, String sUpdate, String sGSP) { + this(null, destination, sQuery, sUpdate, sGSP) ; + } + + /** Create connection, using URL of the dataset and short names for the services */ + public RDFConnectionRemote(HttpClient httpClient, String destination, String sQuery, String sUpdate, String sGSP) { + this.destination = destination ; + this.svcQuery = formServiceURL(destination,sQuery) ; + this.svcUpdate = formServiceURL(destination,sUpdate) ; + this.svcGraphStore = formServiceURL(destination,sGSP) ; +// if ( httpClient == null ) --- End diff -- I am guessing that the null check is unnecessary because passing a null client to `HttpOp` causes the default client to be used?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---