Fixing connector due to APIs changes

This commit is contained in:
Luca Frosini 2023-05-19 09:06:25 +02:00
parent ce04881b32
commit 580dda9f43
3 changed files with 9 additions and 12 deletions

View File

@ -9,7 +9,6 @@ import org.gcube.common.security.AuthorizedTasks;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.resourcemanagement.model.reference.entities.resources.EService;
import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode;
import org.gcube.smartgears.configuration.AuthorizationProviderConfiguration;
import org.gcube.smartgears.connector.resourceregistry.resourcemanager.EServiceManager;
import org.gcube.smartgears.connector.resourceregistry.resourcemanager.HostingNodeManager;
import org.gcube.smartgears.context.Property;
@ -18,7 +17,6 @@ import org.gcube.smartgears.context.container.ContainerContext;
import org.gcube.smartgears.publishing.Publisher;
import org.gcube.smartgears.publishing.SmartgearsProfilePublisher;
import org.gcube.smartgears.security.AuthorizationProvider;
import org.gcube.smartgears.security.AuthorizationProviderFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -33,9 +31,7 @@ public class FacetBasedPublisher implements Publisher {
}
public static AuthorizationProvider getAuthorizationProvider(ContainerContext containerContext) {
AuthorizationProviderConfiguration authorizationProviderConfiguration = containerContext.configuration().authorizationConfiguration();
AuthorizationProviderFactory<?> authorizationProviderFactory = authorizationProviderConfiguration.getAuthProviderFactory();
AuthorizationProvider authorizationProvider = authorizationProviderFactory.connect(authorizationProviderConfiguration.getCredentials());
AuthorizationProvider authorizationProvider = containerContext.configuration().authorizationProvider();
return authorizationProvider;
}

View File

@ -236,7 +236,7 @@ public class EServiceManager {
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
softwareFacet.setDescription(applicationConfiguration.description());
softwareFacet.setGroup(applicationConfiguration.group());
softwareFacet.setGroup(applicationConfiguration.serviceClass());
softwareFacet.setName(applicationConfiguration.name());
softwareFacet.setVersion(applicationConfiguration.version());

View File

@ -74,13 +74,13 @@ import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNo
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasPersistentMemory;
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasVolatileMemory;
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
import org.gcube.smartgears.configuration.PersistenceConfiguration;
import org.gcube.smartgears.configuration.SmartgearsConfiguration;
import org.gcube.smartgears.configuration.container.ContainerConfiguration;
import org.gcube.smartgears.configuration.container.Site;
import org.gcube.smartgears.configuration.library.SmartGearsConfiguration;
import org.gcube.smartgears.connector.resourceregistry.ContextUtility;
import org.gcube.smartgears.connector.resourceregistry.FacetBasedPublisher;
import org.gcube.smartgears.context.container.ContainerContext;
import org.gcube.smartgears.persistence.PersistenceWriter;
import org.gcube.smartgears.provider.ProviderFactory;
import org.gcube.smartgears.security.AuthorizationProvider;
import org.slf4j.Logger;
@ -321,11 +321,11 @@ public class HostingNodeManager {
hostingNode.addFacet(osSoftwareFacet);
SmartgearsConfiguration config = ProviderFactory.provider().smartgearsConfiguration();
SmartGearsConfiguration config = ProviderFactory.provider().smartgearsConfiguration();
SoftwareFacet smartgearsSoftwareFacet = new SoftwareFacetImpl();
smartgearsSoftwareFacet.setGroup("gCube");
smartgearsSoftwareFacet.setName("SmartGears");
smartgearsSoftwareFacet.setVersion(config.getVersion());
smartgearsSoftwareFacet.setVersion(config.version());
hostingNode.addFacet(smartgearsSoftwareFacet);
SoftwareFacet smartgearsDistributionSoftwareFacet = new SoftwareFacetImpl();
@ -435,9 +435,10 @@ public class HostingNodeManager {
long free = 0;
long total = 0;
try {
PersistenceConfiguration persistenceConfiguration = containerContext.configuration().persistenceConfiguration();
PersistenceWriter persistenceWriter = containerContext.configuration().persistence();
FileStore fileStore = Files
.getFileStore(Paths.get(persistenceConfiguration.getImplementationClass().newInstance().getLocation()));
.getFileStore(Paths.get(persistenceWriter.getLocation()));
// persistenceWriter.getFreeSpace();
free = fileStore.getUsableSpace() / 1048576; // 1048576 = 1024*1024
// user to convert
// bytes in MByte