Skip to content

Commit

Permalink
use spring aware and leave deprecated stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenek-jonas committed Oct 29, 2024
1 parent 2010863 commit e0397f9
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public EmbeddedStorageFoundationFactory embeddedStorageFoundationFactory(
ApplicationContext applicationContext
)
{
return new EmbeddedStorageFoundationFactory(eclipseStoreConfigConverter, classLoaderProvider, applicationContext);
return new EmbeddedStorageFoundationFactory(eclipseStoreConfigConverter, classLoaderProvider);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
import org.eclipse.store.storage.embedded.configuration.types.EmbeddedStorageConfigurationBuilder;
import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation;
import org.slf4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import java.util.Map;

Expand All @@ -37,21 +39,21 @@
*
* @since 1.2.0
*/
public class EmbeddedStorageFoundationFactory
public class EmbeddedStorageFoundationFactory implements ApplicationContextAware
{
private final EclipseStoreConfigConverter converter;
private final ClassLoaderProvider classLoaderProvider;
private final ApplicationContext applicationContext;
private ApplicationContext applicationContext;

private final Logger logger = Logging.getLogger(EmbeddedStorageFoundationFactory.class);

public EmbeddedStorageFoundationFactory(final EclipseStoreConfigConverter converter, final ClassLoaderProvider classLoaderProvider, final ApplicationContext context)
public EmbeddedStorageFoundationFactory(final EclipseStoreConfigConverter converter, final ClassLoaderProvider classLoaderProvider)
{
this.converter = converter;
this.classLoaderProvider = classLoaderProvider;
this.applicationContext = context;
}


/**
* Creates an {@code EmbeddedStorageFoundation} using the provided configuration. This method should be called when the additional configuration for the foundation is required.
*
Expand Down Expand Up @@ -129,4 +131,9 @@ protected Object createNewRootInstance(final EclipseStoreProperties properties)
}
}

@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
this.applicationContext = applicationContext;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package org.eclipse.store.integrations.spring.boot.types.factories.legacy;

/*-
* #%L
* spring-boot3
* %%
* Copyright (C) 2023 MicroStream Software
* %%
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
* #L%
*/

import org.eclipse.serializer.reflect.ClassLoaderProvider;
import org.eclipse.store.integrations.spring.boot.types.EclipseStoreProvider;
import org.eclipse.store.integrations.spring.boot.types.configuration.ConfigurationPair;
import org.eclipse.store.integrations.spring.boot.types.configuration.EclipseStoreProperties;
import org.eclipse.store.integrations.spring.boot.types.converter.EclipseStoreConfigConverter;
import org.eclipse.store.integrations.spring.boot.types.factories.EmbeddedStorageFoundationFactory;
import org.eclipse.store.integrations.spring.boot.types.factories.EmbeddedStorageManagerFactory;
import org.eclipse.store.storage.embedded.types.EmbeddedStorageFoundation;
import org.eclipse.store.storage.embedded.types.EmbeddedStorageManager;


@SuppressWarnings("removal")
@Deprecated
public class EclipseStoreProviderImpl implements EclipseStoreProvider
{

private final EmbeddedStorageFoundationFactory embeddedStorageFoundationFactory;
private final EmbeddedStorageManagerFactory embeddedStorageManagerFactory;

public EclipseStoreProviderImpl(final EclipseStoreConfigConverter converter, final ClassLoaderProvider classLoaderProvider)
{
this.embeddedStorageFoundationFactory = new EmbeddedStorageFoundationFactory(converter, classLoaderProvider);
this.embeddedStorageManagerFactory = new EmbeddedStorageManagerFactory();
}

@Override
public EmbeddedStorageManager createStorage(final EclipseStoreProperties eclipseStoreProperties, final ConfigurationPair... additionalConfiguration)
{
final EmbeddedStorageFoundation<?> storageFoundation = this.createStorageFoundation(eclipseStoreProperties, additionalConfiguration);
return this.createStorage(storageFoundation, eclipseStoreProperties.isAutoStart());
}

@Override
public EmbeddedStorageManager createStorage(final EmbeddedStorageFoundation<?> foundation, final boolean autoStart)
{
return embeddedStorageManagerFactory.createStorage(foundation, autoStart);
}

@Override
public EmbeddedStorageFoundation<?> createStorageFoundation(final EclipseStoreProperties eclipseStoreProperties, final ConfigurationPair... additionalConfiguration)
{
return this.embeddedStorageFoundationFactory.createStorageFoundation(eclipseStoreProperties, additionalConfiguration);
}

}

0 comments on commit e0397f9

Please sign in to comment.