Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[lyo-dev] eclipse/Lyo Java Client API updates for release 4.0.0

Since Apache Wink has been retired, and the current oslc-java-client includes a large set of Wink jar files that bloat up client implementations, we decided to remove Wink from OSLC4J.

Unfortunately, for the Java client, that would result in some API breaking changes. So we decided to leave oslc-java-client alone - it and its sample applications are unchanged in 4.0.0, and still depend on Wink. As expected, this client works with servers that are implemented using Wink or Jersey, so there was no need to change it.

In addition, I created a new Java client, oslc4j-client that only depends on JAX-RS 2.0. This client does not reference any JAX-RS implementation, leaving the choice of the implementation up to the client applications. It also does not support SSL or any authentication, also leaving those specifics up to the client applications as needed. This radically simplifies the oslc4j-client, and reduces its size, while providing the flexibility client applications need to configure their client access.

The new OslcClient constructor can now take a single ClientBuilder argument. The client application creates and configures a ClientBuilder to meet their needs, and passes in the OslcClient(ClientBuilder) constructor for subsequent use.

I have also added Jazz rootservices discovery methods directly to OslcClient since these are often necessary to discover OSLC discovery URLs (and something we're considering adding to the OSLC standards).

As a result, there is no longer any need for OslcClient subclasses for rootservices processing, Jazz Form based authentication, etc.

Here's an example of how a client application would configure, create and use an OslcClient to access jazz-apps that use JEE Form based authentication, taken from the oslc4j-client-samples/IECMSample.java sample application. HTTP Basic, Digest, etc. can be handled similarly:

                        // STEP 1: Configure the ClientBuilder as needed for your client application
                       
                        // Use HttpClient instead of the default HttpUrlConnection
                        ClientConfig clientConfig= newClientConfig().connectorProvider(newApacheConnectorProvider());
                        ClientBuilder clientBuilder= ClientBuilder.newBuilder();
                        clientBuilder.withConfig(clientConfig);
                       
                        // Setup SSL support to ignore self-assigned SSL certificates
                    SSLContextBuilder sslContextBuilder= newSSLContextBuilder();
                    sslContextBuilder.loadTrustMaterial(TrustSelfSignedStrategy.INSTANCE);
                    clientBuilder.sslContext(sslContextBuilder.build());
                    clientBuilder.hostnameVerifier(NoopHostnameVerifier.INSTANCE);
                                       
                    // IBM jazz-apps use JEE Form based authentication
                    clientBuilder.register(newJEEFormAuthenticator(webContextUrl, userId, password));

                    // STEP 2: Create a new OslcClient using the above configuration
                        OslcClient client= newOslcClient(clientBuilder);

                        // STEP 3: Get the URL of the OSLC ChangeManagement service from the rootservicesdocument
                        String catalogUrl= client.getCatalogUrl(webContextUrl, OSLCConstants.OSLC_CM_V2);

                        // STEP 4: Find the OSLC Service Provider for the project area we want to work with
                        String serviceProviderUrl= client.lookupServiceProviderUrl(catalogUrl, projectArea);

JEE FormAuthenticator is included in oslc4j-client for convenience, and to provide an example for how other authentication filters could be developed.

Let me know if this is sufficient to meet you OSLC4J Java client needs as we are in the process of finishing up the 4.0.0 release.



Jim Amsden, Senior Technical Staff Member
OSLC and Linked Lifecycle Data
919-525-6575


Back to the top