Skip to content

Commit 3c55022

Browse files
committedNov 11, 2024·
Merge branch 'develop' into update-from-template-merged
2 parents 06e8428 + 3674f4f commit 3c55022

31 files changed

+1871
-34
lines changed
 

‎.github/ISSUE_TEMPLATE/bug_report.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ body:
1414
attributes:
1515
label: "Checklist"
1616
options:
17-
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/template-placeholder/releases/latest)"
17+
- label: "I am able to reproduce the bug with the [latest version](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/releases/latest)"
1818
required: true
19-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
19+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/issues) or [closed](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
2020
required: true
2121
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
2222
required: true

‎.github/ISSUE_TEMPLATE/enhancement.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/issues) or [closed](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
1818
required: true

‎.github/ISSUE_TEMPLATE/question.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ body:
1212
attributes:
1313
label: "Checklist"
1414
options:
15-
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/template-placeholder/issues) or [closed](https://github.com/xdev-software/template-placeholder/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
15+
- label: "I made sure that there are *no existing issues* - [open](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/issues) or [closed](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
1616
required: true
1717
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
1818
required: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Demo With Single Access Read Only" type="Application" factoryName="Application" singleton="false">
3+
<option name="MAIN_CLASS_NAME" value="software.xdev.ApplicationWithSingleAccessReadOnly" />
4+
<module name="eclipse-store-afs-ibm-cos-demo" />
5+
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
6+
<extension name="coverage">
7+
<pattern>
8+
<option name="PATTERN" value="software.xdev.*" />
9+
<option name="ENABLED" value="true" />
10+
</pattern>
11+
</extension>
12+
<method v="2">
13+
<option name="Make" enabled="true" />
14+
</method>
15+
</configuration>
16+
</component>
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="Run Demo With Single Access" type="Application" factoryName="Application" singleton="false">
3+
<option name="MAIN_CLASS_NAME" value="software.xdev.ApplicationWithSingleAccess" />
4+
<module name="eclipse-store-afs-ibm-cos-demo" />
5+
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
6+
<extension name="coverage">
7+
<pattern>
8+
<option name="PATTERN" value="software.xdev.*" />
9+
<option name="ENABLED" value="true" />
10+
</pattern>
11+
</extension>
12+
<method v="2">
13+
<option name="Make" enabled="true" />
14+
</method>
15+
</configuration>
16+
</component>

‎.run/Run Demo.run.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
33
<option name="MAIN_CLASS_NAME" value="software.xdev.Application" />
4-
<module name="template-placeholder-demo" />
4+
<module name="eclipse-store-afs-ibm-cos-demo" />
55
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
66
<extension name="coverage">
77
<pattern>

‎CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## 1.0.4
2+
* Updated dependencies
3+
* Updated EclipseStore to 1.3.2
4+
5+
## 1.0.3
6+
7+
* Using v1.2.0 of EclipseStore now
8+
* Added SingleAccessManager to handle single access with multiple instances on IBM COS
9+
10+
## 1.0.2
11+
12+
* Using v1.1.0 of EclipseStore now
13+
14+
## 1.0.1
15+
* ⚠️ GroupId changed from ``com.xdev-software`` to ``software.xdev``
16+
* Updated dependencies
17+
18+
## 1.0.0
19+
20+
Using v1.0.0 of EclipseStore now.
21+
22+
## 0.0.2
23+
24+
Restructured maven modules for the maven central release.
25+
26+
## 0.0.1
27+
28+
Initial release.

‎CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ You should have the following things installed:
3434
* Ensure that the JDK/Java-Version is correct
3535

3636

37-
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/release.yml?branch=master)](https://github.com/xdev-software/template-placeholder/actions/workflows/release.yml)
37+
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/eclipse-store-afs-ibm-cos/release.yml?branch=master)](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/actions/workflows/release.yml)
3838

3939
Before releasing:
40-
* Consider doing a [test-deployment](https://github.com/xdev-software/template-placeholder/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
40+
* Consider doing a [test-deployment](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
4141
* Check the [changelog](CHANGELOG.md)
4242

4343
If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes

‎README.md

+27-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
1-
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/template-placeholder?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/template-placeholder)
2-
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/template-placeholder/check-build.yml?branch=develop)](https://github.com/xdev-software/template-placeholder/actions/workflows/check-build.yml?query=branch%3Adevelop)
3-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_template-placeholder&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_template-placeholder)
1+
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/eclipse-store-afs-ibm-cos?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/eclipse-store-afs-ibm-cos)
2+
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/eclipse-store-afs-ibm-cos/check-build.yml?branch=develop)](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/actions/workflows/check-build.yml?query=branch%3Adevelop)
3+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_eclipse-store-afs-ibm-cos&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_eclipse-store-afs-ibm-cos)
44

5-
# template-placeholder
5+
# eclipse-store-afs-ibm-cos
66

7+
A connector for the [EclipseStore](https://eclipsestore.io/) which allows storing data in the [IBM Cloud Object Storage](https://www.ibm.com/cloud/object-storage).
8+
9+
It uses the [IBM-provided Java SDK](https://github.com/IBM/ibm-cos-sdk-java).
10+
11+
The connector works virtually identical to the [AWS S3 Connector](https://docs.eclipsestore.io/manual/storage/storage-targets/blob-stores/aws-s3.html) of EclipseStore but for IBM COS instead of AWS S3.
12+
13+
To easily handle multiple processes using a single IBM COS instance, we implemented the [SingleAccessManager](eclipse-store-afs-ibm-cos/src/main/java/software/xdev/eclipse/store/afs/ibm/access/SingleAccessManager.java).
14+
It manages access by creating tokens and checking for other tokens. For more information see [the demo application](eclipse-store-afs-ibm-cos-demo/src/main/java/software/xdev/ApplicationWithSingleAccess.java).
715

816
## Installation
9-
[Installation guide for the latest release](https://github.com/xdev-software/template-placeholder/releases/latest#Installation)
17+
18+
[Installation guide for the latest release](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/releases/latest#Installation)
19+
20+
## Supported EclipseStore versions
21+
22+
To find out the currently supported EclipseStore version of the connector have a look at its ``compile`` dependencies and search for ``org.eclipse.store``.<br/>
23+
This can be done inside an IDE (e.g. IntelliJ IDEA), via a Maven Web explorer (e.g. [mvnrepository.com](https://mvnrepository.com/artifact/software.xdev/eclipse-store-afs-ibm-cos)) or - for the latest version - have a look into the [``Dependencies``](./README.md#dependencies-and-licenses) section below.<br/>
24+
As an alternative you can also check the [changelog](./CHANGELOG.md).
25+
26+
If you are using a different, not listed version of EclipseStore this shouldn't be a problem.<br/>
27+
Usually you can simply exclude the dependent version of EclipseStore.
1028

1129
## Support
12-
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
30+
31+
If you need support as soon as possible, and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
1332

1433
## Contributing
34+
1535
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
1636

1737
## Dependencies and Licenses
18-
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/template-placeholder/dependencies)
38+
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/eclipse-store-afs-ibm-cos/dependencies)

‎SECURITY.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/template-placeholder/security/advisories/new).
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/eclipse-store-afs-ibm-cos/security/advisories/new).

‎template-placeholder-demo/pom.xml ‎eclipse-store-afs-ibm-cos-demo/pom.xml

+20-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
<parent>
88
<groupId>software.xdev</groupId>
9-
<artifactId>template-placeholder-root</artifactId>
10-
<version>1.0.0-SNAPSHOT</version>
9+
<artifactId>eclipse-store-afs-ibm-cos-root</artifactId>
10+
<version>1.0.5-SNAPSHOT</version>
1111
</parent>
1212

13-
<artifactId>template-placeholder-demo</artifactId>
14-
<version>1.0.0-SNAPSHOT</version>
13+
<artifactId>eclipse-store-afs-ibm-cos-demo</artifactId>
14+
<version>1.0.5-SNAPSHOT</version>
1515
<packaging>jar</packaging>
1616

1717
<organization>
@@ -20,21 +20,35 @@
2020
</organization>
2121

2222
<properties>
23-
<javaVersion>17</javaVersion>
23+
<javaVersion>11</javaVersion>
2424
<maven.compiler.release>${javaVersion}</maven.compiler.release>
2525

2626
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2727
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2828

2929
<mainClass>software.xdev.Application</mainClass>
30+
31+
<org.eclipse.store.version>1.3.2</org.eclipse.store.version>
3032
</properties>
3133

3234
<dependencies>
3335
<dependency>
3436
<groupId>software.xdev</groupId>
35-
<artifactId>template-placeholder</artifactId>
37+
<artifactId>eclipse-store-afs-ibm-cos</artifactId>
3638
<version>${project.version}</version>
3739
</dependency>
40+
41+
<dependency>
42+
<groupId>org.slf4j</groupId>
43+
<artifactId>slf4j-simple</artifactId>
44+
<version>2.0.13</version>
45+
</dependency>
46+
47+
<dependency>
48+
<groupId>org.eclipse.store</groupId>
49+
<artifactId>storage-embedded</artifactId>
50+
<version>${org.eclipse.store.version}</version>
51+
</dependency>
3852
</dependencies>
3953

4054
<build>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
package software.xdev;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
import org.eclipse.store.afs.blobstore.types.BlobStoreFileSystem;
7+
import org.eclipse.store.storage.embedded.types.EmbeddedStorage;
8+
import org.eclipse.store.storage.embedded.types.EmbeddedStorageManager;
9+
import org.slf4j.Logger;
10+
import org.slf4j.LoggerFactory;
11+
12+
import com.ibm.cloud.objectstorage.ClientConfiguration;
13+
import com.ibm.cloud.objectstorage.auth.AWSCredentials;
14+
import com.ibm.cloud.objectstorage.auth.AWSStaticCredentialsProvider;
15+
import com.ibm.cloud.objectstorage.client.builder.AwsClientBuilder;
16+
import com.ibm.cloud.objectstorage.oauth.BasicIBMOAuthCredentials;
17+
import com.ibm.cloud.objectstorage.services.s3.AmazonS3;
18+
import com.ibm.cloud.objectstorage.services.s3.AmazonS3ClientBuilder;
19+
20+
import software.xdev.eclipse.store.afs.ibm.cos.types.CosConnector;
21+
22+
23+
@SuppressWarnings("checkstyle:MagicNumber")
24+
public final class Application
25+
{
26+
private static final String COS_ENDPOINT = ""; // eg "https://s3.us.cloud-object-storage.appdomain.cloud"
27+
private static final String COS_API_KEY_ID = ""; // eg "0viPHOY7LbLNa9eLftrtHPpTjoGv6hbLD1QalRXikliJ"
28+
private static final String COS_SERVICE_CRN = "";
29+
// "crn:v1:bluemix:public:cloud-object-storage:global:a/<CREDENTIAL_ID_AS_GENERATED>:<SERVICE_ID_AS_GENERATED>::"
30+
private static final String COS_BUCKET_LOCATION = ""; // eg "us"
31+
private static final String BUCKET_NAME = "";
32+
33+
private static final Logger LOG = LoggerFactory.getLogger(Application.class);
34+
35+
/**
36+
* This function connects to the IBM COS and writes one million String-Entries on it.
37+
*/
38+
public static void main(final String[] args)
39+
{
40+
final List<String> stringList = new ArrayList<>();
41+
LOG.info("List size before loading: {}", stringList.size());
42+
try(final EmbeddedStorageManager manager = getStorageManager(stringList))
43+
{
44+
LOG.info("List size after loading: {}", stringList.size());
45+
for(int i = 0; i < 1_000_000; i++)
46+
{
47+
stringList.add("Test" + i);
48+
}
49+
manager.store(stringList);
50+
LOG.info("List size after storing new entities: {}", stringList.size());
51+
}
52+
}
53+
54+
public static EmbeddedStorageManager getStorageManager(final Object root)
55+
{
56+
final AmazonS3 client = createClient(COS_API_KEY_ID, COS_SERVICE_CRN, COS_ENDPOINT, COS_BUCKET_LOCATION);
57+
58+
LOG.info("Start creating file system");
59+
final BlobStoreFileSystem cloudFileSystem = BlobStoreFileSystem.New(
60+
// use caching connector
61+
CosConnector.Caching(client)
62+
);
63+
LOG.info("Finished creating file system");
64+
65+
LOG.info("Starting storage manager");
66+
final EmbeddedStorageManager storageManager = EmbeddedStorage.start(
67+
root,
68+
cloudFileSystem.ensureDirectoryPath(BUCKET_NAME));
69+
LOG.info("Finished storage manager");
70+
71+
return storageManager;
72+
}
73+
74+
public static AmazonS3 createClient(
75+
final String apiKey,
76+
final String serviceInstanceId,
77+
final String endpointUrl,
78+
final String location)
79+
{
80+
LOG.info("Start creating client");
81+
final AWSCredentials credentials = new BasicIBMOAuthCredentials(apiKey, serviceInstanceId);
82+
final ClientConfiguration clientConfig = new ClientConfiguration().withRequestTimeout(-1);
83+
clientConfig.setUseTcpKeepAlive(true);
84+
85+
final AmazonS3 build = AmazonS3ClientBuilder.standard()
86+
.withCredentials(new AWSStaticCredentialsProvider(credentials))
87+
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpointUrl, location))
88+
.withPathStyleAccessEnabled(true)
89+
.withClientConfiguration(clientConfig)
90+
.build();
91+
LOG.info("Finished creating client");
92+
return build;
93+
}
94+
95+
private Application()
96+
{
97+
}
98+
}

0 commit comments

Comments
 (0)
Please sign in to comment.