### Java Hello World Example with EclipseStore
Source: https://docs.eclipsestore.io/manual/1/storage/getting-started
A basic 'Hello World' example demonstrating the initialization, usage, and shutdown of EclipseStore. It shows how to start a storage manager, store a string, and then 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();
```
--------------------------------
### Spark Java REST Service Setup
Source: https://docs.eclipsestore.io/manual/storage/rest-interface/setup
This snippet demonstrates setting up the EclipseStore Spark Java REST service. It includes the necessary Maven dependencies for the service and an optional logger. The example shows how to initialize storage, resolve the REST service, and start it.
```xml
org.eclipse.store
storage-restservice-sparkjava
3.1.0
org.slf4j
slf4j-simple
1.7.32
```
```java
EmbeddedStorageManager storage = EmbeddedStorage.start();
if (storage.root() == null)
{
storage.setRoot(new Object[] {
LocalDate.now(),
X.List("a", "b", "c"),
1337
});
storage.storeRoot();
}
// create the REST service
StorageRestService service = StorageRestServiceResolver.resolve(storage);
// and start it
service.start();
```
--------------------------------
### Java Database Creation with EclipseStore
Source: https://docs.eclipsestore.io/manual/1/storage/getting-started
Illustrates how to set up an EclipseStore database application. This code initializes a custom root instance ('DataRoot') and starts an 'EmbeddedStorageManager' linked to it, specifying a directory for 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
);
```
--------------------------------
### Create and Use a JCache with Default Configuration
Source: https://docs.eclipsestore.io/manual/1/cache/getting-started
This Java code demonstrates the basic usage of JCache with a default configuration provided by EclipseStore. It shows how to obtain a `CachingProvider`, create a `CacheManager`, configure a cache with specific settings (like storage by value and expiry), and then perform basic put and get operations.
```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);
```
--------------------------------
### Add Data to GigaMap
Source: https://docs.eclipsestore.io/manual/gigamap/getting-started
A concise example showing how to add data elements to the GigaMap instance. This is a fundamental step before performing any queries on the stored data.
```java
gigaMap.add(...);
```
--------------------------------
### Install EclipseStore with Gradle (Kotlin)
Source: https://docs.eclipsestore.io/manual/intro/installation
Incorporate EclipseStore into your Gradle project using Kotlin DSL by adding the implementation dependency to your build.gradle.kts file. This enables the library for your Kotlin-based projects.
```kotlin
dependencies {
implementation("org.eclipse.store:storage-embedded:3.1.0")
}
```
--------------------------------
### Initialize Custom Root Instance (Java)
Source: https://docs.eclipsestore.io/manual/2/storage/root-instances
Demonstrates the initial setup of a custom application-specific root instance before database initialization. This approach highlights the limitation of directly updating the root instance before the storage manager is started.
```java
MyApplicationRoot root = new MyApplicationRoot();
EmbeddedStorageManager storage = EmbeddedStorage.start();
root.printAllMyEntities();
```
--------------------------------
### Registering and Storing Root Instance in EclipseStore
Source: https://docs.eclipsestore.io/manual/storage/root-instances
This snippet demonstrates the basic setup for an EclipseStore application. It involves starting the storage manager, setting a root object (in this case, a string 'Hello World'), and then persisting this root object to storage.
```java
EmbeddedStorageManager storageManager = EmbeddedStorage.start();
// Set the entity (graph) as root
storageManager.setRoot("Hello World");
// Store root
storageManager.storeRoot();
```
--------------------------------
### Install EclipseStore with Gradle (Groovy)
Source: https://docs.eclipsestore.io/manual/intro/installation
Integrate EclipseStore into your Gradle project using Groovy DSL by adding the implementation dependency to your build.gradle file. This makes the library available for compilation and runtime.
```groovy
dependencies {
implementation 'org.eclipse.store:storage-embedded:3.1.0'
}
```
--------------------------------
### Start EclipseStore Client GUI
Source: https://docs.eclipsestore.io/manual/1/storage/rest-interface/client-gui
This command starts the EclipseStore Client GUI by executing the downloaded JAR file. An optional server port can be specified; otherwise, it defaults to 8080. Requires Java 17 or later to run.
```bash
java -jar storage-restclient-app-standalone-assembly-1.4.0-standalone.jar --server.port=8888
```
--------------------------------
### Download Client GUI using Maven Dependency Get
Source: https://docs.eclipsestore.io/manual/1/storage/rest-interface/client-gui
This command downloads the EclipseStore Client GUI JAR file into the local Maven repository. It specifies the artifact coordinates and disables transitive dependency downloads. Requires Maven to be installed.
```bash
mvn dependency:get -Dartifact=org.eclipse.store:storage-restclient-app-standalone-assembly:{maven-version}:jar -Dtransitive=false -Dclassifier=standalone
```
--------------------------------
### Start EclipseStore Client GUI
Source: https://docs.eclipsestore.io/manual/storage/rest-interface/client-gui
This command starts the EclipseStore Client GUI application using a Java runtime. The '--server.port' argument is optional and sets the port for the embedded web server; if omitted, it defaults to 8080.
```bash
java -jar storage-restclient-app-standalone-assembly-3.1.0-standalone.jar --server.port=8888
```
--------------------------------
### Initialize and Start Spark Java REST Service
Source: https://docs.eclipsestore.io/manual/1/storage/rest-interface/setup
This Java code initializes an EmbeddedStorageManager, sets its root if empty, resolves the REST service using StorageRestServiceResolver, and then starts the service. The default base URL is 'http://localhost:4567/store-data/'.
```java
EmbeddedStorageManager storage = EmbeddedStorage.start();
if (storage.root() == null)
{
storage.setRoot(new Object[] {
LocalDate.now(),
X.List("a", "b", "c"),
1337
});
storage.storeRoot();
}
// create the REST service
StorageRestService service = StorageRestServiceResolver.resolve(storage);
// and start it
service.start();
```
--------------------------------
### Install EclipseStore with Apache Buildr
Source: https://docs.eclipsestore.io/manual/intro/installation
Add the EclipseStore storage embedded library to your Apache Buildr project by specifying the compile dependency in your Buildfile. This integrates the library into your project's build process.
```ruby
define 'my-app' do
compile.with 'org.eclipse.store:storage-embedded:3.1.0'
end
```
--------------------------------
### Create and Use a JCache with EclipseStore CacheConfiguration
Source: https://docs.eclipsestore.io/manual/1/cache/getting-started
This Java code illustrates using EclipseStore's `CacheConfiguration` API for creating and managing a JCache. It utilizes an `EmbeddedStorageManager` as the backing store and configures the cache with a different expiry policy (one hour) and demonstrates storing and retrieving data.
```java
EmbeddedStorageManager storageManager = EmbeddedStorage.start();
CachingProvider provider = Caching.getCachingProvider();
CacheManager cacheManager = provider.getCacheManager();
CacheConfiguration configuration = CacheConfiguration
.Builder(Integer.class, String.class, "jCache", storageManager)
.expiryPolicyFactory(CreatedExpiryPolicy.factoryOf(Duration.ONE_HOUR))
.build();
Cache cache = cacheManager.createCache("jCache", configuration);
cache.put(1, "one");
String value = cache.get(1);
```
--------------------------------
### INI Configuration File Example
Source: https://docs.eclipsestore.io/manual/1/storage/configuration/index
An example of an INI file for EclipseStore configuration, specifying the storage directory and channel count.
```text
storage-directory = data
channel-count = 4
```
--------------------------------
### Example EclipseStore Debug Log Output
Source: https://docs.eclipsestore.io/manual/1/misc/integrations/spring-boot
Illustrates the debug log output from EclipseStore after enabling detailed logging. This output shows various configuration items such as storage directory, channel count, and auto-start status, providing insights into the current EclipseStore setup.
```log
15:57:34.923 [main] DEBUG o.e.s.i.s.b.t.EclipseStoreProviderImpl -- EclipseStore configuration items:
15:57:34.923 [main] DEBUG o.e.s.i.s.b.t.EclipseStoreProviderImpl -- storage-directory : jokes_storage
15:57:34.923 [main] DEBUG o.e.s.i.s.b.t.EclipseStoreProviderImpl -- channel-count : 2
15:57:34.923 [main] DEBUG o.e.s.i.s.b.t.EclipseStoreProviderImpl -- auto-start : true
```
--------------------------------
### YAML Configuration File Example
Source: https://docs.eclipsestore.io/manual/1/storage/configuration/index
An example YAML configuration file for EclipseStore, defining the storage directory and channel count.
```yaml
storage-directory: "data"
channel-count: 4
```
--------------------------------
### EclipseStore Basic Root Instance Setup
Source: https://docs.eclipsestore.io/manual/1/storage/root-instances
Demonstrates the fundamental steps to initialize EclipseStore, set a root instance for the entity graph, and store it. This forms the basis of a simple database application.
```java
EmbeddedStorageManager storageManager = EmbeddedStorage.start();
storageManager.setRoot("Hello World");
storageManager.storeRoot();
```
--------------------------------
### Define Data Entities for GigaMap Storage
Source: https://docs.eclipsestore.io/manual/gigamap/getting-started
Example Java classes for 'Person' and 'Address' entities that can be stored and indexed within a GigaMap. These classes define the structure of the data you will be managing.
```java
public class Person
{
private UUID id ;
private String firstName ;
private String lastName ;
private LocalDate dateOfBirth;
private Address address ;
// ...
}
public class Address
{
private String street ;
private String city ;
private String country;
// ...
}
```
--------------------------------
### Query GigaMap for Persons by Year of Birth
Source: https://docs.eclipsestore.io/manual/gigamap/getting-started
Example Java code for querying the GigaMap to find all 'Person' entities born in the year 2000. This query leverages the 'dateOfBirth' indexer and its specific year filtering capabilities.
```java
// Geta all born in the year 2000
List result = gigaMap.query(PersonIndices.dateOfBirth.isYear(2000)).toList();
```
--------------------------------
### TLS Echo Server Setup with Java
Source: https://docs.eclipsestore.io/manual/1/communication/index
Demonstrates how to set up a TLS-enabled echo server in Java. It requires key store and trust store paths, passwords, and configures the ComTLSConnectionHandler with specific providers for key management, trust management, TLS parameters, and secure random generation. The server then listens for connections, receives messages, and sends them back.
```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();
}
}
```
--------------------------------
### Install EclipseStore with Maven
Source: https://docs.eclipsestore.io/manual/intro/installation
Add the EclipseStore embedded storage library to your Maven project by including the specified dependency in your pom.xml. This is the standard way to manage dependencies for Maven projects.
```xml
org.eclipse.store
storage-embedded
3.1.0
```
--------------------------------
### Placeholder for Default Root Initialization (Java)
Source: https://docs.eclipsestore.io/manual/1/storage/root-instances
This snippet shows the initial setup where an empty application-specific root instance is created before database initialization. This approach has limitations when the root needs to be populated directly from the database during initialization, as shown in the problem description.
```java
// Empty application-specific root, to be filled during start()
MyApplicationRoot root = new MyApplicationRoot();
// Start the database manager
EmbeddedStorageManager storage = EmbeddedStorage.start();
// root must be filled at this point... but how?
root.printAllMyEntities();
```
--------------------------------
### Add EclipseStore Embedded Dependency to Maven Project
Source: https://docs.eclipsestore.io/manual/1/intro/installation
Configure your Maven pom.xml to include the EclipseStore embedded storage library. This involves specifying the repository for snapshots and adding the dependency to your project. Ensure you have Maven installed and configured.
```xml
ossrh
https://oss.sonatype.org/content/repositories/snapshots
false
true
org.eclipse.store
storage-embedded
1.4.0
```
--------------------------------
### Using Eager Storing
Source: https://docs.eclipsestore.io/manual/storage/storing-data/lazy-eager-full
Demonstrates how to create and use an EagerStorer to store data with the eager storing strategy.
```APIDOC
## Using Eager Storing
### Description
This example shows how to explicitly use the eager storing strategy provided by EclipseStore.
### Method
`store()` and `commit()` methods on a `Storer` instance.
### Endpoint
N/A (Java API usage)
### Parameters
N/A
### Request Example
```java
Storer storer = storage.createEagerStorer();
storer.store(myData);
storer.commit();
```
### Response
N/A (Java API usage)
### Response Example
N/A
```
--------------------------------
### Configure Bazel for EclipseStore Embedded Dependency
Source: https://docs.eclipsestore.io/manual/1/intro/installation
Set up your Bazel WORKSPACE file to fetch and manage the EclipseStore embedded storage library using rules_jvm_external. This involves defining the external repository and installing the artifact. Requires Bazel and rules_jvm_external configured.
```python
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "2.8"
RULES_JVM_EXTERNAL_SHA = "79c9850690d7614ecdb72d68394f994fef7534b292c4867ce5e7dec0aa7bdfad"
http_archive(
name = "rules_jvm_external",
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
sha256 = RULES_JVM_EXTERNAL_SHA,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)
load("@rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
artifacts = [
"org.eclipse.store:storage-embedded:1.4.0"
],
)
```
--------------------------------
### Download Client GUI using Maven Dependency Copy
Source: https://docs.eclipsestore.io/manual/1/storage/rest-interface/client-gui
This command downloads the EclipseStore Client GUI JAR file directly into the current directory. It requires Maven to be installed and specifies the artifact and output directory.
```bash
mvn dependency:copy -Dartifact=org.eclipse.store:storage-restclient-app-standalone-assembly:{maven-version}:jar:standalone -DoutputDirectory=./
```
--------------------------------
### Initialize with Explicit Root Instance (Java)
Source: https://docs.eclipsestore.io/manual/1/storage/root-instances
Demonstrates initializing EclipseStore with an explicit application-specific root instance. This custom root is passed to the `EmbeddedStorage.start()` method, allowing it to be populated during database initialization. The `MyApplicationRoot` class is a placeholder for the user's specific root object.
```java
import org.eclipse.store.storage.embedded.EmbeddedStorage;
import org.eclipse.store.storage.embedded.EmbeddedStorageManager;
// Assuming MyApplicationRoot is defined elsewhere
// class MyApplicationRoot {
// void printAllMyEntities() { /* ... */ }
// }
// Empty application-specific root, to be filled during start()
MyApplicationRoot root = new MyApplicationRoot();
// Start the database manager with a reference to the application's root.
EmbeddedStorageManager storageManager = EmbeddedStorage.start(root);
// root is "magically" filled at this point. (Yay!)
root.printAllMyEntities();
```
--------------------------------
### Add EclipseStore Embedded Dependency to Apache Buildr Project
Source: https://docs.eclipsestore.io/manual/1/intro/installation
Specify the EclipseStore embedded storage library within an Apache Buildr Buildfile. This Ruby-based build system uses a straightforward syntax to declare compilation dependencies. Assumes Buildr is installed.
```ruby
define 'my-app' do
compile.with 'org.eclipse.store:storage-embedded:1.4.0'
end
```
--------------------------------
### Java Storing Data with EclipseStore
Source: https://docs.eclipsestore.io/manual/1/storage/getting-started
Demonstrates how to store data in EclipseStore. This snippet shows how to update the content of the root object and then persist the changes using `storageManager.storeRoot()`.
```java
// Set content data to the root element, including the time to visualize
// changes on the next execution.
root.setContent("Hello World! @ " + new Date());
// Store the modified root and its content.
storageManager.storeRoot();
```
--------------------------------
### Initialize Various Auto-Incrementing Version Contexts
Source: https://docs.eclipsestore.io/manual/1/misc/layered-entities/versioning
Provides examples of initializing different types of auto-incrementing version contexts, including system time-based and Instant-based contexts.
```java
EntityVersionContext systemTimeContext = EntityVersionContext.AutoIncrementingSystemTimeMillis();
EntityVersionContext nanoTimeContext = EntityVersionContext.AutoIncrementingSystemNanoTime();
EntityVersionContext instantContext = EntityVersionContext.AutoIncrementingInstant();
```
--------------------------------
### Initialize and Store Root Instance in Java
Source: https://docs.eclipsestore.io/manual/1/storage/storing-data/index
Initializes an EmbeddedStorageManager and stores the root object of the data graph. This is the starting point for persisting your object-oriented data with EclipseStore.
```java
// Init storage manager
final EmbeddedStorageManager storageManager = EmbeddedStorage.start(root);
// Store the root object
storageManager.storeRoot();
```
--------------------------------
### Maven Dependency for EclipseStore Embedded
Source: https://docs.eclipsestore.io/manual/1/storage/getting-started
This snippet shows the Maven dependency required to include the EclipseStore embedded storage in your project. It specifies the group ID, artifact ID, and version for the 'storage-embedded' module.
```xml
org.eclipse.store
storage-embedded
1.4.0
```
--------------------------------
### Storing New Objects
Source: https://docs.eclipsestore.io/manual/2/storage/storing-data/index
Demonstrates how to store newly created objects by storing their 'owner' object or the collection they are added to.
```APIDOC
## Storing New Objects
### Description
Stores a newly created object by storing the object that owns it or the collection it belongs to.
### Method
`store(Object object)` or `store(Collection collection)`
### Endpoint
N/A (Method call on `EmbeddedStorageManager`)
### Parameters
- **object** (Object) - The owner object or collection containing the new object.
### Request Example
```java
// Add a new data object to the list in root
MyData dataItem = new MyData("Alice");
root.myObjects.add(dataItem);
// Store the modified list
storageManager.store(root.myObjects);
```
### Response
#### Success Response
New object is persisted as part of the object graph.
#### Response Example
N/A
```
--------------------------------
### Query GigaMap for Persons by First Name
Source: https://docs.eclipsestore.io/manual/gigamap/getting-started
Java code demonstrating how to query the GigaMap to retrieve all 'Person' entities whose first name is 'John'. This utilizes the predefined 'firstName' indexer.
```java
// Get all Johns
List result = gigaMap.query(PersonIndices.firstName.is("John")).toList();
```
--------------------------------
### Use Different Auto-Incrementing Time-Based Version Contexts (Java)
Source: https://docs.eclipsestore.io/manual/2/misc/layered-entities/versioning
Provides examples of using different time-based strategies for auto-incrementing version contexts, including system time in milliseconds, nanoseconds, and Instant.
```java
EntityVersionContext systemTimeContext =
EntityVersionContext.AutoIncrementingSystemTimeMillis();
EntityVersionContext nanoTimeContext =
EntityVersionContext.AutoIncrementingSystemNanoTime();
EntityVersionContext instantContext =
EntityVersionContext.AutoIncrementingInstant();
```
--------------------------------
### Build and Configure GigaMap Instance
Source: https://docs.eclipsestore.io/manual/gigamap/getting-started
Java code snippet for creating a GigaMap instance for 'Person' entities. This involves using the GigaMap builder and specifying which indexes (identity, bitmap) to include for efficient data retrieval.
```java
final GigaMap gigaMap = GigaMap.Builder()
.withBitmapIdentityIndex(PersonIndices.id)
.withBitmapIndex(PersonIndices.firstName)
.withBitmapIndex(PersonIndices.lastName)
.withBitmapIndex(PersonIndices.dateOfBirth)
.withBitmapIndex(PersonIndices.city)
.withBitmapIndex(PersonIndices.country)
.build();
```
--------------------------------
### Basic Serialization and Deserialization
Source: https://docs.eclipsestore.io/manual/1/serializer/index
Demonstrates the fundamental usage of the EclipseStore serializer. It involves creating a serializer instance, optionally with a foundation, and then using its serialize and deserialize methods. The byte array format is suitable for transport layers.
```java
final SerializerFoundation> foundation = SerializerFoundation.New()
.registerEntityTypes(Customer.class);
final Serializer serializer = Serializer.Bytes(foundation);
byte[] data = serializer.serialize(customer);
Customer restored = serializer.deserialize(data);
```
--------------------------------
### Initialize BlobStoreFileSystem with Kafka Connector
Source: https://docs.eclipsestore.io/manual/1/storage/storage-targets/blob-stores/kafka
This Java code snippet demonstrates how to initialize the BlobStoreFileSystem using the KafkaConnector. It sets the Kafka bootstrap servers and ensures the storage directory exists.
```java
Properties properties = new Properties();
properties.setProperty(
CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG,
"localhost:9093"
);
BlobStoreFileSystem fileSystem = BlobStoreFileSystem.New(
KafkaConnector.Caching(properties)
);
EmbeddedStorage.start(fileSystem.ensureDirectoryPath("storage"));
```
--------------------------------
### Create Custom Indexers for Person Entities
Source: https://docs.eclipsestore.io/manual/gigamap/getting-started
Java code demonstrating how to define custom indexers for the 'Person' entity. These indexers specify how to extract values for indexing from the entity's properties, enabling efficient querying.
```java
public class PersonIndices
{
public final static BinaryIndexerUUID id = new BinaryIndexerUUID.Abstract<>()
{
@Override
protected UUID getUUID(final Person entity)
{
return entity.getId();
}
};
public final static IndexerString firstName = new IndexerString.Abstract<>()
{
@Override
public String getString(final Person entity)
{
return entity.getFirstName();
}
};
public final static IndexerString lastName = new IndexerString.Abstract<>()
{
@Override
public String getString(final Person entity)
{
return entity.getLastName();
}
};
public final static IndexerLocalDate dateOfBirth = new IndexerLocalDate.Abstract<>()
{
@Override
protected LocalDate getLocalDate(final Person entity)
{
return entity.getDateOfBirth();
}
};
public final static IndexerString city = new IndexerString.Abstract<>()
{
@Override
public String getString(final Person entity)
{
return entity.getAddress().getCity();
}
};
public final static IndexerString country = new IndexerString.Abstract<>()
{
@Override
public String getString(final Person entity)
{
return entity.getAddress().getCountry();
}
};
}
```
--------------------------------
### Add GigaMap Dependency to Maven Project
Source: https://docs.eclipsestore.io/manual/gigamap/getting-started
This snippet shows how to add the necessary Eclipse Store GigaMap dependency to your Maven project's pom.xml file. Ensure you are using a compatible version of the GigaMap artifact.
```xml
org.eclipse.store
gigamap
3.1.0
```
--------------------------------
### Importing Type Dictionary using setInitialTypeDictionary()
Source: https://docs.eclipsestore.io/manual/1/serializer/index
Demonstrates importing an initial type dictionary string by first creating a SerializerFoundation instance and then using the setInitialTypeDictionary() method.
```java
final SerializerFoundation> foundation = SerializerFoundation.New();
foundation.setInitialTypeDictionary(typeDictionaryString);
```
--------------------------------
### Java DataRoot Class Definition
Source: https://docs.eclipsestore.io/manual/1/storage/getting-started
Defines a simple Java class 'DataRoot' to be used as the root instance for EclipseStore persistence. This class contains a String content field with standard getter and setter methods, and an overridden toString method.
```java
public class DataRoot
{
private String content;
public DataRoot()
{
super();
}
public String getContent()
{
return this.content;
}
public void setContent(final String content)
{
this.content = content;
}
@Override
public String toString()
{
return "Root: " + this.content;
}
}
```
--------------------------------
### Add EclipseStore Embedded Dependency to Gradle Project (Groovy)
Source: https://docs.eclipsestore.io/manual/1/intro/installation
Integrate the EclipseStore embedded storage library into your Gradle build script using Groovy syntax. This is a straightforward addition to your dependencies block. Ensure Gradle is set up in your project.
```groovy
dependencies {
implementation 'org.eclipse.store:storage-embedded:1.4.0'
}
```
--------------------------------
### Java Code for Oracle Data Source and File System Setup
Source: https://docs.eclipsestore.io/manual/1/storage/storage-targets/sql-databases/oracle
This Java code demonstrates how to configure an Oracle data source and initialize EclipseStore's SQL file system. It sets up the connection URL, user credentials, and ensures the storage directory is created.
```java
OracleDataSource dataSource = new OracleDataSource();
dataSource.setURL("jdbc:oracle:thin:@localhost:1521/db");
dataSource.setUser("user");
dataSource.setPassword("secret");
SqlFileSystem fileSystem = SqlFileSystem.New(
SqlConnector.Caching(
SqlProviderOracle.New(dataSource)
)
);
EmbeddedStorage.start(fileSystem.ensureDirectoryPath("storage"));
```
--------------------------------
### Importing Type Dictionary using New()
Source: https://docs.eclipsestore.io/manual/1/serializer/index
Illustrates how to import an initial type dictionary string when creating a new SerializerFoundation using the static New(String typeDictionaryString) method.
```java
final SerializerFoundation> foundation = SerializerFoundation.New(typeDictionaryString);
```