### Basic File System Setup Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storage-targets/file-system.adoc Initializes a new NIO file system and starts storage, ensuring the specified directory path exists. This is the default and recommended setup. ```java NioFileSystem fileSystem = NioFileSystem.New(); EmbeddedStorage.start(fileSystem.ensureDirectoryPath("path", "to", "storage")); ``` -------------------------------- ### Quick Start Example Source: https://github.com/eclipse-store/store/blob/main/docs/modules/intro/pages/welcome.adoc Demonstrates the basic steps to start Eclipse Store, store data, and shut down the storage manager. Ensure you have defined your data model as plain Java classes. ```java import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import org.eclipse.store.storage.embedded.EmbeddedStorage; import org.eclipse.store.storage.embedded.EmbeddedStorageManager; // Define your data model as plain Java classes public class DataRoot { private final List messages = new ArrayList<>(); public List getMessages() { return messages; } } // Start the storage DataRoot root = new DataRoot(); EmbeddedStorageManager storage = EmbeddedStorage.start(root, Paths.get("data")); // Store data root.getMessages().add("Hello EclipseStore!"); storage.store(root.getMessages()); // Shutdown storage.shutdown(); ``` -------------------------------- ### Start Embedded Storage Manager with Basic Configuration Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/configuration/index.adoc Use this method for a quick setup of the EmbeddedStorageManager, specifying the root object and the data directory. ```java EmbeddedStorageManager storageManager = EmbeddedStorage.start( myRoot, // root object of entity graph Paths.get("data-dir") // storage data directory ); ``` -------------------------------- ### TLS Server Setup Example Source: https://github.com/eclipse-store/store/blob/main/docs/modules/communication/pages/tls.adoc Demonstrates how to set up a TLS-encrypted server using ComTLSConnectionHandler and various TLS providers. Requires keystore and truststore paths and passwords as arguments. ```java public class EchoServerTLS { public static void main(final String[] args) { Path serverKeyStore = Paths.get(args[0]); Path serverTrustStore = Paths.get(args[1]); char[] serverKeyStorePassword = args[2].toCharArray(); char[] serverTrustStorePassword = args[2].toCharArray(); final ComHost host = ComBinaryDynamic.Foundation() .setConnectionHandler(ComTLSConnectionHandler.New( new TLSKeyManagerProvider.PKCS12( serverKeyStore, serverKeyStorePassword), new TLSTrustManagerProvider.PKCS12( serverTrustStore, serverTrustStorePassword), new TLSParametersProvider.Default(), new SecureRandomProvider.Default() )) .setHostChannelAcceptor(channel -> { final Object received = channel.receive(); System.out.println("received: " + received); channel.send(received); }) .createHost(); // run the host, making it constantly listen for new connections and relaying them to the logic host.run(); } } ``` -------------------------------- ### Initialize BlobStoreFileSystem with DynamoDB Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storage-targets/blob-stores/aws-dynamodb.adoc Example of initializing a BlobStoreFileSystem using DynamoDB as the storage backend and starting embedded storage. ```java DynamoDbClient client = ...; BlobStoreFileSystem fileSystem = BlobStoreFileSystem.New( DynamoDbConnector.Caching(client) ); EmbeddedStorage.start(fileSystem.ensureDirectoryPath("storage")); ``` -------------------------------- ### Basic File System Setup with Path String Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storage-targets/file-system.adoc Starts the embedded storage manager using a provided path string. This is a simpler alternative for specifying the storage directory. ```java EmbeddedStorageManager storage = EmbeddedStorage.start( Paths.get("path", "to", "storage") ); ``` -------------------------------- ### Initialize Firestore BlobStoreFileSystem Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storage-targets/blob-stores/google-cloud-firestore.adoc Example of initializing the BlobStoreFileSystem with Google Cloud Firestore connector and starting the embedded storage. ```java Firestore firestore = ... BlobStoreFileSystem fileSystem = BlobStoreFileSystem.New( GoogleCloudFirestoreConnector.Caching(client) ); EmbeddedStorage.start(fileSystem.ensureDirectoryPath("storage")); ``` -------------------------------- ### Hello World Example: Initialize, Store, and Shutdown Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/getting-started.adoc A basic example demonstrating how to initialize the storage manager, store a simple string, and shut down the manager. ```java // Initialize a storage manager ("the database") with purely defaults. final EmbeddedStorageManager storageManager = EmbeddedStorage.start(); // print the last loaded root instance, // replace it with a current version and store it System.out.println(storageManager.root()); storageManager.setRoot("Hello World! @ " + new Date()); storageManager.storeRoot(); // shutdown storage storageManager.shutdown(); ``` -------------------------------- ### Minimal Setup for Automatic Legacy Mapping Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/legacy-type-mapping/index.adoc Start the storage manager with minimal configuration for automatic legacy type mapping. The heuristic handles the mapping process without explicit configuration. ```java // Just start — heuristic handles everything EmbeddedStorageManager storage = EmbeddedStorage.start(root, dataDir); ``` -------------------------------- ### Starting the Country Explorer Application Source: https://github.com/eclipse-store/store/blob/main/demos/country-explorer/docs/country-explorer-guide.html This command starts the Spring Boot application for the Country Explorer demo from the project root directory. Ensure Java 17+ is installed. ```Shell # From the project root mvn -pl demos/country-explorer spring-boot:run ``` -------------------------------- ### Programmatic MariaDB Data Source Setup Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storage-targets/sql-databases/mariadb.adoc Configure and start an Eclipse Store SQL FileSystem using a MariaDB data source programmatically. ```java MariaDbDataSource dataSource = new MariaDbDataSource(); dataSource.setUrl("jdbc:mysql://host:3306/mydb"); dataSource.setUser("user"); dataSource.setPassword("secret"); SqlFileSystem fileSystem = SqlFileSystem.New( SqlConnector.Caching( SqlProviderMariaDb.New(dataSource) ) ); EmbeddedStorage.start(fileSystem.ensureDirectoryPath("storage")); ``` -------------------------------- ### Configuration File Example (Properties Format) Source: https://github.com/eclipse-store/store/blob/main/docs/modules/misc/pages/integrations/cdi.adoc Example of setting a custom database name within a configuration file. If not specified, the MicroProfile config key name is used. ```properties database-name=theName ``` -------------------------------- ### Default Directory Configuration Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storage-targets/file-system.adoc Starts storage without specifying a path, causing it to default to a 'storage' subfolder within the current working directory. This is convenient for simple setups. ```java DataRoot root = new DataRoot(); EmbeddedStorage.start(root); // Creates storage in ./storage/ ``` -------------------------------- ### Run Spring Boot Application Source: https://github.com/eclipse-store/store/blob/main/demos/product-recommendations/README.md Start the Spring Boot application using Maven. The application will initialize a GigaMap with products and start a web server. ```bash mvn spring-boot:run ``` -------------------------------- ### Example Product JSON Source: https://github.com/eclipse-store/store/blob/main/demos/product-recommendations/docs/product-recommendations-guide.html Illustrates the JSON format for a product, including the snake_case 'in_stock' field. ```json { "name": "Wireless Headphones", "category": "Electronics", "price": 59.99, "in_stock": true } ``` -------------------------------- ### Initialize Embedded Storage and Cache Source: https://github.com/eclipse-store/store/blob/main/docs/modules/cache/pages/configuration/storage.adoc Demonstrates how to start an embedded storage manager and create a JCache instance using it. ```java EmbeddedStorageManager storageManager = EmbeddedStorage.start(); CachingProvider provider = Caching.getCachingProvider(); CacheManager cacheManager = provider.getCacheManager(); CacheConfiguration configuration = CacheConfiguration .Builder(Integer.class, String.class, "my-cache", storageManager) .build(); Cache cache = cacheManager.createCache("jCache", configuration); ``` -------------------------------- ### Integrating Lucene Index with Eclipse Store Source: https://github.com/eclipse-store/store/blob/main/docs/modules/gigamap/pages/indexing/lucene/index.adoc Demonstrates the setup of Eclipse Store with a Lucene index. It includes starting the storage, creating a GigaMap, registering the Lucene index, adding data, and storing the root. ```java try (EmbeddedStorageManager storage = EmbeddedStorage.start(storageDir)) { GigaMap
articles = GigaMap.New(); storage.setRoot(articles); LuceneContext
context = LuceneContext.New(new ArticleDocumentPopulator()); LuceneIndex
luceneIndex = articles.index().register(LuceneIndex.Category(context)); articles.add(new Article("Title", "Content", "Author")); storage.storeRoot(); } ``` -------------------------------- ### Example: Storing Multiple Instances Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storing-data/transactions.adoc Shows how to use the storeAll varargs method to store several individual instances. ```java storage.storeAll(itemA, iteamB, iteamC); ``` -------------------------------- ### Mapping Classes Example Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/legacy-type-mapping/index.adoc Demonstrates the syntax for renaming or moving an entire class. ```text com.myapp.entities.OldOrder;com.myapp.entities.Order ``` -------------------------------- ### Start Client GUI with Custom Port Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/rest-interface/client-gui.adoc Start the Client GUI JAR, optionally specifying a server port. The default port is 8080. Replace {maven-version} with the correct version. ```text java -jar storage-restclient-app-standalone-assembly-{maven-version}-standalone.jar --server.port=8888 ``` -------------------------------- ### Response: List Available Routes Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/rest-interface/rest-api.adoc Example JSON response showing the available routes and their HTTP methods. ```json [ { "url": "/store-data/default/", "httpMethod": "get" }, { "url": "/store-data/default/root", "httpMethod": "get" }, { "url": "/store-data/default/dictionary", "httpMethod": "get" }, { "url": "/store-data/default/object/:oid", "httpMethod": "get" }, { "url": "/store-data/default/maintenance/filesStatistics", "httpMethod": "get" } ] ``` -------------------------------- ### External INI Configuration Example Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/configuration/index.adoc An example of an external INI configuration file for Eclipse Store, specifying storage directory and channel count. ```text storage-directory = data channel-count = 4 ``` -------------------------------- ### External XML Configuration Example Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/configuration/index.adoc An example of an external XML configuration file for Eclipse Store, specifying storage directory and channel count. ```xml ``` -------------------------------- ### External YAML Configuration Example Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/configuration/index.adoc An example of an external YAML configuration file for Eclipse Store, specifying storage directory and channel count. ```yaml storage-directory: "data" channel-count: 4 ``` -------------------------------- ### Start Storage Ignoring Missing Objects Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/addendum/troubleshooting.adoc Use this to start a storage manager when objects are missing, preventing a StorageExceptionConsistency. Ensure you understand the risks before proceeding. ```java final EmbeddedStorageFoundation foundation = EmbeddedStorage.Foundation() .setStorageEntityCollectorCreator(StorageEntityCollector.Creator.Unchecked()); final EmbeddedStorageManager storage = foundation.start(); ``` -------------------------------- ### External JSON Configuration Example Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/configuration/index.adoc An example of an external JSON configuration file for Eclipse Store, specifying storage directory and channel count. ```json { "storage-directory": "data", "channel-count": 4 } ``` -------------------------------- ### Start Embedded Storage with Local Path Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storage-targets/index.adoc Use this snippet to start embedded storage connected to the local file system via the Java NIO connector. No additional dependencies are required as it's part of the 'base' module. ```java EmbeddedStorage.start(Paths.get("path", "to", "storage")); ``` -------------------------------- ### Log Search Examples Source: https://github.com/eclipse-store/store/blob/main/docs/modules/gigamap/pages/indexing/lucene/use-cases.adoc Provides examples for searching logs by level, message content, source service, trace ID, and within a specific time range. ```java // Search for errors List errors = searchIndex.query("level:ERROR"); ``` ```java // Search by message content List nullPointers = searchIndex.query("message:NullPointerException"); ``` ```java // Filter by source List authLogs = searchIndex.query("source:AuthService"); ``` ```java // Trace a specific request List trace = searchIndex.query("traceId:abc123"); ``` ```java // Time range query long oneHourAgo = System.currentTimeMillis() - 3600000; Query recentQuery = LongPoint.newRangeQuery("timestamp", oneHourAgo, Long.MAX_VALUE); List recentLogs = searchIndex.query(recentQuery); ``` -------------------------------- ### GigaMap Setup with Spatial Index Source: https://github.com/eclipse-store/store/blob/main/docs/modules/gigamap/pages/indexing/spatial/index.adoc Instantiate a GigaMap, register a custom spatial indexer, and add entities for indexing. ```java // Create indexer instance (keep as singleton for query access) LocationIndex locationIndex = new LocationIndex(); // Create GigaMap and register the spatial index GigaMap gigaMap = GigaMap.Builder() .withBitmapIndex(locationIndex) .build(); // Add entities gigaMap.addAll( new Location("New York", 40.7128, -74.0060), new Location("London", 51.5074, -0.1278), new Location("Tokyo", 35.6762, 139.6503), new Location("Sydney", -33.8688, 151.2093), new Location("Cape Town", -33.9249, 18.4241) ); ``` -------------------------------- ### Start Spark Java REST Service Source: https://github.com/eclipse-store/store/blob/main/storage/rest/service-sparkjava/README.md This snippet shows how to initialize and start the StorageRestService using Spark Java. It includes setting the root if it's null. ```java public class MainTestStorageRestService { public static void main(final String[] args) { final EmbeddedStorageManager storage = EmbeddedStorage.start(); if(storage.root() == null) { storage.setRoot(new Object[] {"A", "B", "C"}); storage.storeRoot(); } final StorageRestService service = RestServiceResolver.getType(storage, StorageRestServiceSparkJava.class); service.start(); } } ``` -------------------------------- ### Start Embedded Storage with S3 Connector Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storage-targets/index.adoc This snippet shows how to start embedded storage using the AWS S3 connector. It demonstrates creating an S3 client and configuring a caching connector for the file system. ```java // create S3 client S3Client client = ...; BlobStoreFileSystem fileSystem = BlobStoreFileSystem.New( // use caching connector S3Connector.Caching(client) ); EmbeddedStorage.start(fileSystem.ensureDirectoryPath("bucket-name", "folder", "subfolder")); ``` -------------------------------- ### Run Executable Jar Source: https://github.com/eclipse-store/store/blob/main/examples/wildfly-cdi4/readme.md Start the generated MicroProfile application by executing the jar file. ```shell java -jar target/wildfly-example-bootable.jar ``` -------------------------------- ### Main Application Class Source: https://github.com/eclipse-store/store/blob/main/demos/product-recommendations/docs/product-recommendations-guide.html The entry point for the product recommendations demo application. It sets up the data store, recommendation service, and demonstrates its usage. ```java package org.eclipse.store.demo.productrecommendations; import org.eclipse.store.storage.configuration.Configuration; import org.eclipse.store.storage.configuration.StorageConfiguration; import org.eclipse.store.storage.configuration.StorageConfigurationProvider; import org.eclipse.store.storage.types.IOStorageManager; import java.util.ArrayList; import java.util.List; public class ProductRecommendationsDemo { private static final String STORAGE_PATH = "./product-recommendations-storage"; public static void main(String[] args) { // 1. Setup EclipseStore IOStorageManager storageManager = setupStorage(); // 2. Load or Initialize Product Data List products = loadProducts(storageManager); // 3. Initialize Recommendation Service RecommendationService recommendationService = new SimpleRecommendationService(products); // 4. Get Recommendations for a User String userId = "user123"; int maxRecommendations = 5; List recommendations = recommendationService.recommendProducts(userId, maxRecommendations); // 5. Display Recommendations displayRecommendations(userId, recommendations); // 6. Shutdown EclipseStore storageManager.shutdown(); } private static IOStorageManager setupStorage() { StorageConfiguration configuration = StorageConfiguration.newInstance(STORAGE_PATH); configuration.setStorageConfigurationProvider(new StorageConfigurationProvider() { @Override public Configuration getConfiguration() { return Configuration.newBuilder().build(); } }); return configuration.createIOStorageManager(); } private static List loadProducts(IOStorageManager storageManager) { // In a real application, product data would likely be loaded from a database or external source. // For this demo, we'll create some sample products and store them. // Check if products already exist in storage List products = storageManager.fetchType(Product.class); if (products.isEmpty()) { System.out.println("No products found in storage. Creating sample products..."); products = createSampleProducts(); storageManager.store(products); System.out.println("Sample products created and stored."); } else { System.out.println("Loaded " + products.size() + " products from storage."); } return products; } private static List createSampleProducts() { List sampleProducts = new ArrayList<>(); sampleProducts.add(new Product("P001", "Laptop", "Electronics", 1200.00)); sampleProducts.add(new Product("P002", "Mouse", "Electronics", 25.00)); sampleProducts.add(new Product("P003", "Keyboard", "Electronics", 75.00)); sampleProducts.add(new Product("P004", "Monitor", "Electronics", 300.00)); sampleProducts.add(new Product("P005", "Webcam", "Electronics", 50.00)); sampleProducts.add(new Product("P006", "Desk Chair", "Furniture", 150.00)); sampleProducts.add(new Product("P007", "Standing Desk", "Furniture", 400.00)); sampleProducts.add(new Product("P008", "Notebook", "Stationery", 5.00)); sampleProducts.add(new Product("P009", "Pen Set", "Stationery", 15.00)); sampleProducts.add(new Product("P010", "Backpack", "Accessories", 60.00)); return sampleProducts; } private static void displayRecommendations(String userId, List recommendations) { System.out.println("\n--- Product Recommendations for " + userId + " ---"); if (recommendations.isEmpty()) { System.out.println("No recommendations available at this time."); } else { for (int i = 0; i < recommendations.size(); i++) { Product product = recommendations.get(i); System.out.printf("%d. %s (%s) - $%.2f\n", i + 1, product.getName(), product.getCategory(), product.getPrice()); } } System.out.println("---------------------------------------"); } } ``` -------------------------------- ### Basic JCache Hello World Example Source: https://github.com/eclipse-store/store/blob/main/docs/modules/cache/pages/getting-started.adoc Demonstrates creating a cache, configuring it with a one-minute expiry, storing a value, and retrieving it using the JCache API. ```java CachingProvider provider = Caching.getCachingProvider(); CacheManager cacheManager = provider.getCacheManager(); MutableConfiguration configuration = new MutableConfiguration() .setStoreByValue(false) .setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(Duration.ONE_MINUTE)); Cache cache = cacheManager.createCache("jCache", configuration); cache.put(1, "Hello World"); String value = cache.get(1); ``` -------------------------------- ### Prefix Query Example Source: https://github.com/eclipse-store/store/blob/main/docs/modules/gigamap/pages/indexing/lucene/advanced.adoc Use PrefixQuery to find terms that start with a specific prefix. Requires importing PrefixQuery. ```java import org.apache.lucene.search.PrefixQuery; Query prefixQuery = new PrefixQuery(new Term("name", "wire")); List results = luceneIndex.query(prefixQuery); ``` -------------------------------- ### Root Instance Class Example Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/loading-data/lazy-loading/index.adoc A basic structure for a root instance class in a business application. This serves as a starting point for demonstrating data organization. ```java public class MyBusinessApp { // ... private HashMap businessYears = new HashMap<>(); // ... } ``` -------------------------------- ### Run Product Recommendations Demo Source: https://github.com/eclipse-store/store/blob/main/demos/README.md First, pull the 'all-minilm' model for Ollama. Then, navigate to the product-recommendations directory and run the Spring Boot application using Maven. ```bash ollama pull all-minilm cd product-recommendations mvn spring-boot:run ``` -------------------------------- ### Pagination Example for Object Retrieval Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/rest-interface/rest-api.adoc This URL demonstrates how to paginate through variable-size members of an object. Specify `variableOffset` for the starting index and `variableLength` for the number of elements to retrieve. ```javascript [instance-name]/object/1000000000000000028?variableOffset=100&variableLength=50 ``` -------------------------------- ### Set Custom LazyReferenceManager Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/loading-data/lazy-loading/clearing-lazy-references.adoc Configure a custom LazyReferenceManager before starting the storage. This example sets a timeout of 30 minutes for lazy access and a memory quota of 0.75. ```java LazyReferenceManager.set(LazyReferenceManager.New( Lazy.Checker( Duration.ofMinutes(30).toMillis(), // timeout of lazy access 0.75 // memory quota ) )); ``` -------------------------------- ### External Configuration for Azure Storage Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storage-targets/blob-stores/azure-storage.adoc Configure Azure Storage as the storage filesystem target using external properties. This example shows basic authentication setup. ```properties # optional, enforces checks storage-filesystem.target=azure.storage storage-filesystem.azure.storage.credentials.type=basic storage-filesystem.azure.storage.credentials.username=user storage-filesystem.azure.storage.credentials.password=secret ``` -------------------------------- ### Product Search Queries with Lucene Source: https://github.com/eclipse-store/store/blob/main/docs/modules/gigamap/pages/indexing/lucene/use-cases.adoc Demonstrates setting up a Lucene context for products and executing various search queries, including keyword, multi-field, category filtering, price range, and stock availability. ```java // Setup LuceneContext context = LuceneContext.New( Paths.get("/data/product-index"), new ProductDocumentPopulator() ); GigaMap products = GigaMap.New(); LuceneIndex searchIndex = products.index().register(LuceneIndex.Category(context)); // Search by keyword List results = searchIndex.query("name:wireless"); // Search across multiple fields List results = searchIndex.query("name:bluetooth OR description:bluetooth"); // Filter by category List electronics = searchIndex.query("category:Electronics"); // Price range Query priceQuery = DoublePoint.newRangeQuery("price", 50.0, 200.0); List midRange = searchIndex.query(priceQuery); // In-stock items only Query stockQuery = IntPoint.newRangeQuery("stock", 1, Integer.MAX_VALUE); List available = searchIndex.query(stockQuery); ``` -------------------------------- ### Configure Continuous Backup with Foundation Classes (Java) Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/configuration/backup/continuous-backup.adoc Set up continuous backup using foundation classes, specifying directories for backup, truncation, and deletion. ```java NioFileSystem fileSystem = NioFileSystem.New(); StorageBackupSetup backupSetup = StorageBackupSetup.New( Storage.BackupFileProviderBuilder(fileSystem) .setDirectory(fileSystem.ensureDirectoryPath(BACKUPDIR)) .setTruncationDirectory(fileSystem.ensureDirectoryPath(TRUNCATIONDIR)) .setDeletionDirectory(fileSystem.ensureDirectoryPath(DELETIONDIR)) .createFileProvider() ); StorageConfiguration configuration = StorageConfiguration.Builder() .setBackupSetup(backupSetup) .setStorageFileProvider(StorageLiveFileProvider.New( fileSystem.ensureDirectoryPath(WORKINGDIR) )) .createConfiguration() ; ``` -------------------------------- ### Example Log Output Source: https://github.com/eclipse-store/store/blob/main/docs/modules/misc/pages/layered-entities/logging.adoc This is an example of the log output generated by the `JulLogger` after an entity update. ```text Oct 15, 2019 11:17:53 AM JulLogger afterUpdate INFO: Entity updated ``` -------------------------------- ### Full JVM Configuration for Performance Tuning Source: https://github.com/eclipse-store/store/blob/main/docs/modules/gigamap/pages/indexing/jvector/configuration.adoc Example of a full JVM configuration including SIMD module and physical core count for performance tuning. ```bash java --add-modules jdk.incubator.vector \ -Djvector.physical_core_count=8 \ -jar your-app.jar ``` -------------------------------- ### Get All Jokes using REST API Source: https://github.com/eclipse-store/store/blob/main/examples/spring-boot3-simple/readme.md Curl command to GET all jokes from the application. ```shell curl --location --request GET 'http://localhost:8080' \ --header 'Content-Type: application/json' ``` -------------------------------- ### Get All Products using curl Source: https://github.com/eclipse-store/store/blob/main/examples/wildfly-cdi4/readme.md Use curl to send a GET request to retrieve all products. ```shell curl --location --request GET 'http://localhost:8080/products/' ``` -------------------------------- ### Simplified Root Initialization with `ensureRoot()` Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/root-instances.adoc Demonstrates the `ensureRoot()` method for simplifying the process of checking for and creating a root object if it doesn't exist. ```java EmbeddedStorageManager storage = EmbeddedStorage.Foundation() .createEmbeddedStorageManager(); MyApplicationRoot root = storage.ensureRoot(MyApplicationRoot::new); ``` -------------------------------- ### Creating a Database with a Root Instance and Directory Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/getting-started.adoc Initializes the storage manager with a custom root object and specifies a directory for data storage. ```java // Application-specific root instance final DataRoot root = new DataRoot(); // Initialize a storage manager ("the database") with the given directory. final EmbeddedStorageManager storageManager = EmbeddedStorage.start( root, // root object Paths.get("data") // storage directory ); ``` -------------------------------- ### Country JSON Example Source: https://github.com/eclipse-store/store/blob/main/demos/country-explorer/docs/country-explorer-guide.html An example of a country entry in JSON format, corresponding to the Country record structure. ```JSON { "name": "Germany", "alpha2": "DE", "alpha3": "DEU", "capital": "Berlin", "latitude": 52.52, "longitude": 13.405, "continent": "Europe", "population": 83190556, "area": 357022.0 } ``` -------------------------------- ### Get Joke by ID using REST API Source: https://github.com/eclipse-store/store/blob/main/examples/spring-boot3-simple/readme.md Curl command to GET a specific joke by its ID. ```shell curl --location --request GET 'http://localhost:8080/joke?id=50' \ --header 'Content-Type: application/json' ``` -------------------------------- ### Creating a GigaMap with Normal Bitmap Indexes Source: https://github.com/eclipse-store/store/blob/main/docs/modules/gigamap/pages/indexing/bitmap/types.adoc Demonstrates how to initialize a GigaMap with multiple normal bitmap indexes using the builder pattern or by registering them after creation. ```java final GigaMap gigaMap = GigaMap.Builder() .withBitmapIndex(PersonIndices.firstName) .withBitmapIndex(PersonIndices.lastName) ... .build(); ``` ```java GigaMap gigaMap = GigaMap.New(); gigaMap.index().bitmap().ensure(PersonIndices.firstName); gigaMap.index().bitmap().ensure(PersonIndices.lastName); ... ``` -------------------------------- ### Start Embedded Storage Manager Source: https://github.com/eclipse-store/store/blob/main/storage/rest/service-sparkjava/README.md Initialize and start the Eclipse Store storage manager. This is a prerequisite for the REST service. ```java EmbeddedStorageManager storage = EmbeddedStorage .Foundation(storageDir) .start(); ``` -------------------------------- ### Initialize Version Contexts with Different Key Types Source: https://github.com/eclipse-store/store/blob/main/docs/modules/misc/pages/layered-entities/versioning.adoc Shows how to initialize version contexts using different key types: auto-incrementing Long, auto-incrementing System Time Millis, auto-incrementing System Nano Time, and Instant. ```java EntityVersionContext systemTimeContext = EntityVersionContext.AutoIncrementingSystemTimeMillis(); EntityVersionContext nanoTimeContext = EntityVersionContext.AutoIncrementingSystemNanoTime(); EntityVersionContext instantContext = EntityVersionContext.AutoIncrementingInstant(); ``` -------------------------------- ### Get Specific Product using curl Source: https://github.com/eclipse-store/store/blob/main/examples/wildfly-cdi4/readme.md Use curl to send a GET request to retrieve a specific product by its ID. ```shell curl --location --request GET 'http://localhost:8080/products/1' ``` -------------------------------- ### Start EmbeddedStorageManager Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/application-life-cycle.adoc Initializes the database manager and starts the threads responsible for data access. This is the first step to interact with the database. ```java // Setup the database manager and start the managing threads EmbeddedStorageManager storageManager = EmbeddedStorage.start(); ``` -------------------------------- ### Default Root Initialization (Conceptual) Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/root-instances.adoc Illustrates a scenario where an application-defined root instance needs to be filled after the database manager starts, highlighting a limitation of the default approach. ```java MyApplicationRoot root = new MyApplicationRoot(); EmbeddedStorageManager storage = EmbeddedStorage.start(); root.printAllMyEntities(); ``` -------------------------------- ### Example Model Classes Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/queries.adoc These Java classes define the data model used for query examples: Shop, Article, Customer, Order, and OrderLine. ```java public class Shop { private List
articles = new ArrayList<>(); private List customers = new ArrayList<>(); private List orders = new ArrayList<>(); // getters ... } public class Article { private String name; private String category; private double price; private boolean available; } public class Customer { private long id; private String name; private String city; } public class Order { private Customer customer; private List lines; private LocalDate date; } public class OrderLine { private Article article; private int quantity; } ``` -------------------------------- ### Maven Command to Run Demo Source: https://github.com/eclipse-store/store/blob/main/demos/country-explorer/docs/country-explorer-guide.html Use this Maven command to build and run the Country Explorer demo application. Ensure you are in the project's root directory. ```bash mvn clean install spring-boot:run ``` -------------------------------- ### Configure and Create a Product Similarity Vector Index Source: https://github.com/eclipse-store/store/blob/main/docs/modules/gigamap/pages/indexing/jvector/use-cases.adoc This example demonstrates configuring a vector index for product embeddings using COSINE similarity and then registering it with a GigaMap. Key parameters include dimension, similarity function, and persistence settings. ```java // Configure index for product catalog VectorIndexConfiguration config = VectorIndexConfiguration.builder() .dimension(768) // Common for text embedding models .similarityFunction(VectorSimilarityFunction.COSINE) .maxDegree(32) .beamWidth(200) .onDisk(true) .indexDirectory(Path.of("/data/product-embeddings")) .persistenceIntervalMs(60_000) .build(); // Register and create index GigaMap products = GigaMap.New(); VectorIndices vectorIndices = products.index().register(VectorIndices.Category()); VectorIndex similarityIndex = vectorIndices.add("similarity", config, new ProductVectorizer()); ``` -------------------------------- ### Configure Storage File Provider Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/configuration/storage-files-and-directories.adoc Set up the storage directory, deletion directory, truncation directory, and the filename provider for the storage system. ```java NioFileSystem fileSystem = NioFileSystem.New(); StorageLiveFileProvider fileProvider = Storage .FileProviderBuilder (fileSystem) .setDirectory (fileSystem.ensureDirectoryPath(WORKINGDIR)) .setDeletionDirectory (fileSystem.ensureDirectoryPath(DELETIONDIR)) .setTruncationDirectory(fileSystem.ensureDirectoryPath(TRUNCATIONDIR)) .setFileNameProvider (fileNameProvider) .createFileProvider () ; ``` -------------------------------- ### Start Spark Java REST Service Source: https://github.com/eclipse-store/store/blob/main/storage/rest/service-sparkjava/README.md Create an instance of StorageRestService using RestServiceResolver and start the server. The server defaults to port 4567. ```java final StorageRestService service = RestServiceResolver.getType(storage, StorageRestServiceSparkJava.class); service.start(); ``` -------------------------------- ### Start Database and Set Root Instance Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/root-instances.adoc This snippet shows how to start the EmbeddedStorageManager and set a string value as the root instance of the entity graph. ```java EmbeddedStorageManager storageManager = EmbeddedStorage.start(); storageManager.setRoot("Hello World"); storageManager.storeRoot(); ``` -------------------------------- ### VectorIndex.Default Initialization Sequence Diagram Source: https://github.com/eclipse-store/store/blob/main/gigamap/jvector/ARCHITECTURE.md This Mermaid diagram illustrates the step-by-step initialization process of VectorIndex.Default, showing interactions between various components like EclipseStore deserializer, BinaryHandlerVectorIndexDefault, DiskIndexManager, PQCompressionManager, and BackgroundTaskManager. It highlights conditional logic for PQ compression and on-disk index loading. ```mermaid sequenceDiagram autonumber participant ES as EclipseStore deserializer participant H as BinaryHandlerVectorIndexDefault participant VI as VectorIndex.Default participant DIM as DiskIndexManager participant PQM as PQCompressionManager participant BTM as BackgroundTaskManager ES->>H: create(data, handler) H->>VI: new VectorIndex.Default() ES->>H: updateState(data, instance, handler) H->>VI: XMemory.setObject(parent / name / configuration / vectorizer / vectorStore) ES->>H: complete(data, instance, handler) H->>VI: ensureIndexInitialized() VI->>VI: initializeIndex() alt PQ enabled VI->>PQM: new PQCompressionManager.Default(this, ...) end VI->>VI: initializeInMemoryBuilder()<(> (NullSafeVectorValues + GraphIndexBuilder) alt onDisk enabled VI->>DIM: new DiskIndexManager.Default(this, ...) VI->>DIM: tryLoad() alt files present + 4-check metadata pass DIM->>DIM: OnDiskGraphIndex.load(readerSupplier) DIM-->>VI: true VI->>VI: pqManager.markTrained() (FusedPQ embedded) VI->>VI: incrementalMode = true<(> diskDeletedOrdinals = newKeySet()) else metadata mismatch / files missing DIM-->>VI: false VI->>VI: rebuildGraphFromStore() end else VI->>VI: rebuildGraphFromStore() end VI->>VI: initializeSearcherPool() opt eventualIndexing or backgroundOptimization or backgroundPersistence VI->>BTM: new BackgroundTaskManager(this, ...) end ``` -------------------------------- ### Load Sample Data Source: https://github.com/eclipse-store/store/blob/main/examples/spring-boot3-simple/readme.md Initializes the application with sample joke data. This is recommended before performing other operations to ensure data is available. ```APIDOC ## POST /init ### Description Loads sample data into the application. This is an optional but recommended step to populate the store with initial jokes. ### Method POST ### Endpoint /init ### Request Example ```json {} ``` ### Response #### Success Response (200) Indicates that the data initialization was successful. The response body is typically empty. ``` -------------------------------- ### German Analyzer and Context Setup Source: https://github.com/eclipse-store/store/blob/main/docs/modules/gigamap/pages/indexing/lucene/use-cases.adoc Demonstrates creating a custom analyzer for German language content and setting up a Lucene context for indexing German articles. ```java public class GermanAnalyzerCreator extends AnalyzerCreator { @Override public Analyzer create() { return new GermanAnalyzer(); } } // German content index LuceneContext
germanContext = LuceneContext.New( DirectoryCreator.MMap(Paths.get("/data/german-index")), new GermanAnalyzerCreator(), new ArticleDocumentPopulator() ); ``` -------------------------------- ### Initialize BlobStoreFileSystem with Oracle Cloud Object Storage Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/storage-targets/blob-stores/oracle-cloud-object-storage.adoc Instantiate an ObjectStorageClient and create a BlobStoreFileSystem using the OracleCloudObjectStorageConnector. Ensure the directory path is created and the file system is started. ```java ObjectStorageClient client = ...; BlobStoreFileSystem fileSystem = BlobStoreFileSystem.New( OracleCloudObjectStorageConnector.Caching(client) ); EmbeddedStorage.start(fileSystem.ensureDirectoryPath("storage")); ``` -------------------------------- ### Run Country Explorer Demo Source: https://github.com/eclipse-store/store/blob/main/demos/README.md Navigate to the country-explorer directory and run the Spring Boot application using Maven. ```bash cd country-explorer mvn spring-boot:run ``` -------------------------------- ### Check if Storage is Running Before Starting Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/addendum/troubleshooting.adoc Safely start the storage manager by first checking its current running state. This prevents the 'Storage is already running' error. ```java // Check if storage is running before starting if (!storage.isRunning()) { storage.start(); } ``` -------------------------------- ### Setup with Custom Legacy Type Handler Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/legacy-type-mapping/index.adoc Initialize the storage manager and register a custom legacy type handler. This is used when automatic mapping is insufficient for a specific legacy type. ```java EmbeddedStorageManager storage = EmbeddedStorage.Foundation(dataDir) .onConnectionFoundation(f -> f.getCustomTypeHandlerRegistry() .registerLegacyTypeHandler(new MyLegacyTypeHandler()) ) .start(); ``` -------------------------------- ### Install Storage Migrator Standalone JAR to Local Maven Repository Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/addendum/tools.adoc Install the built standalone Storage Migrator JAR to your local Maven repository. This allows it to be used as a recipe artifact coordinate. ```bash mvn -Pmigrator-standalone install -pl storage/embedded-tools/storage-migrator -am ``` -------------------------------- ### Simple Recommendation Service Implementation Source: https://github.com/eclipse-store/store/blob/main/demos/product-recommendations/docs/product-recommendations-guide.html A basic implementation of the RecommendationService. It returns a predefined list of products, simulating a recommendation engine. ```java package org.eclipse.store.demo.productrecommendations; import java.util.ArrayList; import java.util.List; public class SimpleRecommendationService implements RecommendationService { private final List allProducts; public SimpleRecommendationService(List allProducts) { this.allProducts = new ArrayList<>(allProducts); } @Override public List recommendProducts(String userId, int maxRecommendations) { // In a real-world scenario, this would involve complex algorithms based on user history, // product similarity, popularity, etc. // For this demo, we'll just return a subset of all available products. List recommendations = new ArrayList<>(); int count = 0; for (Product product : allProducts) { if (count < maxRecommendations) { recommendations.add(product); count++; } } return recommendations; } } ``` -------------------------------- ### Download Client GUI JAR using Maven Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/rest-interface/client-gui.adoc Use this Maven command to download the Client GUI JAR into your local repository. Ensure you replace {maven-version} with the actual version. ```shell mvn dependency:get -Dartifact=org.eclipse.store:storage-restclient-app-standalone-assembly:{maven-version}:jar -Dtransitive=false -Dclassifier=standalone ``` -------------------------------- ### Custom Root Instance Registration Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/root-instances.adoc Shows how to directly register a custom root instance with the database setup by passing it to the `EmbeddedStorage.start()` method. ```java MyApplicationRoot root = new MyApplicationRoot(); EmbeddedStorageManager storageManager = EmbeddedStorage.start(root); root.printAllMyEntities(); ``` -------------------------------- ### Load Sample Data using REST API Source: https://github.com/eclipse-store/store/blob/main/examples/spring-boot3-simple/readme.md Curl command to POST a request to initialize the application with sample data. This is recommended before performing other data operations. ```shell curl --location --request POST 'http://localhost:8080/init' \ --header 'Content-Type: application/json' ``` -------------------------------- ### Get All Jokes Source: https://github.com/eclipse-store/store/blob/main/examples/spring-boot3-advanced/readme.md Retrieve all jokes currently stored in the application. ```shell curl --location --request GET 'http://localhost:8080/jokes' \ --header 'Content-Type: application/json' ``` -------------------------------- ### Get Joke by ID Source: https://github.com/eclipse-store/store/blob/main/examples/spring-boot3-simple/readme.md Retrieves a specific joke by its unique identifier. ```APIDOC ## GET /joke ### Description Retrieves a specific joke by its ID. ### Method GET ### Endpoint /joke ### Parameters #### Query Parameters - **id** (integer) - Required - The unique identifier of the joke to retrieve. ``` -------------------------------- ### Get All Jokes Source: https://github.com/eclipse-store/store/blob/main/examples/spring-boot3-simple/readme.md Retrieves a list of all jokes currently stored in the application. ```APIDOC ## GET / ### Description Retrieves all jokes stored in the application. ### Method GET ### Endpoint / ### Response #### Success Response (200) - **jokes** (array) - A list of joke objects. ### Response Example ```json { "jokes": [ { "id": 1, "content": "Sample joke content" } ] } ``` ``` -------------------------------- ### Initialize StorageConfiguration for Storage Converter (Java API) Source: https://github.com/eclipse-store/store/blob/main/docs/modules/storage/pages/addendum/tools.adoc Example of initializing a StorageConfiguration using the Java API for the Storage Converter. This allows for programmatic control over storage conversion. ```java StorageConfiguration source = StorageConfiguration.Builder() .setStorageFileProvider( StorageLiveFileProvider.New( NioFileSystem.New().ensureDirectoryPath("path", "to", "source", "storage") ) ) .createConfiguration(); ``` -------------------------------- ### Get All Muppets Source: https://github.com/eclipse-store/store/blob/main/examples/spring-boot3-advanced/readme.md Retrieve all Muppet characters currently stored in the application. ```shell curl --location --request GET 'http://localhost:8080/muppets' \ --header 'Content-Type: application/json' ```