From 3f38f09dc31e0bd591f93f9d9d570fad2a2c6eaf Mon Sep 17 00:00:00 2001 From: Enrico Vianello Date: Mon, 31 Jan 2022 09:59:45 +0100 Subject: [PATCH] WIP Info endpoints refactoring --- pom.xml | 1 + .../it/grid/storm/config/Configuration.java | 166 +++++---- .../storm/config/ConfigurationDefaults.java | 5 + .../model/v2/AdvancedDirectorySettings.java | 22 +- .../config/model/v2/AdvancedFileSettings.java | 44 ++- .../storm/config/model/v2/BolScheduler.java | 30 +- .../model/v2/CompletedRequestsAgent.java | 50 ++- .../config/model/v2/DatabaseConnection.java | 61 +++- .../model/v2/DatabasePoolProperties.java | 50 ++- .../config/model/v2/DiskUsageService.java | 40 +- .../grid/storm/config/model/v2/Endpoint.java | 28 +- .../config/model/v2/ExpiredSpacesAgent.java | 20 +- .../config/model/v2/ExtraslashesSettings.java | 40 +- .../config/model/v2/HearthbeatSettings.java | 50 ++- .../model/v2/InProgressRequestsAgent.java | 30 +- .../config/model/v2/PinlifetimeSettings.java | 20 +- .../storm/config/model/v2/PtgScheduler.java | 31 +- .../storm/config/model/v2/PtpScheduler.java | 29 +- .../storm/config/model/v2/QualityLevel.java | 9 + .../config/model/v2/RequestsPickerAgent.java | 32 +- .../config/model/v2/RequestsScheduler.java | 30 +- .../storm/config/model/v2/RestServer.java | 23 +- .../config/model/v2/SecuritySettings.java | 21 +- .../it/grid/storm/config/model/v2/Site.java | 38 ++ .../config/model/v2/StormProperties.java | 293 +++++++++++++-- .../config/model/v2/SynchLsSettings.java | 40 +- .../storm/config/model/v2/XmlRpcServer.java | 21 +- .../config/xml/XMLNamespaceParser.java | 10 +- .../storm/namespace/model/AccessLatency.java | 50 +-- .../grid/storm/namespace/model/Property.java | 13 +- .../namespace/model/RetentionPolicy.java | 49 +-- .../namespace/model/StorageClassType.java | 52 +-- .../grid/storm/namespace/model/VirtualFS.java | 10 - .../storm/namespace/remote/Constants.java | 36 -- .../TransferProtocolListConverter.java | 3 +- .../persistence/model/PtGChunkDataTO.java | 4 +- .../java/it/grid/storm/rest/RestServer.java | 6 +- .../rest/info/endpoint/EndpointResource.java | 60 +++ .../info/endpoint/model/EndpointInfo.java | 54 +++ .../storageareas/StorageAreasResource.java} | 15 +- .../info/storageareas/model/HttpPerms.java | 5 + .../info/storageareas}/model/SAInfo.java | 42 ++- .../config/ConfigurationConverterTest.java | 172 ++++----- .../config/model/StormPropertiesTest.java | 345 ++++++++++-------- .../storm/namespace/model/SAInfoTest.java | 11 +- src/test/resources/storm.properties | 3 + 46 files changed, 1486 insertions(+), 678 deletions(-) create mode 100644 src/main/java/it/grid/storm/config/model/v2/QualityLevel.java create mode 100644 src/main/java/it/grid/storm/config/model/v2/Site.java delete mode 100644 src/main/java/it/grid/storm/namespace/remote/Constants.java create mode 100644 src/main/java/it/grid/storm/rest/info/endpoint/EndpointResource.java create mode 100644 src/main/java/it/grid/storm/rest/info/endpoint/model/EndpointInfo.java rename src/main/java/it/grid/storm/{namespace/remote/resource/VirtualFSResource.java => rest/info/storageareas/StorageAreasResource.java} (70%) create mode 100644 src/main/java/it/grid/storm/rest/info/storageareas/model/HttpPerms.java rename src/main/java/it/grid/storm/{namespace => rest/info/storageareas}/model/SAInfo.java (79%) diff --git a/pom.xml b/pom.xml index 9e01e7b92..46161527f 100644 --- a/pom.xml +++ b/pom.xml @@ -126,6 +126,7 @@ true + true diff --git a/src/main/java/it/grid/storm/config/Configuration.java b/src/main/java/it/grid/storm/config/Configuration.java index bc63f2d46..54afb8f59 100644 --- a/src/main/java/it/grid/storm/config/Configuration.java +++ b/src/main/java/it/grid/storm/config/Configuration.java @@ -33,6 +33,7 @@ import it.grid.storm.config.converter.StormPropertiesConversionException; import it.grid.storm.config.converter.StormPropertiesConverter; import it.grid.storm.config.model.v2.OverwriteMode; +import it.grid.storm.config.model.v2.QualityLevel; import it.grid.storm.config.model.v2.StorageType; import it.grid.storm.config.model.v2.StormProperties; import it.grid.storm.namespace.model.Authority; @@ -95,7 +96,7 @@ public synchronized static Configuration getInstance() { public String getVersion() { - return properties.version; + return properties.getVersion(); } public File getConfigurationDir() { @@ -113,8 +114,8 @@ public String getSrmServiceHostname() { public List getManagedSrmEndpoints() { - return properties.srmEndpoints.stream() - .map(e -> new Authority(e.host, e.port)) + return properties.getSrmEndpoints().stream() + .map(e -> new Authority(e.getHost(), e.getPort())) .collect(Collectors.toList()); } @@ -131,7 +132,7 @@ public int getSrmServicePort() { */ public String getDbHostname() { - return properties.db.hostname; + return properties.getDb().getHostname(); } /** @@ -139,7 +140,7 @@ public String getDbHostname() { */ public int getDbPort() { - return properties.db.port; + return properties.getDb().getPort(); } /** @@ -147,7 +148,7 @@ public int getDbPort() { */ public String getDbUsername() { - return properties.db.username; + return properties.getDb().getUsername(); } /** @@ -155,7 +156,7 @@ public String getDbUsername() { */ public String getDbPassword() { - return properties.db.password; + return properties.getDb().getPassword(); } /** @@ -163,7 +164,7 @@ public String getDbPassword() { */ public String getDbProperties() { - return properties.db.properties; + return properties.getDb().getProperties(); } /** @@ -172,7 +173,7 @@ public String getDbProperties() { */ public int getDbPoolSize() { - return properties.db.pool.size; + return properties.getDb().getPool().getSize(); } /** @@ -180,7 +181,7 @@ public int getDbPoolSize() { */ public int getDbPoolMinIdle() { - return properties.db.pool.minIdle; + return properties.getDb().getPool().getMinIdle(); } /** @@ -188,7 +189,7 @@ public int getDbPoolMinIdle() { */ public int getDbPoolMaxWaitMillis() { - return properties.db.pool.maxWaitMillis; + return properties.getDb().getPool().getMaxWaitMillis(); } /** @@ -197,7 +198,7 @@ public int getDbPoolMaxWaitMillis() { */ public boolean isDbPoolTestOnBorrow() { - return properties.db.pool.testOnBorrow; + return properties.getDb().getPool().isTestOnBorrow(); } /** @@ -205,7 +206,7 @@ public boolean isDbPoolTestOnBorrow() { */ public boolean isDbPoolTestWhileIdle() { - return properties.db.pool.testWhileIdle; + return properties.getDb().getPool().isTestWhileIdle(); } /** @@ -213,22 +214,22 @@ public boolean isDbPoolTestWhileIdle() { */ public int getRestServicesPort() { - return properties.rest.port; + return properties.getRest().getPort(); } public int getRestServicesMaxThreads() { - return properties.rest.maxThreads; + return properties.getRest().getMaxThreads(); } public int getRestServicesMaxQueueSize() { - return properties.rest.maxQueueSize; + return properties.getRest().getMaxQueueSize(); } public boolean isSanityCheckEnabled() { - return properties.sanityChecksEnabled; + return properties.isSanityChecksEnabled(); } /** @@ -236,47 +237,47 @@ public boolean isSanityCheckEnabled() { */ public int getXmlrpcMaxThreads() { - return properties.xmlrpc.maxThreads; + return properties.getXmlrpc().getMaxThreads(); } public int getXmlrpcMaxQueueSize() { - return properties.xmlrpc.maxQueueSize; + return properties.getXmlrpc().getMaxQueueSize(); } public int getXmlRpcServerPort() { - return properties.xmlrpc.port; + return properties.getXmlrpc().getPort(); } public Boolean isSecurityEnabled() { - return properties.security.enabled; + return properties.getSecurity().isEnabled(); } public String getSecurityToken() { - return properties.security.token; + return properties.getSecurity().getToken(); } public boolean isDiskUsageServiceEnabled() { - return properties.du.enabled; + return properties.getDu().isEnabled(); } public int getDiskUsageServiceInitialDelay() { - return properties.du.initialDelay; + return properties.getDu().getInitialDelay(); } public long getDiskUsageServiceTasksInterval() { - return properties.du.tasksInterval; + return properties.getDu().getTasksInterval(); } public boolean isDiskUsageServiceTasksParallel() { - return properties.du.parallelTasksEnabled; + return properties.getDu().isParallelTasksEnabled(); } public String getNamespaceConfigFilename() { @@ -299,7 +300,7 @@ public String getNamespaceConfigFilePath() { */ public long getExpiredSpacesAgentInitialDelay() { - return properties.expiredSpacesAgent.delay; + return properties.getExpiredSpacesAgent().getDelay(); } /** @@ -307,12 +308,12 @@ public long getExpiredSpacesAgentInitialDelay() { */ public long getExpiredSpacesAgentInterval() { - return properties.expiredSpacesAgent.interval; + return properties.getExpiredSpacesAgent().getInterval(); } public long getFileDefaultSize() { - return properties.files.defaultSize; + return properties.getFiles().getDefaultSize(); } /** @@ -322,7 +323,7 @@ public long getFileDefaultSize() { */ public long getFileLifetimeDefault() { - return properties.files.defaultLifetime; + return properties.getFiles().getDefaultLifetime(); } /** @@ -333,7 +334,7 @@ public long getFileLifetimeDefault() { */ public long getPinLifetimeDefault() { - return properties.pinlifetime.defaultValue; + return properties.getPinlifetime().getDefaultValue(); } /** @@ -342,7 +343,7 @@ public long getPinLifetimeDefault() { */ public long getPinLifetimeMaximum() { - return properties.pinlifetime.maximum; + return properties.getPinlifetime().getMaximum(); } /** @@ -351,7 +352,7 @@ public long getPinLifetimeMaximum() { */ public long getInProgressAgentInitialDelay() { - return properties.inprogressRequestsAgent.delay; + return properties.getInprogressRequestsAgent().getDelay(); } /** @@ -359,7 +360,7 @@ public long getInProgressAgentInitialDelay() { */ public long getInProgressAgentInterval() { - return properties.inprogressRequestsAgent.interval; + return properties.getInprogressRequestsAgent().getInterval(); } /** @@ -368,7 +369,7 @@ public long getInProgressAgentInterval() { */ public long getRequestsPickerAgentInitialDelay() { - return properties.requestsPickerAgent.delay; + return properties.getRequestsPickerAgent().getDelay(); } /** @@ -376,7 +377,7 @@ public long getRequestsPickerAgentInitialDelay() { */ public long getRequestsPickerAgentInterval() { - return properties.requestsPickerAgent.interval; + return properties.getRequestsPickerAgent().getInterval(); } /** @@ -385,7 +386,7 @@ public long getRequestsPickerAgentInterval() { */ public int getRequestsPickerAgentMaxFetchedSize() { - return properties.requestsPickerAgent.maxFetchedSize; + return properties.getRequestsPickerAgent().getMaxFetchedSize(); } /** @@ -394,7 +395,7 @@ public int getRequestsPickerAgentMaxFetchedSize() { */ public int getLsMaxNumberOfEntry() { - return properties.synchLs.maxEntries; + return properties.getSynchLs().getMaxEntries(); } /** @@ -402,7 +403,7 @@ public int getLsMaxNumberOfEntry() { */ public boolean isLsDefaultAllLevelRecursive() { - return properties.synchLs.defaultAllLevelRecursive; + return properties.getSynchLs().isDefaultAllLevelRecursive(); } /** @@ -410,7 +411,7 @@ public boolean isLsDefaultAllLevelRecursive() { */ public short getLsDefaultNumOfLevels() { - return properties.synchLs.defaultNumLevels; + return properties.getSynchLs().getDefaultNumLevels(); } /** @@ -418,7 +419,7 @@ public short getLsDefaultNumOfLevels() { */ public short getLsDefaultOffset() { - return properties.synchLs.defaultOffset; + return properties.getSynchLs().getDefaultOffset(); } /** @@ -434,7 +435,7 @@ public short getLsDefaultOffset() { */ public int getPtPCorePoolSize() { - return properties.ptpScheduler.corePoolSize; + return properties.getPtpScheduler().getCorePoolSize(); } /** @@ -450,7 +451,7 @@ public int getPtPCorePoolSize() { */ public int getPtPMaxPoolSize() { - return properties.ptpScheduler.maxPoolSize; + return properties.getPtpScheduler().getMaxPoolSize(); } /** @@ -467,7 +468,7 @@ public int getPtPMaxPoolSize() { */ public int getPtPQueueSize() { - return properties.ptpScheduler.queueSize; + return properties.getPtpScheduler().getQueueSize(); } /** @@ -484,7 +485,7 @@ public int getPtPQueueSize() { */ public int getPtGCorePoolSize() { - return properties.ptgScheduler.corePoolSize; + return properties.getPtgScheduler().getCorePoolSize(); } /** @@ -501,7 +502,7 @@ public int getPtGCorePoolSize() { */ public int getPtGMaxPoolSize() { - return properties.ptgScheduler.maxPoolSize; + return properties.getPtgScheduler().getMaxPoolSize(); } /** @@ -518,7 +519,7 @@ public int getPtGMaxPoolSize() { */ public int getPtGQueueSize() { - return properties.ptgScheduler.queueSize; + return properties.getPtgScheduler().getQueueSize(); } /** @@ -535,7 +536,7 @@ public int getPtGQueueSize() { */ public int getBoLCorePoolSize() { - return properties.bolScheduler.corePoolSize; + return properties.getBolScheduler().getCorePoolSize(); } /** @@ -552,7 +553,7 @@ public int getBoLCorePoolSize() { */ public int getBoLMaxPoolSize() { - return properties.bolScheduler.maxPoolSize; + return properties.getBolScheduler().getMaxPoolSize(); } /** @@ -569,7 +570,7 @@ public int getBoLMaxPoolSize() { */ public int getBoLQueueSize() { - return properties.bolScheduler.queueSize; + return properties.getBolScheduler().getQueueSize(); } /** @@ -586,7 +587,7 @@ public int getBoLQueueSize() { */ public int getCorePoolSize() { - return properties.requestsScheduler.corePoolSize; + return properties.getRequestsScheduler().getCorePoolSize(); } /** @@ -602,7 +603,7 @@ public int getCorePoolSize() { */ public int getMaxPoolSize() { - return properties.requestsScheduler.maxPoolSize; + return properties.getRequestsScheduler().getMaxPoolSize(); } /** @@ -619,7 +620,7 @@ public int getMaxPoolSize() { */ public int getQueueSize() { - return properties.requestsScheduler.queueSize; + return properties.getRequestsScheduler().getQueueSize(); } /** @@ -628,7 +629,7 @@ public int getQueueSize() { */ public boolean isAutomaticDirectoryCreationEnabled() { - return properties.directories.enableAutomaticCreation; + return properties.getDirectories().isEnableAutomaticCreation(); } /** @@ -638,7 +639,7 @@ public boolean isAutomaticDirectoryCreationEnabled() { */ public boolean isDirectoryWritePermOnCreationEnabled() { - return properties.directories.enableWritepermOnCreation; + return properties.getDirectories().isEnableWritepermOnCreation(); } /** @@ -646,7 +647,7 @@ public boolean isDirectoryWritePermOnCreationEnabled() { */ public OverwriteMode getDefaultOverwriteMode() { - return OverwriteMode.valueOf(properties.files.defaultOverwrite); + return OverwriteMode.valueOf(properties.getFiles().getDefaultOverwrite()); } /** @@ -654,7 +655,7 @@ public OverwriteMode getDefaultOverwriteMode() { */ public StorageType getDefaultFileStorageType() { - return StorageType.valueOf(properties.files.defaultStoragetype); + return StorageType.valueOf(properties.getFiles().getDefaultStoragetype()); } /** @@ -662,7 +663,7 @@ public StorageType getDefaultFileStorageType() { */ public int getCompletedRequestsAgentPurgeSize() { - return properties.completedRequestsAgent.purgeSize; + return properties.getCompletedRequestsAgent().getPurgeSize(); } /** @@ -672,7 +673,7 @@ public int getCompletedRequestsAgentPurgeSize() { */ public long getCompletedRequestsAgentPurgeAge() { - return properties.completedRequestsAgent.purgeAge; + return properties.getCompletedRequestsAgent().getPurgeAge(); } /** @@ -681,7 +682,7 @@ public long getCompletedRequestsAgentPurgeAge() { */ public int getCompletedRequestsAgentDelay() { - return properties.completedRequestsAgent.delay; + return properties.getCompletedRequestsAgent().getDelay(); } /** @@ -690,7 +691,7 @@ public int getCompletedRequestsAgentDelay() { */ public int getCompletedRequestsAgentPeriod() { - return properties.completedRequestsAgent.interval; + return properties.getCompletedRequestsAgent().getInterval(); } /** @@ -700,12 +701,12 @@ public int getCompletedRequestsAgentPeriod() { */ public boolean isCompletedRequestsAgentEnabled() { - return properties.completedRequestsAgent.enabled; + return properties.getCompletedRequestsAgent().isEnabled(); } public long getInProgressPtpExpirationTime() { - return properties.inprogressRequestsAgent.ptpExpirationTime; + return properties.getInprogressRequestsAgent().getPtpExpirationTime(); } /** @@ -714,7 +715,7 @@ public long getInProgressPtpExpirationTime() { */ public String getExtraSlashesForFileTURL() { - return properties.extraslashes.file; + return properties.getExtraslashes().getFile(); } /** @@ -723,7 +724,7 @@ public String getExtraSlashesForFileTURL() { */ public String getExtraSlashesForRFIOTURL() { - return properties.extraslashes.rfio; + return properties.getExtraslashes().getRfio(); } /** @@ -732,7 +733,7 @@ public String getExtraSlashesForRFIOTURL() { */ public String getExtraSlashesForGsiFTPTURL() { - return properties.extraslashes.gsiftp; + return properties.getExtraslashes().getGsiftp(); } /** @@ -741,7 +742,7 @@ public String getExtraSlashesForGsiFTPTURL() { */ public String getExtraSlashesForRootTURL() { - return properties.extraslashes.root; + return properties.getExtraslashes().getRoot(); } /** @@ -750,37 +751,37 @@ public String getExtraSlashesForRootTURL() { */ public String getPingValuesPropertiesFilename() { - return properties.pingPropertiesFilename; + return properties.getPingPropertiesFilename(); } public int getHearthbeatPeriod() { - return properties.hearthbeat.period; + return properties.getHearthbeat().getPeriod(); } public int getHearthbeatPerformanceGlanceTimeInterval() { - return properties.hearthbeat.performanceGlanceTimeInterval; + return properties.getHearthbeat().getPerformanceGlanceTimeInterval(); } public int getHearthbeatPerformanceLogbookTimeInterval() { - return properties.hearthbeat.performanceLogbookTimeInterval; + return properties.getHearthbeat().getPerformanceLogbookTimeInterval(); } public boolean isHearthbeatPerformanceMeasuringEnabled() { - return properties.hearthbeat.performanceMeasuringEnabled; + return properties.getHearthbeat().isPerformanceMeasuringEnabled(); } public boolean isHearthbeatBookkeepingEnabled() { - return properties.hearthbeat.bookkeepingEnabled; + return properties.getHearthbeat().isBookkeepingEnabled(); } public int getMaxLoop() { - return properties.abortMaxloop; + return properties.getAbortMaxloop(); } public String getGridUserMapperClassname() { @@ -805,22 +806,22 @@ public String getTaskoverKey() { public int getGPFSQuotaRefreshPeriod() { - return properties.infoQuotaRefreshPeriod; + return properties.getInfoQuotaRefreshPeriod(); } public long getServerPoolStatusCheckTimeout() { - return properties.serverPoolStatusCheckTimeout; + return properties.getServerPoolStatusCheckTimeout(); } public boolean isSkipPtgACLSetup() { - return properties.skipPtgAclSetup; + return properties.isSkipPtgAclSetup(); } public String getHTTPTURLPrefix() { - return properties.httpTurlPrefix; + return properties.getHttpTurlPrefix(); } public int getNetworkAddressCacheTtl() { @@ -833,4 +834,13 @@ public int getNetworkAddressCacheNegativeTtl() { return 0; } + public String getSiteName() { + + return properties.getSite().getName(); + } + + public QualityLevel getQualityLevel() { + + return properties.getSite().getQualityLevel(); + } } diff --git a/src/main/java/it/grid/storm/config/ConfigurationDefaults.java b/src/main/java/it/grid/storm/config/ConfigurationDefaults.java index 58dada362..5fccf087e 100644 --- a/src/main/java/it/grid/storm/config/ConfigurationDefaults.java +++ b/src/main/java/it/grid/storm/config/ConfigurationDefaults.java @@ -1,10 +1,15 @@ package it.grid.storm.config; import it.grid.storm.config.model.v2.OverwriteMode; +import it.grid.storm.config.model.v2.QualityLevel; import it.grid.storm.config.model.v2.StorageType; public class ConfigurationDefaults { + /* Endpoint info */ + public static final String DEFAULT_SITENAME = "StoRM site"; + public static final QualityLevel DEFAULT_QUALITY_LEVEL = QualityLevel.PREPRODUCTION; + /* SRM port for endpoints */ public static final int DEFAULT_SRM_PORT = 8444; diff --git a/src/main/java/it/grid/storm/config/model/v2/AdvancedDirectorySettings.java b/src/main/java/it/grid/storm/config/model/v2/AdvancedDirectorySettings.java index 40dd63854..1cdd7c672 100644 --- a/src/main/java/it/grid/storm/config/model/v2/AdvancedDirectorySettings.java +++ b/src/main/java/it/grid/storm/config/model/v2/AdvancedDirectorySettings.java @@ -9,8 +9,8 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class AdvancedDirectorySettings { - public boolean enableAutomaticCreation; - public boolean enableWritepermOnCreation; + private boolean enableAutomaticCreation; + private boolean enableWritepermOnCreation; public AdvancedDirectorySettings() { enableAutomaticCreation = AUTOMATIC_DIRECTORY_CREATION; @@ -27,5 +27,21 @@ public String toString() { builder.append("]"); return builder.toString(); } - + + public boolean isEnableAutomaticCreation() { + return enableAutomaticCreation; + } + + public void setEnableAutomaticCreation(boolean enableAutomaticCreation) { + this.enableAutomaticCreation = enableAutomaticCreation; + } + + public boolean isEnableWritepermOnCreation() { + return enableWritepermOnCreation; + } + + public void setEnableWritepermOnCreation(boolean enableWritepermOnCreation) { + this.enableWritepermOnCreation = enableWritepermOnCreation; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/AdvancedFileSettings.java b/src/main/java/it/grid/storm/config/model/v2/AdvancedFileSettings.java index 268afe72f..6adff01da 100644 --- a/src/main/java/it/grid/storm/config/model/v2/AdvancedFileSettings.java +++ b/src/main/java/it/grid/storm/config/model/v2/AdvancedFileSettings.java @@ -10,11 +10,11 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class AdvancedFileSettings { - - public long defaultSize; - public long defaultLifetime; - public String defaultOverwrite; - public String defaultStoragetype; + + private long defaultSize; + private long defaultLifetime; + private String defaultOverwrite; + private String defaultStoragetype; public AdvancedFileSettings() { defaultSize = FILE_DEFAULT_SIZE; @@ -37,5 +37,37 @@ public String toString() { builder.append("]"); return builder.toString(); } - + + public long getDefaultSize() { + return defaultSize; + } + + public void setDefaultSize(long defaultSize) { + this.defaultSize = defaultSize; + } + + public long getDefaultLifetime() { + return defaultLifetime; + } + + public void setDefaultLifetime(long defaultLifetime) { + this.defaultLifetime = defaultLifetime; + } + + public String getDefaultOverwrite() { + return defaultOverwrite; + } + + public void setDefaultOverwrite(String defaultOverwrite) { + this.defaultOverwrite = defaultOverwrite; + } + + public String getDefaultStoragetype() { + return defaultStoragetype; + } + + public void setDefaultStoragetype(String defaultStoragetype) { + this.defaultStoragetype = defaultStoragetype; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/BolScheduler.java b/src/main/java/it/grid/storm/config/model/v2/BolScheduler.java index 110f89937..e9e48aea4 100644 --- a/src/main/java/it/grid/storm/config/model/v2/BolScheduler.java +++ b/src/main/java/it/grid/storm/config/model/v2/BolScheduler.java @@ -10,9 +10,9 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class BolScheduler { - public int corePoolSize; - public int maxPoolSize; - public int queueSize; + private int corePoolSize; + private int maxPoolSize; + private int queueSize; public BolScheduler() { corePoolSize = BOL_SCHEDULER_CORE_POOL_SIZE; @@ -33,4 +33,28 @@ public String toString() { return builder.toString(); } + public int getCorePoolSize() { + return corePoolSize; + } + + public void setCorePoolSize(int corePoolSize) { + this.corePoolSize = corePoolSize; + } + + public int getMaxPoolSize() { + return maxPoolSize; + } + + public void setMaxPoolSize(int maxPoolSize) { + this.maxPoolSize = maxPoolSize; + } + + public int getQueueSize() { + return queueSize; + } + + public void setQueueSize(int queueSize) { + this.queueSize = queueSize; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/CompletedRequestsAgent.java b/src/main/java/it/grid/storm/config/model/v2/CompletedRequestsAgent.java index 0b9f75ba7..6def87f33 100644 --- a/src/main/java/it/grid/storm/config/model/v2/CompletedRequestsAgent.java +++ b/src/main/java/it/grid/storm/config/model/v2/CompletedRequestsAgent.java @@ -12,11 +12,11 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class CompletedRequestsAgent { - public boolean enabled; - public int delay; - public int interval; - public long purgeAge; - public int purgeSize; + private boolean enabled; + private int delay; + private int interval; + private long purgeAge; + private int purgeSize; public CompletedRequestsAgent() { enabled = COMPLETED_REQUESTS_AGENT_ENABLED; @@ -43,4 +43,44 @@ public String toString() { return builder.toString(); } + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public int getDelay() { + return delay; + } + + public void setDelay(int delay) { + this.delay = delay; + } + + public int getInterval() { + return interval; + } + + public void setInterval(int interval) { + this.interval = interval; + } + + public long getPurgeAge() { + return purgeAge; + } + + public void setPurgeAge(long purgeAge) { + this.purgeAge = purgeAge; + } + + public int getPurgeSize() { + return purgeSize; + } + + public void setPurgeSize(int purgeSize) { + this.purgeSize = purgeSize; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/DatabaseConnection.java b/src/main/java/it/grid/storm/config/model/v2/DatabaseConnection.java index f0a6ea95b..31d46a6d8 100644 --- a/src/main/java/it/grid/storm/config/model/v2/DatabaseConnection.java +++ b/src/main/java/it/grid/storm/config/model/v2/DatabaseConnection.java @@ -14,13 +14,13 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class DatabaseConnection { - public String username; - public String password; - public String hostname; - public int port; - public String properties; + private String username; + private String password; + private String hostname; + private int port; + private String properties; - public DatabasePoolProperties pool; + private DatabasePoolProperties pool; public DatabaseConnection() throws UnknownHostException { username = DB_USERNAME; @@ -49,4 +49,53 @@ public String toString() { builder.append("]"); return builder.toString(); } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getHostname() { + return hostname; + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } + + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } + + public String getProperties() { + return properties; + } + + public void setProperties(String properties) { + this.properties = properties; + } + + public DatabasePoolProperties getPool() { + return pool; + } + + public void setPool(DatabasePoolProperties pool) { + this.pool = pool; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/DatabasePoolProperties.java b/src/main/java/it/grid/storm/config/model/v2/DatabasePoolProperties.java index 37dc43776..2fea815cd 100644 --- a/src/main/java/it/grid/storm/config/model/v2/DatabasePoolProperties.java +++ b/src/main/java/it/grid/storm/config/model/v2/DatabasePoolProperties.java @@ -12,11 +12,11 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class DatabasePoolProperties { - public int size; - public int minIdle; - public int maxWaitMillis; - public boolean testOnBorrow; - public boolean testWhileIdle; + private int size; + private int minIdle; + private int maxWaitMillis; + private boolean testOnBorrow; + private boolean testWhileIdle; public DatabasePoolProperties() { size = DB_POOL_SIZE; @@ -43,4 +43,44 @@ public String toString() { return builder.toString(); } + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public int getMinIdle() { + return minIdle; + } + + public void setMinIdle(int minIdle) { + this.minIdle = minIdle; + } + + public int getMaxWaitMillis() { + return maxWaitMillis; + } + + public void setMaxWaitMillis(int maxWaitMillis) { + this.maxWaitMillis = maxWaitMillis; + } + + public boolean isTestOnBorrow() { + return testOnBorrow; + } + + public void setTestOnBorrow(boolean testOnBorrow) { + this.testOnBorrow = testOnBorrow; + } + + public boolean isTestWhileIdle() { + return testWhileIdle; + } + + public void setTestWhileIdle(boolean testWhileIdle) { + this.testWhileIdle = testWhileIdle; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/DiskUsageService.java b/src/main/java/it/grid/storm/config/model/v2/DiskUsageService.java index 74d0bf965..f2dbd7c32 100644 --- a/src/main/java/it/grid/storm/config/model/v2/DiskUsageService.java +++ b/src/main/java/it/grid/storm/config/model/v2/DiskUsageService.java @@ -11,10 +11,10 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class DiskUsageService { - public boolean enabled; - public boolean parallelTasksEnabled; - public int initialDelay; - public long tasksInterval; + private boolean enabled; + private boolean parallelTasksEnabled; + private int initialDelay; + private long tasksInterval; public DiskUsageService() { enabled = DISKUSAGE_SERVICE_ENABLED; @@ -38,4 +38,36 @@ public String toString() { return builder.toString(); } + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public boolean isParallelTasksEnabled() { + return parallelTasksEnabled; + } + + public void setParallelTasksEnabled(boolean parallelTasksEnabled) { + this.parallelTasksEnabled = parallelTasksEnabled; + } + + public int getInitialDelay() { + return initialDelay; + } + + public void setInitialDelay(int initialDelay) { + this.initialDelay = initialDelay; + } + + public long getTasksInterval() { + return tasksInterval; + } + + public void setTasksInterval(long tasksInterval) { + this.tasksInterval = tasksInterval; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/Endpoint.java b/src/main/java/it/grid/storm/config/model/v2/Endpoint.java index 381f2b316..e4ce65b83 100644 --- a/src/main/java/it/grid/storm/config/model/v2/Endpoint.java +++ b/src/main/java/it/grid/storm/config/model/v2/Endpoint.java @@ -2,8 +2,6 @@ import static it.grid.storm.config.ConfigurationDefaults.DEFAULT_SRM_PORT; -import java.net.InetAddress; -import java.net.UnknownHostException; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonCreator; @@ -14,8 +12,8 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class Endpoint { - public String host; - public int port; + private String host; + private int port; @JsonCreator public Endpoint(@JsonProperty(value = "host", required = true) String host) { @@ -23,12 +21,6 @@ public Endpoint(@JsonProperty(value = "host", required = true) String host) { port = DEFAULT_SRM_PORT; } - public static Endpoint DEFAULT() throws UnknownHostException { - Endpoint e = new Endpoint(InetAddress.getLocalHost().getHostName()); - e.port = DEFAULT_SRM_PORT; - return e; - } - @Override public int hashCode() { return Objects.hash(host, port); @@ -57,4 +49,20 @@ public String toString() { return builder.toString(); } + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/ExpiredSpacesAgent.java b/src/main/java/it/grid/storm/config/model/v2/ExpiredSpacesAgent.java index 3e42adefb..f641eae21 100644 --- a/src/main/java/it/grid/storm/config/model/v2/ExpiredSpacesAgent.java +++ b/src/main/java/it/grid/storm/config/model/v2/ExpiredSpacesAgent.java @@ -9,8 +9,8 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class ExpiredSpacesAgent { - public int delay; - public int interval; + private int delay; + private int interval; public ExpiredSpacesAgent() { delay = EXPIRED_SPACES_AGENT_DELAY; @@ -28,4 +28,20 @@ public String toString() { return builder.toString(); } + public int getDelay() { + return delay; + } + + public void setDelay(int delay) { + this.delay = delay; + } + + public int getInterval() { + return interval; + } + + public void setInterval(int interval) { + this.interval = interval; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/ExtraslashesSettings.java b/src/main/java/it/grid/storm/config/model/v2/ExtraslashesSettings.java index 011166f4c..a5c22933a 100644 --- a/src/main/java/it/grid/storm/config/model/v2/ExtraslashesSettings.java +++ b/src/main/java/it/grid/storm/config/model/v2/ExtraslashesSettings.java @@ -11,10 +11,10 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class ExtraslashesSettings { - public String file; - public String rfio; - public String root; - public String gsiftp; + private String file; + private String rfio; + private String root; + private String gsiftp; public ExtraslashesSettings() { file = EXTRA_SLASHES_FOR_FILE_TURL; @@ -38,4 +38,36 @@ public String toString() { return builder.toString(); } + public String getFile() { + return file; + } + + public void setFile(String file) { + this.file = file; + } + + public String getRfio() { + return rfio; + } + + public void setRfio(String rfio) { + this.rfio = rfio; + } + + public String getRoot() { + return root; + } + + public void setRoot(String root) { + this.root = root; + } + + public String getGsiftp() { + return gsiftp; + } + + public void setGsiftp(String gsiftp) { + this.gsiftp = gsiftp; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/HearthbeatSettings.java b/src/main/java/it/grid/storm/config/model/v2/HearthbeatSettings.java index 1edf60375..363646709 100644 --- a/src/main/java/it/grid/storm/config/model/v2/HearthbeatSettings.java +++ b/src/main/java/it/grid/storm/config/model/v2/HearthbeatSettings.java @@ -12,11 +12,11 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class HearthbeatSettings { - public boolean bookkeepingEnabled; - public boolean performanceMeasuringEnabled; - public int period; - public int performanceLogbookTimeInterval; - public int performanceGlanceTimeInterval; + private boolean bookkeepingEnabled; + private boolean performanceMeasuringEnabled; + private int period; + private int performanceLogbookTimeInterval; + private int performanceGlanceTimeInterval; public HearthbeatSettings() { bookkeepingEnabled = BOOK_KEEPING_ENABLED; @@ -43,4 +43,44 @@ public String toString() { return builder.toString(); } + public boolean isBookkeepingEnabled() { + return bookkeepingEnabled; + } + + public void setBookkeepingEnabled(boolean bookkeepingEnabled) { + this.bookkeepingEnabled = bookkeepingEnabled; + } + + public boolean isPerformanceMeasuringEnabled() { + return performanceMeasuringEnabled; + } + + public void setPerformanceMeasuringEnabled(boolean performanceMeasuringEnabled) { + this.performanceMeasuringEnabled = performanceMeasuringEnabled; + } + + public int getPeriod() { + return period; + } + + public void setPeriod(int period) { + this.period = period; + } + + public int getPerformanceLogbookTimeInterval() { + return performanceLogbookTimeInterval; + } + + public void setPerformanceLogbookTimeInterval(int performanceLogbookTimeInterval) { + this.performanceLogbookTimeInterval = performanceLogbookTimeInterval; + } + + public int getPerformanceGlanceTimeInterval() { + return performanceGlanceTimeInterval; + } + + public void setPerformanceGlanceTimeInterval(int performanceGlanceTimeInterval) { + this.performanceGlanceTimeInterval = performanceGlanceTimeInterval; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/InProgressRequestsAgent.java b/src/main/java/it/grid/storm/config/model/v2/InProgressRequestsAgent.java index 4fab29518..ce042b250 100644 --- a/src/main/java/it/grid/storm/config/model/v2/InProgressRequestsAgent.java +++ b/src/main/java/it/grid/storm/config/model/v2/InProgressRequestsAgent.java @@ -10,9 +10,9 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class InProgressRequestsAgent { - public int delay; - public int interval; - public long ptpExpirationTime; + private int delay; + private int interval; + private long ptpExpirationTime; public InProgressRequestsAgent() { delay = INPROGRESS_REQUESTS_AGENT_DELAY; @@ -33,4 +33,28 @@ public String toString() { return builder.toString(); } + public int getDelay() { + return delay; + } + + public void setDelay(int delay) { + this.delay = delay; + } + + public int getInterval() { + return interval; + } + + public void setInterval(int interval) { + this.interval = interval; + } + + public long getPtpExpirationTime() { + return ptpExpirationTime; + } + + public void setPtpExpirationTime(long ptpExpirationTime) { + this.ptpExpirationTime = ptpExpirationTime; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/PinlifetimeSettings.java b/src/main/java/it/grid/storm/config/model/v2/PinlifetimeSettings.java index b3217bef8..588ac76da 100644 --- a/src/main/java/it/grid/storm/config/model/v2/PinlifetimeSettings.java +++ b/src/main/java/it/grid/storm/config/model/v2/PinlifetimeSettings.java @@ -11,8 +11,8 @@ public class PinlifetimeSettings { @JsonProperty("default") - public long defaultValue; - public long maximum; + private long defaultValue; + private long maximum; public PinlifetimeSettings() { defaultValue = PIN_LIFETIME_DEFAULT; @@ -30,4 +30,20 @@ public String toString() { return builder.toString(); } + public long getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(long defaultValue) { + this.defaultValue = defaultValue; + } + + public long getMaximum() { + return maximum; + } + + public void setMaximum(long maximum) { + this.maximum = maximum; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/PtgScheduler.java b/src/main/java/it/grid/storm/config/model/v2/PtgScheduler.java index 7bf9e10f4..8015145f8 100644 --- a/src/main/java/it/grid/storm/config/model/v2/PtgScheduler.java +++ b/src/main/java/it/grid/storm/config/model/v2/PtgScheduler.java @@ -10,9 +10,9 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class PtgScheduler { - public int corePoolSize; - public int maxPoolSize; - public int queueSize; + private int corePoolSize; + private int maxPoolSize; + private int queueSize; public PtgScheduler() { corePoolSize = PTG_SCHEDULER_CORE_POOL_SIZE; @@ -32,4 +32,29 @@ public String toString() { builder.append("]"); return builder.toString(); } + + public int getCorePoolSize() { + return corePoolSize; + } + + public void setCorePoolSize(int corePoolSize) { + this.corePoolSize = corePoolSize; + } + + public int getMaxPoolSize() { + return maxPoolSize; + } + + public void setMaxPoolSize(int maxPoolSize) { + this.maxPoolSize = maxPoolSize; + } + + public int getQueueSize() { + return queueSize; + } + + public void setQueueSize(int queueSize) { + this.queueSize = queueSize; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/PtpScheduler.java b/src/main/java/it/grid/storm/config/model/v2/PtpScheduler.java index 930c4f487..8a2738745 100644 --- a/src/main/java/it/grid/storm/config/model/v2/PtpScheduler.java +++ b/src/main/java/it/grid/storm/config/model/v2/PtpScheduler.java @@ -10,9 +10,9 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class PtpScheduler { - public int corePoolSize; - public int maxPoolSize; - public int queueSize; + private int corePoolSize; + private int maxPoolSize; + private int queueSize; public PtpScheduler() { corePoolSize = PTP_SCHEDULER_CORE_POOL_SIZE; @@ -33,4 +33,27 @@ public String toString() { return builder.toString(); } + public int getCorePoolSize() { + return corePoolSize; + } + + public void setCorePoolSize(int corePoolSize) { + this.corePoolSize = corePoolSize; + } + + public int getMaxPoolSize() { + return maxPoolSize; + } + + public void setMaxPoolSize(int maxPoolSize) { + this.maxPoolSize = maxPoolSize; + } + + public int getQueueSize() { + return queueSize; + } + + public void setQueueSize(int queueSize) { + this.queueSize = queueSize; + } } diff --git a/src/main/java/it/grid/storm/config/model/v2/QualityLevel.java b/src/main/java/it/grid/storm/config/model/v2/QualityLevel.java new file mode 100644 index 000000000..bdd24d867 --- /dev/null +++ b/src/main/java/it/grid/storm/config/model/v2/QualityLevel.java @@ -0,0 +1,9 @@ +package it.grid.storm.config.model.v2; + +import com.fasterxml.jackson.annotation.JsonFormat; + +@JsonFormat(shape = JsonFormat.Shape.STRING) +public enum QualityLevel { + + DEVELOPMENT, TESTING, PREPRODUCTION, PRODUCTION; +} diff --git a/src/main/java/it/grid/storm/config/model/v2/RequestsPickerAgent.java b/src/main/java/it/grid/storm/config/model/v2/RequestsPickerAgent.java index 96852589f..26f4dcf8d 100644 --- a/src/main/java/it/grid/storm/config/model/v2/RequestsPickerAgent.java +++ b/src/main/java/it/grid/storm/config/model/v2/RequestsPickerAgent.java @@ -10,9 +10,9 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class RequestsPickerAgent { - public int delay; - public int interval; - public int maxFetchedSize; + private int delay; + private int interval; + private int maxFetchedSize; public RequestsPickerAgent() { delay = REQUESTS_PICKER_AGENT_DELAY; @@ -32,4 +32,30 @@ public String toString() { builder.append("]"); return builder.toString(); } + + public int getDelay() { + return delay; + } + + public void setDelay(int delay) { + this.delay = delay; + } + + public int getInterval() { + return interval; + } + + public void setInterval(int interval) { + this.interval = interval; + } + + public int getMaxFetchedSize() { + return maxFetchedSize; + } + + public void setMaxFetchedSize(int maxFetchedSize) { + this.maxFetchedSize = maxFetchedSize; + } + + } diff --git a/src/main/java/it/grid/storm/config/model/v2/RequestsScheduler.java b/src/main/java/it/grid/storm/config/model/v2/RequestsScheduler.java index 522260650..b32f6e9d3 100644 --- a/src/main/java/it/grid/storm/config/model/v2/RequestsScheduler.java +++ b/src/main/java/it/grid/storm/config/model/v2/RequestsScheduler.java @@ -10,9 +10,9 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class RequestsScheduler { - public int corePoolSize; - public int maxPoolSize; - public int queueSize; + private int corePoolSize; + private int maxPoolSize; + private int queueSize; public RequestsScheduler() { corePoolSize = REQUESTS_SCHEDULER_CORE_POOL_SIZE; @@ -20,4 +20,28 @@ public RequestsScheduler() { queueSize = REQUESTS_SCHEDULER_QUEUE_SIZE; } + public int getCorePoolSize() { + return corePoolSize; + } + + public void setCorePoolSize(int corePoolSize) { + this.corePoolSize = corePoolSize; + } + + public int getMaxPoolSize() { + return maxPoolSize; + } + + public void setMaxPoolSize(int maxPoolSize) { + this.maxPoolSize = maxPoolSize; + } + + public int getQueueSize() { + return queueSize; + } + + public void setQueueSize(int queueSize) { + this.queueSize = queueSize; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/RestServer.java b/src/main/java/it/grid/storm/config/model/v2/RestServer.java index 33afb4af1..7cb4f08ce 100644 --- a/src/main/java/it/grid/storm/config/model/v2/RestServer.java +++ b/src/main/java/it/grid/storm/config/model/v2/RestServer.java @@ -10,9 +10,9 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class RestServer { - public int port; - public int maxThreads; - public int maxQueueSize; + private int port; + private int maxThreads; + private int maxQueueSize; public RestServer() { port = REST_SERVICES_PORT; @@ -28,4 +28,21 @@ public void setMaxQueueSize(int maxQueueSize) { this.maxQueueSize = maxQueueSize > 0 ? maxQueueSize : REST_SERVICES_MAX_QUEUE_SIZE; } + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } + + public int getMaxThreads() { + return maxThreads; + } + + public int getMaxQueueSize() { + return maxQueueSize; + } + + } diff --git a/src/main/java/it/grid/storm/config/model/v2/SecuritySettings.java b/src/main/java/it/grid/storm/config/model/v2/SecuritySettings.java index 1409ecd7e..e9f318000 100644 --- a/src/main/java/it/grid/storm/config/model/v2/SecuritySettings.java +++ b/src/main/java/it/grid/storm/config/model/v2/SecuritySettings.java @@ -9,11 +9,28 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class SecuritySettings { - public boolean enabled; - public String token; + private boolean enabled; + private String token; public SecuritySettings() { enabled = SECURITY_ENABLED; token = SECURITY_TOKEN; } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/Site.java b/src/main/java/it/grid/storm/config/model/v2/Site.java new file mode 100644 index 000000000..1ff232a7e --- /dev/null +++ b/src/main/java/it/grid/storm/config/model/v2/Site.java @@ -0,0 +1,38 @@ +package it.grid.storm.config.model.v2; + +import static it.grid.storm.config.ConfigurationDefaults.DEFAULT_QUALITY_LEVEL; +import static it.grid.storm.config.ConfigurationDefaults.DEFAULT_SITENAME; + +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.annotation.JsonNaming; + +@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) +public class Site { + + private String name; + private QualityLevel qualityLevel; + + public Site() { + + setName(DEFAULT_SITENAME); + setQualityLevel(DEFAULT_QUALITY_LEVEL); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public QualityLevel getQualityLevel() { + return qualityLevel; + } + + public void setQualityLevel(QualityLevel qualityLevel) { + this.qualityLevel = qualityLevel; + } + + +} diff --git a/src/main/java/it/grid/storm/config/model/v2/StormProperties.java b/src/main/java/it/grid/storm/config/model/v2/StormProperties.java index 6f2e76a6b..f46348c00 100644 --- a/src/main/java/it/grid/storm/config/model/v2/StormProperties.java +++ b/src/main/java/it/grid/storm/config/model/v2/StormProperties.java @@ -8,6 +8,7 @@ import static it.grid.storm.config.ConfigurationDefaults.SANITY_CHECK_ENABLED; import static it.grid.storm.config.ConfigurationDefaults.SERVER_POOL_STATUS_CHECK_TIMEOUT; +import java.net.InetAddress; import java.net.UnknownHostException; import java.util.List; @@ -24,40 +25,42 @@ public class StormProperties { public static final String VERSION = "2.0"; public static final String UNRECOGNIZED_VERSION = "unknown"; - public String version; - public List srmEndpoints; - public DatabaseConnection db; - public RestServer rest; - public XmlRpcServer xmlrpc; - public SecuritySettings security; - public DiskUsageService du; - public InProgressRequestsAgent inprogressRequestsAgent; - public ExpiredSpacesAgent expiredSpacesAgent; - public CompletedRequestsAgent completedRequestsAgent; - public RequestsPickerAgent requestsPickerAgent; - public RequestsScheduler requestsScheduler; - public PtpScheduler ptpScheduler; - public PtgScheduler ptgScheduler; - public BolScheduler bolScheduler; - public boolean sanityChecksEnabled; - public ExtraslashesSettings extraslashes; - public SynchLsSettings synchLs; - public PinlifetimeSettings pinlifetime; - public boolean skipPtgAclSetup; - public AdvancedFileSettings files; - public AdvancedDirectorySettings directories; - public HearthbeatSettings hearthbeat; - public int infoQuotaRefreshPeriod; - public String httpTurlPrefix; - public long serverPoolStatusCheckTimeout; - public int abortMaxloop; - public String pingPropertiesFilename; + private String version; + private List srmEndpoints; + private DatabaseConnection db; + private RestServer rest; + private XmlRpcServer xmlrpc; + private SecuritySettings security; + private DiskUsageService du; + private InProgressRequestsAgent inprogressRequestsAgent; + private ExpiredSpacesAgent expiredSpacesAgent; + private CompletedRequestsAgent completedRequestsAgent; + private RequestsPickerAgent requestsPickerAgent; + private RequestsScheduler requestsScheduler; + private PtpScheduler ptpScheduler; + private PtgScheduler ptgScheduler; + private BolScheduler bolScheduler; + private boolean sanityChecksEnabled; + private ExtraslashesSettings extraslashes; + private SynchLsSettings synchLs; + private PinlifetimeSettings pinlifetime; + private boolean skipPtgAclSetup; + private AdvancedFileSettings files; + private AdvancedDirectorySettings directories; + private HearthbeatSettings hearthbeat; + private int infoQuotaRefreshPeriod; + private String httpTurlPrefix; + private long serverPoolStatusCheckTimeout; + private int abortMaxloop; + private String pingPropertiesFilename; + + private Site site; @JsonCreator public StormProperties(@JsonProperty(value = "version", required = true) String version) throws UnknownHostException { this.version = version; - srmEndpoints = Lists.newArrayList(Endpoint.DEFAULT()); + srmEndpoints = Lists.newArrayList(new Endpoint(InetAddress.getLocalHost().getHostName())); db = new DatabaseConnection(); rest = new RestServer(); xmlrpc = new XmlRpcServer(); @@ -84,6 +87,7 @@ public StormProperties(@JsonProperty(value = "version", required = true) String serverPoolStatusCheckTimeout = SERVER_POOL_STATUS_CHECK_TIMEOUT; abortMaxloop = MAX_LOOP; pingPropertiesFilename = PING_VALUES_PROPERTIES_FILENAME; + setSite(new Site()); } @Override @@ -149,5 +153,236 @@ public String toString() { return builder.toString(); } + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public List getSrmEndpoints() { + return srmEndpoints; + } + + public void setSrmEndpoints(List srmEndpoints) { + this.srmEndpoints = srmEndpoints; + } + + public DatabaseConnection getDb() { + return db; + } + + public void setDb(DatabaseConnection db) { + this.db = db; + } + + public RestServer getRest() { + return rest; + } + + public void setRest(RestServer rest) { + this.rest = rest; + } + + public XmlRpcServer getXmlrpc() { + return xmlrpc; + } + + public void setXmlrpc(XmlRpcServer xmlrpc) { + this.xmlrpc = xmlrpc; + } + + public SecuritySettings getSecurity() { + return security; + } + + public void setSecurity(SecuritySettings security) { + this.security = security; + } + + public DiskUsageService getDu() { + return du; + } + + public void setDu(DiskUsageService du) { + this.du = du; + } + + public InProgressRequestsAgent getInprogressRequestsAgent() { + return inprogressRequestsAgent; + } + + public void setInprogressRequestsAgent(InProgressRequestsAgent inprogressRequestsAgent) { + this.inprogressRequestsAgent = inprogressRequestsAgent; + } + + public ExpiredSpacesAgent getExpiredSpacesAgent() { + return expiredSpacesAgent; + } + + public void setExpiredSpacesAgent(ExpiredSpacesAgent expiredSpacesAgent) { + this.expiredSpacesAgent = expiredSpacesAgent; + } + + public CompletedRequestsAgent getCompletedRequestsAgent() { + return completedRequestsAgent; + } + + public void setCompletedRequestsAgent(CompletedRequestsAgent completedRequestsAgent) { + this.completedRequestsAgent = completedRequestsAgent; + } + + public RequestsPickerAgent getRequestsPickerAgent() { + return requestsPickerAgent; + } + + public void setRequestsPickerAgent(RequestsPickerAgent requestsPickerAgent) { + this.requestsPickerAgent = requestsPickerAgent; + } + + public RequestsScheduler getRequestsScheduler() { + return requestsScheduler; + } + + public void setRequestsScheduler(RequestsScheduler requestsScheduler) { + this.requestsScheduler = requestsScheduler; + } + + public PtpScheduler getPtpScheduler() { + return ptpScheduler; + } + + public void setPtpScheduler(PtpScheduler ptpScheduler) { + this.ptpScheduler = ptpScheduler; + } + + public PtgScheduler getPtgScheduler() { + return ptgScheduler; + } + + public void setPtgScheduler(PtgScheduler ptgScheduler) { + this.ptgScheduler = ptgScheduler; + } + + public BolScheduler getBolScheduler() { + return bolScheduler; + } + + public void setBolScheduler(BolScheduler bolScheduler) { + this.bolScheduler = bolScheduler; + } + + public boolean isSanityChecksEnabled() { + return sanityChecksEnabled; + } + + public void setSanityChecksEnabled(boolean sanityChecksEnabled) { + this.sanityChecksEnabled = sanityChecksEnabled; + } + + public ExtraslashesSettings getExtraslashes() { + return extraslashes; + } + + public void setExtraslashes(ExtraslashesSettings extraslashes) { + this.extraslashes = extraslashes; + } + + public SynchLsSettings getSynchLs() { + return synchLs; + } + + public void setSynchLs(SynchLsSettings synchLs) { + this.synchLs = synchLs; + } + + public PinlifetimeSettings getPinlifetime() { + return pinlifetime; + } + + public void setPinlifetime(PinlifetimeSettings pinlifetime) { + this.pinlifetime = pinlifetime; + } + + public boolean isSkipPtgAclSetup() { + return skipPtgAclSetup; + } + + public void setSkipPtgAclSetup(boolean skipPtgAclSetup) { + this.skipPtgAclSetup = skipPtgAclSetup; + } + + public AdvancedFileSettings getFiles() { + return files; + } + + public void setFiles(AdvancedFileSettings files) { + this.files = files; + } + + public AdvancedDirectorySettings getDirectories() { + return directories; + } + + public void setDirectories(AdvancedDirectorySettings directories) { + this.directories = directories; + } + + public HearthbeatSettings getHearthbeat() { + return hearthbeat; + } + + public void setHearthbeat(HearthbeatSettings hearthbeat) { + this.hearthbeat = hearthbeat; + } + + public int getInfoQuotaRefreshPeriod() { + return infoQuotaRefreshPeriod; + } + + public void setInfoQuotaRefreshPeriod(int infoQuotaRefreshPeriod) { + this.infoQuotaRefreshPeriod = infoQuotaRefreshPeriod; + } + + public String getHttpTurlPrefix() { + return httpTurlPrefix; + } + + public void setHttpTurlPrefix(String httpTurlPrefix) { + this.httpTurlPrefix = httpTurlPrefix; + } + + public long getServerPoolStatusCheckTimeout() { + return serverPoolStatusCheckTimeout; + } + + public void setServerPoolStatusCheckTimeout(long serverPoolStatusCheckTimeout) { + this.serverPoolStatusCheckTimeout = serverPoolStatusCheckTimeout; + } + + public int getAbortMaxloop() { + return abortMaxloop; + } + + public void setAbortMaxloop(int abortMaxloop) { + this.abortMaxloop = abortMaxloop; + } + + public String getPingPropertiesFilename() { + return pingPropertiesFilename; + } + + public void setPingPropertiesFilename(String pingPropertiesFilename) { + this.pingPropertiesFilename = pingPropertiesFilename; + } + + public Site getSite() { + return site; + } + + public void setSite(Site site) { + this.site = site; + } } diff --git a/src/main/java/it/grid/storm/config/model/v2/SynchLsSettings.java b/src/main/java/it/grid/storm/config/model/v2/SynchLsSettings.java index cf0d624f6..f72e4073a 100644 --- a/src/main/java/it/grid/storm/config/model/v2/SynchLsSettings.java +++ b/src/main/java/it/grid/storm/config/model/v2/SynchLsSettings.java @@ -11,10 +11,10 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class SynchLsSettings { - public int maxEntries; - public boolean defaultAllLevelRecursive; - public short defaultNumLevels; - public short defaultOffset; + private int maxEntries; + private boolean defaultAllLevelRecursive; + private short defaultNumLevels; + private short defaultOffset; public SynchLsSettings() { maxEntries = LS_MAX_NUMBER_OF_ENTRY; @@ -38,4 +38,36 @@ public String toString() { return builder.toString(); } + public int getMaxEntries() { + return maxEntries; + } + + public void setMaxEntries(int maxEntries) { + this.maxEntries = maxEntries; + } + + public boolean isDefaultAllLevelRecursive() { + return defaultAllLevelRecursive; + } + + public void setDefaultAllLevelRecursive(boolean defaultAllLevelRecursive) { + this.defaultAllLevelRecursive = defaultAllLevelRecursive; + } + + public short getDefaultNumLevels() { + return defaultNumLevels; + } + + public void setDefaultNumLevels(short defaultNumLevels) { + this.defaultNumLevels = defaultNumLevels; + } + + public short getDefaultOffset() { + return defaultOffset; + } + + public void setDefaultOffset(short defaultOffset) { + this.defaultOffset = defaultOffset; + } + } diff --git a/src/main/java/it/grid/storm/config/model/v2/XmlRpcServer.java b/src/main/java/it/grid/storm/config/model/v2/XmlRpcServer.java index 467060f95..f704a5157 100644 --- a/src/main/java/it/grid/storm/config/model/v2/XmlRpcServer.java +++ b/src/main/java/it/grid/storm/config/model/v2/XmlRpcServer.java @@ -10,9 +10,9 @@ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class XmlRpcServer { - public int port; - public int maxThreads; - public int maxQueueSize; + private int port; + private int maxThreads; + private int maxQueueSize; public XmlRpcServer() { port = XMLRPC_SERVER_PORT; @@ -41,4 +41,19 @@ public String toString() { return builder.toString(); } + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } + + public int getMaxThreads() { + return maxThreads; + } + + public int getMaxQueueSize() { + return maxQueueSize; + } } diff --git a/src/main/java/it/grid/storm/namespace/config/xml/XMLNamespaceParser.java b/src/main/java/it/grid/storm/namespace/config/xml/XMLNamespaceParser.java index 3c02aa424..ad57db8e1 100644 --- a/src/main/java/it/grid/storm/namespace/config/xml/XMLNamespaceParser.java +++ b/src/main/java/it/grid/storm/namespace/config/xml/XMLNamespaceParser.java @@ -45,6 +45,7 @@ import it.grid.storm.namespace.config.NamespaceLoader; import it.grid.storm.namespace.config.NamespaceParser; import it.grid.storm.namespace.model.ACLEntry; +import it.grid.storm.namespace.model.AccessLatency; import it.grid.storm.namespace.model.ApproachableRule; import it.grid.storm.namespace.model.Authority; import it.grid.storm.namespace.model.Capability; @@ -53,11 +54,12 @@ import it.grid.storm.namespace.model.PermissionException; import it.grid.storm.namespace.model.PoolMember; import it.grid.storm.namespace.model.Property; -import it.grid.storm.namespace.model.Property.SizeUnitType; import it.grid.storm.namespace.model.Protocol; +import it.grid.storm.namespace.model.Property.SizeUnitType; import it.grid.storm.namespace.model.ProtocolPool; import it.grid.storm.namespace.model.Quota; import it.grid.storm.namespace.model.QuotaType; +import it.grid.storm.namespace.model.RetentionPolicy; import it.grid.storm.namespace.model.SAAuthzType; import it.grid.storm.namespace.model.StorageClassType; import it.grid.storm.namespace.model.SubjectRules; @@ -399,7 +401,7 @@ private void buildVFSs() throws ClassNotFoundException, NamespaceException { vfs.setSpaceTokenDescription(spaceTokenDescription); log.debug("VFS({}).space-token-description = '{}'", name, spaceTokenDescription); - storageClass = StorageClassType.getStorageClassType(parserUtil.getStorageClass(name)); + storageClass = StorageClassType.valueOf(parserUtil.getStorageClass(name)); vfs.setStorageClassType(storageClass); log.debug("VFS({}).storage-class = '{}'", name, storageClass); @@ -446,7 +448,7 @@ private PropertyInterface buildProperties(String fsName) throws NamespaceExcepti Property prop = new Property(); String accessLatency = parserUtil.getAccessLatencyType(fsName); - prop.setAccessLatency(accessLatency); + prop.setAccessLatency(AccessLatency.valueOf(accessLatency)); log.debug("VFS({}).Properties.AccessLatency = '{}'", fsName, accessLatency); String expirationMode = parserUtil.getExpirationModeType(fsName); @@ -454,7 +456,7 @@ private PropertyInterface buildProperties(String fsName) throws NamespaceExcepti log.debug("VFS({}).Properties.ExpirationMode = '{}'", fsName, expirationMode); String retentionPolicy = parserUtil.getRetentionPolicyType(fsName); - prop.setRetentionPolicy(retentionPolicy); + prop.setRetentionPolicy(RetentionPolicy.valueOf(retentionPolicy)); log.debug("VFS({}).Properties.RetentionPolicy = '{}'", fsName, retentionPolicy); String unitType = parserUtil.getNearlineSpaceUnitType(fsName); diff --git a/src/main/java/it/grid/storm/namespace/model/AccessLatency.java b/src/main/java/it/grid/storm/namespace/model/AccessLatency.java index c37b5e18f..1a4b48184 100644 --- a/src/main/java/it/grid/storm/namespace/model/AccessLatency.java +++ b/src/main/java/it/grid/storm/namespace/model/AccessLatency.java @@ -17,53 +17,7 @@ package it.grid.storm.namespace.model; -public class AccessLatency { - - /** - * - **/ - - private String accessLatency; - private String stringSchema; - - public final static AccessLatency ONLINE = new AccessLatency("ONLINE", - "online"); - public final static AccessLatency NEARLINE = new AccessLatency("NEARLINE", - "nearline"); - public final static AccessLatency OFFLINE = new AccessLatency("OFFLINE", - "offline"); - public final static AccessLatency UNKNOWN = new AccessLatency("UNKNOWN", - "Access Latency UNKNOWN!"); - - private AccessLatency(String accessLatency, String stringSchema) { - - this.accessLatency = accessLatency; - this.stringSchema = stringSchema; - } - - // Only get method for Name - public String getAccessLatencyName() { - - return accessLatency; - } - - // Only get method for Schema - public String toString() { - - return this.stringSchema; - } - - public static AccessLatency getAccessLatency(String accessLatency) { - - if (accessLatency.equals(AccessLatency.ONLINE.toString())) - return AccessLatency.ONLINE; - if (accessLatency.equals(AccessLatency.NEARLINE.toString())) - return AccessLatency.NEARLINE; - if (accessLatency.equals(AccessLatency.OFFLINE.toString())) - return AccessLatency.OFFLINE; - return AccessLatency.UNKNOWN; - } +public enum AccessLatency { + online, nearline, offline; } diff --git a/src/main/java/it/grid/storm/namespace/model/Property.java b/src/main/java/it/grid/storm/namespace/model/Property.java index 3260f80e4..8c16cddab 100644 --- a/src/main/java/it/grid/storm/namespace/model/Property.java +++ b/src/main/java/it/grid/storm/namespace/model/Property.java @@ -31,9 +31,9 @@ public class Property implements PropertyInterface { private Logger log = LoggerFactory.getLogger(Property.class); private TSizeInBytes totalOnlineSize = TSizeInBytes.makeEmpty(); private TSizeInBytes totalNearlineSize = TSizeInBytes.makeEmpty(); - private RetentionPolicy retentionPolicy = RetentionPolicy.UNKNOWN; + private RetentionPolicy retentionPolicy; private ExpirationMode expirationMode = ExpirationMode.UNKNOWN; - private AccessLatency accessLatency = AccessLatency.UNKNOWN; + private AccessLatency accessLatency; private boolean hasLimitedSize = false; public static Property from(PropertyInterface other) { @@ -103,15 +103,14 @@ public void setTotalNearlineSize(String unitType, long nearlineSize) } } - public void setRetentionPolicy(String retentionPolicy) - throws NamespaceException { + public void setRetentionPolicy(RetentionPolicy retentionPolicy) { - this.retentionPolicy = RetentionPolicy.getRetentionPolicy(retentionPolicy); + this.retentionPolicy = retentionPolicy; } - public void setAccessLatency(String accessLatency) throws NamespaceException { + public void setAccessLatency(AccessLatency accessLatency) { - this.accessLatency = AccessLatency.getAccessLatency(accessLatency); + this.accessLatency = accessLatency; } public void setExpirationMode(String expirationMode) diff --git a/src/main/java/it/grid/storm/namespace/model/RetentionPolicy.java b/src/main/java/it/grid/storm/namespace/model/RetentionPolicy.java index 38044c9c1..765a5f1c1 100644 --- a/src/main/java/it/grid/storm/namespace/model/RetentionPolicy.java +++ b/src/main/java/it/grid/storm/namespace/model/RetentionPolicy.java @@ -17,52 +17,7 @@ package it.grid.storm.namespace.model; -public class RetentionPolicy { - - /** - * - **/ - private String retentionPolicy; - private String stringSchema; - - public final static RetentionPolicy CUSTODIAL = new RetentionPolicy( - "CUSTODIAL", "custodial"); - public final static RetentionPolicy OUTPUT = new RetentionPolicy("OUTPUT", - "output"); - public final static RetentionPolicy REPLICA = new RetentionPolicy("REPLICA", - "replica"); - public final static RetentionPolicy UNKNOWN = new RetentionPolicy("UNKNOWN", - "Retention policy UNKNOWN!"); - - private RetentionPolicy(String retentionPolicy, String stringSchema) { - - this.retentionPolicy = retentionPolicy; - this.stringSchema = stringSchema; - } - - // Only get method for Name - public String getRetentionPolicyName() { - - return retentionPolicy; - } - - // Only get method for Schema - public String toString() { - - return this.stringSchema; - } - - public static RetentionPolicy getRetentionPolicy(String retentionPolicy) { - - if (retentionPolicy.equals(RetentionPolicy.CUSTODIAL.toString())) - return RetentionPolicy.CUSTODIAL; - if (retentionPolicy.equals(RetentionPolicy.OUTPUT.toString())) - return RetentionPolicy.OUTPUT; - if (retentionPolicy.equals(RetentionPolicy.REPLICA.toString())) - return RetentionPolicy.REPLICA; - return RetentionPolicy.UNKNOWN; - } +public enum RetentionPolicy { + custodial, output, replica; } diff --git a/src/main/java/it/grid/storm/namespace/model/StorageClassType.java b/src/main/java/it/grid/storm/namespace/model/StorageClassType.java index ed1a87d5d..8fd7baff1 100644 --- a/src/main/java/it/grid/storm/namespace/model/StorageClassType.java +++ b/src/main/java/it/grid/storm/namespace/model/StorageClassType.java @@ -19,51 +19,7 @@ public enum StorageClassType { - T0D0("T0D0", "T0D0"), T0D1("T0D1", "T0D1"), T1D0("T1D0", "T1D0"), T1D1( - "T1D1", "T1D1"), UNKNOWN("UNKNOWN", "Storage Class Type UNKNOWN!"); - - private String storageClassTypeString; - private String stringSchema; - - private StorageClassType(String storageClassTypeString, String stringSchema) { - - this.storageClassTypeString = storageClassTypeString; - this.stringSchema = stringSchema; - - } - - /** - * - * @param storageClassTypeString - * String - * @return StorageClassType - */ - public static StorageClassType getStorageClassType( - String storageClassTypeString) { - - for (StorageClassType sct : StorageClassType.values()) { - if (sct.getStorageClassTypeString().equals(storageClassTypeString)) { - return sct; - } - } - - return UNKNOWN; - } - - /** - * Returns the String representation of this storage class type instance. - * - * @return the String representation of this storage class type instance. - */ - public String getStorageClassTypeString() { - - return storageClassTypeString; - } - - public String getStringSchema() { - - return stringSchema; - } + T0D1, T1D0, T1D1; public boolean isTapeEnabled() { @@ -73,10 +29,4 @@ public boolean isTapeEnabled() { return false; } - - // Only get method for Schema - public String toString() { - - return this.stringSchema; - } } diff --git a/src/main/java/it/grid/storm/namespace/model/VirtualFS.java b/src/main/java/it/grid/storm/namespace/model/VirtualFS.java index aecee2c59..7fb69f18e 100644 --- a/src/main/java/it/grid/storm/namespace/model/VirtualFS.java +++ b/src/main/java/it/grid/storm/namespace/model/VirtualFS.java @@ -184,7 +184,6 @@ public void setCapabilities(CapabilityInterface cap) { public void setRoot(String rootPath) throws NamespaceException { this.rootPath = buildRootPath(rootPath); - buildStoRIRoot(rootPath); } public void addMappingRule(MappingRule mappingRule) { @@ -225,15 +224,6 @@ private String buildRootPath(String rootPath) throws NamespaceException { return rootPathUri.normalize().toString(); } - private void buildStoRIRoot(String rootPath) throws NamespaceException { - - /** - * @todo - */ - - // storiRoot = new StoRIImpl(this, rootPath, StoRIType.FOLDER); - } - /***************************************************************************** * READ METHODs ****************************************************************************/ diff --git a/src/main/java/it/grid/storm/namespace/remote/Constants.java b/src/main/java/it/grid/storm/namespace/remote/Constants.java deleted file mode 100644 index 64e050975..000000000 --- a/src/main/java/it/grid/storm/namespace/remote/Constants.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Istituto Nazionale di Fisica Nucleare (INFN). 2006-2010. - * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by - * applicable law or agreed to in writing, software distributed under the - * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS - * OF ANY KIND, either express or implied. See the License for the specific - * language governing permissions and limitations under the License. - */ -package it.grid.storm.namespace.remote; - -/** - * @author Michele Dibenedetto - */ -public class Constants { - - public static final String ENCODING_SCHEME = "UTF-8"; - public static final String RESOURCE = "configuration"; - public static final String VERSION = "1.4"; - public static final String LIST_ALL_KEY = "StorageAreaList"; - public static final char VFS_LIST_SEPARATOR = ':'; - public static final String VFS_NAME_KEY = "name"; - public static final char VFS_FIELD_MATCHER = '='; - public static final char VFS_FIELD_SEPARATOR = '&'; - public static final String VFS_ROOT_KEY = "root"; - public static final String VFS_STFN_ROOT_KEY = "stfnRoot"; - public static final char VFS_STFN_ROOT_SEPARATOR = ';'; - public static final String VFS_ENABLED_PROTOCOLS_KEY = "protocols"; - public static final char VFS_ENABLED_PROTOCOLS_SEPARATOR = ';'; - public static final String VFS_ANONYMOUS_PERMS_KEY = "anonymous"; - public static final String LIST_ALL_VFS = "VirtualFSList"; - - public static enum HttpPerms { NOREAD, READ, READWRITE }; - -} diff --git a/src/main/java/it/grid/storm/persistence/converter/TransferProtocolListConverter.java b/src/main/java/it/grid/storm/persistence/converter/TransferProtocolListConverter.java index 962201f14..9bb877aa1 100644 --- a/src/main/java/it/grid/storm/persistence/converter/TransferProtocolListConverter.java +++ b/src/main/java/it/grid/storm/persistence/converter/TransferProtocolListConverter.java @@ -18,10 +18,11 @@ package it.grid.storm.persistence.converter; import it.grid.storm.common.types.TURLPrefix; +import it.grid.storm.namespace.model.Protocol; + import java.util.Iterator; import java.util.List; import java.util.ArrayList; -import it.grid.storm.namespace.model.Protocol; /** * Package private auxiliary class used to convert between the DB raw data representation and StoRM diff --git a/src/main/java/it/grid/storm/persistence/model/PtGChunkDataTO.java b/src/main/java/it/grid/storm/persistence/model/PtGChunkDataTO.java index 402a76645..749e70dcc 100644 --- a/src/main/java/it/grid/storm/persistence/model/PtGChunkDataTO.java +++ b/src/main/java/it/grid/storm/persistence/model/PtGChunkDataTO.java @@ -19,9 +19,11 @@ import it.grid.storm.srm.types.TStatusCode; import it.grid.storm.common.types.TURLPrefix; +import it.grid.storm.namespace.model.Protocol; + import java.sql.Timestamp; import java.util.List; -import it.grid.storm.namespace.model.Protocol; + import it.grid.storm.persistence.converter.StatusCodeConverter; import it.grid.storm.persistence.converter.TransferProtocolListConverter; diff --git a/src/main/java/it/grid/storm/rest/RestServer.java b/src/main/java/it/grid/storm/rest/RestServer.java index 5ea5d2dc7..feb2f75e1 100644 --- a/src/main/java/it/grid/storm/rest/RestServer.java +++ b/src/main/java/it/grid/storm/rest/RestServer.java @@ -47,9 +47,10 @@ import it.grid.storm.info.remote.resources.SpaceStatusResource; import it.grid.storm.metrics.NamedInstrumentedSelectChannelConnector; import it.grid.storm.metrics.NamedInstrumentedThreadPool; -import it.grid.storm.namespace.remote.resource.VirtualFSResource; import it.grid.storm.rest.auth.RestTokenFilter; +import it.grid.storm.rest.info.endpoint.EndpointResource; import it.grid.storm.rest.info.namespace.NamespaceInfoEndpoint; +import it.grid.storm.rest.info.storageareas.StorageAreasResource; import it.grid.storm.rest.metadata.Metadata; import it.grid.storm.tape.recalltable.providers.TapeRecallTOListMessageBodyWriter; import it.grid.storm.tape.recalltable.resources.TaskResource; @@ -112,8 +113,9 @@ private void configure() { resourceConfig.register(TapeRecallTOListMessageBodyWriter.class); // resourceConfig.register(AuthorizationResource.class); // resourceConfig.register(AuthorizationResourceCompat_1_0.class); - resourceConfig.register(VirtualFSResource.class); + resourceConfig.register(StorageAreasResource.class); resourceConfig.register(NamespaceInfoEndpoint.class); + resourceConfig.register(EndpointResource.class); // resourceConfig.register(StormEAResource.class); resourceConfig.register(Metadata.class); // resourceConfig.register(Ping.class); diff --git a/src/main/java/it/grid/storm/rest/info/endpoint/EndpointResource.java b/src/main/java/it/grid/storm/rest/info/endpoint/EndpointResource.java new file mode 100644 index 000000000..9b0102aef --- /dev/null +++ b/src/main/java/it/grid/storm/rest/info/endpoint/EndpointResource.java @@ -0,0 +1,60 @@ +package it.grid.storm.rest.info.endpoint; + +import java.util.List; +import java.util.Map; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.collect.Maps; + +import it.grid.storm.config.Configuration; +import it.grid.storm.namespace.Namespace; +import it.grid.storm.namespace.NamespaceException; +import it.grid.storm.namespace.VirtualFSInterface; +import it.grid.storm.rest.info.endpoint.model.EndpointInfo; +import it.grid.storm.rest.info.storageareas.model.SAInfo; + +@Path("/info") +public class EndpointResource { + + private static final Logger log = LoggerFactory.getLogger(EndpointResource.class); + + private EndpointInfo endpoint; + + public EndpointResource() { + + this(Configuration.getInstance()); + } + + public EndpointResource(Configuration config) { + + endpoint = new EndpointInfo(); + endpoint.setSiteName(config.getSiteName()); + endpoint.setQualityLevel(config.getQualityLevel()); + endpoint.setVersion(getClass().getPackage().getImplementationVersion()); + + List vfsCollection = Namespace.getInstance().getAllDefinedVFS(); + Map sas = Maps.newHashMap(); + + for (VirtualFSInterface vfs : vfsCollection) { + try { + sas.put(vfs.getAliasName(), SAInfo.buildFromVFS(vfs)); + } catch (NamespaceException e) { + log.error(e.getMessage(), e); + } + } + endpoint.setStorageAreas(sas); + } + + @GET + @Produces(MediaType.APPLICATION_JSON) + public EndpointInfo getEndpointInfo() { + return endpoint; + } +} diff --git a/src/main/java/it/grid/storm/rest/info/endpoint/model/EndpointInfo.java b/src/main/java/it/grid/storm/rest/info/endpoint/model/EndpointInfo.java new file mode 100644 index 000000000..83560a284 --- /dev/null +++ b/src/main/java/it/grid/storm/rest/info/endpoint/model/EndpointInfo.java @@ -0,0 +1,54 @@ +package it.grid.storm.rest.info.endpoint.model; + +import java.util.Map; + +import com.google.common.collect.Maps; + +import it.grid.storm.config.model.v2.QualityLevel; +import it.grid.storm.rest.info.storageareas.model.SAInfo; + +public class EndpointInfo { + + private String siteName; + private QualityLevel qualityLevel; + private String version; + private Map storageAreas; + + public EndpointInfo() { + storageAreas = Maps.newHashMap(); + } + + public String getSiteName() { + return siteName; + } + + public void setSiteName(String siteName) { + this.siteName = siteName; + } + + public QualityLevel getQualityLevel() { + return qualityLevel; + } + + public void setQualityLevel(QualityLevel qualityLevel) { + this.qualityLevel = qualityLevel; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public Map getStorageAreas() { + return storageAreas; + } + + public void setStorageAreas(Map storageAreas) { + this.storageAreas.clear(); + this.storageAreas.putAll(storageAreas); + } + +} diff --git a/src/main/java/it/grid/storm/namespace/remote/resource/VirtualFSResource.java b/src/main/java/it/grid/storm/rest/info/storageareas/StorageAreasResource.java similarity index 70% rename from src/main/java/it/grid/storm/namespace/remote/resource/VirtualFSResource.java rename to src/main/java/it/grid/storm/rest/info/storageareas/StorageAreasResource.java index dca595cb2..c05646863 100644 --- a/src/main/java/it/grid/storm/namespace/remote/resource/VirtualFSResource.java +++ b/src/main/java/it/grid/storm/rest/info/storageareas/StorageAreasResource.java @@ -1,4 +1,4 @@ -package it.grid.storm.namespace.remote.resource; +package it.grid.storm.rest.info.storageareas; import java.util.List; import java.util.Map; @@ -16,22 +16,17 @@ import it.grid.storm.namespace.Namespace; import it.grid.storm.namespace.NamespaceException; import it.grid.storm.namespace.VirtualFSInterface; -import it.grid.storm.namespace.model.SAInfo; -import it.grid.storm.namespace.remote.Constants; +import it.grid.storm.rest.info.storageareas.model.SAInfo; -/** - * @author Michele Dibenedetto - */ -@Path("/" + Constants.RESOURCE + "/" + Constants.VERSION) -public class VirtualFSResource { +@Path("/info/storage-areas") +public class StorageAreasResource { - private static final Logger log = LoggerFactory.getLogger(VirtualFSResource.class); + private static final Logger log = LoggerFactory.getLogger(StorageAreasResource.class); /** * @return */ @GET - @Path("/" + Constants.LIST_ALL_VFS) @Produces(MediaType.APPLICATION_JSON) public Map listVFS() { diff --git a/src/main/java/it/grid/storm/rest/info/storageareas/model/HttpPerms.java b/src/main/java/it/grid/storm/rest/info/storageareas/model/HttpPerms.java new file mode 100644 index 000000000..949b05dc8 --- /dev/null +++ b/src/main/java/it/grid/storm/rest/info/storageareas/model/HttpPerms.java @@ -0,0 +1,5 @@ +package it.grid.storm.rest.info.storageareas.model; + +public enum HttpPerms { + NOREAD, READ, READWRITE; +} diff --git a/src/main/java/it/grid/storm/namespace/model/SAInfo.java b/src/main/java/it/grid/storm/rest/info/storageareas/model/SAInfo.java similarity index 79% rename from src/main/java/it/grid/storm/namespace/model/SAInfo.java rename to src/main/java/it/grid/storm/rest/info/storageareas/model/SAInfo.java index 6e002a488..7cbc94ce2 100644 --- a/src/main/java/it/grid/storm/namespace/model/SAInfo.java +++ b/src/main/java/it/grid/storm/rest/info/storageareas/model/SAInfo.java @@ -1,4 +1,4 @@ -package it.grid.storm.namespace.model; +package it.grid.storm.rest.info.storageareas.model; import java.util.Iterator; import java.util.List; @@ -7,18 +7,22 @@ import it.grid.storm.namespace.NamespaceException; import it.grid.storm.namespace.VirtualFSInterface; -import it.grid.storm.namespace.remote.Constants.HttpPerms; +import it.grid.storm.namespace.model.AccessLatency; +import it.grid.storm.namespace.model.ApproachableRule; +import it.grid.storm.namespace.model.Protocol; +import it.grid.storm.namespace.model.RetentionPolicy; +import it.grid.storm.namespace.model.StorageClassType; public class SAInfo { private String name; private String token; private List vos; - private String root; - private String storageClass; + private String rootPath; + private StorageClassType storageClass; private List accessPoints; - private String retentionPolicy; - private String accessLatency; + private RetentionPolicy retentionPolicy; + private AccessLatency accessLatency; private List protocols; private HttpPerms anonymous; private long availableNearlineSpace; @@ -63,22 +67,22 @@ public void addVo(String voName) { this.vos.add(voName); } - public String getRoot() { + public String getRootPath() { - return root; + return rootPath; } - public void setRoot(String root) { + public void setRoot(String rootPath) { - this.root = root; + this.rootPath = rootPath; } - public String getStorageClass() { + public StorageClassType getStorageClass() { return storageClass; } - public void setStorageClass(String storageClass) { + public void setStorageClass(StorageClassType storageClass) { this.storageClass = storageClass; } @@ -93,22 +97,22 @@ public void addAccessPoint(String accessPoint) { this.accessPoints.add(accessPoint); } - public String getRetentionPolicy() { + public RetentionPolicy getRetentionPolicy() { return retentionPolicy; } - public void setRetentionPolicy(String retentionPolicy) { + public void setRetentionPolicy(RetentionPolicy retentionPolicy) { this.retentionPolicy = retentionPolicy; } - public String getAccessLatency() { + public AccessLatency getAccessLatency() { return accessLatency; } - public void setAccessLatency(String accessLatency) { + public void setAccessLatency(AccessLatency accessLatency) { this.accessLatency = accessLatency; } @@ -180,9 +184,9 @@ public static SAInfo buildFromVFS(VirtualFSInterface vfs) throws NamespaceExcept } else { sa.setAnonymous(HttpPerms.NOREAD); } - sa.setStorageClass(vfs.getStorageClassType().getStorageClassTypeString()); - sa.setRetentionPolicy(vfs.getProperties().getRetentionPolicy().getRetentionPolicyName()); - sa.setAccessLatency(vfs.getProperties().getAccessLatency().getAccessLatencyName()); + sa.setStorageClass(vfs.getStorageClassType()); + sa.setRetentionPolicy(vfs.getProperties().getRetentionPolicy()); + sa.setAccessLatency(vfs.getProperties().getAccessLatency()); sa.setAvailableNearlineSpace(vfs.getAvailableNearlineSpace().value()); for (ApproachableRule rule : vfs.getApproachableRules()) { diff --git a/src/test/java/it/grid/storm/config/ConfigurationConverterTest.java b/src/test/java/it/grid/storm/config/ConfigurationConverterTest.java index 0c0d83699..bd23e03e8 100644 --- a/src/test/java/it/grid/storm/config/ConfigurationConverterTest.java +++ b/src/test/java/it/grid/storm/config/ConfigurationConverterTest.java @@ -37,94 +37,94 @@ public void testLoadedConfigurationFromOldProperties() StormProperties properties = mapper.readValue(target, StormProperties.class); // not converted - assertEquals(DB_PORT, properties.db.port); - assertEquals(DB_POOL_SIZE, properties.db.pool.size); - assertEquals(DB_POOL_MIN_IDLE, properties.db.pool.minIdle); - assertEquals(DB_POOL_MAX_WAIT_MILLIS, properties.db.pool.maxWaitMillis); - assertEquals(DB_POOL_TEST_ON_BORROW, properties.db.pool.testOnBorrow); - assertEquals(DB_POOL_TEST_WHILE_IDLE, properties.db.pool.testWhileIdle); + assertEquals(DB_PORT, properties.getDb().getPort()); + assertEquals(DB_POOL_SIZE, properties.getDb().getPool().getSize()); + assertEquals(DB_POOL_MIN_IDLE, properties.getDb().getPool().getMinIdle()); + assertEquals(DB_POOL_MAX_WAIT_MILLIS, properties.getDb().getPool().getMaxWaitMillis()); + assertEquals(DB_POOL_TEST_ON_BORROW, properties.getDb().getPool().isTestOnBorrow()); + assertEquals(DB_POOL_TEST_WHILE_IDLE, properties.getDb().getPool().isTestWhileIdle()); // SRM service - assertEquals("fe.example.org", properties.srmEndpoints.get(0).host); - assertEquals(8444, properties.srmEndpoints.get(0).port); - assertEquals("fe-01.example.org", properties.srmEndpoints.get(1).host); - assertEquals(8444, properties.srmEndpoints.get(1).port); - assertEquals("fe-02.example.org", properties.srmEndpoints.get(2).host); - assertEquals(8444, properties.srmEndpoints.get(2).port); - assertEquals("be.example.org", properties.db.hostname); - assertEquals("storm", properties.db.username); - assertEquals("my-secret-password", properties.db.password); - assertEquals("prop=1", properties.db.properties); - assertEquals(9999, properties.rest.port); - assertEquals(512, properties.rest.maxThreads); - assertEquals(2000, properties.rest.maxQueueSize); - assertEquals(8081, properties.xmlrpc.port); - assertEquals(512, properties.xmlrpc.maxThreads); - assertEquals(2000, properties.xmlrpc.maxQueueSize); - assertEquals(true, properties.security.enabled); - assertEquals("ilovejava", properties.security.token); - assertEquals(true, properties.du.enabled); - assertEquals(true, properties.du.parallelTasksEnabled); - assertEquals(60, properties.du.initialDelay); - assertEquals(360, properties.du.tasksInterval); - assertEquals(true, properties.sanityChecksEnabled); - assertEquals(true, properties.directories.enableAutomaticCreation); - assertEquals(true, properties.directories.enableWritepermOnCreation); - assertEquals(310000, properties.pinlifetime.defaultValue); - assertEquals(1900000, properties.pinlifetime.maximum); - assertEquals("/file", properties.extraslashes.file); - assertEquals("/rfio", properties.extraslashes.rfio); - assertEquals("/root", properties.extraslashes.root); - assertEquals("/gsiftp", properties.extraslashes.gsiftp); - assertEquals(2000000, properties.files.defaultSize); - assertEquals(300000, properties.files.defaultLifetime); - assertEquals("N", properties.files.defaultOverwrite); - assertEquals("P", properties.files.defaultStoragetype); - assertEquals(20, properties.requestsScheduler.corePoolSize); - assertEquals(60, properties.requestsScheduler.maxPoolSize); - assertEquals(3000, properties.requestsScheduler.queueSize); - assertEquals(60, properties.ptpScheduler.corePoolSize); - assertEquals(300, properties.ptpScheduler.maxPoolSize); - assertEquals(2000, properties.ptpScheduler.queueSize); - assertEquals(70, properties.ptgScheduler.corePoolSize); - assertEquals(400, properties.ptgScheduler.maxPoolSize); - assertEquals(3000, properties.ptgScheduler.queueSize); - assertEquals(40, properties.bolScheduler.corePoolSize); - assertEquals(100, properties.bolScheduler.maxPoolSize); - assertEquals(1000, properties.bolScheduler.queueSize); - assertEquals(15, properties.requestsPickerAgent.delay); - assertEquals(25, properties.requestsPickerAgent.interval); - assertEquals(150, properties.requestsPickerAgent.maxFetchedSize); - assertEquals(true, properties.synchLs.defaultAllLevelRecursive); - assertEquals(3, properties.synchLs.defaultNumLevels); - assertEquals(2, properties.synchLs.defaultOffset); - assertEquals(3000, properties.synchLs.maxEntries); - assertEquals(false, properties.skipPtgAclSetup); - - assertEquals(60, properties.inprogressRequestsAgent.delay); - assertEquals(600, properties.inprogressRequestsAgent.interval); - assertEquals(7000, properties.inprogressRequestsAgent.ptpExpirationTime); - - assertEquals(10, properties.expiredSpacesAgent.delay); - assertEquals(300, properties.expiredSpacesAgent.interval); - - assertEquals(false, properties.completedRequestsAgent.enabled); - assertEquals(100, properties.completedRequestsAgent.delay); - assertEquals(600, properties.completedRequestsAgent.interval); - assertEquals(1000, properties.completedRequestsAgent.purgeSize); - assertEquals(7200, properties.completedRequestsAgent.purgeAge); - - assertEquals(true, properties.hearthbeat.bookkeepingEnabled); - assertEquals(true, properties.hearthbeat.performanceMeasuringEnabled); - assertEquals(30, properties.hearthbeat.period); - assertEquals(10, properties.hearthbeat.performanceLogbookTimeInterval); - assertEquals(10, properties.hearthbeat.performanceGlanceTimeInterval); - - assertEquals(900, properties.infoQuotaRefreshPeriod); - assertEquals("/", properties.httpTurlPrefix); - assertEquals(20000, properties.serverPoolStatusCheckTimeout); - assertEquals(10, properties.abortMaxloop); - assertEquals("ping-values.properties", properties.pingPropertiesFilename); + assertEquals("fe.example.org", properties.getSrmEndpoints().get(0).getHost()); + assertEquals(8444, properties.getSrmEndpoints().get(0).getPort()); + assertEquals("fe-01.example.org", properties.getSrmEndpoints().get(1).getHost()); + assertEquals(8444, properties.getSrmEndpoints().get(1).getPort()); + assertEquals("fe-02.example.org", properties.getSrmEndpoints().get(2).getHost()); + assertEquals(8444, properties.getSrmEndpoints().get(2).getPort()); + assertEquals("be.example.org", properties.getDb().getHostname()); + assertEquals("storm", properties.getDb().getUsername()); + assertEquals("my-secret-password", properties.getDb().getPassword()); + assertEquals("prop=1", properties.getDb().getProperties()); + assertEquals(9999, properties.getRest().getPort()); + assertEquals(512, properties.getRest().getMaxThreads()); + assertEquals(2000, properties.getRest().getMaxQueueSize()); + assertEquals(8081, properties.getXmlrpc().getPort()); + assertEquals(512, properties.getXmlrpc().getMaxThreads()); + assertEquals(2000, properties.getXmlrpc().getMaxQueueSize()); + assertEquals(true, properties.getSecurity().isEnabled()); + assertEquals("ilovejava", properties.getSecurity().getToken()); + assertEquals(true, properties.getDu().isEnabled()); + assertEquals(true, properties.getDu().isParallelTasksEnabled()); + assertEquals(60, properties.getDu().getInitialDelay()); + assertEquals(360, properties.getDu().getTasksInterval()); + assertEquals(true, properties.isSanityChecksEnabled()); + assertEquals(true, properties.getDirectories().isEnableAutomaticCreation()); + assertEquals(true, properties.getDirectories().isEnableWritepermOnCreation()); + assertEquals(310000, properties.getPinlifetime().getDefaultValue()); + assertEquals(1900000, properties.getPinlifetime().getMaximum()); + assertEquals("/file", properties.getExtraslashes().getFile()); + assertEquals("/rfio", properties.getExtraslashes().getRfio()); + assertEquals("/root", properties.getExtraslashes().getRoot()); + assertEquals("/gsiftp", properties.getExtraslashes().getGsiftp()); + assertEquals(2000000, properties.getFiles().getDefaultSize()); + assertEquals(300000, properties.getFiles().getDefaultLifetime()); + assertEquals("N", properties.getFiles().getDefaultOverwrite()); + assertEquals("P", properties.getFiles().getDefaultStoragetype()); + assertEquals(20, properties.getRequestsScheduler().getCorePoolSize()); + assertEquals(60, properties.getRequestsScheduler().getMaxPoolSize()); + assertEquals(3000, properties.getRequestsScheduler().getQueueSize()); + assertEquals(60, properties.getPtpScheduler().getCorePoolSize()); + assertEquals(300, properties.getPtpScheduler().getMaxPoolSize()); + assertEquals(2000, properties.getPtpScheduler().getQueueSize()); + assertEquals(70, properties.getPtgScheduler().getCorePoolSize()); + assertEquals(400, properties.getPtgScheduler().getMaxPoolSize()); + assertEquals(3000, properties.getPtgScheduler().getQueueSize()); + assertEquals(40, properties.getBolScheduler().getCorePoolSize()); + assertEquals(100, properties.getBolScheduler().getMaxPoolSize()); + assertEquals(1000, properties.getBolScheduler().getQueueSize()); + assertEquals(15, properties.getRequestsPickerAgent().getDelay()); + assertEquals(25, properties.getRequestsPickerAgent().getInterval()); + assertEquals(150, properties.getRequestsPickerAgent().getMaxFetchedSize()); + assertEquals(true, properties.getSynchLs().isDefaultAllLevelRecursive()); + assertEquals(3, properties.getSynchLs().getDefaultNumLevels()); + assertEquals(2, properties.getSynchLs().getDefaultOffset()); + assertEquals(3000, properties.getSynchLs().getMaxEntries()); + assertEquals(false, properties.isSkipPtgAclSetup()); + + assertEquals(60, properties.getInprogressRequestsAgent().getDelay()); + assertEquals(600, properties.getInprogressRequestsAgent().getInterval()); + assertEquals(7000, properties.getInprogressRequestsAgent().getPtpExpirationTime()); + + assertEquals(10, properties.getExpiredSpacesAgent().getDelay()); + assertEquals(300, properties.getExpiredSpacesAgent().getInterval()); + + assertEquals(false, properties.getCompletedRequestsAgent().isEnabled()); + assertEquals(100, properties.getCompletedRequestsAgent().getDelay()); + assertEquals(600, properties.getCompletedRequestsAgent().getInterval()); + assertEquals(1000, properties.getCompletedRequestsAgent().getPurgeSize()); + assertEquals(7200, properties.getCompletedRequestsAgent().getPurgeAge()); + + assertEquals(true, properties.getHearthbeat().isBookkeepingEnabled()); + assertEquals(true, properties.getHearthbeat().isPerformanceMeasuringEnabled()); + assertEquals(30, properties.getHearthbeat().getPeriod()); + assertEquals(10, properties.getHearthbeat().getPerformanceLogbookTimeInterval()); + assertEquals(10, properties.getHearthbeat().getPerformanceGlanceTimeInterval()); + + assertEquals(900, properties.getInfoQuotaRefreshPeriod()); + assertEquals("/", properties.getHttpTurlPrefix()); + assertEquals(20000, properties.getServerPoolStatusCheckTimeout()); + assertEquals(10, properties.getAbortMaxloop()); + assertEquals("ping-values.properties", properties.getPingPropertiesFilename()); // delete temporary file target.delete(); diff --git a/src/test/java/it/grid/storm/config/model/StormPropertiesTest.java b/src/test/java/it/grid/storm/config/model/StormPropertiesTest.java index 12e294d77..073c1619d 100644 --- a/src/test/java/it/grid/storm/config/model/StormPropertiesTest.java +++ b/src/test/java/it/grid/storm/config/model/StormPropertiesTest.java @@ -21,6 +21,8 @@ import static it.grid.storm.config.ConfigurationDefaults.DB_USERNAME; import static it.grid.storm.config.ConfigurationDefaults.DEFAULT_FILE_STORAGE_TYPE; import static it.grid.storm.config.ConfigurationDefaults.DEFAULT_OVERWRITE_MODE; +import static it.grid.storm.config.ConfigurationDefaults.DEFAULT_QUALITY_LEVEL; +import static it.grid.storm.config.ConfigurationDefaults.DEFAULT_SITENAME; import static it.grid.storm.config.ConfigurationDefaults.DISKUSAGE_SERVICE_ENABLED; import static it.grid.storm.config.ConfigurationDefaults.DISKUSAGE_SERVICE_INITIAL_DELAY; import static it.grid.storm.config.ConfigurationDefaults.DISKUSAGE_SERVICE_PARALLEL_TASKS_ENABLED; @@ -91,6 +93,7 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapper; +import it.grid.storm.config.model.v2.QualityLevel; import it.grid.storm.config.model.v2.StormProperties; public class StormPropertiesTest { @@ -104,88 +107,89 @@ public void testLoadingConfigurationFromFullPropertiesV2() File file = new File(classLoader.getResource("storm.properties").getFile()); StormProperties properties = mapper.readValue(file, StormProperties.class); System.out.println(properties); - assertEquals(StormProperties.VERSION, properties.version); - assertFalse(properties.srmEndpoints.isEmpty()); - assertEquals(2, properties.srmEndpoints.size()); - assertEquals("storm.example", properties.srmEndpoints.get(0).host); - assertEquals(8444, properties.srmEndpoints.get(0).port); - assertEquals("alias.example", properties.srmEndpoints.get(1).host); - assertEquals(8445, properties.srmEndpoints.get(1).port); - assertEquals("storm.example", properties.db.hostname); - assertEquals("test", properties.db.username); - assertEquals("secret", properties.db.password); - assertEquals(3308, properties.db.port); - assertEquals("test", properties.db.properties); - assertEquals(200, properties.db.pool.size); - assertEquals(1200, properties.db.pool.maxWaitMillis); - assertEquals(false, properties.db.pool.testOnBorrow); - assertEquals(false, properties.db.pool.testWhileIdle); - assertEquals(9999, properties.rest.port); - assertEquals(150, properties.rest.maxThreads); - assertEquals(1500, properties.rest.maxQueueSize); - assertEquals(9090, properties.xmlrpc.port); - assertEquals(512, properties.xmlrpc.maxThreads); - assertEquals(2000, properties.xmlrpc.maxQueueSize); - assertEquals(true, properties.security.enabled); - assertEquals("ilovejava", properties.security.token); - assertEquals(true, properties.du.enabled); - assertEquals(true, properties.du.parallelTasksEnabled); - assertEquals(120, properties.du.initialDelay); - assertEquals(200000, properties.du.tasksInterval); - assertEquals(20, properties.inprogressRequestsAgent.delay); - assertEquals(400, properties.inprogressRequestsAgent.interval); - assertEquals(333000, properties.inprogressRequestsAgent.ptpExpirationTime); - assertEquals(20, properties.expiredSpacesAgent.delay); - assertEquals(400, properties.expiredSpacesAgent.interval); - assertEquals(true, properties.completedRequestsAgent.enabled); - assertEquals(20, properties.completedRequestsAgent.delay); - assertEquals(400, properties.completedRequestsAgent.interval); - assertEquals(1800, properties.completedRequestsAgent.purgeSize); - assertEquals(22200, properties.completedRequestsAgent.purgeAge); - assertEquals(10, properties.requestsScheduler.corePoolSize); - assertEquals(50, properties.requestsScheduler.maxPoolSize); - assertEquals(2000, properties.requestsScheduler.queueSize); - assertEquals(50, properties.ptpScheduler.corePoolSize); - assertEquals(200, properties.ptpScheduler.maxPoolSize); - assertEquals(1000, properties.ptpScheduler.queueSize); - assertEquals(50, properties.ptgScheduler.corePoolSize); - assertEquals(200, properties.ptgScheduler.maxPoolSize); - assertEquals(2000, properties.ptgScheduler.queueSize); - assertEquals(50, properties.bolScheduler.corePoolSize); - assertEquals(200, properties.bolScheduler.maxPoolSize); - assertEquals(2000, properties.bolScheduler.queueSize); - assertEquals(10, properties.requestsPickerAgent.delay); - assertEquals(20, properties.requestsPickerAgent.interval); - assertEquals(1000, properties.requestsPickerAgent.maxFetchedSize); - assertEquals(false, properties.sanityChecksEnabled); - assertEquals("/file", properties.extraslashes.file); - assertEquals("/rfio", properties.extraslashes.rfio); - assertEquals("/root", properties.extraslashes.root); - assertEquals("/gsiftp", properties.extraslashes.gsiftp); - assertEquals(true, properties.synchLs.defaultAllLevelRecursive); - assertEquals(2, properties.synchLs.defaultNumLevels); - assertEquals(1, properties.synchLs.defaultOffset); - assertEquals(3000, properties.synchLs.maxEntries); - assertEquals(300000, properties.pinlifetime.defaultValue); - assertEquals(18000000, properties.pinlifetime.maximum); - assertEquals(true, properties.skipPtgAclSetup); - assertEquals(100000, properties.files.defaultSize); - assertEquals(300000, properties.files.defaultLifetime); - assertEquals("N", properties.files.defaultOverwrite); - assertEquals("P", properties.files.defaultStoragetype); - assertEquals(true, properties.directories.enableAutomaticCreation); - assertEquals(true, properties.directories.enableWritepermOnCreation); - assertEquals(true, properties.hearthbeat.bookkeepingEnabled); - assertEquals(true, properties.hearthbeat.performanceMeasuringEnabled); - assertEquals(30, properties.hearthbeat.period); - assertEquals(10, properties.hearthbeat.performanceLogbookTimeInterval); - assertEquals(10, properties.hearthbeat.performanceGlanceTimeInterval); - assertEquals(900, properties.infoQuotaRefreshPeriod); - assertEquals("/", properties.httpTurlPrefix); - assertEquals(20000, properties.serverPoolStatusCheckTimeout); - assertEquals(10, properties.abortMaxloop); - assertEquals("ping-values.properties", properties.pingPropertiesFilename); - + assertEquals(StormProperties.VERSION, properties.getVersion()); + assertFalse(properties.getSrmEndpoints().isEmpty()); + assertEquals(2, properties.getSrmEndpoints().size()); + assertEquals("storm.example", properties.getSrmEndpoints().get(0).getHost()); + assertEquals(8444, properties.getSrmEndpoints().get(0).getPort()); + assertEquals("alias.example", properties.getSrmEndpoints().get(1).getHost()); + assertEquals(8445, properties.getSrmEndpoints().get(1).getPort()); + assertEquals("storm.example", properties.getDb().getHostname()); + assertEquals("test", properties.getDb().getUsername()); + assertEquals("secret", properties.getDb().getPassword()); + assertEquals(3308, properties.getDb().getPort()); + assertEquals("test", properties.getDb().getProperties()); + assertEquals(200, properties.getDb().getPool().getSize()); + assertEquals(1200, properties.getDb().getPool().getMaxWaitMillis()); + assertEquals(false, properties.getDb().getPool().isTestOnBorrow()); + assertEquals(false, properties.getDb().getPool().isTestWhileIdle()); + assertEquals(9999, properties.getRest().getPort()); + assertEquals(150, properties.getRest().getMaxThreads()); + assertEquals(1500, properties.getRest().getMaxQueueSize()); + assertEquals(9090, properties.getXmlrpc().getPort()); + assertEquals(512, properties.getXmlrpc().getMaxThreads()); + assertEquals(2000, properties.getXmlrpc().getMaxQueueSize()); + assertEquals(true, properties.getSecurity().isEnabled()); + assertEquals("ilovejava", properties.getSecurity().getToken()); + assertEquals(true, properties.getDu().isEnabled()); + assertEquals(true, properties.getDu().isParallelTasksEnabled()); + assertEquals(120, properties.getDu().getInitialDelay()); + assertEquals(200000, properties.getDu().getTasksInterval()); + assertEquals(20, properties.getInprogressRequestsAgent().getDelay()); + assertEquals(400, properties.getInprogressRequestsAgent().getInterval()); + assertEquals(333000, properties.getInprogressRequestsAgent().getPtpExpirationTime()); + assertEquals(20, properties.getExpiredSpacesAgent().getDelay()); + assertEquals(400, properties.getExpiredSpacesAgent().getInterval()); + assertEquals(true, properties.getCompletedRequestsAgent().isEnabled()); + assertEquals(20, properties.getCompletedRequestsAgent().getDelay()); + assertEquals(400, properties.getCompletedRequestsAgent().getInterval()); + assertEquals(1800, properties.getCompletedRequestsAgent().getPurgeSize()); + assertEquals(22200, properties.getCompletedRequestsAgent().getPurgeAge()); + assertEquals(10, properties.getRequestsScheduler().getCorePoolSize()); + assertEquals(50, properties.getRequestsScheduler().getMaxPoolSize()); + assertEquals(2000, properties.getRequestsScheduler().getQueueSize()); + assertEquals(50, properties.getPtpScheduler().getCorePoolSize()); + assertEquals(200, properties.getPtpScheduler().getMaxPoolSize()); + assertEquals(1000, properties.getPtpScheduler().getQueueSize()); + assertEquals(50, properties.getPtgScheduler().getCorePoolSize()); + assertEquals(200, properties.getPtgScheduler().getMaxPoolSize()); + assertEquals(2000, properties.getPtgScheduler().getQueueSize()); + assertEquals(50, properties.getBolScheduler().getCorePoolSize()); + assertEquals(200, properties.getBolScheduler().getMaxPoolSize()); + assertEquals(2000, properties.getBolScheduler().getQueueSize()); + assertEquals(10, properties.getRequestsPickerAgent().getDelay()); + assertEquals(20, properties.getRequestsPickerAgent().getInterval()); + assertEquals(1000, properties.getRequestsPickerAgent().getMaxFetchedSize()); + assertEquals(false, properties.isSanityChecksEnabled()); + assertEquals("/file", properties.getExtraslashes().getFile()); + assertEquals("/rfio", properties.getExtraslashes().getRfio()); + assertEquals("/root", properties.getExtraslashes().getRoot()); + assertEquals("/gsiftp", properties.getExtraslashes().getGsiftp()); + assertEquals(true, properties.getSynchLs().isDefaultAllLevelRecursive()); + assertEquals(2, properties.getSynchLs().getDefaultNumLevels()); + assertEquals(1, properties.getSynchLs().getDefaultOffset()); + assertEquals(3000, properties.getSynchLs().getMaxEntries()); + assertEquals(300000, properties.getPinlifetime().getDefaultValue()); + assertEquals(18000000, properties.getPinlifetime().getMaximum()); + assertEquals(true, properties.isSkipPtgAclSetup()); + assertEquals(100000, properties.getFiles().getDefaultSize()); + assertEquals(300000, properties.getFiles().getDefaultLifetime()); + assertEquals("N", properties.getFiles().getDefaultOverwrite()); + assertEquals("P", properties.getFiles().getDefaultStoragetype()); + assertEquals(true, properties.getDirectories().isEnableAutomaticCreation()); + assertEquals(true, properties.getDirectories().isEnableWritepermOnCreation()); + assertEquals(true, properties.getHearthbeat().isBookkeepingEnabled()); + assertEquals(true, properties.getHearthbeat().isPerformanceMeasuringEnabled()); + assertEquals(30, properties.getHearthbeat().getPeriod()); + assertEquals(10, properties.getHearthbeat().getPerformanceLogbookTimeInterval()); + assertEquals(10, properties.getHearthbeat().getPerformanceGlanceTimeInterval()); + assertEquals(900, properties.getInfoQuotaRefreshPeriod()); + assertEquals("/", properties.getHttpTurlPrefix()); + assertEquals(20000, properties.getServerPoolStatusCheckTimeout()); + assertEquals(10, properties.getAbortMaxloop()); + assertEquals("ping-values.properties", properties.getPingPropertiesFilename()); + assertEquals("StoRM test", properties.getSite().getName()); + assertEquals(QualityLevel.PRODUCTION, properties.getSite().getQualityLevel()); } @Test @@ -197,87 +201,104 @@ public void testDefaultConfigurationStartingFromEmptyFile() ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("empty.properties").getFile()); StormProperties properties = mapper.readValue(file, StormProperties.class); - assertEquals(VERSION, properties.version); - assertFalse(properties.srmEndpoints.isEmpty()); - assertEquals(1, properties.srmEndpoints.size()); - assertEquals(hostname, properties.srmEndpoints.get(0).host); - assertEquals(8444, properties.srmEndpoints.get(0).port); - assertEquals(hostname, properties.db.hostname); - assertEquals(DB_USERNAME, properties.db.username); - assertEquals(DB_PASSWORD, properties.db.password); - assertEquals(DB_PORT, properties.db.port); - assertEquals(DB_PROPERTIES, properties.db.properties); - assertEquals(DB_POOL_SIZE, properties.db.pool.size); - assertEquals(DB_POOL_MAX_WAIT_MILLIS, properties.db.pool.maxWaitMillis); - assertEquals(DB_POOL_MIN_IDLE, properties.db.pool.minIdle); - assertEquals(DB_POOL_TEST_ON_BORROW, properties.db.pool.testOnBorrow); - assertEquals(DB_POOL_TEST_WHILE_IDLE, properties.db.pool.testWhileIdle); - assertEquals(REST_SERVICES_PORT, properties.rest.port); - assertEquals(REST_SERVICES_MAX_THREADS, properties.rest.maxThreads); - assertEquals(REST_SERVICES_MAX_QUEUE_SIZE, properties.rest.maxQueueSize); - assertEquals(XMLRPC_SERVER_PORT, properties.xmlrpc.port); - assertEquals(XMLRPC_MAX_THREADS, properties.xmlrpc.maxThreads); - assertEquals(XMLRPC_MAX_QUEUE_SIZE, properties.xmlrpc.maxQueueSize); - assertEquals(SECURITY_ENABLED, properties.security.enabled); - assertEquals(SECURITY_TOKEN, properties.security.token); - assertEquals(DISKUSAGE_SERVICE_ENABLED, properties.du.enabled); - assertEquals(DISKUSAGE_SERVICE_PARALLEL_TASKS_ENABLED, properties.du.parallelTasksEnabled); - assertEquals(DISKUSAGE_SERVICE_INITIAL_DELAY, properties.du.initialDelay); - assertEquals(DISKUSAGE_SERVICE_TASKS_INTERVAL, properties.du.tasksInterval); - assertEquals(INPROGRESS_REQUESTS_AGENT_DELAY, properties.inprogressRequestsAgent.delay); - assertEquals(INPROGRESS_REQUESTS_AGENT_INTERVAL, properties.inprogressRequestsAgent.interval); + assertEquals(VERSION, properties.getVersion()); + assertFalse(properties.getSrmEndpoints().isEmpty()); + assertEquals(1, properties.getSrmEndpoints().size()); + assertEquals(hostname, properties.getSrmEndpoints().get(0).getHost()); + assertEquals(8444, properties.getSrmEndpoints().get(0).getPort()); + assertEquals(hostname, properties.getDb().getHostname()); + assertEquals(DB_USERNAME, properties.getDb().getUsername()); + assertEquals(DB_PASSWORD, properties.getDb().getPassword()); + assertEquals(DB_PORT, properties.getDb().getPort()); + assertEquals(DB_PROPERTIES, properties.getDb().getProperties()); + assertEquals(DB_POOL_SIZE, properties.getDb().getPool().getSize()); + assertEquals(DB_POOL_MAX_WAIT_MILLIS, properties.getDb().getPool().getMaxWaitMillis()); + assertEquals(DB_POOL_MIN_IDLE, properties.getDb().getPool().getMinIdle()); + assertEquals(DB_POOL_TEST_ON_BORROW, properties.getDb().getPool().isTestOnBorrow()); + assertEquals(DB_POOL_TEST_WHILE_IDLE, properties.getDb().getPool().isTestWhileIdle()); + assertEquals(REST_SERVICES_PORT, properties.getRest().getPort()); + assertEquals(REST_SERVICES_MAX_THREADS, properties.getRest().getMaxThreads()); + assertEquals(REST_SERVICES_MAX_QUEUE_SIZE, properties.getRest().getMaxQueueSize()); + assertEquals(XMLRPC_SERVER_PORT, properties.getXmlrpc().getPort()); + assertEquals(XMLRPC_MAX_THREADS, properties.getXmlrpc().getMaxThreads()); + assertEquals(XMLRPC_MAX_QUEUE_SIZE, properties.getXmlrpc().getMaxQueueSize()); + assertEquals(SECURITY_ENABLED, properties.getSecurity().isEnabled()); + assertEquals(SECURITY_TOKEN, properties.getSecurity().getToken()); + assertEquals(DISKUSAGE_SERVICE_ENABLED, properties.getDu().isEnabled()); + assertEquals(DISKUSAGE_SERVICE_PARALLEL_TASKS_ENABLED, + properties.getDu().isParallelTasksEnabled()); + assertEquals(DISKUSAGE_SERVICE_INITIAL_DELAY, properties.getDu().getInitialDelay()); + assertEquals(DISKUSAGE_SERVICE_TASKS_INTERVAL, properties.getDu().getTasksInterval()); + assertEquals(INPROGRESS_REQUESTS_AGENT_DELAY, + properties.getInprogressRequestsAgent().getDelay()); + assertEquals(INPROGRESS_REQUESTS_AGENT_INTERVAL, + properties.getInprogressRequestsAgent().getInterval()); assertEquals(INPROGRESS_REQUESTS_AGENT_PTP_EXPIRATION_TIME, - properties.inprogressRequestsAgent.ptpExpirationTime); - assertEquals(EXPIRED_SPACES_AGENT_DELAY, properties.expiredSpacesAgent.delay); - assertEquals(EXPIRED_SPACES_AGENT_INTERVAL, properties.expiredSpacesAgent.interval); - assertEquals(COMPLETED_REQUESTS_AGENT_ENABLED, properties.completedRequestsAgent.enabled); - assertEquals(COMPLETED_REQUESTS_AGENT_DELAY, properties.completedRequestsAgent.delay); - assertEquals(COMPLETED_REQUESTS_AGENT_INTERVAL, properties.completedRequestsAgent.interval); - assertEquals(COMPLETED_REQUESTS_AGENT_PURGE_SIZE, properties.completedRequestsAgent.purgeSize); - assertEquals(COMPLETED_REQUESTS_AGENT_PURGE_AGE, properties.completedRequestsAgent.purgeAge); - assertEquals(REQUESTS_SCHEDULER_CORE_POOL_SIZE, properties.requestsScheduler.corePoolSize); - assertEquals(REQUESTS_SCHEDULER_MAX_POOL_SIZE, properties.requestsScheduler.maxPoolSize); - assertEquals(REQUESTS_SCHEDULER_QUEUE_SIZE, properties.requestsScheduler.queueSize); - assertEquals(PTP_SCHEDULER_CORE_POOL_SIZE, properties.ptpScheduler.corePoolSize); - assertEquals(PTP_SCHEDULER_MAX_POOL_SIZE, properties.ptpScheduler.maxPoolSize); - assertEquals(PTP_SCHEDULER_QUEUE_SIZE, properties.ptpScheduler.queueSize); - assertEquals(PTG_SCHEDULER_CORE_POOL_SIZE, properties.ptgScheduler.corePoolSize); - assertEquals(PTG_SCHEDULER_MAX_POOL_SIZE, properties.ptgScheduler.maxPoolSize); - assertEquals(PTG_SCHEDULER_QUEUE_SIZE, properties.ptgScheduler.queueSize); - assertEquals(BOL_SCHEDULER_CORE_POOL_SIZE, properties.bolScheduler.corePoolSize); - assertEquals(BOL_SCHEDULER_MAX_POOL_SIZE, properties.bolScheduler.maxPoolSize); - assertEquals(BOL_SCHEDULER_QUEUE_SIZE, properties.bolScheduler.queueSize); - assertEquals(REQUESTS_PICKER_AGENT_DELAY, properties.requestsPickerAgent.delay); - assertEquals(REQUESTS_PICKER_AGENT_INTERVAL, properties.requestsPickerAgent.interval); - assertEquals(REQUESTS_PICKER_AGENT_MAX_FETCHED_SIZE, properties.requestsPickerAgent.maxFetchedSize); - assertEquals(SANITY_CHECK_ENABLED, properties.sanityChecksEnabled); - assertEquals(EXTRA_SLASHES_FOR_FILE_TURL, properties.extraslashes.file); - assertEquals(EXTRA_SLASHES_FOR_RFIO_TURL, properties.extraslashes.rfio); - assertEquals(EXTRA_SLASHES_FOR_ROOT_TURL, properties.extraslashes.root); - assertEquals(EXTRA_SLASHES_FOR_GSIFTP_TURL, properties.extraslashes.gsiftp); - assertEquals(LS_DEFAULT_ALL_LEVEL_RECURSIVE, properties.synchLs.defaultAllLevelRecursive); - assertEquals(LS_DEFAULT_NUM_OF_LEVELS, properties.synchLs.defaultNumLevels); - assertEquals(LS_DEFAULT_OFFSET, properties.synchLs.defaultOffset); - assertEquals(LS_MAX_NUMBER_OF_ENTRY, properties.synchLs.maxEntries); - assertEquals(PIN_LIFETIME_DEFAULT, properties.pinlifetime.defaultValue); - assertEquals(PIN_LIFETIME_MAXIMUM, properties.pinlifetime.maximum); - assertEquals(PTG_SKIP_ACL_SETUP, properties.skipPtgAclSetup); - assertEquals(FILE_DEFAULT_SIZE, properties.files.defaultSize); - assertEquals(FILE_LIFETIME_DEFAULT, properties.files.defaultLifetime); - assertEquals(DEFAULT_OVERWRITE_MODE, properties.files.defaultOverwrite); - assertEquals(DEFAULT_FILE_STORAGE_TYPE, properties.files.defaultStoragetype); - assertEquals(AUTOMATIC_DIRECTORY_CREATION, properties.directories.enableAutomaticCreation); - assertEquals(ENABLE_WRITE_PERM_ON_DIRECTORY, properties.directories.enableWritepermOnCreation); - assertEquals(BOOK_KEEPING_ENABLED, properties.hearthbeat.bookkeepingEnabled); - assertEquals(PERFORMANCE_MEASURING, properties.hearthbeat.performanceMeasuringEnabled); - assertEquals(HEARTHBEAT_PERIOD, properties.hearthbeat.period); - assertEquals(PERFORMANCE_LOGBOOK_TIME_INTERVAL, properties.hearthbeat.performanceLogbookTimeInterval); - assertEquals(PERFORMANCE_GLANCE_TIME_INTERVAL, properties.hearthbeat.performanceGlanceTimeInterval); - assertEquals(GPFS_QUOTA_REFRESH_PERIOD, properties.infoQuotaRefreshPeriod); - assertEquals(HTTP_TURL_PREFIX, properties.httpTurlPrefix); - assertEquals(SERVER_POOL_STATUS_CHECK_TIMEOUT, properties.serverPoolStatusCheckTimeout); - assertEquals(MAX_LOOP, properties.abortMaxloop); - assertEquals(PING_VALUES_PROPERTIES_FILENAME, properties.pingPropertiesFilename); + properties.getInprogressRequestsAgent().getPtpExpirationTime()); + assertEquals(EXPIRED_SPACES_AGENT_DELAY, properties.getExpiredSpacesAgent().getDelay()); + assertEquals(EXPIRED_SPACES_AGENT_INTERVAL, properties.getExpiredSpacesAgent().getInterval()); + assertEquals(COMPLETED_REQUESTS_AGENT_ENABLED, + properties.getCompletedRequestsAgent().isEnabled()); + assertEquals(COMPLETED_REQUESTS_AGENT_DELAY, properties.getCompletedRequestsAgent().getDelay()); + assertEquals(COMPLETED_REQUESTS_AGENT_INTERVAL, + properties.getCompletedRequestsAgent().getInterval()); + assertEquals(COMPLETED_REQUESTS_AGENT_PURGE_SIZE, + properties.getCompletedRequestsAgent().getPurgeSize()); + assertEquals(COMPLETED_REQUESTS_AGENT_PURGE_AGE, + properties.getCompletedRequestsAgent().getPurgeAge()); + assertEquals(REQUESTS_SCHEDULER_CORE_POOL_SIZE, + properties.getRequestsScheduler().getCorePoolSize()); + assertEquals(REQUESTS_SCHEDULER_MAX_POOL_SIZE, + properties.getRequestsScheduler().getMaxPoolSize()); + assertEquals(REQUESTS_SCHEDULER_QUEUE_SIZE, properties.getRequestsScheduler().getQueueSize()); + assertEquals(PTP_SCHEDULER_CORE_POOL_SIZE, properties.getPtpScheduler().getCorePoolSize()); + assertEquals(PTP_SCHEDULER_MAX_POOL_SIZE, properties.getPtpScheduler().getMaxPoolSize()); + assertEquals(PTP_SCHEDULER_QUEUE_SIZE, properties.getPtpScheduler().getQueueSize()); + assertEquals(PTG_SCHEDULER_CORE_POOL_SIZE, properties.getPtgScheduler().getCorePoolSize()); + assertEquals(PTG_SCHEDULER_MAX_POOL_SIZE, properties.getPtgScheduler().getMaxPoolSize()); + assertEquals(PTG_SCHEDULER_QUEUE_SIZE, properties.getPtgScheduler().getQueueSize()); + assertEquals(BOL_SCHEDULER_CORE_POOL_SIZE, properties.getBolScheduler().getCorePoolSize()); + assertEquals(BOL_SCHEDULER_MAX_POOL_SIZE, properties.getBolScheduler().getMaxPoolSize()); + assertEquals(BOL_SCHEDULER_QUEUE_SIZE, properties.getBolScheduler().getQueueSize()); + assertEquals(REQUESTS_PICKER_AGENT_DELAY, properties.getRequestsPickerAgent().getDelay()); + assertEquals(REQUESTS_PICKER_AGENT_INTERVAL, properties.getRequestsPickerAgent().getInterval()); + assertEquals(REQUESTS_PICKER_AGENT_MAX_FETCHED_SIZE, + properties.getRequestsPickerAgent().getMaxFetchedSize()); + assertEquals(SANITY_CHECK_ENABLED, properties.isSanityChecksEnabled()); + assertEquals(EXTRA_SLASHES_FOR_FILE_TURL, properties.getExtraslashes().getFile()); + assertEquals(EXTRA_SLASHES_FOR_RFIO_TURL, properties.getExtraslashes().getRfio()); + assertEquals(EXTRA_SLASHES_FOR_ROOT_TURL, properties.getExtraslashes().getRoot()); + assertEquals(EXTRA_SLASHES_FOR_GSIFTP_TURL, properties.getExtraslashes().getGsiftp()); + assertEquals(LS_DEFAULT_ALL_LEVEL_RECURSIVE, + properties.getSynchLs().isDefaultAllLevelRecursive()); + assertEquals(LS_DEFAULT_NUM_OF_LEVELS, properties.getSynchLs().getDefaultNumLevels()); + assertEquals(LS_DEFAULT_OFFSET, properties.getSynchLs().getDefaultOffset()); + assertEquals(LS_MAX_NUMBER_OF_ENTRY, properties.getSynchLs().getMaxEntries()); + assertEquals(PIN_LIFETIME_DEFAULT, properties.getPinlifetime().getDefaultValue()); + assertEquals(PIN_LIFETIME_MAXIMUM, properties.getPinlifetime().getMaximum()); + assertEquals(PTG_SKIP_ACL_SETUP, properties.isSkipPtgAclSetup()); + assertEquals(FILE_DEFAULT_SIZE, properties.getFiles().getDefaultSize()); + assertEquals(FILE_LIFETIME_DEFAULT, properties.getFiles().getDefaultLifetime()); + assertEquals(DEFAULT_OVERWRITE_MODE, properties.getFiles().getDefaultOverwrite()); + assertEquals(DEFAULT_FILE_STORAGE_TYPE, properties.getFiles().getDefaultStoragetype()); + assertEquals(AUTOMATIC_DIRECTORY_CREATION, + properties.getDirectories().isEnableAutomaticCreation()); + assertEquals(ENABLE_WRITE_PERM_ON_DIRECTORY, + properties.getDirectories().isEnableWritepermOnCreation()); + assertEquals(BOOK_KEEPING_ENABLED, properties.getHearthbeat().isBookkeepingEnabled()); + assertEquals(PERFORMANCE_MEASURING, properties.getHearthbeat().isPerformanceMeasuringEnabled()); + assertEquals(HEARTHBEAT_PERIOD, properties.getHearthbeat().getPeriod()); + assertEquals(PERFORMANCE_LOGBOOK_TIME_INTERVAL, + properties.getHearthbeat().getPerformanceLogbookTimeInterval()); + assertEquals(PERFORMANCE_GLANCE_TIME_INTERVAL, + properties.getHearthbeat().getPerformanceGlanceTimeInterval()); + assertEquals(GPFS_QUOTA_REFRESH_PERIOD, properties.getInfoQuotaRefreshPeriod()); + assertEquals(HTTP_TURL_PREFIX, properties.getHttpTurlPrefix()); + assertEquals(SERVER_POOL_STATUS_CHECK_TIMEOUT, properties.getServerPoolStatusCheckTimeout()); + assertEquals(MAX_LOOP, properties.getAbortMaxloop()); + assertEquals(PING_VALUES_PROPERTIES_FILENAME, properties.getPingPropertiesFilename()); + assertEquals(DEFAULT_SITENAME, properties.getSite().getName()); + assertEquals(DEFAULT_QUALITY_LEVEL, properties.getSite().getQualityLevel()); } @Test(expected = JsonMappingException.class) diff --git a/src/test/java/it/grid/storm/namespace/model/SAInfoTest.java b/src/test/java/it/grid/storm/namespace/model/SAInfoTest.java index cb33fda79..11b4478f4 100644 --- a/src/test/java/it/grid/storm/namespace/model/SAInfoTest.java +++ b/src/test/java/it/grid/storm/namespace/model/SAInfoTest.java @@ -11,14 +11,15 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import it.grid.storm.namespace.remote.Constants.HttpPerms; +import it.grid.storm.rest.info.storageareas.model.HttpPerms; +import it.grid.storm.rest.info.storageareas.model.SAInfo; public class SAInfoTest { private static final Logger log = LoggerFactory.getLogger(SAInfoTest.class); private static final String JSON_STRING = - "{\"name\":\"test.vo\",\"token\":\"TESTVO_TOKEN\",\"vos\":[\"test.vo\"],\"root\":\"/storage/test.vo\",\"storageClass\":\"T1D0\",\"accessPoints\":[\"/test.vo\"],\"retentionPolicy\":\"CUSTODIAL\",\"accessLatency\":\"ONLINE\",\"protocols\":[\"xroot\",\"webdav\"],\"anonymous\":\"NOREAD\",\"availableNearlineSpace\":20000000,\"approachableRules\":[\"Fake-DN-Matching-Rule\"]}"; + "{\"name\":\"test.vo\",\"token\":\"TESTVO_TOKEN\",\"vos\":[\"test.vo\"],\"rootPath\":\"/storage/test.vo\",\"storageClass\":\"T1D0\",\"accessPoints\":[\"/test.vo\"],\"retentionPolicy\":\"CUSTODIAL\",\"accessLatency\":\"ONLINE\",\"protocols\":[\"xroot\",\"webdav\"],\"anonymous\":\"NOREAD\",\"availableNearlineSpace\":20000000,\"approachableRules\":[\"Fake-DN-Matching-Rule\"]}"; private static final SAInfo saInfo; @@ -28,10 +29,10 @@ public class SAInfoTest { saInfo.setToken("TESTVO_TOKEN"); saInfo.addVo("test.vo"); saInfo.setRoot("/storage/test.vo"); - saInfo.setStorageClass("T1D0"); + saInfo.setStorageClass(StorageClassType.T1D0); saInfo.addAccessPoint("/test.vo"); - saInfo.setRetentionPolicy(RetentionPolicy.CUSTODIAL.getRetentionPolicyName()); - saInfo.setAccessLatency(AccessLatency.ONLINE.getAccessLatencyName()); + saInfo.setRetentionPolicy(RetentionPolicy.custodial); + saInfo.setAccessLatency(AccessLatency.online); saInfo.addProtocol("xroot"); saInfo.addProtocol("webdav"); saInfo.setAnonymous(HttpPerms.NOREAD); diff --git a/src/test/resources/storm.properties b/src/test/resources/storm.properties index a48195caf..08d3e9d86 100644 --- a/src/test/resources/storm.properties +++ b/src/test/resources/storm.properties @@ -103,3 +103,6 @@ abort_maxloop: 10 ping_properties_filename: ping-values.properties #unknown.property: test + +site.name: StoRM test +site.quality_level: PRODUCTION