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

View File

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