Skip to content

Commit

Permalink
Merge pull request #397 from apache/bugfix/385-Allow-import-of-type-s…
Browse files Browse the repository at this point in the history
…ystems-published-through-SPI

Issue #385: Allow import of type systems published through SPI
  • Loading branch information
reckart authored Sep 30, 2024
2 parents e33e8d0 + aa50d4c commit a5a825a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 24 deletions.
11 changes: 6 additions & 5 deletions uimafit-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@
org.apache.uima.fit.*
</Export-Package>
<Require-Capability>
osgi.extender;filter:="(osgi.extender=osgi.serviceloader.processor)";resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.TypeSystemDescriptionProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.TypePrioritiesProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.FsIndexCollectionProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.fit.validation.ValidationCheck)";cardinality:=multiple;resolution:=optional
osgi.extender;filter:="(osgi.extender=osgi.serviceloader.processor)";resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.TypeSystemProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.TypeSystemDescriptionProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.TypePrioritiesProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.FsIndexCollectionProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.fit.validation.ValidationCheck)";cardinality:=multiple;resolution:=optional
</Require-Capability>
</instructions>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,15 @@ static void loadFsIndexCollectionsfromSPIs(List<FsIndexDescription> fsIndexList)
var loaded = Collections.newSetFromMap(new IdentityHashMap<>());

ServiceLoader.load(FsIndexCollectionProvider.class).forEach(provider -> {
loaded.add(provider);
for (var fsIdxCol : provider.listFsIndexCollections()) {
loaded.add(fsIdxCol);
fsIndexList.addAll(asList(fsIdxCol.getFsIndexes()));
LOG.debug("Loaded SPI-provided index collection at [{}]", fsIdxCol.getSourceUrlString());
LOG.debug("Loaded legacy SPI-provided index collection at [{}]",
fsIdxCol.getSourceUrlString());
}
});

ServiceLoader.load(TypeSystemProvider.class).forEach(provider -> {
if (loaded.contains(provider)) {
return;
}

for (var fsIdxCol : provider.listFsIndexCollections()) {
if (loaded.contains(fsIdxCol)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,14 @@ static void loadTypePrioritiesFromSPIs(List<TypePriorities> typePrioritiesList)
var loaded = Collections.newSetFromMap(new IdentityHashMap<>());

ServiceLoader.load(TypePrioritiesProvider.class).forEach(provider -> {
loaded.add(provider);

for (var desc : provider.listTypePriorities()) {
loaded.add(desc);
typePrioritiesList.add(desc);
LOG.debug("Loaded SPI-provided type priorities at [{}]", desc.getSourceUrlString());
LOG.debug("Loaded legacy SPI-provided type priorities at [{}]", desc.getSourceUrlString());
}
});

ServiceLoader.load(TypeSystemProvider.class).forEach(provider -> {
if (loaded.contains(provider)) {
return;
}

for (var desc : provider.listTypePriorities()) {
if (loaded.contains(desc)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,14 @@ static void loadTypeSystemDescriptionsFromSPIs(List<TypeSystemDescription> tsdLi
var loaded = Collections.newSetFromMap(new IdentityHashMap<>());

ServiceLoader.load(TypeSystemDescriptionProvider.class).forEach(provider -> {
loaded.add(provider);
for (var desc : provider.listTypeSystemDescriptions()) {
loaded.add(desc);
tsdList.add(desc);
LOG.debug("Loaded SPI-provided type system at [{}]", desc.getSourceUrlString());
LOG.debug("Loaded legacy SPI-provided type system at [{}]", desc.getSourceUrlString());
}
});

ServiceLoader.load(TypeSystemProvider.class).forEach(provider -> {
if (loaded.contains(provider)) {
return;
}

for (var desc : provider.listTypeSystemDescriptions()) {
if (loaded.contains(desc)) {
continue;
Expand Down
1 change: 1 addition & 0 deletions uimaj-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
<Require-Capability>
osgi.extender;filter:="(osgi.extender=osgi.serviceloader.processor)";resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.JCasClassProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.TypeSystemProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.TypeSystemDescriptionProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.TypePrioritiesProvider)";cardinality:=multiple;resolution:=optional,
osgi.serviceloader;filter:="(osgi.serviceloader=org.apache.uima.spi.FsIndexCollectionProvider)";cardinality:=multiple;resolution:=optional
Expand Down

0 comments on commit a5a825a

Please sign in to comment.