repo
stringlengths
1
191
file
stringlengths
23
351
code
stringlengths
0
5.32M
file_length
int64
0
5.32M
avg_line_length
float64
0
2.9k
max_line_length
int64
0
288k
extension_type
stringclasses
1 value
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/CrossSiteAddClusters.java
ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServers("LON_host1:11222;LON_host2:11222;LON_host3:11222") .addCluster("NYC") .addClusterNodes("NYC_hostA:11222;NYC_hostB:11222;NYC_hostC:11222;NYC_hostD:11222")
246
48.4
90
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/PersistenceJdbcConnectionPool.java
ConfigurationBuilder builder = new ConfigurationBuilder(); builder.persistence() .connectionPool() .connectionUrl("jdbc:h2:mem:infinispan_string_based;DB_CLOSE_DELAY=-1") .username("sa") .driverClass("org.h2.Driver");
252
35.142857
80
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/FunctionalMetaParam.java
import java.time.Duration; import org.infinispan.functional.EntryView.*; import org.infinispan.functional.FunctionalMap.*; import org.infinispan.functional.MetaParam.*; WriteOnlyMap<String, String> writeOnlyMap = ... ReadOnlyMap<String, String> readOnlyMap = ... CompletableFuture<Void> writeFuture = writeOnlyMap.eval("key1", "value1", (v, view) -> view.set(v, new MetaLifespan(Duration.ofHours(1).toMillis()))); CompletableFuture<MetaLifespan> readFuture = writeFuture.thenCompose(r -> readOnlyMap.eval("key1", view -> view.findMetaParam(MetaLifespan.class).get())); readFuture.thenAccept(System.out::println);
621
43.428571
83
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/HotRodScram.java
ConfigurationBuilder clientBuilder = new ConfigurationBuilder(); clientBuilder.addServer() .host("127.0.0.1") .port(11222) .security() .authentication() .saslMechanism("SCRAM-SHA-512") .username("myuser") .password("qwer1234!");
338
32.9
64
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/CounterManagerRemote.java
// create or obtain your RemoteCacheManager RemoteCacheManager manager = ...; // retrieve the CounterManager CounterManager counterManager = RemoteCounterManagerFactory.asCounterManager(manager);
197
32
86
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/ReadWriteMapAutoCloseable.java
import org.infinispan.functional.EntryView.*; import org.infinispan.functional.FunctionalMap.*; ReadWriteMap<String, String> rwMap = ... AutoCloseable createClose = rwMap.listeners().onCreate(created -> { // `created` is a ReadEntryView of the created entry System.out.printf("Created: %s%n", created.get()); }); AutoCloseable modifyClose = rwMap.listeners().onModify((before, after) -> { // `before` is a ReadEntryView of the entry before update // `after` is a ReadEntryView of the entry after update System.out.printf("Before: %s%n", before.get()); System.out.printf("After: %s%n", after.get()); }); AutoCloseable removeClose = rwMap.listeners().onRemove(removed -> { // `removed` is a ReadEntryView of the removed entry System.out.printf("Removed: %s%n", removed.get()); }); AutoCloseable writeClose = woMap.listeners().onWrite(written -> { // `written` is a ReadEntryView of the written entry System.out.printf("Written: %s%n", written.get()); }); ... // Either wrap handler in a try section to have it auto close... try(createClose) { // Create entries using read-write functional map API ... } // Or close manually modifyClose.close();
1,180
37.096774
75
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/CacheConfigurationBean.java
@Bean(name = "small-cache") public org.infinispan.configuration.cache.Configuration smallCache() { return new ConfigurationBuilder() .read(baseCache) .memory().size(1000L) .memory().evictionType(EvictionType.COUNT) .build(); } @Bean(name = "large-cache") public org.infinispan.configuration.cache.Configuration largeCache() { return new ConfigurationBuilder() .read(baseCache) .memory().size(2000L) .build(); }
476
27.058824
70
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/ManualSerializationContextInitializer.java
import org.infinispan.protostream.FileDescriptorSource; import org.infinispan.protostream.SerializationContext; import org.infinispan.protostream.SerializationContextInitializer; ... public class ManualSerializationContextInitializer implements SerializationContextInitializer { @Override public String getProtoFileName() { return "library.proto"; } @Override public String getProtoFile() throws UncheckedIOException { // Assumes that the file is located in a Jar's resources, we must provide the path to the library.proto file return FileDescriptorSource.getResourceAsString(getClass(), "/" + getProtoFileName()); } @Override public void registerSchema(SerializationContext serCtx) { serCtx.registerProtoFiles(FileDescriptorSource.fromString(getProtoFileName(), getProtoFile())); } @Override public void registerMarshallers(SerializationContext serCtx) { serCtx.registerMarshaller(new AuthorMarshaller()); serCtx.registerMarshaller(new BookMarshaller()); } }
1,035
36
114
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/ClusteredLockManager.java
@Experimental public interface ClusteredLockManager { boolean defineLock(String name); boolean defineLock(String name, ClusteredLockConfiguration configuration); ClusteredLock get(String name); ClusteredLockConfiguration getConfiguration(String name); boolean isDefined(String name); CompletableFuture<Boolean> remove(String name); CompletableFuture<Boolean> forceRelease(String name); }
416
22.166667
77
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/GetAdvancedCacheWithFlagsIgnoreReturnValues.java
Cache noPreviousValueCache = cache.getAdvancedCache().withFlags(Flag.IGNORE_RETURN_VALUES); noPreviousValueCache.put(k, v);
124
40.666667
91
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/SerializationMarshaller.java
GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder(); builder.serialization() .marshaller(new JavaSerializationMarshaller()) .allowList() .addRegexps("org.infinispan.example.", "org.infinispan.concrete.SomeClass");
253
41.333333
83
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/InjectRemoteCache.java
public class GreetingService { @Inject private RemoteCache<String, String> cache; public String greet(String user) { String cachedValue = cache.get(user); if (cachedValue == null) { cachedValue = "Hello " + user; cache.put(user, cachedValue); } return cachedValue; } }
343
21.933333
46
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/ReadWriteMapReplace.java
ReadWriteMap<String, String> readWriteMap = ... String oldValue = "old-value"; CompletableFuture<Boolean> replaceFuture = readWriteMap.eval("key1", "value1", (v, view) -> { return view.find().map(prev -> { if (prev.equals(oldValue)) { rw.set(v); return true; // previous value present and equals to the expected one } return false; // previous value associated with key does not match }).orElse(false); // no value associated with this key }); replaceFuture.thenAccept(replaced -> System.out.printf("Value was replaced? %s%n", replaced));
582
40.642857
94
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/PersistenceWriteBehind.java
ConfigurationBuilder builder = new ConfigurationBuilder(); builder.persistence() .async() .modificationQueueSize(2048) .failSilently(true);
161
26
58
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/RemoteQuery.java
package org.infinispan; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; import org.infinispan.client.hotrod.RemoteCache; import org.infinispan.client.hotrod.RemoteCacheManager; import org.infinispan.client.hotrod.Search; import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; import org.infinispan.query.dsl.Query; import org.infinispan.query.dsl.QueryFactory; import org.infinispan.query.remote.client.ProtobufMetadataManagerConstants; public class RemoteQuery { public static void main(String[] args) throws Exception { ConfigurationBuilder clientBuilder = new ConfigurationBuilder(); // RemoteQueryInitializerImpl is generated clientBuilder.addServer().host("127.0.0.1").port(11222) .security().authentication().username("user").password("user") .addContextInitializers(new RemoteQueryInitializerImpl()); RemoteCacheManager remoteCacheManager = new RemoteCacheManager(clientBuilder.build()); // Grab the generated protobuf schema and registers in the server. Path proto = Paths.get(RemoteQuery.class.getClassLoader() .getResource("proto/book.proto").toURI()); String protoBufCacheName = ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME; remoteCacheManager.getCache(protoBufCacheName).put("book.proto", Files.readString(proto)); // Obtain the 'books' remote cache RemoteCache<Object, Object> remoteCache = remoteCacheManager.getCache("books"); // Add some Books Book book1 = new Book("Infinispan in Action", "Learn Infinispan with using it", 2015); Book book2 = new Book("Cloud-Native Applications with Java and Quarkus", "Build robust and reliable cloud applications", 2019); remoteCache.put(1, book1); remoteCache.put(2, book2); // Execute a full-text query QueryFactory queryFactory = Search.getQueryFactory(remoteCache); Query<Book> query = queryFactory.create("FROM book_sample.Book WHERE title:'java'"); List<Book> list = query.execute().list(); // Voila! We have our book back from the cache! } }
2,161
42.24
133
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/LockingModePessimistic.java
ConfigurationBuilder builder = new ConfigurationBuilder(); builder.transaction().lockingMode(LockingMode.PESSIMISTIC);
119
39
59
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/VisitableCommand.java
public class PutKeyValueCommand extends VisitableCommand { ... } public class GetKeyValueCommand extends VisitableCommand { ... } ... etc ...
148
13.9
58
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/LockingModePessimisticImplicitAcquire.java
tm.begin() cache.put(K,V) // acquire cluster-wide lock on K cache.put(K2,V2) // acquire cluster-wide lock on K2 cache.put(K,V5) // no-op, we already own cluster wide lock for K tm.commit() // releases locks
219
35.666667
66
java
null
infinispan-main/documentation/src/main/asciidoc/topics/code_examples/QuickstartCustomCache.java
public static void main(String args[]) throws Exception { EmbeddedCacheManager manager = new DefaultCacheManager(); manager.defineConfiguration("custom-cache", new ConfigurationBuilder() .eviction().strategy(LIRS).maxEntries(10) .build()); Cache<Object, Object> c = manager.getCache("custom-cache"); }
337
41.25
73
java
null
infinispan-main/api/src/test/java/org/infinispan/api/MutinyCacheDemo.java
package org.infinispan.api; import static org.infinispan.api.common.CacheOptions.options; import static org.infinispan.api.common.CacheWriteOptions.writeOptions; import java.time.Duration; import java.util.Map; import org.infinispan.api.common.CacheEntry; import org.infinispan.api.common.events.cache.CacheEntryEventType; import org.infinispan.api.common.events.cache.CacheListenerOptions; import org.infinispan.api.mutiny.MutinyCache; import io.smallrye.mutiny.Uni; import io.smallrye.mutiny.operators.uni.UniBlockingAwait; /** * @since 14.0 **/ public class MutinyCacheDemo { public void testAPI() { try (Infinispan infinispan = Infinispan.create("file:///path/to/infinispan.xml")) { // obtain a cache Uni<MutinyCache<String, String>> cacheUni = infinispan.mutiny().caches().get("mycache"); MutinyCache<String, String> mycache = await(cacheUni); // set await(mycache.set("key", "value")); // get String value = await(mycache.get("key")); // put CacheEntry<String, String> previous = await(mycache.put("key", "newvalue")); // set with options await(mycache.set("key", "anothervalue", writeOptions().lifespan(Duration.ofHours(1)).timeout(Duration.ofMillis(500)).build())); // get with options value = await(mycache.get("key", options().timeout(Duration.ofMillis(500)).flags(DemoEnumFlags.of(DemoEnumFlag.skipLoad(), DemoEnumFlag.skipNotification())).build())); // get entry CacheEntry<String, String> entry = await(mycache.getEntry("key")); // query mycache.query("age > :age").param("age", 5).skip(5).limit(10).find().subscribe(); // remove by query await(mycache.query("delete from person where age > :age").param("age", 80).skip(5).limit(10).execute()); // update by query mycache.query("age > :age").param("age", 80).skip(5).limit(10).process((entries, ctx) -> null).subscribe(); // keys mycache.keys().subscribe(); // keys mycache.entries().subscribe(); // Bulk ops mycache.putAll(Map.of("key1", "value1", "key2", "value2")).subscribe(); mycache.getAll("key1", "key2").subscribe(); // Listen mycache.listen(new CacheListenerOptions().clustered(), CacheEntryEventType.CREATED).subscribe(); } } public static <T> T await(Uni<T> uni) { return UniBlockingAwait.await(uni, Duration.ofHours(1), null); } }
2,514
40.916667
176
java
null
infinispan-main/api/src/test/java/org/infinispan/api/DemoEnumFlags.java
package org.infinispan.api; import java.util.EnumSet; import org.infinispan.api.common.Flags; /** * @since 14.0 **/ public class DemoEnumFlags implements Flags<DemoEnumFlag, DemoEnumFlags> { private final EnumSet<DemoEnumFlag> flags = EnumSet.noneOf(DemoEnumFlag.class); DemoEnumFlags() {} public static DemoEnumFlags of(DemoEnumFlag... flag) { DemoEnumFlags flags = new DemoEnumFlags(); for(DemoEnumFlag f : flag) { flags.add(f); } return flags; } @Override public DemoEnumFlags add(DemoEnumFlag flag) { flags.add(flag); return this; } @Override public boolean contains(DemoEnumFlag flag) { return flags.contains(flag); } @Override public DemoEnumFlags addAll(Flags<DemoEnumFlag, DemoEnumFlags> flags) { DemoEnumFlags theFlags = (DemoEnumFlags) flags; this.flags.addAll(theFlags.flags); return this; } }
922
22.075
82
java
null
infinispan-main/api/src/test/java/org/infinispan/api/DemoEnumFlag.java
package org.infinispan.api; import org.infinispan.api.common.Flag; import org.infinispan.api.common.Flags; /** * @since 14.0 **/ public enum DemoEnumFlag implements Flag { SKIP_LOAD, SKIP_NOTIFICATION, FORCE_RETURN_VALUES; static DemoEnumFlag skipLoad() { return SKIP_LOAD; } static DemoEnumFlag skipNotification() { return SKIP_NOTIFICATION; } static DemoEnumFlag forceReturnValues() { return FORCE_RETURN_VALUES; } @Override public Flags<?, ?> add(Flags<?, ?> flags) { DemoEnumFlags demoFlags = (DemoEnumFlags) flags; if (demoFlags == null) { demoFlags = DemoEnumFlags.of(this); } else { demoFlags.add(this); } return demoFlags; } }
745
19.162162
54
java
null
infinispan-main/api/src/test/java/org/infinispan/api/SyncCacheAPIDemo.java
package org.infinispan.api; import static org.infinispan.api.common.CacheOptions.options; import static org.infinispan.api.common.CacheWriteOptions.writeOptions; import static org.infinispan.api.common.process.CacheProcessorOptions.processorOptions; import java.time.Duration; import java.util.Map; import java.util.Set; import java.util.function.Consumer; import org.infinispan.api.common.CacheEntry; import org.infinispan.api.common.events.cache.CacheEntryEvent; import org.infinispan.api.sync.SyncCache; import org.infinispan.api.sync.SyncContainer; import org.infinispan.api.sync.events.cache.SyncCacheEntryCreatedListener; import org.infinispan.api.sync.events.cache.SyncCacheEntryRemovedListener; import org.infinispan.api.sync.events.cache.SyncCacheEntryUpdatedListener; /** * @author Tristan Tarrant &lt;tristan@infinispan.org&gt; * @since 14.0 **/ public class SyncCacheAPIDemo { public void demo() { try (SyncContainer infinispan = Infinispan.create("file:///path/to/infinispan.xml").sync()) { // obtain a cache SyncCache<String, String> mycache = infinispan.caches().get("mycache"); // set mycache.set("key", "value"); // get String value = mycache.get("key"); // put CacheEntry<String, String> previous = mycache.put("key", "newvalue"); // set with options mycache.set("key", "anothervalue", writeOptions().lifespan(Duration.ofHours(1)).timeout(Duration.ofMillis(500)).build()); // get with options DemoEnumFlags flags = DemoEnumFlags.of(DemoEnumFlag.skipLoad()); value = mycache.get("key", options().timeout(Duration.ofMillis(500)).flags(flags.add(DemoEnumFlag.skipNotification())).build()); // get entry CacheEntry<String, String> entry = mycache.getEntry("key"); // setIfAbsent mycache.setIfAbsent("anotherkey", "value"); // putIfAbsent CacheEntry<String, String> existing = mycache.putIfAbsent("anotherkey", "anothervalue"); // remove boolean removed = mycache.remove("anotherkey"); // query mycache.query("age > :age").param("age", 5).skip(5).limit(10).find().results().forEach(new NullConsumer<>()); // remove by query mycache.query("delete from person where age > :age").param("age", 80).skip(5).limit(10).execute(); // process by query mycache.query("age > :age").param("age", 80).skip(5).limit(10).process((e, ctx) -> { e.setValue(e.value().toLowerCase()); return null; }); // Bulk ops mycache.putAll(Map.of("key1", "value1", "key2", "value2")); Map<String, String> all = mycache.getAll(Set.of("key1", "key2")); // Iteration over keys and entries mycache.keys().forEach(new NullConsumer<>()); mycache.entries().forEach(e -> System.out.printf("key=%s, value=%s%n", e.key(), e.value())); // Event handling mycache.listen((SyncCacheEntryCreatedListener<String, String>) event -> { // Handle create event }); mycache.listen(new NullListener()); mycache.process(Set.of("key1", "key2"), (e, ctx) -> { e.setValue(e.value().toLowerCase()); return null; }, processorOptions().flags(DemoEnumFlags.of(DemoEnumFlag.skipLoad())).build()); // Batch infinispan.sync().batch(sync -> { SyncCache<String, String> c = sync.caches().get("mycache"); c.set("k1", "v1"); c.set("k2", "v2"); return null; }); } } public static class NullConsumer<T> implements Consumer<T> { @Override public void accept(T t) { } } public static class NullListener implements SyncCacheEntryUpdatedListener, SyncCacheEntryRemovedListener { @Override public void onRemove(CacheEntryEvent event) { } @Override public void onUpdate(CacheEntryEvent event) { } } }
4,036
36.37963
137
java
null
infinispan-main/api/src/test/java/org/infinispan/api/ASyncCacheDemo.java
package org.infinispan.api; import static org.infinispan.api.common.CacheOptions.options; import static org.infinispan.api.common.CacheWriteOptions.writeOptions; import java.time.Duration; import java.util.Map; import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; import java.util.concurrent.ExecutionException; import java.util.concurrent.Flow; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.infinispan.api.async.AsyncCache; import org.infinispan.api.common.CacheEntry; import org.infinispan.api.common.events.cache.CacheEntryEventType; import org.infinispan.api.common.events.cache.CacheListenerOptions; /** * @author Tristan Tarrant &lt;tristan@infinispan.org&gt; * @since 13.0 **/ public class ASyncCacheDemo { /* * Demo of cache API */ public void cache() throws ExecutionException, InterruptedException { try (Infinispan infinispan = Infinispan.create("file:///path/to/infinispan.xml")) { // obtain a cache CompletionStage<? extends AsyncCache<String, String>> cacheCompletionStage = infinispan.async().caches().get("mycache"); AsyncCache<String, String> mycache = await(cacheCompletionStage); // set await(mycache.set("key", "value")); // get String value = await(mycache.get("key")); // put CacheEntry<String, String> previous = await(mycache.put("key", "newvalue")); // set with options await(mycache.set("key", "anothervalue", writeOptions().lifespan(Duration.ofHours(1)).timeout(Duration.ofMillis(500)).build())); // get with options value = await(mycache.get("key", options().timeout(Duration.ofMillis(500)).flags(DemoEnumFlags.of(DemoEnumFlag.skipLoad(), DemoEnumFlag.skipNotification())).build())); // get entry CacheEntry<String, String> entry = await(mycache.getEntry("key")); // setIfAbsent await(mycache.setIfAbsent("anotherkey", "value")); // putIfAbsent CacheEntry<String, String> existing = await(mycache.putIfAbsent("anotherkey", "anothervalue")); // remove boolean removed = await(mycache.remove("anotherkey")); // query await(mycache.query("age > :age").param("age", 5).skip(5).limit(10).find()).results().subscribe(new NullSubscriber<>()); // remove by query await(mycache.query("delete from person where age > :age").param("age", 80).skip(5).limit(10).execute()); // update by query mycache.query("age > :age").param("age", 80).skip(5).limit(10).process((e, ctx) -> null).subscribe(new NullSubscriber()); // keys mycache.keys().subscribe(new NullSubscriber<>()); mycache.entries().subscribe(new NullSubscriber<>()); mycache.process(Set.of("k1", "k2"), (entries, context) -> null); // Bulk ops await(mycache.putAll(Map.of("key1", "value1", "key2", "value2"))); mycache.getAll(Set.of("key1", "key2")).subscribe(new NullSubscriber<>()); // Listen mycache.listen(new CacheListenerOptions().clustered(), CacheEntryEventType.CREATED).subscribe(new NullSubscriber<>()); // Batch await(infinispan.async().batch(async -> async.caches().get("mycache").thenCompose(c -> c.set("k1", "v1").thenApply(v -> c)).thenCompose(c -> c.set("k2", "v2")) )); } } static class NullSubscriber<T> implements Flow.Subscriber<T> { @Override public void onSubscribe(Flow.Subscription subscription) { } @Override public void onNext(T item) { } @Override public void onError(Throwable throwable) { } @Override public void onComplete() { } } // Some utilities private final static long BIG_DELAY_NANOS = TimeUnit.DAYS.toNanos(1); static <T> T await(CompletionStage<T> cf) { return await(cf.toCompletableFuture()); } static <T> T await(CompletableFuture<T> cf) { try { return cf.get(BIG_DELAY_NANOS, TimeUnit.NANOSECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } catch (ExecutionException e) { throw new RuntimeException(e); } catch (TimeoutException e) { throw new IllegalStateException(e); } } }
4,455
36.133333
176
java
null
infinispan-main/api/src/test/java/org/infinispan/api/SyncCounterAPITest.java
package org.infinispan.api; import org.infinispan.api.sync.SyncWeakCounter; /** * @author Tristan Tarrant &lt;tristan@infinispan.org&gt; * @since 13.0 **/ public class SyncCounterAPITest { public void testCounterAPI() { try (Infinispan infinispan = Infinispan.create("file:///path/to/infinispan.xml")) { SyncWeakCounter counter = infinispan.sync().weakCounters().get("counter"); counter.increment(); counter.decrement(); long value = counter.value(); } } }
516
26.210526
89
java
null
infinispan-main/api/src/test/java/org/infinispan/api/annotations/indexing/demo/Author.java
package org.infinispan.api.annotations.indexing.demo; import org.infinispan.api.annotations.indexing.Basic; import org.infinispan.api.annotations.indexing.GeoCoordinates; import org.infinispan.api.annotations.indexing.Keyword; import org.infinispan.api.annotations.indexing.Latitude; import org.infinispan.api.annotations.indexing.Longitude; /** * Example of use of the new Infinispan indexing annotations. * <p> * Instance of indexed embedded entity. * The root indexed entity containing this entity is {@link Book}. * * @since 14.0 */ @GeoCoordinates(fieldName = "placeOfBirth", marker = "birth") @GeoCoordinates(fieldName = "placeOfDeath", marker = "death") public class Author { @Keyword(sortable = true) private String firstname; @Keyword private String surname; @Basic(name = "publications") @Basic(name = "books", searchable = false, sortable = true, projectable = true, aggregable = true) private Integer numberOfPublishedBooks; @Latitude(marker = "birth") private Double placeOfBirthLatitude; @Longitude(marker = "birth") private Double placeOfBirthLongitude; @Latitude(marker = "death") private Double placeOfDeathLatitude; @Longitude(marker = "death") private Double placeOfDeathLongitude; }
1,265
27.772727
101
java
null
infinispan-main/api/src/test/java/org/infinispan/api/annotations/indexing/demo/Book.java
package org.infinispan.api.annotations.indexing.demo; import java.util.List; import org.infinispan.api.annotations.indexing.Basic; import org.infinispan.api.annotations.indexing.Decimal; import org.infinispan.api.annotations.indexing.Embedded; import org.infinispan.api.annotations.indexing.GeoCoordinates; import org.infinispan.api.annotations.indexing.Indexed; import org.infinispan.api.annotations.indexing.Keyword; import org.infinispan.api.annotations.indexing.Text; import org.infinispan.api.annotations.indexing.model.Point; import org.infinispan.api.annotations.indexing.option.Structure; import org.infinispan.api.annotations.indexing.option.TermVector; /** * Example of use of the new Infinispan indexing annotations. * <p> * Instance of indexed (as root) entity, * containing two embedded indexed entities: {@link Author} and {@link Review}. * * @since 14.0 */ @Indexed(index = "books") public class Book { @Keyword(normalizer = "lowercase", projectable = true) private String keyword; @Basic(name = "year", searchable = true) private Integer yearOfPublication; @Text(name = "descriptionText", analyzer = "english", termVector = TermVector.WITH_POSITIONS_OFFSETS_PAYLOADS, norms = false) @Basic(name = "description", projectable = true, sortable = true) private String description; @Decimal(decimalScale = 2, aggregable = true) private Float price; @Embedded(structure = Structure.FLATTENED) private Author author; @Embedded(structure = Structure.NESTED) private List<Review> reviews; @GeoCoordinates private Point placeOfPublication; }
1,611
31.24
128
java
null
infinispan-main/api/src/test/java/org/infinispan/api/annotations/indexing/demo/Review.java
package org.infinispan.api.annotations.indexing.demo; import java.time.LocalDate; import org.infinispan.api.annotations.indexing.Basic; import org.infinispan.api.annotations.indexing.Decimal; import org.infinispan.api.annotations.indexing.Text; /** * Example of use of the new Infinispan indexing annotations. * <p> * Instance of indexed embedded entity. * The root indexed entity containing this entity is {@link Book}. * * @since 14.0 */ public class Review { @Basic(sortable = true) private LocalDate date; @Text private String content; @Decimal(decimalScale = 1, sortable = true, projectable = true, aggregable = true) private Float score; }
678
22.413793
85
java
null
infinispan-main/api/src/test/java/org/infinispan/api/protostream/builder/ProtoBufBuilderTest.java
package org.infinispan.api.protostream.builder; public class ProtoBufBuilderTest { public void testProtoBuilder() { ProtoBuf.builder() .packageName("org.infinispan") .message("author") // protobuf message is usually lowercase .indexed() .required("name", 1, "string") .basic() .sortable(true) .projectable(true) .optional("age", 2, "int32") .keyword() .sortable(true) .aggregable(true) .message("book") .indexed() .required("title", 1, "string") .basic() .projectable(true) .optional("yearOfPublication", 2, "int32") .keyword() .normalizer("lowercase") .optional("description", 3, "string") .text() .analyzer("english") .searchAnalyzer("whitespace") .required("author", 4, "author") .embedded() .build(); } }
1,152
31.942857
71
java
null
infinispan-main/api/src/main/java/org/infinispan/api/Experimental.java
package org.infinispan.api; import static java.lang.annotation.ElementType.ANNOTATION_TYPE; import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.PACKAGE; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.CLASS; import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * An experimental user-facing API. Elements annotated with this annotation are experimental and may get removed from * the distribution at any time. * * @since 14.0 */ @Retention(CLASS) @Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD}) @Documented public @interface Experimental { String value() default ""; }
888
31.925926
117
java
null
infinispan-main/api/src/main/java/org/infinispan/api/Infinispan.java
package org.infinispan.api; import java.net.URI; import java.util.ServiceLoader; import org.infinispan.api.async.AsyncContainer; import org.infinispan.api.configuration.Configuration; import org.infinispan.api.exception.InfinispanConfigurationException; import org.infinispan.api.mutiny.MutinyContainer; import org.infinispan.api.sync.SyncContainer; /** * Infinispan instance, embedded or client, depending on the access point. * * @since 14.0 */ @Experimental("This is not ready yet for general consumption. Major changes are still expected.") public interface Infinispan extends AutoCloseable { /** * Creates and starts the Infinispan manager object * <p> * Calling create with the same URI multiple times should return the same object. Ref count the object. * * <ul> * <li><tt>file:///.../infinispan.xml</tt> Embedded Infinispan configured via XML/JSON/Yaml file</li> * <li><tt>classpath:///.../infinispan.xml</tt> Embedded Infinispan configured via XML/JSON/Yaml classpath resource</li> * <li><tt>hotrod[s]://[username[:password]@]host:port[,host2:port]?property=value[&property=value]</tt> </li> * </ul> * * @param uri one of the supported Infinispan URIs: * @return an */ static Infinispan create(URI uri) { for (Factory factory : ServiceLoader.load(Factory.class, Factory.class.getClassLoader())) { Infinispan instance = factory.create(uri); if (instance != null) { return instance; } } throw new InfinispanConfigurationException("No factory to handle URI " + uri); } static Infinispan create(String uri) { return create(URI.create(uri)); } static Infinispan create(Configuration configuration) { for (Factory factory : ServiceLoader.load(Factory.class, Factory.class.getClassLoader())) { Infinispan instance = create(configuration, factory); if (instance != null) { return instance; } } throw new InfinispanConfigurationException("No factory to handle configuration " + configuration); } static Infinispan create(Configuration configuration, Factory factory) { return factory.create(configuration); } /** * Returns a synchronous version of the Infinispan API * * @return */ SyncContainer sync(); /** * Returns an asynchronous version of the Infinispan API * * @return */ AsyncContainer async(); /** * Returns a mutiny version of the Infinispan API * * @return */ MutinyContainer mutiny(); /** * Closes the instance, releasing all allocated resources (thread pools, open files, etc) */ @Override void close(); interface Factory { /** * Create an {@link Infinispan} instance for the supplied uri. If the factory cannot handle the uri, it should * return null. * * @param uri * @return An {@link Infinispan} instance or null if the factory cannot handle the uri. */ Infinispan create(URI uri); /** * Create an {@link Infinispan} instance for the supplied configuration. If the factory cannot handle the uri, it * should return null. * * @param configuration * @return An {@link Infinispan} instance or null if the factory cannot handle the uri. */ Infinispan create(Configuration configuration); } }
3,429
30.759259
125
java
null
infinispan-main/api/src/main/java/org/infinispan/api/configuration/LockConfiguration.java
package org.infinispan.api.configuration; /** * The lock configuration. * * @since 14.0 **/ public interface LockConfiguration { }
136
12.7
41
java
null
infinispan-main/api/src/main/java/org/infinispan/api/configuration/CacheConfiguration.java
package org.infinispan.api.configuration; /** * The cache configuration. * * @since 14.0 **/ public interface CacheConfiguration { }
138
12.9
41
java
null
infinispan-main/api/src/main/java/org/infinispan/api/configuration/Configuration.java
package org.infinispan.api.configuration; /** * The global configuration. * * @since 14.0 **/ public interface Configuration { }
134
12.5
41
java
null
infinispan-main/api/src/main/java/org/infinispan/api/configuration/CounterConfiguration.java
package org.infinispan.api.configuration; /** * The counter configuration. * * @since 14.0 **/ public interface CounterConfiguration { }
142
13.3
41
java
null
infinispan-main/api/src/main/java/org/infinispan/api/configuration/MultimapConfiguration.java
package org.infinispan.api.configuration; /** * The Multimap configuration. * * @since 14.0 **/ public interface MultimapConfiguration { }
144
13.5
41
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncCacheEntryProcessor.java
package org.infinispan.api.async; import java.util.concurrent.Flow; import org.infinispan.api.common.MutableCacheEntry; import org.infinispan.api.common.process.CacheEntryProcessorContext; import org.infinispan.api.common.process.CacheEntryProcessorResult; /** * @since 14.0 **/ @FunctionalInterface public interface AsyncCacheEntryProcessor<K, V, T> { Flow.Publisher<CacheEntryProcessorResult<K, T>> process(Flow.Publisher<MutableCacheEntry<K, V>> entries, CacheEntryProcessorContext context); }
505
30.625
144
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncStrongCounter.java
package org.infinispan.api.async; import java.util.concurrent.CompletionStage; import java.util.function.Consumer; import org.infinispan.api.common.events.counter.CounterEvent; import org.infinispan.api.configuration.CounterConfiguration; /** * The strong consistent counter interface. * <p> * It provides atomic updates for the counter. All the operations are perform asynchronously and they complete the * {@link CompletionStage} when completed. * * @since 14.0 */ public interface AsyncStrongCounter { /** * @return The counter name. */ String name(); /** * Retrieves the counter's configuration. * * @return this counter's configuration. */ CompletionStage<CounterConfiguration> configuration(); /** * Return the container of this counter * * @return */ AsyncContainer container(); /** * It fetches the current value. * <p> * It may go remotely to fetch the current value. * * @return The current value. */ CompletionStage<Long> value(); /** * Atomically increments the counter and returns the new value. * * @return The new value. */ default CompletionStage<Long> incrementAndGet() { return addAndGet(1L); } /** * Atomically decrements the counter and returns the new value * * @return The new value. */ default CompletionStage<Long> decrementAndGet() { return addAndGet(-1L); } /** * Atomically adds the given value and return the new value. * * @param delta The non-zero value to add. It can be negative. * @return The new value. */ CompletionStage<Long> addAndGet(long delta); /** * Resets the counter to its initial value. */ CompletionStage<Void> reset(); /** * Registers a {@link Consumer<CounterEvent>} to this counter. * * @param listener The listener to register. * @return A {@link AutoCloseable} that allows to remove the listener via {@link AutoCloseable#close()}. */ CompletionStage<AutoCloseable> listen(Consumer<CounterEvent> listener); /** * Atomically sets the value to the given updated value if the current value {@code ==} the expected value. * <p> * It is the same as {@code return compareAndSwap(expect, update).thenApply(value -> value == expect);} * * @param expect the expected value * @param update the new value * @return {@code true} if successful, {@code false} otherwise. */ default CompletionStage<Boolean> compareAndSet(long expect, long update) { return compareAndSwap(expect, update).thenApply(value -> value == expect); } /** * Atomically sets the value to the given updated value if the current value {@code ==} the expected value. * <p> * The operation is successful if the return value is equals to the expected value. * * @param expect the expected value. * @param update the new value. * @return the previous counter's value. */ CompletionStage<Long> compareAndSwap(long expect, long update); /** * Atomically sets the value to the given updated value * * @param value the new value. * @return the old counter value. */ CompletionStage<Long> getAndSet(long value); }
3,262
26.420168
114
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncWeakCounter.java
package org.infinispan.api.async; import java.util.concurrent.CompletionStage; import org.infinispan.api.configuration.CounterConfiguration; /** * @since 14.0 **/ public interface AsyncWeakCounter { /** * @return The counter name. */ String name(); /** * Retrieves the counter's configuration. * * @return this counter's configuration. */ CompletionStage<CounterConfiguration> configuration(); /** * Return the container of this counter * * @return */ AsyncContainer container(); /** * Retrieves this counter's value. * * @return */ CompletionStage<Long> value(); /** * Increments the counter. */ default CompletionStage<Void> increment() { return add(1L); } /** * Decrements the counter. */ default CompletionStage<Void> decrement() { return add(-1L); } /** * Adds the given value to the new value. * * @param delta the value to add. */ CompletionStage<Void> add(long delta); }
1,038
16.913793
61
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncMultimaps.java
package org.infinispan.api.async; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import org.infinispan.api.configuration.MultimapConfiguration; /** * @since 14.0 **/ public interface AsyncMultimaps { <K, V> CompletionStage<AsyncMultimap<K, V>> create(String name, MultimapConfiguration cacheConfiguration); <K, V> CompletionStage<AsyncMultimap<K, V>> create(String name, String template); <K, V> CompletionStage<AsyncMultimap<K, V>> get(String name); CompletionStage<Void> remove(String name); Flow.Publisher<String> names(); CompletionStage<Void> createTemplate(String name, MultimapConfiguration cacheConfiguration); CompletionStage<Void> removeTemplate(String name); Flow.Publisher<String> templateNames(); }
780
26.892857
109
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncLock.java
package org.infinispan.api.async; import java.util.concurrent.CompletionStage; import java.util.concurrent.TimeUnit; /** * @since 14.0 */ public interface AsyncLock { String name(); /** * Return the container of this lock * * @return */ AsyncContainer container(); CompletionStage<Void> lock(); CompletionStage<Boolean> tryLock(); CompletionStage<Boolean> tryLock(long time, TimeUnit unit); CompletionStage<Void> unlock(); CompletionStage<Boolean> isLocked(); CompletionStage<Boolean> isLockedByMe(); }
557
17
62
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncStrongCounters.java
package org.infinispan.api.async; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import org.infinispan.api.configuration.CounterConfiguration; /** * @since 14.0 **/ public interface AsyncStrongCounters { CompletionStage<AsyncStrongCounter> get(String name); CompletionStage<AsyncStrongCounter> create(String name, CounterConfiguration configuration); CompletionStage<Void> remove(String name); Flow.Publisher<String> names(); }
480
23.05
95
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncLocks.java
package org.infinispan.api.async; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import org.infinispan.api.configuration.LockConfiguration; /** * @since 14.0 **/ public interface AsyncLocks { CompletionStage<AsyncLock> create(String name, LockConfiguration configuration); CompletionStage<AsyncLock> lock(String name); CompletionStage<Void> remove(String name); Flow.Publisher<String> names(); }
448
21.45
83
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncCache.java
package org.infinispan.api.async; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import org.infinispan.api.common.CacheEntry; import org.infinispan.api.common.CacheEntryVersion; import org.infinispan.api.common.CacheOptions; import org.infinispan.api.common.CacheWriteOptions; import org.infinispan.api.common.events.cache.CacheEntryEvent; import org.infinispan.api.common.events.cache.CacheEntryEventType; import org.infinispan.api.common.events.cache.CacheListenerOptions; import org.infinispan.api.common.process.CacheEntryProcessorResult; import org.infinispan.api.common.process.CacheProcessor; import org.infinispan.api.common.process.CacheProcessorOptions; import org.infinispan.api.configuration.CacheConfiguration; /** * @since 14.0 **/ public interface AsyncCache<K, V> { /** * The name of the cache. * * @return */ String name(); /** * The configuration for this cache. * * @return */ CompletionStage<CacheConfiguration> configuration(); /** * Return the container of this cache * * @return */ AsyncContainer container(); /** * Get the value of the Key if such exists * * @param key * @return the value */ default CompletionStage<V> get(K key) { return get(key, CacheOptions.DEFAULT); } /** * Get the value of the Key if such exists * * @param key * @param options * @return the value */ default CompletionStage<V> get(K key, CacheOptions options) { return getEntry(key, options) .thenApply(ce -> ce != null ? ce.value() : null); } /** * Get the entry of the Key if such exists * * @param key * @return the entry */ default CompletionStage<CacheEntry<K, V>> getEntry(K key) { return getEntry(key, CacheOptions.DEFAULT); } /** * Get the entry of the Key if such exists * * @param key * @param options * @return the entry */ CompletionStage<CacheEntry<K, V>> getEntry(K key, CacheOptions options); /** * Insert the key/value if such key does not exist * * @param key * @param value * @return the previous value if present */ default CompletionStage<CacheEntry<K, V>> putIfAbsent(K key, V value) { return putIfAbsent(key, value, CacheWriteOptions.DEFAULT); } /** * Insert the key/value if such key does not exist * * @param key * @param value * @param options * @return the previous value if present */ CompletionStage<CacheEntry<K, V>> putIfAbsent(K key, V value, CacheWriteOptions options); /** * Insert the key/value if such key does not exist * * @param key * @param value * @return */ default CompletionStage<Boolean> setIfAbsent(K key, V value) { return setIfAbsent(key, value, CacheWriteOptions.DEFAULT); } /** * Insert the key/value if such key does not exist * * @param key * @param value * @param options * @return Void */ default CompletionStage<Boolean> setIfAbsent(K key, V value, CacheWriteOptions options) { return putIfAbsent(key, value, options) .thenApply(Objects::isNull); } /** * @param key * @param value * @return Void */ default CompletionStage<CacheEntry<K, V>> put(K key, V value) { return put(key, value, CacheWriteOptions.DEFAULT); } /** * @param key * @param value * @param options * @return Void */ CompletionStage<CacheEntry<K, V>> put(K key, V value, CacheWriteOptions options); /** * @param key * @param value * @return */ default CompletionStage<Void> set(K key, V value) { return set(key, value, CacheWriteOptions.DEFAULT); } /** * @param key * @param value * @param options * @return */ default CompletionStage<Void> set(K key, V value, CacheWriteOptions options) { return put(key, value, options) .thenApply(__ -> null); } /** * @param key * @param value * @return */ default CompletionStage<Boolean> replace(K key, V value, CacheEntryVersion version) { return replace(key, value, version, CacheWriteOptions.DEFAULT); } /** * @param key * @param value * @param options * @return */ default CompletionStage<Boolean> replace(K key, V value, CacheEntryVersion version, CacheWriteOptions options) { return getOrReplaceEntry(key, value, version, options) .thenApply(ce -> ce != null && version.equals(ce.metadata().version())); } /** * @param key * @param value * @param version * @return */ default CompletionStage<CacheEntry<K, V>> getOrReplaceEntry(K key, V value, CacheEntryVersion version) { return getOrReplaceEntry(key, value, version, CacheWriteOptions.DEFAULT); } /** * @param key * @param value * @param options * @param version * @return */ CompletionStage<CacheEntry<K, V>> getOrReplaceEntry(K key, V value, CacheEntryVersion version, CacheWriteOptions options); /** * Delete the key * * @param key * @return whether the entry was removed. */ default CompletionStage<Boolean> remove(K key) { return remove(key, CacheOptions.DEFAULT); } /** * Delete the key * * @param key * @param options * @return whether the entry was removed. */ CompletionStage<Boolean> remove(K key, CacheOptions options); /** * Delete the key only if the version matches * * @param key * @param version * @return whether the entry was removed. */ default CompletionStage<Boolean> remove(K key, CacheEntryVersion version) { return remove(key, version, CacheOptions.DEFAULT); } /** * Delete the key only if the version matches * * @param key * @param version * @param options * @return whether the entry was removed. */ CompletionStage<Boolean> remove(K key, CacheEntryVersion version, CacheOptions options); /** * Removes the key and returns its value if present. * * @param key * @return the value of the key before removal. Returns null if the key didn't exist. */ default CompletionStage<CacheEntry<K, V>> getAndRemove(K key) { return getAndRemove(key, CacheOptions.DEFAULT); } /** * Removes the key and returns its value if present. * * @param key * @param options * @return the value of the key before removal. Returns null if the key didn't exist. */ CompletionStage<CacheEntry<K, V>> getAndRemove(K key, CacheOptions options); /** * Retrieve all keys * * @return */ default Flow.Publisher<K> keys() { return keys(CacheOptions.DEFAULT); } /** * Retrieve all keys * * @param options * @return */ Flow.Publisher<K> keys(CacheOptions options); /** * Retrieve all entries * * @return */ default Flow.Publisher<CacheEntry<K, V>> entries() { return entries(CacheOptions.DEFAULT); } /** * Retrieve all entries * * @param options * @return */ Flow.Publisher<CacheEntry<K, V>> entries(CacheOptions options); /** * @param entries * @return Void */ default CompletionStage<Void> putAll(Map<K, V> entries) { return putAll(entries, CacheWriteOptions.DEFAULT); } /** * @param entries * @param options * @return */ CompletionStage<Void> putAll(Map<K, V> entries, CacheWriteOptions options); /** * @param entries * @return Void */ default CompletionStage<Void> putAll(Flow.Publisher<CacheEntry<K, V>> entries) { return putAll(entries, CacheWriteOptions.DEFAULT); } /** * @param entries * @param options * @return */ CompletionStage<Void> putAll(Flow.Publisher<CacheEntry<K, V>> entries, CacheWriteOptions options); /** * Retrieves the entries for the specified keys. * * @param keys * @return */ default Flow.Publisher<CacheEntry<K, V>> getAll(Set<K> keys) { return getAll(keys, CacheOptions.DEFAULT); } /** * Retrieves the entries for the specified keys. * * @param keys * @param options * @return */ Flow.Publisher<CacheEntry<K, V>> getAll(Set<K> keys, CacheOptions options); /** * Retrieves the entries for the specified keys. * * @param keys * @return */ default Flow.Publisher<CacheEntry<K, V>> getAll(K... keys) { return getAll(CacheOptions.DEFAULT, keys); } /** * Retrieves the entries for the specified keys. * * @param keys * @param options * @return */ Flow.Publisher<CacheEntry<K, V>> getAll(CacheOptions options, K... keys); /** * Removes a set of keys. Returns the keys that were removed. * * @param keys * @return */ default Flow.Publisher<K> removeAll(Set<K> keys) { return removeAll(keys, CacheWriteOptions.DEFAULT); } /** * Removes a set of keys. Returns the keys that were removed. * * @param keys * @param options * @return */ Flow.Publisher<K> removeAll(Set<K> keys, CacheWriteOptions options); /** * @param keys * @return Void */ default Flow.Publisher<K> removeAll(Flow.Publisher<K> keys) { return removeAll(keys, CacheWriteOptions.DEFAULT); } /** * @param keys * @param options * @return */ Flow.Publisher<K> removeAll(Flow.Publisher<K> keys, CacheWriteOptions options); /** * Removes a set of keys. Returns the keys that were removed. * * @param keys * @return */ default Flow.Publisher<CacheEntry<K, V>> getAndRemoveAll(Set<K> keys) { return getAndRemoveAll(keys, CacheWriteOptions.DEFAULT); } /** * Removes a set of keys. Returns the keys that were removed. * * @param keys * @param options * @return */ Flow.Publisher<CacheEntry<K, V>> getAndRemoveAll(Set<K> keys, CacheWriteOptions options); /** * Removes a set of keys. Returns the keys that were removed. * * @param keys * @return */ default Flow.Publisher<CacheEntry<K, V>> getAndRemoveAll(Flow.Publisher<K> keys) { return getAndRemoveAll(keys, CacheWriteOptions.DEFAULT); } /** * Removes a set of keys. Returns the keys that were removed. * * @param keys * @param options * @return */ Flow.Publisher<CacheEntry<K, V>> getAndRemoveAll(Flow.Publisher<K> keys, CacheWriteOptions options); /** * Estimate the size of the store * * @return Long, estimated size */ default CompletionStage<Long> estimateSize() { return estimateSize(CacheOptions.DEFAULT); } /** * Estimate the size of the store * * @param options * @return Long, estimated size */ CompletionStage<Long> estimateSize(CacheOptions options); /** * Clear the cache. If a concurrent operation puts data in the cache the clear might work properly * * @return Void */ default CompletionStage<Void> clear() { return clear(CacheOptions.DEFAULT); } /** * Clear the cache. If a concurrent operation puts data in the cache the clear might not properly work * * @param options * @return Void */ CompletionStage<Void> clear(CacheOptions options); /** * @param <R> * @param query query String * @return */ default <R> AsyncQuery<K, V, R> query(String query) { return query(query, CacheOptions.DEFAULT); } /** * Executes the query and returns an iterable with the entries * * @param <R> * @param query query String * @param options * @return */ <R> AsyncQuery<K, V, R> query(String query, CacheOptions options); /** * Register a cache listener with default {@link CacheListenerOptions} * * @param types * @return */ default Flow.Publisher<CacheEntryEvent<K, V>> listen(CacheEntryEventType... types) { return listen(new CacheListenerOptions(), types); } /** * Register a cache listener with the supplied {@link CacheListenerOptions} * * @param options * @param types one or more {@link CacheEntryEventType} * @return */ Flow.Publisher<CacheEntryEvent<K, V>> listen(CacheListenerOptions options, CacheEntryEventType... types); /** * Process entries using the supplied task * * @param keys * @param processor * @return */ default <T> Flow.Publisher<CacheEntryProcessorResult<K, T>> process(Set<K> keys, AsyncCacheEntryProcessor<K, V, T> processor) { return process(keys, processor, CacheOptions.DEFAULT); } /** * Process entries using the supplied task * * @param keys * @param task * @param options * @return */ <T> Flow.Publisher<CacheEntryProcessorResult<K, T>> process(Set<K> keys, AsyncCacheEntryProcessor<K, V, T> task, CacheOptions options); /** * Execute a {@link CacheProcessor} on a cache * * @param <T> * @param processor * @return */ default <T> Flow.Publisher<CacheEntryProcessorResult<K, T>> processAll(AsyncCacheEntryProcessor<K, V, T> processor) { return processAll(processor, CacheProcessorOptions.DEFAULT); } /** * Execute a {@link CacheProcessor} on a cache * * @param <T> * @param processor * @param options * @return */ <T> Flow.Publisher<CacheEntryProcessorResult<K, T>> processAll(AsyncCacheEntryProcessor<K, V, T> processor, CacheProcessorOptions options); /** * @return */ AsyncStreamingCache<K> streaming(); }
13,795
23.635714
142
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncContainer.java
package org.infinispan.api.async; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import java.util.function.Function; import org.infinispan.api.Infinispan; import org.infinispan.api.common.events.container.ContainerEvent; import org.infinispan.api.common.events.container.ContainerListenerEventType; /** * @since 14.0 **/ public interface AsyncContainer extends Infinispan { AsyncCaches caches(); AsyncMultimaps multimaps(); AsyncStrongCounters strongCounters(); AsyncWeakCounters weakCounters(); AsyncLocks locks(); Flow.Publisher<ContainerEvent> listen(ContainerListenerEventType... types); <T> CompletionStage<T> batch(Function<AsyncContainer, CompletionStage<T>> function); }
744
23.833333
87
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncMultimap.java
package org.infinispan.api.async; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import org.infinispan.api.configuration.MultimapConfiguration; /** * @since 14.0 **/ public interface AsyncMultimap<K, V> { /** * The name of this multimap * * @return */ String name(); /** * The configuration of this multimap * * @return */ CompletionStage<MultimapConfiguration> configuration(); /** * Return the container of this Multimap * * @return */ AsyncContainer container(); CompletionStage<Void> add(K key, V value); Flow.Publisher<V> get(K key); CompletionStage<Boolean> remove(K key); CompletionStage<Boolean> remove(K key, V value); CompletionStage<Boolean> containsKey(K key); CompletionStage<Boolean> containsEntry(K key, V value); CompletionStage<Long> estimateSize(); }
902
18.212766
62
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncStreamingCache.java
package org.infinispan.api.async; import java.nio.ByteBuffer; import java.util.List; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import org.infinispan.api.common.CacheEntryMetadata; import org.infinispan.api.common.CacheOptions; import org.infinispan.api.common.CacheWriteOptions; /** * AsyncStreamingCache implements streaming versions of put and get methods * * @since 14.0 */ public interface AsyncStreamingCache<K> { /** * Retrieves the value of the specified key as a {@link CacheEntrySubscriber}. It is up to the application to ensure * that the data is consumed and closed. The marshaller is ignored, i.e. all data will be read in its raw binary * form. * * @param key key to use */ default CacheEntrySubscriber get(K key) { return get(key, CacheOptions.DEFAULT); } /** * Retrieves the value of the specified key as a {@link CacheEntrySubscriber}. It is up to the application to ensure * that the data is consumed and closed. The marshaller is ignored, i.e. all data will be read in its raw binary * form. * * @param key key to use * @param metadata */ CacheEntrySubscriber get(K key, CacheOptions metadata); /** * Initiates a streaming put operation. It is up to the application to write to the returned {@link * CacheEntryPublisher} and close it when there is no more data to write. The marshaller is ignored, i.e. all data * will be written in its raw binary form. The returned output stream is not thread-safe. * * @param key key to use */ default CacheEntryPublisher put(K key) { return put(key, CacheWriteOptions.DEFAULT); } /** * Initiates a streaming put operation. It is up to the application to write to the returned {@link * CacheEntryPublisher} and close it when there is no more data to write. The marshaller is ignored, i.e. all data * will be written in its raw binary form. The returned output stream is not thread-safe. * * @param key key to use * @param metadata metadata */ CacheEntryPublisher put(K key, CacheWriteOptions metadata); /** * A conditional form of put which inserts an entry into the cache only if no mapping for the key is already present. * The operation is atomic. The server only performs the operation once the data is complete. * * @param key key to use */ default CacheEntryPublisher putIfAbsent(K key) { return putIfAbsent(key, CacheWriteOptions.DEFAULT); } /** * A conditional form of put which inserts an entry into the cache only if no mapping for the key is already present. * The operation is atomic. The server only performs the operation once the data is complete. * * @param key key to use * @param metadata metadata */ CacheEntryPublisher putIfAbsent(K key, CacheWriteOptions metadata); interface CacheEntrySubscriber extends Flow.Subscriber<List<ByteBuffer>> { CompletionStage<CacheEntryMetadata> metadata(); } interface CacheEntryPublisher extends Flow.Publisher<ByteBuffer>, AutoCloseable { } }
3,148
35.616279
120
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncWeakCounters.java
package org.infinispan.api.async; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import org.infinispan.api.configuration.CounterConfiguration; /** * @since 14.0 **/ public interface AsyncWeakCounters { CompletionStage<AsyncWeakCounter> get(String name); CompletionStage<AsyncWeakCounter> create(String name, CounterConfiguration configuration); CompletionStage<Void> remove(String name); Flow.Publisher<String> names(); }
474
22.75
93
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncCaches.java
package org.infinispan.api.async; import java.util.Set; import java.util.concurrent.CompletionStage; import org.infinispan.api.configuration.CacheConfiguration; /** * @since 14.0 **/ public interface AsyncCaches { <K, V> CompletionStage<AsyncCache<K, V>> create(String name, CacheConfiguration cacheConfiguration); <K, V> CompletionStage<AsyncCache<K, V>> create(String name, String template); <K, V> CompletionStage<AsyncCache<K, V>> get(String name); CompletionStage<Void> remove(String name); CompletionStage<Set<String>> names(); CompletionStage<Void> createTemplate(String name, CacheConfiguration cacheConfiguration); CompletionStage<Void> removeTemplate(String name); CompletionStage<Set<String>> templateNames(); }
759
26.142857
103
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncQuery.java
package org.infinispan.api.async; import java.util.concurrent.CompletionStage; import java.util.concurrent.Flow; import org.infinispan.api.common.events.cache.CacheContinuousQueryEvent; import org.infinispan.api.common.process.CacheEntryProcessorResult; import org.infinispan.api.common.process.CacheProcessor; import org.infinispan.api.common.process.CacheProcessorOptions; /** * Parameterized Query builder * * @param <K> * @param <V> * @param <R> the result type for the query * @since 14.0 */ public interface AsyncQuery<K, V, R> { /** * Sets the named parameter to the specified value * * @param name * @param value * @return */ AsyncQuery<K, V, R> param(String name, Object value); /** * Skips the first specified number of results * * @param skip * @return */ AsyncQuery<K, V, R> skip(long skip); /** * Limits the number of results * * @param limit * @return */ AsyncQuery<K, V, R> limit(int limit); /** * Executes the query */ CompletionStage<AsyncQueryResult<R>> find(); /** * Executes the query and returns a {@link java.util.concurrent.Flow.Publisher} with the results * * @param query query String * @return a {@link Flow.Publisher} which produces {@link CacheContinuousQueryEvent} items. */ Flow.Publisher<CacheContinuousQueryEvent<K, R>> findContinuously(String query); /** * Executes the manipulation statement (UPDATE, REMOVE) * * @return the number of entries that were processed */ CompletionStage<Long> execute(); /** * @param <T> * @param processor the entry processor task * @return */ default <T> Flow.Publisher<CacheEntryProcessorResult<K, T>> process(AsyncCacheEntryProcessor<K, V, T> processor) { return process(processor, CacheProcessorOptions.DEFAULT); } /** * @param <T> * @param processor the entry processor task * @param options * @return */ <T> Flow.Publisher<CacheEntryProcessorResult<K, T>> process(AsyncCacheEntryProcessor<K, V, T> processor, CacheProcessorOptions options); /** * Processes entries matched by the query using a named {@link CacheProcessor}. The query <b>MUST NOT</b> use * projections. If the cache processor returns a non-null value for an entry, it will be returned through the * publisher. * * @param <T> * @param processor the entry processor * @return */ default <T> Flow.Publisher<CacheEntryProcessorResult<K, T>> process(CacheProcessor processor) { return process(processor, CacheProcessorOptions.DEFAULT); } /** * Processes entries matched by the query using a named {@link CacheProcessor}. The query <b>MUST NOT</b> use * projections. If the cache processor returns a non-null value for an entry, it will be returned through the * publisher. * * @param <T> * @param processor the named entry processor * @param options * @return */ <T> Flow.Publisher<CacheEntryProcessorResult<K, T>> process(CacheProcessor processor, CacheProcessorOptions options); }
3,122
28.186916
139
java
null
infinispan-main/api/src/main/java/org/infinispan/api/async/AsyncQueryResult.java
package org.infinispan.api.async; import java.util.OptionalLong; import java.util.concurrent.Flow; /** * @since 14.0 **/ public interface AsyncQueryResult<R> extends AutoCloseable { OptionalLong hitCount(); Flow.Publisher<R> results(); void close(); }
267
15.75
60
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/Flags.java
package org.infinispan.api.common; /** * @since 14.0 **/ public interface Flags<F extends Flag, SELF> { SELF add(F flag); boolean contains(F flag); SELF addAll(Flags<F, SELF> flags); }
199
14.384615
46
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/CacheEntry.java
package org.infinispan.api.common; /** * @since 14.0 **/ public interface CacheEntry<K, V> { K key(); V value(); CacheEntryMetadata metadata(); }
160
11.384615
35
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/CloseableIterator.java
package org.infinispan.api.common; import java.util.Iterator; /** * Interface that provides semantics of a {@link Iterator} and {@link AutoCloseable} interfaces. This is useful when * you have data that must be iterated on and may hold resources in the underlying implementation that must be closed. * <p>Some implementations may close resources automatically when the iterator is finished being iterated on however * this is an implementation detail and all callers should call {@link AutoCloseable#close()} method to be sure all * resources are freed properly.</p> * * @author wburns * @since 14.0 */ public interface CloseableIterator<E> extends AutoCloseable, Iterator<E> { @Override void close(); }
722
37.052632
118
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/CacheEntryExpiration.java
package org.infinispan.api.common; import java.time.Duration; import java.util.Objects; import java.util.Optional; /** * @since 14.0 **/ public interface CacheEntryExpiration { CacheEntryExpiration DEFAULT = new Impl(); CacheEntryExpiration IMMORTAL = new Impl(Duration.ZERO, Duration.ZERO); static CacheEntryExpiration withLifespan(Duration lifespan) { return lifespan == null ? DEFAULT : new Impl(lifespan, null); } static CacheEntryExpiration withMaxIdle(Duration maxIdle) { return maxIdle == null ? DEFAULT : new Impl(null, maxIdle); } static CacheEntryExpiration withLifespanAndMaxIdle(Duration lifespan, Duration maxIdle) { return (lifespan == null && maxIdle == null) ? DEFAULT : new Impl(lifespan, maxIdle); } Optional<Duration> lifespan(); Optional<Duration> maxIdle(); boolean isImmortal(); boolean isDefault(); class Impl implements CacheEntryExpiration { private final Duration lifespan; private final Duration maxIdle; private Impl() { this.lifespan = null; this.maxIdle = null; } private Impl(Duration lifespan, Duration maxIdle) { this.lifespan = lifespan; this.maxIdle = maxIdle; } @Override public Optional<Duration> lifespan() { return Optional.ofNullable(lifespan); } @Override public Optional<Duration> maxIdle() { return Optional.ofNullable(maxIdle); } public Duration rawLifespan() { return lifespan; } public Duration rawMaxIdle() { return maxIdle; } @Override public boolean isImmortal() { return this == IMMORTAL; } @Override public boolean isDefault() { return this == DEFAULT; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Impl that = (Impl) o; return Objects.equals(lifespan, that.lifespan) && Objects.equals(maxIdle, that.maxIdle); } @Override public int hashCode() { return Objects.hash(lifespan, maxIdle); } @Override public String toString() { if (this == IMMORTAL) { return "Impl{IMMORTAL}"; } else if (this == DEFAULT) { return "Impl{DEFAULT}"; } else { return "Impl{" + "lifespan=" + lifespan + ", maxIdle=" + maxIdle + '}'; } } } }
2,585
23.865385
97
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/MutableCacheEntry.java
package org.infinispan.api.common; /** * @since 14.0 **/ public interface MutableCacheEntry<K, V> extends CacheEntry<K, V> { void setValue(V newValue); }
160
16.888889
67
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/CacheWriteOptions.java
package org.infinispan.api.common; import java.time.Duration; /** * @since 14.0 **/ public interface CacheWriteOptions extends CacheOptions { CacheWriteOptions DEFAULT = new Impl(); static Builder writeOptions() { return new Builder(); } static Builder writeOptions(CacheOptions options) { Builder builder = new Builder(); options.timeout().ifPresent(builder::timeout); options.flags().ifPresent(builder::flags); return builder; } static Builder writeOptions(CacheWriteOptions options) { Builder builder = writeOptions((CacheOptions) options); options.expiration().lifespan().ifPresent(builder::lifespan); options.expiration().maxIdle().ifPresent(builder::maxIdle); return builder; } CacheEntryExpiration expiration(); class Impl extends CacheOptions.Impl implements CacheWriteOptions { private final CacheEntryExpiration expiration; public Impl() { this(null, null, CacheEntryExpiration.DEFAULT); } Impl(Duration timeout, Flags<?, ?> flags, CacheEntryExpiration expiration) { super(timeout, flags); this.expiration = expiration != null ? expiration : CacheEntryExpiration.DEFAULT; } @Override public CacheEntryExpiration expiration() { return expiration; } } class Builder extends CacheOptions.Builder { private CacheEntryExpiration expiration = CacheEntryExpiration.DEFAULT; @Override public Builder timeout(Duration timeout) { super.timeout(timeout); return this; } @Override public Builder flags(Flags<?, ?> flags) { super.flags(flags); return this; } public Builder lifespan(Duration lifespan) { if (expiration.maxIdle().isPresent()) { return lifespanAndMaxIdle(lifespan, expiration.maxIdle().get()); } else { this.expiration = CacheEntryExpiration.withLifespan(lifespan); return this; } } public Builder maxIdle(Duration maxIdle) { if (expiration.lifespan().isPresent()) { return lifespanAndMaxIdle(expiration.lifespan().get(), maxIdle); } else { this.expiration = CacheEntryExpiration.withMaxIdle(maxIdle); return this; } } public Builder lifespanAndMaxIdle(Duration lifespan, Duration maxIdle) { this.expiration = CacheEntryExpiration.withLifespanAndMaxIdle(lifespan, maxIdle); return this; } @Override public CacheWriteOptions build() { return new Impl(timeout, flags, expiration); } } }
2,675
27.774194
90
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/CacheEntryCollection.java
package org.infinispan.api.common; import java.util.Collection; /** * @since 14.0 **/ public interface CacheEntryCollection<K, V> { K key(); Collection<V> values(); CacheEntryMetadata metadata(); }
213
13.266667
45
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/CacheOptions.java
package org.infinispan.api.common; import java.time.Duration; import java.util.Optional; /** * @since 14.0 **/ public interface CacheOptions { CacheOptions DEFAULT = new Impl(); static Builder options() { return new Builder(); } Optional<Duration> timeout(); Optional<Flags<?, ?>> flags(); class Impl implements CacheOptions { private final Duration timeout; private final Flags<?, ?> flags; protected Impl() { this(null, null); } protected Impl(Duration timeout, Flags<?, ?> flags) { this.timeout = timeout; this.flags = flags; } @Override public Optional<Duration> timeout() { return Optional.ofNullable(timeout); } public Duration rawTimeout() { return timeout; } @Override public Optional<Flags<?, ?>> flags() { return Optional.ofNullable(flags); } public Flags<?, ?> rawFlags() { return flags; } } class Builder { protected Duration timeout; protected Flags<?, ?> flags; public Builder timeout(Duration timeout) { this.timeout = timeout; return this; } public Builder flags(Flags<?, ?> flags) { this.flags.addAll((Flags) flags); return this; } public CacheOptions build() { return new Impl(timeout, flags); } } }
1,421
19.028169
59
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/CacheEntryMetadata.java
package org.infinispan.api.common; import java.time.Instant; import java.util.Optional; /** * @since 14.0 **/ public interface CacheEntryMetadata { Optional<Instant> creationTime(); Optional<Instant> lastAccessTime(); CacheEntryExpiration expiration(); CacheEntryVersion version(); }
304
15.052632
38
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/Flag.java
package org.infinispan.api.common; /** * @since 14.0 **/ public interface Flag { Flags<?, ?> add(Flags<?, ?> flags); }
125
13
38
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/CloseableIterable.java
package org.infinispan.api.common; import java.util.function.Consumer; /** * Interface that provides semantics of a {@link Iterable} but produces {@link CloseableIterator} instances. * Note that the iterators produced via {@link #iterator()} do not need to be closed if fully iterated upon. * Therefore, methods like {@link Iterable#forEach(Consumer)} and {@link java.util.Iterator#forEachRemaining(Consumer)} * can be used without any worry to closing any iterators. * * @since 14.0 */ public interface CloseableIterable<E> extends Iterable<E> { @Override CloseableIterator<E> iterator(); }
607
34.764706
119
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/CacheEntryVersion.java
package org.infinispan.api.common; /** * @since 14.0 **/ public interface CacheEntryVersion { }
99
11.5
36
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/ConfigurationChangeEvent.java
package org.infinispan.api.common.events; import org.infinispan.api.common.events.container.ContainerEvent; /** * @since 14.0 **/ public interface ConfigurationChangeEvent extends ContainerEvent { }
203
19.4
66
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/container/ContainerListenerEventType.java
package org.infinispan.api.common.events.container; /** * @since 14.0 **/ public enum ContainerListenerEventType { CACHE_STARTED, CACHE_STOPPED, CONFIGURATION_CHANGED, CLUSTER_MERGED, VIEW_CHANGED }
217
15.769231
51
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/container/ContainerEvent.java
package org.infinispan.api.common.events.container; /** * @since 14.0 **/ public interface ContainerEvent { }
113
13.25
51
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/cache/CacheEntryEvent.java
package org.infinispan.api.common.events.cache; import org.infinispan.api.common.CacheEntry; /** * @since 14.0 **/ public interface CacheEntryEvent<K, V> { /** * @return The entry after the event */ CacheEntry<K, V> newEntry(); /** * @return The entry before the event */ CacheEntry<K, V> previousEntry(); /** * @return True if this event is generated from an existing entry as the listener has {@link * CacheListenerOptions#includeCurrentState()} set to <code>true</code>. */ default boolean isCurrentState() { return false; } /** * @return an identifier of the transaction or cache invocation that triggered the event. In a transactional cache, * it is the transaction object associated with the current call. In a non-transactional cache, it is an internal * object that identifies the cache invocation. */ default Object getSource() { return null; } /** * @return true if the call originated on the local cache instance; false if originated from a remote one. */ default boolean isOriginLocal() { return false; } CacheEntryEventType type(); }
1,168
24.977778
118
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/cache/CacheListenerOptions.java
package org.infinispan.api.common.events.cache; /** * TODO SPLIT INTO EMBEDDED/REMOTE * * @since 14.0 **/ public class CacheListenerOptions { boolean primaryOnly; Observation observation; boolean clustered; boolean includeCurrentState; public CacheListenerOptions() { } public CacheListenerOptions primaryOnly() { return primaryOnly(true); } public CacheListenerOptions primaryOnly(boolean primaryOnly) { this.primaryOnly = primaryOnly; return this; } public CacheListenerOptions observation(Observation observation) { this.observation = observation; return this; } public CacheListenerOptions clustered() { return clustered(true); } public CacheListenerOptions clustered(boolean clustered) { this.clustered = clustered; return this; } public CacheListenerOptions includeCurrentState() { return includeCurrentState(true); } public CacheListenerOptions includeCurrentState(boolean includeCurrentState) { this.includeCurrentState = includeCurrentState; return this; } enum Observation { PRE() { @Override public boolean shouldInvoke(boolean pre) { return pre; } }, POST() { @Override public boolean shouldInvoke(boolean pre) { return !pre; } }, BOTH() { @Override public boolean shouldInvoke(boolean pre) { return true; } }; public abstract boolean shouldInvoke(boolean pre); } }
1,584
21.013889
81
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/cache/CacheStopEvent.java
package org.infinispan.api.common.events.cache; import org.infinispan.api.common.events.container.ContainerEvent; /** * @since 14.0 **/ public interface CacheStopEvent extends ContainerEvent { }
199
19
65
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/cache/CacheEntryCreatedEvent.java
package org.infinispan.api.common.events.cache; /** * @since 14.0 **/ public interface CacheEntryCreatedEvent<K, V> extends CacheEntryEvent<K, V> { }
153
18.25
77
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/cache/CacheContinuousQueryEvent.java
package org.infinispan.api.common.events.cache; /** * @since 14.0 */ public interface CacheContinuousQueryEvent<K, V> { // introduce subinterfaces EventType type(); K key(); V value(); enum EventType { // Drop the enum and JOIN, UPDATE, LEAVE } }
287
13.4
77
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/cache/CacheEntryEventType.java
package org.infinispan.api.common.events.cache; /** * @since 14.0 **/ public enum CacheEntryEventType { CREATED, UPDATED, REMOVED, EXPIRED }
156
12.083333
47
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/cache/CacheStartEvent.java
package org.infinispan.api.common.events.cache; import org.infinispan.api.common.events.container.ContainerEvent; /** * @since 14.0 **/ public interface CacheStartEvent extends ContainerEvent { String cacheName(); }
223
19.363636
65
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/counter/CounterState.java
package org.infinispan.api.common.events.counter; /** * The possible states for a counter value. * * @since 14.0 */ public enum CounterState { /** * The counter value is valid. */ VALID, /** * The counter value has reached its min threshold. */ LOWER_BOUND_REACHED, /** * The counter value has reached its max threshold. */ UPPER_BOUND_REACHED; private static final CounterState[] CACHED_VALUES = CounterState.values(); public static CounterState valueOf(int index) { return CACHED_VALUES[index]; } }
567
17.933333
77
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/events/counter/CounterEvent.java
package org.infinispan.api.common.events.counter; /** * @since 14.0 */ public interface CounterEvent { /** * @return the previous value. */ long getOldValue(); /** * @return the previous state. */ CounterState getOldState(); /** * @return the counter value. */ long getNewValue(); /** * @return the counter state. */ CounterState getNewState(); }
411
13.206897
49
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/annotations/indexing/_private/DecimalProcessor.java
package org.infinispan.api.common.annotations.indexing._private; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessor; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorContext; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingScaledNumberFieldOptionsStep; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingStep; import org.infinispan.api.annotations.indexing.Decimal; import org.infinispan.api.annotations.indexing.model.Values; public class DecimalProcessor implements PropertyMappingAnnotationProcessor<Decimal> { @Override public void process(PropertyMappingStep mapping, Decimal annotation, PropertyMappingAnnotationProcessorContext context) { String name = annotation.name(); PropertyMappingScaledNumberFieldOptionsStep scaledNumberField = (name.isEmpty()) ? mapping.scaledNumberField() : mapping.scaledNumberField(name); scaledNumberField.decimalScale(annotation.decimalScale()); scaledNumberField.sortable(Options.sortable(annotation.sortable())); scaledNumberField.aggregable(Options.aggregable(annotation.aggregable())); String indexNullAs = annotation.indexNullAs(); if (indexNullAs != null && !Values.DO_NOT_INDEX_NULL.equals(indexNullAs)) { scaledNumberField.indexNullAs(indexNullAs); } scaledNumberField.projectable(Options.projectable(annotation.projectable())); scaledNumberField.searchable(Options.searchable(annotation.searchable())); } }
1,658
50.84375
124
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/annotations/indexing/_private/IndexedProcessor.java
package org.infinispan.api.common.annotations.indexing._private; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMappingAnnotationProcessor; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMappingAnnotationProcessorContext; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingIndexedStep; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep; import org.infinispan.api.annotations.indexing.Indexed; public class IndexedProcessor implements TypeMappingAnnotationProcessor<Indexed> { @Override public void process(TypeMappingStep mapping, Indexed annotation, TypeMappingAnnotationProcessorContext context) { TypeMappingIndexedStep indexed = mapping.indexed(); String indexName = annotation.index(); if (!indexName.isEmpty()) { indexed.index(indexName); } indexed.enabled(annotation.enabled()); } }
989
42.043478
119
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/annotations/indexing/_private/KeywordProcessor.java
package org.infinispan.api.common.annotations.indexing._private; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessor; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorContext; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingKeywordFieldOptionsStep; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingStep; import org.infinispan.api.annotations.indexing.Keyword; import org.infinispan.api.annotations.indexing.model.Values; public class KeywordProcessor implements PropertyMappingAnnotationProcessor<Keyword> { @Override public void process(PropertyMappingStep mapping, Keyword annotation, PropertyMappingAnnotationProcessorContext context) { String name = annotation.name(); PropertyMappingKeywordFieldOptionsStep keywordField = (name.isEmpty()) ? mapping.keywordField() : mapping.keywordField(name); String normalizer = annotation.normalizer(); if (!normalizer.isEmpty()) { keywordField.normalizer(annotation.normalizer()); } keywordField.norms(Options.norms(annotation.norms())); keywordField.sortable(Options.sortable(annotation.sortable())); keywordField.aggregable(Options.aggregable(annotation.aggregable())); String indexNullAs = annotation.indexNullAs(); if (indexNullAs != null && !Values.DO_NOT_INDEX_NULL.equals(indexNullAs)) { keywordField.indexNullAs(indexNullAs); } keywordField.projectable(Options.projectable(annotation.projectable())); keywordField.searchable(Options.searchable(annotation.searchable())); } }
1,756
47.805556
124
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/annotations/indexing/_private/GeoCoordinatesProcessor.java
package org.infinispan.api.common.annotations.indexing._private; import org.hibernate.search.mapper.pojo.bridge.builtin.programmatic.GeoPointBinder; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessor; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorContext; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMappingAnnotationProcessor; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMappingAnnotationProcessorContext; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingStep; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.TypeMappingStep; import org.infinispan.api.annotations.indexing.GeoCoordinates; public class GeoCoordinatesProcessor implements TypeMappingAnnotationProcessor<GeoCoordinates>, PropertyMappingAnnotationProcessor<GeoCoordinates> { @Override public void process(PropertyMappingStep mapping, GeoCoordinates annotation, PropertyMappingAnnotationProcessorContext context) { mapping.binder(createBinder(annotation)); } @Override public void process(TypeMappingStep mapping, GeoCoordinates annotation, TypeMappingAnnotationProcessorContext context) { mapping.binder(createBinder(annotation)); } private GeoPointBinder createBinder(GeoCoordinates annotation) { return GeoPointBinder.create() .fieldName(annotation.fieldName()) .markerSet(annotation.marker()) .projectable(Options.projectable(annotation.projectable())) .sortable(Options.sortable(annotation.sortable())); } }
1,801
50.485714
123
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/annotations/indexing/_private/BasicProcessor.java
package org.infinispan.api.common.annotations.indexing._private; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessor; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorContext; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingGenericFieldOptionsStep; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingStep; import org.infinispan.api.annotations.indexing.Basic; import org.infinispan.api.annotations.indexing.model.Values; public class BasicProcessor implements PropertyMappingAnnotationProcessor<Basic> { @Override public void process(PropertyMappingStep mapping, Basic annotation, PropertyMappingAnnotationProcessorContext context) { String name = annotation.name(); PropertyMappingGenericFieldOptionsStep genericField = (name.isEmpty()) ? mapping.genericField() : mapping.genericField(name); genericField.sortable(Options.sortable(annotation.sortable())); genericField.aggregable(Options.aggregable(annotation.aggregable())); String indexNullAs = annotation.indexNullAs(); if (indexNullAs != null && !Values.DO_NOT_INDEX_NULL.equals(indexNullAs)) { genericField.indexNullAs(indexNullAs); } genericField.projectable(Options.projectable(annotation.projectable())); genericField.searchable(Options.searchable(annotation.searchable())); } }
1,533
50.133333
123
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/annotations/indexing/_private/LatitudeProcessor.java
package org.infinispan.api.common.annotations.indexing._private; import org.hibernate.search.mapper.pojo.bridge.builtin.programmatic.GeoPointBinder; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessor; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorContext; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingStep; import org.infinispan.api.annotations.indexing.Latitude; public class LatitudeProcessor implements PropertyMappingAnnotationProcessor<Latitude> { @Override public void process(PropertyMappingStep mapping, Latitude annotation, PropertyMappingAnnotationProcessorContext context) { mapping.marker(GeoPointBinder.latitude().markerSet(annotation.marker())); } }
881
50.882353
123
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/annotations/indexing/_private/EmbeddedProcessor.java
package org.infinispan.api.common.annotations.indexing._private; import org.hibernate.search.engine.backend.types.ObjectStructure; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessor; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorContext; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingStep; import org.infinispan.api.annotations.indexing.Embedded; import org.infinispan.api.annotations.indexing.option.Structure; public class EmbeddedProcessor implements PropertyMappingAnnotationProcessor<Embedded> { @Override public void process(PropertyMappingStep mapping, Embedded annotation, PropertyMappingAnnotationProcessorContext context) { String name = annotation.name(); if (name.isEmpty()) { name = null; } mapping.indexingDependency().reindexOnUpdate(ReindexOnUpdate.NO); mapping.indexedEmbedded(name) .structure((annotation.structure() == Structure.NESTED) ? ObjectStructure.NESTED : ObjectStructure.FLATTENED) .includeDepth(annotation.includeDepth()); } }
1,282
48.346154
125
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/annotations/indexing/_private/Options.java
package org.infinispan.api.common.annotations.indexing._private; import org.hibernate.search.util.common.AssertionFailure; import org.infinispan.api.annotations.indexing.option.TermVector; public final class Options { private Options() { } public static org.hibernate.search.engine.backend.types.Norms norms(boolean norms) { return (norms) ? org.hibernate.search.engine.backend.types.Norms.YES : org.hibernate.search.engine.backend.types.Norms.NO; } public static org.hibernate.search.engine.backend.types.Sortable sortable(boolean sortable) { return (sortable) ? org.hibernate.search.engine.backend.types.Sortable.YES : org.hibernate.search.engine.backend.types.Sortable.NO; } public static org.hibernate.search.engine.backend.types.Aggregable aggregable(boolean aggregable) { return (aggregable) ? org.hibernate.search.engine.backend.types.Aggregable.YES : org.hibernate.search.engine.backend.types.Aggregable.NO; } public static org.hibernate.search.engine.backend.types.Projectable projectable(boolean projectable) { return (projectable) ? org.hibernate.search.engine.backend.types.Projectable.YES : org.hibernate.search.engine.backend.types.Projectable.NO; } public static org.hibernate.search.engine.backend.types.Searchable searchable(boolean searchable) { return (searchable) ? org.hibernate.search.engine.backend.types.Searchable.YES : org.hibernate.search.engine.backend.types.Searchable.NO; } public static org.hibernate.search.engine.backend.types.TermVector termVector(TermVector termVector) { switch (termVector) { case YES: return org.hibernate.search.engine.backend.types.TermVector.YES; case NO: return org.hibernate.search.engine.backend.types.TermVector.NO; case WITH_POSITIONS: return org.hibernate.search.engine.backend.types.TermVector.WITH_POSITIONS; case WITH_OFFSETS: return org.hibernate.search.engine.backend.types.TermVector.WITH_OFFSETS; case WITH_POSITIONS_OFFSETS: return org.hibernate.search.engine.backend.types.TermVector.WITH_POSITIONS_OFFSETS; case WITH_POSITIONS_PAYLOADS: return org.hibernate.search.engine.backend.types.TermVector.WITH_POSITIONS_PAYLOADS; case WITH_POSITIONS_OFFSETS_PAYLOADS: return org.hibernate.search.engine.backend.types.TermVector.WITH_POSITIONS_OFFSETS_PAYLOADS; default: throw new AssertionFailure("Unexpected value for TermVector: " + termVector); } } }
2,700
42.564516
105
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/annotations/indexing/_private/LongitudeProcessor.java
package org.infinispan.api.common.annotations.indexing._private; import org.hibernate.search.mapper.pojo.bridge.builtin.programmatic.GeoPointBinder; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessor; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorContext; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingStep; import org.infinispan.api.annotations.indexing.Longitude; public class LongitudeProcessor implements PropertyMappingAnnotationProcessor<Longitude> { @Override public void process(PropertyMappingStep mapping, Longitude annotation, PropertyMappingAnnotationProcessorContext context) { mapping.marker(GeoPointBinder.longitude().markerSet(annotation.marker())); } }
886
51.176471
123
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/annotations/indexing/_private/TextProcessor.java
package org.infinispan.api.common.annotations.indexing._private; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessor; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorContext; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingFullTextFieldOptionsStep; import org.hibernate.search.mapper.pojo.mapping.definition.programmatic.PropertyMappingStep; import org.infinispan.api.annotations.indexing.Text; public class TextProcessor implements PropertyMappingAnnotationProcessor<Text> { @Override public void process(PropertyMappingStep mapping, Text annotation, PropertyMappingAnnotationProcessorContext context) { String name = annotation.name(); PropertyMappingFullTextFieldOptionsStep fullTextField = (name.isEmpty()) ? mapping.fullTextField() : mapping.fullTextField(name); fullTextField.analyzer(annotation.analyzer()); String searchAnalyzer = annotation.searchAnalyzer(); if (!searchAnalyzer.isEmpty()) { fullTextField.searchAnalyzer(searchAnalyzer); } fullTextField.norms(Options.norms(annotation.norms())); fullTextField.termVector(Options.termVector(annotation.termVector())); fullTextField.projectable(Options.projectable(annotation.projectable())); fullTextField.searchable(Options.searchable(annotation.searchable())); } }
1,491
48.733333
123
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/process/CacheEntryProcessorResult.java
package org.infinispan.api.common.process; import org.infinispan.api.Experimental; /** * Write result for process operations on the Cache * * @since 14.0 */ @Experimental public interface CacheEntryProcessorResult<K, T> { K key(); T result(); Throwable error(); static <K, T> CacheEntryProcessorResult<K, T> onResult(K key, T result) { return new Impl<>(key, result, null); } static <K, T> CacheEntryProcessorResult<K, T> onError(K key, Throwable throwable) { return new Impl<>(key, null, throwable); } class Impl<K, T> implements CacheEntryProcessorResult<K, T> { private final K key; private final T result; private final Throwable throwable; public Impl(K key, T result, Throwable throwable) { this.key = key; this.result = result; this.throwable = throwable; } @Override public K key() { return key; } @Override public T result() { return result; } @Override public Throwable error() { return throwable; } } }
1,106
19.886792
86
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/process/CacheEntryProcessorContext.java
package org.infinispan.api.common.process; import org.infinispan.api.common.CacheOptions; /** * @since 14.0 **/ public interface CacheEntryProcessorContext { Object[] arguments(); CacheOptions options(); }
217
15.769231
46
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/process/CacheProcessorOptions.java
package org.infinispan.api.common.process; import java.time.Duration; import org.infinispan.api.common.CacheOptions; import org.infinispan.api.common.Flags; /** * @since 14.0 **/ public interface CacheProcessorOptions extends CacheOptions { CacheProcessorOptions DEFAULT = new Impl(); static Builder processorOptions() { return new Builder(); } Object[] arguments(); class Impl extends CacheOptions.Impl implements CacheProcessorOptions { final Object[] arguments; public Impl() { this(null, null, null); } private Impl(Duration timeout, Flags<?, ?> flags, Object[] arguments) { super(timeout, flags); this.arguments = arguments; } @Override public Object[] arguments() { return arguments; } } class Builder extends CacheOptions.Builder { private Object[] arguments; public Builder arguments(Object... arguments) { this.arguments = arguments; return this; } @Override public Builder timeout(Duration timeout) { super.timeout(timeout); return this; } @Override public Builder flags(Flags<?, ?> flags) { super.flags(flags); return this; } @Override public CacheProcessorOptions build() { return new Impl(timeout, flags, arguments); } } }
1,401
20.90625
77
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/process/CacheProcessor.java
package org.infinispan.api.common.process; /** * @since 14.0 **/ public interface CacheProcessor { String name(); }
122
12.666667
42
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/query/QueryRequestBuilder.java
package org.infinispan.api.common.query; import java.util.HashMap; import java.util.Map; /** * Builder class to build {@link QueryRequest} * <p> * Different parameters can be specified: * <u> * <li>Ickle Query: Mandatory query string</li> * <li>Param: Parameters for the query/li> * <li>Skip: Skip this number of entries</li> * <li>Limit: Limit the result to this number of entries</li> * </u> * * @since 14.0 */ public final class QueryRequestBuilder { private final Map<String, Object> params; private String ickleQuery; private long skip; private int limit = -1; private QueryRequestBuilder() { params = new HashMap<>(); } public static QueryRequestBuilder query(String ickleQuery) { QueryRequestBuilder queryParameters = new QueryRequestBuilder(); queryParameters.ickleQuery = ickleQuery; return queryParameters; } public QueryRequestBuilder param(String name, Object value) { params.put(name, value); return this; } public QueryRequestBuilder skip(long skip) { this.skip = skip; return this; } public QueryRequestBuilder limit(int limit) { this.limit = limit; return this; } public QueryRequest find() { return new QueryRequest(ickleQuery, params, skip, limit); } }
1,305
23.185185
70
java
null
infinispan-main/api/src/main/java/org/infinispan/api/common/query/QueryRequest.java
package org.infinispan.api.common.query; import java.util.Map; /** * QueryRequest creates a request for Query or Continuous Query. It is built with the {@link QueryRequestBuilder} * * @since 14.0 */ public final class QueryRequest { private final boolean created; private final boolean updated; private final boolean removed; private final String queryString; private final Map<String, Object> params; private final long skip; private final int limit; QueryRequest(boolean created, boolean updated, boolean removed, String query, Map<String, Object> params) { this.created = created; this.updated = updated; this.removed = removed; this.queryString = query; this.params = params; this.skip = 0; this.limit = -1; } public QueryRequest(String queryString, Map<String, Object> params, long skip, int limit) { this.created = true; this.updated = true; this.removed = true; this.queryString = queryString; this.params = params; this.skip = skip; this.limit = limit; } public boolean isCreated() { return created; } public boolean isUpdated() { return updated; } public boolean isDeleted() { return removed; } public String getQueryString() { return queryString; } public Map<String, Object> getParams() { return params; } public long skip() { return skip; } public int limit() { return limit; } }
1,524
21.426471
113
java
null
infinispan-main/api/src/main/java/org/infinispan/api/annotations/indexing/Basic.java
package org.infinispan.api.annotations.indexing; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.search.engine.environment.bean.BeanRetrieval; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef; import org.infinispan.api.annotations.indexing.model.Values; import org.infinispan.api.common.annotations.indexing._private.BasicProcessor; /** * Maps an entity property to a field in the index. * <p> * This is a generic annotation that will work for any standard field type: * {@link String}, {@link Integer}, {@link java.time.LocalDate}, ... * <p> * Note that this annotation, being generic, does not offer configuration options * that are specific to only some types of fields. * Use more specific annotations if you want that kind of configuration. * For example, to define a tokenized (multi-word) text field, use {@link Text}. * To define a non-tokenized (single-word), but normalized (lowercased, ...) text field, use {@link Keyword}. * <p> * Simplified version for Infinispan of {@link org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField} * * @since 14.0 */ @Documented @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Repeatable(Basic.List.class) @PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = BasicProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR)) public @interface Basic { /** * @return The name of the index field. */ String name() default ""; /** * Whether we want to be able to obtain the value of the field as a projection. * <p> * This usually means that the field will be stored in the index, but it is more subtle than that, for instance in the * case of projection by distance. * * @return Whether projections are enabled for this field. */ boolean projectable() default false; /** * Whether a field can be used in sorts. * * @return Whether this field should be sortable. */ boolean sortable() default false; /** * Whether we want to be able to search the document using this field. * <p> * If the field is not searchable, search predicates cannot be applied to it. * * @return Whether this field should be searchable. */ boolean searchable() default true; /** * Whether the field can be used in aggregations. * <p> * This usually means that the field will have doc-values stored in the index. * * @return Whether aggregations are enabled for this field. */ boolean aggregable() default false; /** * @return A value used instead of null values when indexing. */ String indexNullAs() default Values.DO_NOT_INDEX_NULL; @Documented @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @interface List { Basic[] value(); } }
3,234
34.549451
136
java
null
infinispan-main/api/src/main/java/org/infinispan/api/annotations/indexing/Longitude.java
package org.infinispan.api.annotations.indexing; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.search.engine.environment.bean.BeanRetrieval; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef; import org.infinispan.api.common.annotations.indexing._private.LongitudeProcessor; /** * Mark the property hosting the longitude of a specific spatial coordinate. * The property must be of type {@code Double} or {@code double}. * <p> * Infinispan version of {@link org.hibernate.search.mapper.pojo.bridge.builtin.annotation.Longitude} * * @since 14.0 */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD}) @Documented @PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = LongitudeProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR)) public @interface Longitude { /** * @return The name of the marker this marker belongs to. * Set it to the value of {@link GeoCoordinates#marker()} * so that the bridge detects this marker. */ String marker() default ""; }
1,384
37.472222
140
java
null
infinispan-main/api/src/main/java/org/infinispan/api/annotations/indexing/Text.java
package org.infinispan.api.annotations.indexing; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.search.engine.environment.bean.BeanRetrieval; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef; import org.infinispan.api.annotations.indexing.option.TermVector; import org.infinispan.api.common.annotations.indexing._private.TextProcessor; /** * Maps a property to a full-text field in the index, potentially holding multiple tokens (words) of text. * <p> * Note that this annotation only creates tokenized (multi-word) text fields. * As a result: * <ul> * <li>The field value must be of type String</li> * <li>You must assign an analyzer when using this annotation</li> * <li>This annotation does not allow making the field sortable (analyzed fields cannot be sorted on)</li> * <li>This annotation does not allow making the field aggregable (analyzed fields cannot be aggregated on)</li> * </ul> * <p> * If you want to index a non-String value, use the {@link Basic} annotation instead. * If you want to index a String value, but don't want the field to be analyzed, or want it to be sortable, * use the {@link Keyword} annotation instead. * <p> * Simplified version for Infinispan of {@link org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField} * * @since 14.0 */ @Documented @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Repeatable(Text.List.class) @PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = TextProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR)) public @interface Text { /** * @return The name of the index field. */ String name() default ""; /** * @return A reference to the analyzer to use for this field. * By default, the Lucene standard analyzer will be applied. */ String analyzer() default "standard"; /** * @return A reference to a different analyzer, overriding the {@link #analyzer()}, * to use for query parameters at search time. * If not defined, the same {@link #analyzer()} will be used. */ String searchAnalyzer() default ""; /** * Whether index-time scoring information for the field should be stored or not. * <p> * Enabling norms will improve the quality of scoring. * Disabling norms will reduce the disk space used by the index. * * @return Whether index-time scoring information should be stored or not. */ boolean norms() default true; /** * @return The term vector storing strategy. * @see TermVector */ TermVector termVector() default TermVector.NO; /** * @return Whether projections are enabled for this field. * @see Basic#projectable() */ boolean projectable() default false; /** * @return Whether this field should be searchable. * @see Basic#searchable() */ boolean searchable() default true; @Documented @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @interface List { Text[] value(); } }
3,452
34.96875
135
java
null
infinispan-main/api/src/main/java/org/infinispan/api/annotations/indexing/Decimal.java
package org.infinispan.api.annotations.indexing; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.search.engine.environment.bean.BeanRetrieval; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef; import org.infinispan.api.annotations.indexing.model.Values; import org.infinispan.api.common.annotations.indexing._private.DecimalProcessor; /** * Maps a property to a scaled number field in the index, * i.e. a numeric field for integer or floating-point values * that require a higher precision than doubles * but always have roughly the same scale. * <p> * Useful for {@link java.math.BigDecimal} and {@link java.math.BigInteger} in particular. * <p> * Simplified version for Infinispan of {@link org.hibernate.search.mapper.pojo.mapping.definition.annotation.ScaledNumberField} * * @see #decimalScale() * * @since 14.0 */ @Documented @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Repeatable(Decimal.List.class) @PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = DecimalProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR)) public @interface Decimal { /** * @return The name of the index field. */ String name() default ""; /** * @return How the scale of values should be adjusted before indexing as a fixed-precision integer. * A positive {@code decimalScale} will shift the decimal point to the right before rounding to the nearest integer and indexing, * effectively retaining that many digits after the decimal place in the index. * Since numbers are indexed with a fixed number of bits, * this increase in precision also means that the maximum value that can be indexed will be smaller. * A negative {@code decimalScale} will shift the decimal point to the left before rounding to the nearest integer and indexing, * effectively setting that many of the smaller digits to zero in the index. * Since numbers are indexed with a fixed number of bits, * this decrease in precision also means that the maximum value that can be indexed will be larger. * By default, two decimals will be used. */ int decimalScale() default 2; /** * @return Whether projections are enabled for this field. * @see Basic#projectable() */ boolean projectable() default false; /** * @return Whether this field should be sortable. * @see Basic#sortable() */ boolean sortable() default false; /** * @return Whether this field should be searchable. * @see Basic#searchable() */ boolean searchable() default true; /** * @return Whether aggregations are enabled for this field. * @see Basic#aggregable() */ boolean aggregable() default false; /** * @return A value used instead of null values when indexing. * @see Basic#indexNullAs() */ String indexNullAs() default Values.DO_NOT_INDEX_NULL; @Documented @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @interface List { Decimal[] value(); } }
3,448
36.086022
138
java
null
infinispan-main/api/src/main/java/org/infinispan/api/annotations/indexing/Embedded.java
package org.infinispan.api.annotations.indexing; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.search.engine.environment.bean.BeanRetrieval; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef; import org.infinispan.api.annotations.indexing.option.Structure; import org.infinispan.api.common.annotations.indexing._private.EmbeddedProcessor; /** * Maps a property to an object field whose fields are the same as those defined in the property type. * <p> * This allows search queries on a single index to use data from multiple entities. * <p> * To get the original structure, the {@link Structure#NESTED nested structure} must be used, * but this has an impact on performance and how queries must be structured. * <p> * Simplified version for Infinispan of {@link org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded} * * @since 14.0 */ @Documented @Repeatable(Embedded.List.class) @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = EmbeddedProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR)) public @interface Embedded { /** * @return The name of the object field created to represent this {@code @Embedded}. * Defaults to the property name. */ String name() default ""; /** * The number of levels of indexed-embedded that will have all their fields included by default. * <p> * {@code includeDepth} is the number of `@Embedded` that will be traversed * and for which all fields of the indexed-embedded element will be included: * <ul> * <li>{@code includeDepth=0} means fields of the indexed-embedded element are <strong>not</strong> included, * nor is any field of nested indexed-embedded elements. * <li>{@code includeDepth=1} means fields of the indexed-embedded element <strong>are</strong> included, * but <strong>not</strong> fields of nested indexed-embedded elements. * <li>And so on. * </ul> * The default is 3. * * @return The number of levels of indexed-embedded that will have all their fields included by default. * By default, three levels will be included. */ int includeDepth() default 3; /** * @return How the structure of the object field created for this indexed-embedded * is preserved upon indexing. * @see Structure */ Structure structure() default Structure.NESTED; @Documented @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @interface List { Embedded[] value(); } }
2,999
39.540541
139
java
null
infinispan-main/api/src/main/java/org/infinispan/api/annotations/indexing/Indexed.java
package org.infinispan.api.annotations.indexing; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.search.engine.environment.bean.BeanRetrieval; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMapping; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMappingAnnotationProcessorRef; import org.infinispan.api.common.annotations.indexing._private.IndexedProcessor; /** * Maps an entity type to an index. * <p> * Simplified version for Infinispan of {@link org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed} * * @since 14.0 */ @Documented @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @TypeMapping(processor = @TypeMappingAnnotationProcessorRef(type = IndexedProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR)) public @interface Indexed { /** * @return The name of the index. * Defaults to the entity name. */ String index() default ""; /** * @return {@code true} to map the type to an index (the default), * {@code false} to disable the mapping to an index. * Useful to disable indexing when subclassing an indexed type. */ boolean enabled() default true; }
1,397
33.097561
130
java
null
infinispan-main/api/src/main/java/org/infinispan/api/annotations/indexing/GeoCoordinates.java
package org.infinispan.api.annotations.indexing; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.search.engine.environment.bean.BeanRetrieval; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMapping; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.TypeMappingAnnotationProcessorRef; import org.infinispan.api.common.annotations.indexing._private.GeoCoordinatesProcessor; import org.infinispan.api.annotations.indexing.model.Point; /** * Defines a {@link Point} binding from a type or a property * to a {@link Point} field representing a point on earth. * <p> * If the longitude and latitude information is hosted on two different properties, * {@code @GeoCoordinates} must be used on the entity (class level). * The {@link Latitude} and {@link Longitude} annotations must mark the properties. * <pre><code> * &#064;GeoCoordinates(name="home") * public class User { * &#064;Latitude * public Double getHomeLatitude() { ... } * &#064;Longitude * public Double getHomeLongitude() { ... } * } * </code></pre> * <p> * Alternatively, {@code @GeoCoordinates} can be used on a property of type {@link Point}: * <pre><code> * public class User { * &#064;GeoCoordinates * public Point getHome() { ... } * } * </code></pre> * <p> * Infinispan version of {@link org.hibernate.search.mapper.pojo.bridge.builtin.annotation.GeoPointBinding} * * @since 14.0 */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE}) @Documented @Repeatable(GeoCoordinates.List.class) @TypeMapping(processor = @TypeMappingAnnotationProcessorRef(type = GeoCoordinatesProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR)) @PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = GeoCoordinatesProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR)) public @interface GeoCoordinates { /** * The name of the index field holding spatial information. * <p> * If {@code @Point} is hosted on a property, defaults to the property name. * If {@code @Point} is hosted on a class, the name must be provided. * * @return the field name */ String fieldName() default ""; /** * @return Whether projections are enabled for this field. * @see Basic#projectable() */ boolean projectable() default false; /** * @return Whether this field should be sortable. * @see Basic#sortable() */ boolean sortable() default false; /** * @return The name of the marker this spatial should look into * when looking for the {@link Latitude} and {@link Longitude} markers. */ String marker() default ""; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE}) @Documented @interface List { GeoCoordinates[] value(); } }
3,339
36.111111
145
java
null
infinispan-main/api/src/main/java/org/infinispan/api/annotations/indexing/Latitude.java
package org.infinispan.api.annotations.indexing; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.search.engine.environment.bean.BeanRetrieval; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef; import org.infinispan.api.common.annotations.indexing._private.LatitudeProcessor; /** * Mark the property hosting the latitude of a specific spatial coordinate. * The property must be of type {@code Double} or {@code double}. * <p> * Infinispan version of {@link org.hibernate.search.mapper.pojo.bridge.builtin.annotation.Latitude} * * @since 14.0 */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD}) @Documented @PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = LatitudeProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR)) public @interface Latitude { /** * @return The name of the marker this marker belongs to. * Set it to the value of {@link GeoCoordinates#marker()} * so that the bridge detects this marker. */ String marker() default ""; }
1,379
37.333333
139
java
null
infinispan-main/api/src/main/java/org/infinispan/api/annotations/indexing/Keyword.java
package org.infinispan.api.annotations.indexing; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.hibernate.search.engine.environment.bean.BeanRetrieval; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMapping; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.processing.PropertyMappingAnnotationProcessorRef; import org.infinispan.api.annotations.indexing.model.Values; import org.infinispan.api.common.annotations.indexing._private.KeywordProcessor; /** * Maps a property to a keyword field in the index, holding a single token (word) of text. * <p> * On contrary to {@link Text}, this annotation only creates non-tokenized (single-word) text fields. * As a result: * <ul> * <li>The field value must be of type String</li> * <li>You cannot assign an analyzer when using this annotation</li> * <li>You can, however, assign a normalizer (which is an analyzer that doesn't perform tokenization) * when using this annotation</li> * <li>This annotation allows to make the field sortable</li> * </ul> * <p> * If you want to index a non-String value, use the {@link Basic} annotation instead. * If you want to index a String value, but want the field to be tokenized, use {@link Text} instead. * <p> * Simplified version for Infinispan of {@link org.hibernate.search.mapper.pojo.mapping.definition.annotation.KeywordField} * * @since 14.0 */ @Documented @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @Repeatable(Keyword.List.class) @PropertyMapping(processor = @PropertyMappingAnnotationProcessorRef(type = KeywordProcessor.class, retrieval = BeanRetrieval.CONSTRUCTOR)) public @interface Keyword { /** * @return The name of the index field. */ String name() default ""; /** * @return A reference to the normalizer to use for this field. * Defaults to an empty string, meaning no normalization at all. */ String normalizer() default ""; /** * @return Whether index time scoring information should be stored or not. * @see Text#norms() */ boolean norms() default true; /** * @return Whether projections are enabled for this field. * @see Basic#projectable() */ boolean projectable() default false; /** * @return Whether this field should be sortable. * @see Basic#sortable() */ boolean sortable() default false; /** * @return Whether this field should be searchable. * @see Basic#searchable() */ boolean searchable() default true; /** * @return Whether aggregations are enabled for this field. * @see Basic#aggregable() */ boolean aggregable() default false; /** * @return A value used instead of null values when indexing. * @see Basic #indexNullAs() */ String indexNullAs() default Values.DO_NOT_INDEX_NULL; @Documented @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @interface List { Keyword[] value(); } }
3,258
32.597938
138
java