Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4C667200D4B for ; Mon, 27 Nov 2017 20:11:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 4ADBC160BFA; Mon, 27 Nov 2017 19:11:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 91939160C13 for ; Mon, 27 Nov 2017 20:11:03 +0100 (CET) Received: (qmail 21198 invoked by uid 500); 27 Nov 2017 19:11:02 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 21178 invoked by uid 99); 27 Nov 2017 19:11:02 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Nov 2017 19:11:02 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id D3A28C049D for ; Mon, 27 Nov 2017 19:11:01 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.011 X-Spam-Level: X-Spam-Status: No, score=-99.011 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KB_WAM_FROM_NAME_SINGLEWORD=0.2, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 7KymEMFMfy6S for ; Mon, 27 Nov 2017 19:11:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id CD90E5F177 for ; Mon, 27 Nov 2017 19:11:00 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 68187E002B for ; Mon, 27 Nov 2017 19:11:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2F58323F1D for ; Mon, 27 Nov 2017 19:11:00 +0000 (UTC) Date: Mon, 27 Nov 2017 19:11:00 +0000 (UTC) From: "Aaron Coburn (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (COMMONSRDF-73) Jena module has Simple dependency, SPI will never work MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 27 Nov 2017 19:11:04 -0000 [ https://issues.apache.org/jira/browse/COMMONSRDF-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16267279#comment-16267279 ] Aaron Coburn commented on COMMONSRDF-73: ---------------------------------------- Hi [~zakmck], I have some similar code [here|https://github.com/trellis-ldp/trellis-api/blob/master/src/main/java/org/trellisldp/api/RDFUtils.java#L37], which is an API that gets used by an LDP server. It, too, is independent of RDF implementations. As you have pointed out, when using commons-rdf-jena, the commons-rdf-simple jar *does* end up on the classpath, but I still will always get a JenaRDF object from `getInstance()`, since elsewhere in the code a JenaRDF object is instantiated. > Jena module has Simple dependency, SPI will never work > ------------------------------------------------------ > > Key: COMMONSRDF-73 > URL: https://issues.apache.org/jira/browse/COMMONSRDF-73 > Project: Apache Commons RDF > Issue Type: Bug > Components: jena > Affects Versions: 0.3.0 > Reporter: Marco Brandizi > > I'm trying to setup the RDF object one should use with Commons-RDF in a transparent way, using the SPI mechanism, ServiceLoader and META-INF/org.apache.commons.rdf.api.RDF. > This is the code I'm using: > {code:java} > private synchronized static RDF getDefaultRdf () > { > if ( defaultRdf != null ) return defaultRdf; > > ServiceLoader loader = ServiceLoader.load ( RDF.class ); > Iterator itr = loader.iterator(); > > if ( !itr.hasNext () ) throw new RdfException ( > "No implementation found for Commons RDF, please, review your dependencies/classpath" > ); > defaultRdf = itr.next(); > if ( itr.hasNext () ) log.warn ( > "More than one RDF instance available for Commons RDF, taking the first one ({})", > itr.next ().getClass ().getName () > ); > > return defaultRdf; > } > {code} > I've done a first test with the Jena module (commons-rdf-jena). SPI is broken by the fact this module also declares commons-rdf-simple as one of its dependencies. At least in Maven, the META-INF in commons-rdf-simple is the first that is met in the classpath and the simple implementation is the one that is picked by the code above, as reported by the warning. I expect the Jena implementation to be pulled up when I link the jena module as the only dependency. > Such dependency should be removed, and not just because of this problem (different commons implementations should be independent of each other). I've given a look at the source files and it seem the rdf-simple module is only used for testing purposes (but physically is in the main code folders). -- This message was sent by Atlassian JIRA (v6.4.14#64029)