Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

38 changes: 20 additions & 18 deletions backing-store/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright 2026 Contributors to the Eclipse Foundation.
Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand All @@ -17,34 +17,19 @@

-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.glassfish.shoal</groupId>
<artifactId>shoal</artifactId>
<version>3.1.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
<version>4.0.0-SNAPSHOT</version>
</parent>

<artifactId>shoal-backing-store</artifactId>
<packaging>jar</packaging>
<name>shoal-backing-store</name>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${basedir}/src/main/resources/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>

<developers>
<developer>
<id>mk111283</id>
Expand All @@ -70,4 +55,21 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
26 changes: 26 additions & 0 deletions backing-store/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

/**
* @author David Matejcek
*/
module org.glassfish.shoal.backingstore {

requires org.glassfish.ha.api;
requires org.glassfish.shoal.ha.cache;

exports org.glassfish.shoal.adapter.store;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -14,43 +15,33 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.shoal.adapter.store;

import org.glassfish.ha.store.api.*;
package org.glassfish.shoal.adapter.store;

import java.io.Serializable;
import java.util.Properties;

import org.glassfish.ha.store.api.BackingStore;
import org.glassfish.ha.store.api.BackingStoreConfiguration;
import org.glassfish.ha.store.api.BackingStoreException;
import org.glassfish.ha.store.api.BackingStoreFactory;
import org.glassfish.ha.store.api.BackingStoreTransaction;

/**
* @author Mahesh Kannan
*/
public class ReplicationBackingStoreFactory
implements BackingStoreFactory {

private Properties props;

public ReplicationBackingStoreFactory() {
}

public ReplicationBackingStoreFactory(Properties p) {
this.props=p;
}
public class GlassFishReplicationBackingStoreFactory implements BackingStoreFactory {

@Override
public <K extends Serializable, V extends Serializable> BackingStore<K, V> createBackingStore(BackingStoreConfiguration<K, V> conf) throws BackingStoreException {

InMemoryBackingStore<K, V> bStore = new InMemoryBackingStore<K, V>();
public <K extends Serializable, V extends Serializable> BackingStore<K, V> createBackingStore(
BackingStoreConfiguration<K, V> conf) throws BackingStoreException {
InMemoryBackingStore<K, V> bStore = new InMemoryBackingStore<>();
bStore.initialize(conf);
System.out.println("ReplicationBackingStoreFactory:: CREATED an instance of: " + bStore.getClass().getName());
return bStore;
}


@Override
public BackingStoreTransaction createBackingStoreTransaction() {
return new BackingStoreTransaction() {
@Override
public void commit() throws BackingStoreException {
}
};
return new NoCommitBackingStoreTransaction();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2020 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -14,30 +15,34 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.shoal.adapter.store;
package org.glassfish.shoal.adapter.store;

import java.io.Serializable;
import java.util.Map;

import org.glassfish.ha.store.api.BackingStore;
import org.glassfish.ha.store.api.BackingStoreConfiguration;
import org.glassfish.ha.store.api.BackingStoreException;
import org.shoal.ha.cache.api.*;

import java.io.Serializable;
import java.util.Map;
import org.glassfish.ha.store.api.BackingStoreFactory;
import org.glassfish.shoal.ha.cache.api.DataStore;
import org.glassfish.shoal.ha.cache.api.DataStoreContext;
import org.glassfish.shoal.ha.cache.api.DataStoreException;
import org.glassfish.shoal.ha.cache.api.DataStoreFactory;

/**
* @param <K> Key type
* @param <V> Value type
* @author Mahesh Kannan
*/
public class InMemoryBackingStore<K extends Serializable, V extends Serializable>
extends BackingStore<K, V> {
public class InMemoryBackingStore<K extends Serializable, V extends Serializable> extends BackingStore<K, V> {

DataStore<K, V> dataStore;

@Override
protected void initialize(BackingStoreConfiguration<K, V> conf)
throws BackingStoreException {
super.initialize(conf);
DataStoreContext<K, V> dsConf = new DataStoreContext<K, V>();
DataStoreContext<K, V> dsConf = new DataStoreContext<>();
dsConf.setInstanceName(conf.getInstanceName())
.setGroupName(conf.getClusterName())
.setStoreName(conf.getStoreName())
Expand All @@ -49,25 +54,17 @@ protected void initialize(BackingStoreConfiguration<K, V> conf)
boolean startGMS = false;
if (stGMS != null) {
if (stGMS instanceof String) {
try {
startGMS = Boolean.valueOf((String) stGMS);
} catch (Throwable th) {
//Ignore
}
startGMS = Boolean.parseBoolean((String) stGMS);
} else if (stGMS instanceof Boolean) {
startGMS = (Boolean) stGMS;
}
}

Object cacheLocally = vendorSpecificMap.get("local.caching");;
Object cacheLocally = vendorSpecificMap.get("local.caching");
boolean enableLocalCaching = false;
if (cacheLocally != null) {
if (cacheLocally instanceof String) {
try {
enableLocalCaching = Boolean.valueOf((String) cacheLocally);
} catch (Throwable th) {
//Ignore
}
enableLocalCaching = Boolean.parseBoolean((String) cacheLocally);
} else if (cacheLocally instanceof Boolean) {
enableLocalCaching = (Boolean) cacheLocally;
}
Expand All @@ -80,7 +77,7 @@ protected void initialize(BackingStoreConfiguration<K, V> conf)
dsConf.setClassLoader(cl)
.setStartGMS(startGMS)
.setCacheLocally(enableLocalCaching);

dataStore = DataStoreFactory.createDataStore(dsConf);
}

Expand Down Expand Up @@ -137,7 +134,6 @@ public void updateTimestamp(K key, long time) throws BackingStoreException {

@Override
public BackingStoreFactory getBackingStoreFactory() {
return new GlassFishReplicationBackingStoreFactory();
return new ReplicationBackingStoreFactory();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2023, 2026 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.glassfish.shoal.adapter.store;

import org.glassfish.ha.store.api.BackingStoreException;
import org.glassfish.ha.store.api.BackingStoreTransaction;

/**
* A special {@link BackingStoreTransaction} ignoring {@link #commit()} calls.
*/
public class NoCommitBackingStoreTransaction implements BackingStoreTransaction {
@Override
public void commit() throws BackingStoreException {
// ignored
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation.
* Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -14,43 +15,37 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package org.shoal.adapter.store;

import org.glassfish.ha.store.api.*;
package org.glassfish.shoal.adapter.store;

import java.io.Serializable;
import java.util.Properties;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;

import org.glassfish.ha.store.api.BackingStore;
import org.glassfish.ha.store.api.BackingStoreConfiguration;
import org.glassfish.ha.store.api.BackingStoreException;
import org.glassfish.ha.store.api.BackingStoreFactory;
import org.glassfish.ha.store.api.BackingStoreTransaction;

/**
* @author Mahesh Kannan
*/
public class GlassFishReplicationBackingStoreFactory
implements BackingStoreFactory {
public class ReplicationBackingStoreFactory implements BackingStoreFactory {

private Properties props;

public GlassFishReplicationBackingStoreFactory() {
}

public GlassFishReplicationBackingStoreFactory(Properties p) {
this.props=p;
}
private static final Logger LOG = System.getLogger(ReplicationBackingStoreFactory.class.getName());

@Override
public <K extends Serializable, V extends Serializable> BackingStore<K, V> createBackingStore(BackingStoreConfiguration<K, V> conf) throws BackingStoreException {

InMemoryBackingStore<K, V> bStore = new InMemoryBackingStore<K, V>();
public <K extends Serializable, V extends Serializable> BackingStore<K, V> createBackingStore(
BackingStoreConfiguration<K, V> conf) throws BackingStoreException {
InMemoryBackingStore<K, V> bStore = new InMemoryBackingStore<>();
bStore.initialize(conf);
System.out.println("ReplicationBackingStoreFactory:: CREATED an instance of: " + bStore.getClass().getName());
LOG.log(Level.INFO, "CREATED an instance of {0}", bStore.getClass());
return bStore;
}


@Override
public BackingStoreTransaction createBackingStoreTransaction() {
return new BackingStoreTransaction() {
@Override
public void commit() throws BackingStoreException {
}
};
return new NoCommitBackingStoreTransaction();
}
}
26 changes: 0 additions & 26 deletions backing-store/src/main/resources/META-INF/MANIFEST.MF

This file was deleted.

Loading