Skip to content

Commit fd960dc

Browse files
committed
Core SNAPSHOT bump
1 parent 74ffa78 commit fd960dc

6 files changed

Lines changed: 33 additions & 44 deletions

File tree

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.atomgraph</groupId>
55
<artifactId>linkeddatahub</artifactId>
6-
<version>5.1.1-SNAPSHOT</version>
6+
<version>5.1.2-SNAPSHOT</version>
77
<packaging>${packaging.type}</packaging>
88

99
<name>AtomGraph LinkedDataHub</name>
@@ -130,18 +130,18 @@
130130
<dependency>
131131
<groupId>${project.groupId}</groupId>
132132
<artifactId>server</artifactId>
133-
<version>4.1.13-SNAPSHOT</version>
133+
<version>4.1.14-SNAPSHOT</version>
134134
</dependency>
135135
<dependency>
136136
<groupId>${project.groupId}</groupId>
137137
<artifactId>client</artifactId>
138-
<version>4.2.8-SNAPSHOT</version>
138+
<version>4.2.9-SNAPSHOT</version>
139139
<classifier>classes</classifier>
140140
</dependency>
141141
<dependency>
142142
<groupId>${project.groupId}</groupId>
143143
<artifactId>client</artifactId>
144-
<version>4.2.8-SNAPSHOT</version>
144+
<version>4.2.9-SNAPSHOT</version>
145145
<type>war</type>
146146
</dependency>
147147
<!-- required by jsonld-java - version same as Jersey's HTTP Client -->

src/main/java/com/atomgraph/linkeddatahub/client/GraphStoreClient.java

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,17 @@
2323
import com.atomgraph.linkeddatahub.server.security.AgentContext;
2424
import com.atomgraph.linkeddatahub.server.security.IDTokenSecurityContext;
2525
import com.atomgraph.linkeddatahub.server.security.WebIDSecurityContext;
26+
import static jakarta.ws.rs.HttpMethod.PATCH;
2627
import java.net.URI;
2728
import jakarta.ws.rs.client.Client;
2829
import jakarta.ws.rs.client.Entity;
30+
import jakarta.ws.rs.client.Invocation;
2931
import jakarta.ws.rs.client.WebTarget;
3032
import jakarta.ws.rs.core.HttpHeaders;
31-
import jakarta.ws.rs.core.MediaType;
3233
import jakarta.ws.rs.core.MultivaluedMap;
3334
import jakarta.ws.rs.core.Response;
34-
import org.apache.jena.rdf.model.Model;
35+
import java.util.List;
36+
import java.util.Map;
3537
import org.apache.jena.update.UpdateRequest;
3638
import org.slf4j.Logger;
3739
import org.slf4j.LoggerFactory;
@@ -184,54 +186,42 @@ protected WebTarget getWebTarget(URI uri)
184186
}
185187

186188
@Override
187-
public Response get(URI uri, jakarta.ws.rs.core.MediaType[] acceptedTypes)
189+
protected Invocation.Builder applyHeaders(Invocation.Builder builder, MultivaluedMap<String, Object> headers)
188190
{
189-
WebTarget webTarget = getWebTarget(uri);
190-
return new RetryAfterHelper(getDefaultDelayMillis(), getMaxRetryCount()).invokeWithRetry(() ->
191-
webTarget.request(acceptedTypes)
192-
.header(HttpHeaders.USER_AGENT, getUserAgentHeaderValue())
193-
.get());
191+
if (headers != null)
192+
for (Map.Entry<String, List<Object>> entry : headers.entrySet())
193+
for (Object value : entry.getValue())
194+
builder = builder.header(entry.getKey(), value);
195+
196+
return builder.header(HttpHeaders.USER_AGENT, getUserAgentHeaderValue());
194197
}
195-
198+
196199
@Override
197-
public Response post(URI uri, Entity entity, MediaType[] acceptedTypes)
200+
public Response get(URI uri, jakarta.ws.rs.core.MediaType[] acceptedTypes, MultivaluedMap<String, Object> headers)
198201
{
199-
WebTarget webTarget = getWebTarget(uri);
200202
return new RetryAfterHelper(getDefaultDelayMillis(), getMaxRetryCount()).invokeWithRetry(() ->
201-
webTarget.request(acceptedTypes).post(entity));
203+
applyHeaders(getWebTarget(uri).request(acceptedTypes), headers).get());
202204
}
203-
205+
204206
@Override
205-
public Response put(URI uri, Entity entity, MediaType[] acceptedTypes)
207+
public Response post(URI uri, Entity entity, jakarta.ws.rs.core.MediaType[] acceptedTypes, MultivaluedMap<String, Object> headers)
206208
{
207-
WebTarget webTarget = getWebTarget(uri);
208209
return new RetryAfterHelper(getDefaultDelayMillis(), getMaxRetryCount()).invokeWithRetry(() ->
209-
webTarget.request(acceptedTypes).put(entity));
210+
applyHeaders(getWebTarget(uri).request(acceptedTypes), headers).post(entity));
210211
}
211212

212-
/**
213-
* Sends a PUT request with RDF model data to the specified URI.
214-
*
215-
* @param uri the target URI
216-
* @param model the RDF model to send
217-
* @param headers additional HTTP headers
218-
* @return the HTTP response
219-
*/
220-
public Response put(URI uri, Model model, MultivaluedMap<String, Object> headers)
213+
@Override
214+
public Response put(URI uri, Entity entity, jakarta.ws.rs.core.MediaType[] acceptedTypes, MultivaluedMap<String, Object> headers)
221215
{
222-
WebTarget webTarget = getWebTarget(uri);
223216
return new RetryAfterHelper(getDefaultDelayMillis(), getMaxRetryCount()).invokeWithRetry(() ->
224-
webTarget.request(getReadableMediaTypes(Model.class)).
225-
headers(headers).
226-
put(Entity.entity(model, getDefaultMediaType())));
217+
applyHeaders(getWebTarget(uri).request(acceptedTypes), headers).put(entity));
227218
}
228219

229220
@Override
230-
public Response delete(URI uri)
221+
public Response delete(URI uri, jakarta.ws.rs.core.MediaType[] acceptedTypes, MultivaluedMap<String, String> params, MultivaluedMap<String, Object> headers)
231222
{
232-
WebTarget webTarget = getWebTarget(uri);
233223
return new RetryAfterHelper(getDefaultDelayMillis(), getMaxRetryCount()).invokeWithRetry(() ->
234-
webTarget.request().delete());
224+
applyHeaders(getWebTarget(uri).request(acceptedTypes), headers).delete());
235225
}
236226

237227
/**
@@ -249,7 +239,7 @@ public Response patch(URI uri, UpdateRequest updateRequest)
249239
String updateString = updateRequest.toString();
250240

251241
return new RetryAfterHelper(getDefaultDelayMillis(), getMaxRetryCount()).invokeWithRetry(() ->
252-
webTarget.request().method("PATCH", Entity.entity(updateString, "application/sparql-update")));
242+
webTarget.request().method(PATCH, Entity.entity(updateString, com.atomgraph.linkeddatahub.MediaType.APPLICATION_SPARQL_UPDATE_TYPE)));
253243
}
254244

255245
/**

src/main/java/com/atomgraph/linkeddatahub/imports/stream/RDFGraphStoreOutput.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.atomgraph.linkeddatahub.server.exception.ImportException;
2222
import java.io.InputStream;
2323
import jakarta.ws.rs.client.Client;
24+
import jakarta.ws.rs.client.Entity;
2425
import jakarta.ws.rs.core.HttpHeaders;
2526
import jakarta.ws.rs.core.MultivaluedHashMap;
2627
import jakarta.ws.rs.core.MultivaluedMap;
@@ -111,7 +112,7 @@ public void write()
111112
MultivaluedMap<String, Object> headers = new MultivaluedHashMap();
112113
headers.putSingle(HttpHeaders.IF_NONE_MATCH, "*");
113114

114-
try (Response putResponse = getGraphStoreClient().put(URI.create(graphUri), namedModel, headers))
115+
try (Response putResponse = getGraphStoreClient().put(URI.create(graphUri), Entity.entity(namedModel, getGraphStoreClient().getDefaultMediaType()), new jakarta.ws.rs.core.MediaType[]{}, headers))
115116
{
116117
if (putResponse.getStatusInfo().equals(Response.Status.PRECONDITION_FAILED))
117118
{
@@ -152,7 +153,7 @@ public void write()
152153
MultivaluedMap<String, Object> headers = new MultivaluedHashMap();
153154
headers.putSingle(HttpHeaders.IF_NONE_MATCH, "*");
154155

155-
try (Response putResponse = getGraphStoreClient().put(URI.create(getGraphURI()), model, headers))
156+
try (Response putResponse = getGraphStoreClient().put(URI.create(getGraphURI()), Entity.entity(model, getGraphStoreClient().getDefaultMediaType()), new jakarta.ws.rs.core.MediaType[]{}, headers))
156157
{
157158
if (putResponse.getStatusInfo().equals(Response.Status.PRECONDITION_FAILED))
158159
{

src/main/java/com/atomgraph/linkeddatahub/imports/stream/csv/CSVGraphStoreRowProcessor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.univocity.parsers.common.ParsingContext;
2323
import com.univocity.parsers.common.processor.RowProcessor;
2424
import jakarta.ws.rs.client.Client;
25+
import jakarta.ws.rs.client.Entity;
2526
import jakarta.ws.rs.core.HttpHeaders;
2627
import jakarta.ws.rs.core.MultivaluedHashMap;
2728
import jakarta.ws.rs.core.MultivaluedMap;
@@ -121,7 +122,7 @@ protected void add(Model namedModel, String graphURI)
121122
MultivaluedMap<String, Object> headers = new MultivaluedHashMap();
122123
headers.putSingle(HttpHeaders.IF_NONE_MATCH, "*");
123124

124-
try (Response putResponse = getGraphStoreClient().put(URI.create(graphURI), namedModel, headers))
125+
try (Response putResponse = getGraphStoreClient().put(URI.create(graphURI), Entity.entity(namedModel, getGraphStoreClient().getDefaultMediaType()), new jakarta.ws.rs.core.MediaType[]{}, headers))
125126
{
126127
if (putResponse.getStatusInfo().equals(Response.Status.PRECONDITION_FAILED))
127128
{

src/main/java/com/atomgraph/linkeddatahub/resource/admin/pkg/InstallPackage.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.atomgraph.linkeddatahub.apps.model.AdminApplication;
2121
import com.atomgraph.linkeddatahub.apps.model.EndUserApplication;
2222
import com.atomgraph.linkeddatahub.client.GraphStoreClient;
23-
import com.atomgraph.linkeddatahub.resource.Graph;
2423
import com.atomgraph.linkeddatahub.resource.admin.ClearOntology;
2524
import com.atomgraph.linkeddatahub.server.security.AgentContext;
2625
import com.atomgraph.linkeddatahub.server.util.UriPath;
@@ -40,7 +39,6 @@
4039
import jakarta.ws.rs.container.ResourceContext;
4140
import jakarta.ws.rs.core.Context;
4241
import jakarta.ws.rs.core.MediaType;
43-
import jakarta.ws.rs.core.MultivaluedHashMap;
4442
import jakarta.ws.rs.core.Response;
4543
import jakarta.ws.rs.core.UriBuilder;
4644
import org.apache.commons.codec.binary.Hex;
@@ -311,7 +309,7 @@ private void installOntology(EndUserApplication app, Model ontologyModel, String
311309
gsc = gsc.delegation(adminApp.getBaseURI(), getAgentContext().get());
312310
}
313311

314-
try (Response putResponse = gsc.put(ontologyDocumentURI, ontologyModel, new MultivaluedHashMap<>()))
312+
try (Response putResponse = gsc.put(ontologyDocumentURI, ontologyModel))
315313
{
316314
if (!putResponse.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL))
317315
{

src/main/java/com/atomgraph/linkeddatahub/resource/admin/pkg/UninstallPackage.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.atomgraph.linkeddatahub.apps.model.AdminApplication;
2121
import com.atomgraph.linkeddatahub.apps.model.EndUserApplication;
2222
import com.atomgraph.linkeddatahub.client.GraphStoreClient;
23-
import com.atomgraph.linkeddatahub.resource.Graph;
2423
import com.atomgraph.linkeddatahub.resource.admin.ClearOntology;
2524
import com.atomgraph.linkeddatahub.server.security.AgentContext;
2625
import com.atomgraph.linkeddatahub.server.util.UriPath;

0 commit comments

Comments
 (0)