FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

JCL-162: installation documentation by timea-solid · Pull Request #256 · inrupt/solid-client-java · GitHub

Repository navigation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2023 Inrupt Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* <h2>Sample CLI application.</h2>
*/
package com.inrupt.client.examples.cli;
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright 2023 Inrupt Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* <h2>Sample web application.</h2>
*/
package com.inrupt.client.examples.webapp;
22 changes: 22 additions & 0 deletions solid/src/site/resources/css/site.css
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#banner img {
width: 200px;
}

table.bodyTable tr.a {
background-color: #ddd;
}

table.bodyTable tr.b {
background-color: #eee;
}

div.sidebar-nav {
display: none;
}

a.externalLink,
a.externalLink[href^=http],
a.externalLink[href^=https] {
background: none;
padding-right: 0px;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Viewer requires iframe.
16 changes: 16 additions & 0 deletions solid/src/site/site.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<project name="Inrupt Client Libraries: RDF4J">

<bannerRight>
<name>Inrupt</name>
<src>images/inrupt_logo-2020.svg</src>
<href>https://inrupt.com</href>
</bannerRight>

<body>
<menu name="Module: Solid" inherit="top">
<item name="Summary" href="summary.html"/>
<item name="Dependencies" href="dependencies.html"/>
<item name="Plugins" href="plugins.html"/>
</menu>
</body>
</project>
121 changes: 121 additions & 0 deletions src/site/apt/gettingStarted.apt.vm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
Getting Started

An app developer will first need to consider how a user creates an authenticated session. Depending on the application framework in use, there may already be
a valid OpenID Id Token. Alternatively, a developer may possess a set of client credentials. Both approaches are described below. In both cases, a client object
will be needed:

----------------------
var CLIENT = SolidClient.getClient();
----------------------

* Using an existing ID Token

All interactions with Solid resources happen in the context of a <<<Session>>>. If an existing Id Token is available, the <<<Session>>> can use that value. In this
case, it will be the responsibility of the application framework to refresh the Id Token upon expiration.

----------------------
var session = OpenIdSession.ofIdToken(idToken);
var client = CLIENT.session(session);
----------------------

* Using OAuth2 Client Credentials

Using <<<client_credentials>>>, an app developer can create a session that automatically refreshes upon token expiration.

----------------------
var session = OpenIdSession.ofClientCredentials(issuer, clientId, clientSecret, authMethod);
var client = CLIENT.session(session);
----------------------

With this <<<session>>> object, one can perform normal CRUD operations on Solid resources.
Please note that, with <<<SolidClient>>>, all operations are asynchronous. For synchronous operations, use <<<SolidSyncClient>>>.

----------------------
var playlist = client.read(uri, Playlist.class);

playlist.thenAccept(p -> {
displayTitle(p.getTitle());
displaySongs(p.getSongs());
}).toCompletableFuture().join();
----------------------

One may also create new resources.

----------------------
var playlist = new Playlist(uri);
playlist.setTitle("Jazz Collection");
playlist.addSong(song1);
playlist.addSong(song2);

client.create(playlist).toCompletableFuture().join();
-----------------------

Or update existing resources.

-----------------------
var playlist = client.read(uri, Playlist.class);

playlist.thenCompose(p -> {
p.setTitle("Bossa Nova");
p.removeSong(song1);
p.addSong(song3);
return client.update(p);
}).toCompletableFuture().join();
-----------------------

Or delete resources.

-----------------------
client.delete(uri).toCompletableFuture().join();
-----------------------

One can use the provided Solid classes to list resources across a user's storage locations.

-----------------------
session.getPrincipal().ifPresent(webid ->
client.send(Request.newBuilder(webid).header("Accept", "text/turtle").build(),
WebIdBodyHandlers.ofWebIdProfile(webid))
.thenApply(Response::body)
.thenAccept(profile ->
profile.getStorage().stream().forEach(storage -> {
LOGGER.info("Storage: {}", storage);
client.read(storage, SolidContainer.class).thenAccept(s ->
s.getContainedResources().forEach(r ->
LOGGER.info("Resource: {}", r.getIdentifier())))))
.toCompletableFuture().join());
-----------------------

* Example applications

** A sample Web Application

The {{{https://inrupt.github.io/solid-client-java/apidocs/com/inrupt/client/examples/webapp/package-summary.html}web app example}} is a Quarkus application implementing a similar pattern to look up a user's WebID profile and then display the contents of a user's storage.

To set up the example application the following configuration values need to be added for this to work properly:

---------------------
quarkus.oidc.auth-server-url=<URL of Solid-OIDC server>
quarkus.oidc.client-id=<URL of Client Identifier>
---------------------

Remark: <<<client-id>>> is a {{{https://solidproject.org/TR/oidc#clientids-document}Client ID Document}}.

The above configuration values are typically added to a <<<./config/application.properties>>> file in the directory where the application is run.

To build the application, use this command:

---------------------
$ ./mvnw package
---------------------

To run the application, use this command:

---------------------
$ java -jar examples/webapp/target/quarkus-app/quarkus-run.jar
---------------------

The application will be available at <<<http://localhost:8080>>>.

** A sample CLI Application

The {{{https://inrupt.github.io/solid-client-java/apidocs/com/inrupt/client/examples/webapp/package-summary.html}cli app example}} is a CLI utility application interacting with a Solid Storage. It is making use of OAuth2 Client Credentials to access the Pod Storage.
Loading

Back | FazBrowse Home | New Git URL