Skip to content

Commit

Permalink
Merge pull request #73 from richardspatrick97/feature/IKDT-797-remove…
Browse files Browse the repository at this point in the history
…-autoservice

removed auto service from the project
  • Loading branch information
dettmoney authored Jan 15, 2025
2 parents bb6b47b + 03aad8d commit 0db4d93
Show file tree
Hide file tree
Showing 40 changed files with 441 additions and 466 deletions.
4 changes: 2 additions & 2 deletions collection/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
* and open the template in the editor.
*/

@SuppressWarnings("module") // 7 in HL7 is not a version reference
@SuppressWarnings("module")
// 7 in HL7 is not a version reference
module dev.ikm.tinkar.collection {
requires transitive dev.ikm.tinkar.common;
requires dev.ikm.jpms.eclipse.collections.api;
requires dev.ikm.jpms.eclipse.collections;
requires org.slf4j;
requires transitive static dev.ikm.jpms.auto.service;

exports dev.ikm.tinkar.collection;
opens dev.ikm.tinkar.collection to org.eclipse.collections.api, org.eclipse.collections;
Expand Down
12 changes: 7 additions & 5 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
</properties>

<dependencies>
<dependency>
<groupId>${tinkar-jpms-deps.groupId}</groupId>
<artifactId>auto-service</artifactId>
</dependency>

<dependency>
<groupId>${tinkar-jpms-deps.groupId}</groupId>
Expand All @@ -30,6 +26,12 @@
<dependency>
<groupId>${tinkar-jpms-deps.groupId}</groupId>
<artifactId>activej-bytebuf</artifactId>
<exclusions>
<exclusion>
<groupId>dev.ikm.jpms</groupId>
<artifactId>auto-service</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${tinkar-jpms-deps.groupId}</groupId>
Expand All @@ -45,6 +47,6 @@
<groupId>${tinkar-jpms-deps.groupId}</groupId>
<artifactId>eclipse-collections-api</artifactId>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package dev.ikm.tinkar.common.service;

import com.google.auto.service.AutoService;
import dev.ikm.tinkar.common.alert.AlertObject;
import dev.ikm.tinkar.common.alert.AlertStreams;
import dev.ikm.tinkar.common.id.IntIdCollection;
Expand All @@ -28,7 +27,6 @@
import java.time.Instant;
import java.util.List;
import java.util.Optional;

import java.util.ServiceLoader;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;
Expand All @@ -47,7 +45,7 @@ public class PrimitiveData {
private static DefaultDescriptionForNidService defaultDescriptionForNidServiceSingleton;
private static PublicIdService publicIdServiceSingleton;
private static PrimitiveData singleton;
private static CopyOnWriteArrayList<SaveState> statesToSave = new CopyOnWriteArrayList<>();
private static final CopyOnWriteArrayList<SaveState> statesToSave = new CopyOnWriteArrayList<>();

static {
try {
Expand All @@ -56,7 +54,8 @@ public class PrimitiveData {
//TODO: Understand why.
//throwable.printStackTrace();
//We don't want to swallow exceptions...
throwable.printStackTrace(); }
throwable.printStackTrace();
}
}

private PrimitiveData() {
Expand Down Expand Up @@ -238,8 +237,6 @@ public static int nid(UUID... uuids) {
return get().nidForUuids(uuids);
}


@AutoService(CachingService.class)
public static class CacheProvider implements CachingService {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package dev.ikm.tinkar.common.service;

import com.google.auto.service.AutoService;
import dev.ikm.tinkar.common.id.PublicId;
import dev.ikm.tinkar.common.sets.ConcurrentHashSet;
import dev.ikm.tinkar.common.util.uuid.UuidUtil;
Expand Down Expand Up @@ -89,12 +88,11 @@ static int valueOrGenerateForList(ListIterable<UUID> sortedUuidList,
foundValue = nid;
} else {
if (foundValue != nid) {
StringBuilder sb = new StringBuilder();
sb.append("Multiple nids for: ");
sb.append(sortedUuidList);
sb.append(" first value: ").append(foundValue);
sb.append(" second value: ").append(nid);
throw new IllegalStateException(sb.toString());
String sb = "Multiple nids for: " +
sortedUuidList +
" first value: " + foundValue +
" second value: " + nid;
throw new IllegalStateException(sb);
}
}
}
Expand Down Expand Up @@ -173,7 +171,7 @@ static byte[] merge(byte[] oldBytes, byte[] newBytes) {
SEMANTIC_CHRONOLOGY((byte) 3, SemanticChronology.class),
STAMP(STAMP_DATA_TYPE, Stamp.class)
*/
case 1, 2, 3, STAMP_DATA_TYPE-> chronologyByteLists.add(versionBytes);
case 1, 2, 3, STAMP_DATA_TYPE -> chronologyByteLists.add(versionBytes);

/*
CONCEPT_VERSION((byte) 4, ConceptVersion.class),
Expand Down Expand Up @@ -377,7 +375,7 @@ default int nidForPublicId(PublicId publicId) {
* This method may be of use when combining multiple mapped values for a nid.
* For example, merging multiple versions of an entity, where each version is represented as a
* byte[].
*
* <p>
* Defaults to an activity of DataActivity.SYNCHRONIZABLE_EDIT.
*
* @param nid native identifier (an int) with which the resulting value is to be associated
Expand All @@ -402,17 +400,17 @@ default byte[] merge(int nid, int patternNid, int referencedComponentNid, byte[]
* null. This method may be of use when combining multiple mapped values for a nid. For example, merging multiple
* versions of an entity, where each version is represented as a byte[].
*
* @param nid Native identifier (an int) with which the resulting value is to be associated.
* @param patternNid Pattern native identifier.
* @param nid Native identifier (an int) with which the resulting value is to be associated.
* @param patternNid Pattern native identifier.
* @param referencedComponentNid If the bytes are for a semantic, the referenced component nid,
* otherwise Integer.MAX_VALUE.
* @param value The non-null value to be merged with the existing value
* associated with the nid or, if no existing value or a null value
* is associated with the nid, to be associated with the nid.
* @param sourceObject Object that is the source of the bytes to merge.
* @param activity The data activity performed, classifying the type of database (and therefore change set) write.
* @param value The non-null value to be merged with the existing value
* associated with the nid or, if no existing value or a null value
* is associated with the nid, to be associated with the nid.
* @param sourceObject Object that is the source of the bytes to merge.
* @param activity The data activity performed, classifying the type of database (and therefore change set) write.
* @return The new value associated with the specified nid, or null if no
* value is associated with the nid.
* value is associated with the nid.
*/
byte[] merge(int nid, int patternNid, int referencedComponentNid, byte[] value, Object sourceObject, DataActivity activity);

Expand Down Expand Up @@ -488,8 +486,6 @@ public static RemoteOperations fromToken(byte token) {
}
}


@AutoService(CachingService.class)
class CacheProvider implements CachingService {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package dev.ikm.tinkar.common.service;

import com.google.auto.service.AutoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -67,8 +66,6 @@ public static final <T> Optional<T> get(Enum enumKey) {
return Optional.ofNullable((T) propertyMap.get(enumKey));
}


@AutoService(CachingService.class)
public static class CacheProvider implements CachingService {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
*/
package dev.ikm.tinkar.common.service;

import com.google.auto.service.AutoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.ServiceConfigurationError;

import java.util.ServiceLoader;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ScheduledExecutorService;
Expand Down Expand Up @@ -105,8 +103,6 @@ public static ScheduledExecutorService scheduled() {
return executorSingleton.scheduled();
}


@AutoService(CachingService.class)
public static class CacheProvider implements CachingService {

@Override
Expand Down
13 changes: 10 additions & 3 deletions common/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@
*/

import dev.ikm.tinkar.common.alert.AlertReportingService;
import dev.ikm.tinkar.common.service.*;
import dev.ikm.tinkar.common.service.CachingService;
import dev.ikm.tinkar.common.service.DataServiceController;
import dev.ikm.tinkar.common.service.DefaultDescriptionForNidService;
import dev.ikm.tinkar.common.service.ExecutorController;
import dev.ikm.tinkar.common.service.PluginServiceLoader;
import dev.ikm.tinkar.common.service.PrimitiveData;
import dev.ikm.tinkar.common.service.PrimitiveDataService;
import dev.ikm.tinkar.common.service.PublicIdService;
import dev.ikm.tinkar.common.service.ServiceProperties;
import dev.ikm.tinkar.common.service.TinkExecutor;

@SuppressWarnings("module")
// 7 in HL7 is not a version reference
Expand All @@ -32,8 +41,6 @@
requires dev.ikm.jpms.eclipse.collections.api;
requires dev.ikm.jpms.roaringbitmap;
requires org.slf4j;
requires static dev.ikm.jpms.auto.service;


exports dev.ikm.tinkar.common.alert;
exports dev.ikm.tinkar.common.binary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
*/
package dev.ikm.tinkar.coordinate.edit;

import com.google.auto.service.AutoService;
import dev.ikm.tinkar.common.binary.*;
import dev.ikm.tinkar.coordinate.ImmutableCoordinate;
import dev.ikm.tinkar.collection.ConcurrentReferenceHashMap;
import dev.ikm.tinkar.common.binary.Decoder;
import dev.ikm.tinkar.common.binary.DecoderInput;
import dev.ikm.tinkar.common.binary.Encodable;
import dev.ikm.tinkar.common.binary.Encoder;
import dev.ikm.tinkar.common.binary.EncoderOutput;
import dev.ikm.tinkar.common.service.CachingService;
import dev.ikm.tinkar.coordinate.ImmutableCoordinate;
import dev.ikm.tinkar.entity.Entity;
import dev.ikm.tinkar.terms.ConceptFacade;

Expand Down Expand Up @@ -141,7 +144,6 @@ public EditCoordinateRecord toEditCoordinateRecord() {
return this;
}

@AutoService(CachingService.class)
public static class CacheProvider implements CachingService {
// TODO: this has implicit assumption that no one will hold on to a calculator... Should we be defensive?
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,31 @@

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.google.auto.service.AutoService;
import dev.ikm.tinkar.collection.ConcurrentReferenceHashMap;
import dev.ikm.tinkar.common.id.IntIdList;
import dev.ikm.tinkar.common.service.CachingService;
import dev.ikm.tinkar.common.service.PrimitiveData;
import dev.ikm.tinkar.coordinate.language.LanguageCoordinate;
import dev.ikm.tinkar.coordinate.language.LanguageCoordinateRecord;
import dev.ikm.tinkar.coordinate.stamp.StampCoordinateRecord;
import dev.ikm.tinkar.coordinate.stamp.calculator.Latest;
import dev.ikm.tinkar.coordinate.stamp.calculator.StampCalculator;
import dev.ikm.tinkar.coordinate.stamp.calculator.StampCalculatorWithCache;
import dev.ikm.tinkar.entity.CacheInvalidationSubscriber;
import dev.ikm.tinkar.entity.Entity;
import dev.ikm.tinkar.entity.EntityService;
import dev.ikm.tinkar.entity.EntityVersion;
import dev.ikm.tinkar.entity.Field;
import dev.ikm.tinkar.entity.PatternEntity;
import dev.ikm.tinkar.entity.PatternEntityVersion;
import dev.ikm.tinkar.entity.SemanticEntity;
import dev.ikm.tinkar.entity.SemanticEntityVersion;
import dev.ikm.tinkar.entity.SemanticVersionRecord;
import dev.ikm.tinkar.terms.EntityFacade;
import dev.ikm.tinkar.terms.TinkarTerm;
import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.api.list.MutableList;
import dev.ikm.tinkar.collection.ConcurrentReferenceHashMap;
import dev.ikm.tinkar.common.id.IntIdList;
import dev.ikm.tinkar.common.service.CachingService;
import dev.ikm.tinkar.common.service.PrimitiveData;
import dev.ikm.tinkar.coordinate.language.LanguageCoordinate;
import dev.ikm.tinkar.entity.*;
import dev.ikm.tinkar.terms.EntityFacade;
import dev.ikm.tinkar.terms.TinkarTerm;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -86,11 +94,10 @@ private Latest<PatternEntityVersion> getPattern(int patternNid) {
return stampCalculator.latestPatternEntityVersion(patternNid);
}

private static record StampLangRecord(StampCoordinateRecord stampFilter,
ImmutableList<LanguageCoordinateRecord> languageCoordinateList) {
private record StampLangRecord(StampCoordinateRecord stampFilter,
ImmutableList<LanguageCoordinateRecord> languageCoordinateList) {
}

@AutoService(CachingService.class)
public static class CacheProvider implements CachingService {
@Override
public void reset() {
Expand Down Expand Up @@ -394,14 +401,13 @@ public Optional<String> getSemanticText(int nid) {
Latest<PatternEntityVersion> latestPatternVersion = stampCalculator.latestPatternEntityVersion(semanticEntity.patternNid());
if (latestPatternVersion.isPresent()) {
PatternEntityVersion patternVersion = latestPatternVersion.get();
StringBuilder sb = new StringBuilder("[");
sb.append(getPreferredDescriptionTextWithFallbackOrNid(patternVersion.semanticMeaningNid()));
sb.append("] of <");
sb.append(getPreferredDescriptionTextWithFallbackOrNid(semanticEntity.referencedComponentNid()));
sb.append("> for [");
sb.append(getPreferredDescriptionTextWithFallbackOrNid(patternVersion.semanticPurposeNid()));
sb.append("]");
return Optional.of(sb.toString());
String sb = "[" + getPreferredDescriptionTextWithFallbackOrNid(patternVersion.semanticMeaningNid()) +
"] of <" +
getPreferredDescriptionTextWithFallbackOrNid(semanticEntity.referencedComponentNid()) +
"> for [" +
getPreferredDescriptionTextWithFallbackOrNid(patternVersion.semanticPurposeNid()) +
"]";
return Optional.of(sb);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
*/
package dev.ikm.tinkar.coordinate.logic.calculator;

import com.google.auto.service.AutoService;
import dev.ikm.tinkar.collection.ConcurrentReferenceHashMap;
import dev.ikm.tinkar.common.service.CachingService;
import dev.ikm.tinkar.common.service.PrimitiveData;
import dev.ikm.tinkar.common.service.PrimitiveDataRepair;
import dev.ikm.tinkar.coordinate.logic.LogicCoordinate;
import dev.ikm.tinkar.coordinate.logic.LogicCoordinateRecord;
import dev.ikm.tinkar.coordinate.logic.PremiseType;
import dev.ikm.tinkar.coordinate.stamp.StampCoordinateRecord;
import dev.ikm.tinkar.collection.ConcurrentReferenceHashMap;
import dev.ikm.tinkar.common.service.CachingService;
import dev.ikm.tinkar.common.service.PrimitiveData;
import dev.ikm.tinkar.coordinate.stamp.StampCoordinate;
import dev.ikm.tinkar.coordinate.stamp.StampCoordinateRecord;
import dev.ikm.tinkar.coordinate.stamp.calculator.Latest;
import dev.ikm.tinkar.coordinate.stamp.calculator.StampCalculator;
import dev.ikm.tinkar.coordinate.stamp.calculator.StampCalculatorWithCache;
Expand All @@ -45,7 +44,6 @@ public class LogicCalculatorWithCache implements LogicCalculator {
new ConcurrentReferenceHashMap<>(ConcurrentReferenceHashMap.ReferenceType.WEAK,
ConcurrentReferenceHashMap.ReferenceType.WEAK);

;
private final LogicCoordinateRecord logicCoordinateRecord;
private final StampCoordinateRecord stampCoordinateRecord;
private final StampCalculator stampCalculator;
Expand All @@ -72,7 +70,6 @@ public static LogicCalculatorWithCache getCalculator(LogicCoordinate logicCoordi
record LogicAndStampCoordinate(LogicCoordinateRecord logicCoordinate, StampCoordinateRecord stampCoordinate) {
}

@AutoService(CachingService.class)
public static class CacheProvider implements CachingService {
@Override
public void reset() {
Expand Down Expand Up @@ -117,7 +114,7 @@ public boolean hasSufficientSet(int nid) {
if (PrimitiveData.get() instanceof PrimitiveDataRepair primitiveDataRepair) {
primitiveDataRepair.mergeThenErase(semanticNids[0], semanticNids[1]);
return hasSufficientSet(nid);
};
}
}
// TODO Raise an alert...
throw new IllegalStateException("More than one set of axioms for concept: " + Entity.getFast(nid));
Expand Down
Loading

0 comments on commit 0db4d93

Please sign in to comment.