Skip to content

Commit

Permalink
Bunch of fixes and features
Browse files Browse the repository at this point in the history
Moved source to Java 11
Added NamespaceInfoEndpoint
  • Loading branch information
enricovianello committed Jan 26, 2022
1 parent 7f69cad commit 894a8bc
Show file tree
Hide file tree
Showing 83 changed files with 2,358 additions and 443 deletions.
74 changes: 60 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
<xercesImplVersion>2.12.1</xercesImplVersion>
<micrometerCoreVersion>1.6.6</micrometerCoreVersion>

<mockitoVersion>1.10.19</mockitoVersion>
<mockitoVersion>4.3.1</mockitoVersion>
<hamcrestVersion>1.3</hamcrestVersion>

<nativeInterfaceVersion>1.0.6</nativeInterfaceVersion>
<nativeInterfaceVersion>1.0.7</nativeInterfaceVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

</properties>
Expand All @@ -58,31 +58,48 @@

<plugins>

<!-- Enforce maven version -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.1.1</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>

<!-- Enable maven compiler plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgs>
<arg>-Xlint:deprecation</arg>
<arg>-Xlint:unchecked</arg>
</compilerArgs>
<release>11</release>
</configuration>
</plugin>

<!-- Enable maven surefire plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<version>3.0.0-M5</version>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<version>3.3.0</version>
<configuration>
<finalName>storm-backend-server</finalName>
<appendAssemblyId>false</appendAssemblyId>
Expand All @@ -104,7 +121,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<version>3.2.2</version>
<configuration>
<archive>
<manifest>
Expand Down Expand Up @@ -146,6 +163,12 @@
</exclusions>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>${jacksonVersion}</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -240,6 +263,12 @@
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>${jettisonVersion}</version>
<exclusions>
<exclusion>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -275,6 +304,10 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -343,6 +376,12 @@
<artifactId>xalan</artifactId>
<version>${xalanVersion}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -352,12 +391,13 @@
<scope>runtime</scope>
</dependency>

<dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<artifactId>mockito-core</artifactId>
<version>${mockitoVersion}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
Expand All @@ -381,6 +421,12 @@
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>${xercesImplVersion}</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
26 changes: 23 additions & 3 deletions src/main/java/it/grid/storm/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;

import org.apache.commons.configuration.ConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.DOMException;
import org.xml.sax.SAXException;

import it.grid.storm.config.Configuration;
import it.grid.storm.namespace.Namespace;
import it.grid.storm.namespace.NamespaceException;
import it.grid.storm.startup.Bootstrap;
import it.grid.storm.startup.BootstrapException;

Expand All @@ -17,23 +24,36 @@ public class Main {

public static final String DEFAULT_CONFIG_DIR = "/etc/storm/backend-server";
public static final String DEFAULT_CONFIG_FILE = DEFAULT_CONFIG_DIR + "/storm.properties";
public static final String DEFAULT_NAMESPACE_FILE = DEFAULT_CONFIG_DIR + "/namespace.xml";
public static final String DEFAULT_NAMESPACE_SCHEMA_FILE =
DEFAULT_CONFIG_DIR + "/namespace-1.5.0.xsd";
public static final String DEFAULT_LOGGING_FILE = DEFAULT_CONFIG_DIR + "/logging.xml";

private Main() {}

public static void main(String[] args) {

log.debug("Configure logging from {} ...", DEFAULT_LOGGING_FILE);
log.info("Configure logging from {} ...", DEFAULT_LOGGING_FILE);
Bootstrap.configureLogging(DEFAULT_LOGGING_FILE);
log.debug("Load configuration from {} ...", DEFAULT_CONFIG_FILE);

log.info("Load configuration from {} ...", DEFAULT_CONFIG_FILE);
try {
Configuration.init(DEFAULT_CONFIG_FILE);
} catch (IOException e) {
log.error(e.getMessage(), e);
exit(1);
}

StoRM storm = new StoRM(Configuration.getInstance());
log.info("Load namespace from {} ...", DEFAULT_NAMESPACE_FILE);
try {
Namespace.init(DEFAULT_NAMESPACE_FILE);
} catch (DOMException | ConfigurationException | ParserConfigurationException | SAXException
| IOException | NamespaceException e) {
log.error(e.getMessage(), e);
exit(1);
}

StoRM storm = new StoRM(Configuration.getInstance(), Namespace.getInstance());

try {
storm.init();
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/it/grid/storm/StoRM.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import it.grid.storm.health.HealthDirector;
import it.grid.storm.info.du.DiskUsageService;
import it.grid.storm.metrics.StormMetricsReporter;
import it.grid.storm.namespace.NamespaceDirector;
import it.grid.storm.namespace.NamespaceInterface;
import it.grid.storm.namespace.VirtualFSInterface;
import it.grid.storm.rest.RestServer;
Expand Down Expand Up @@ -93,10 +92,12 @@ public class StoRM {

private final Configuration config;
private final ReservedSpaceCatalog spaceCatalog;
private final NamespaceInterface namespace;

public StoRM(Configuration config) {
public StoRM(Configuration config, NamespaceInterface namespace) {

this.config = config;
this.namespace = namespace;
this.spaceCatalog = ReservedSpaceCatalog.getInstance();

this.picker = new AdvancedPicker();
Expand All @@ -122,8 +123,6 @@ public void init() throws BootstrapException {

configureMetricsReporting();

NamespaceDirector.init();

HealthDirector.initializeDirector();

loadPathAuthzDBConfiguration();
Expand Down Expand Up @@ -415,7 +414,6 @@ private void configureDiskUsageService() {
int delay = config.getDiskUsageServiceInitialDelay();
long period = config.getDiskUsageServiceTasksInterval();

NamespaceInterface namespace = NamespaceDirector.getNamespace();
List<VirtualFSInterface> quotaEnabledVfs = namespace.getVFSWithQuotaEnabled();
List<VirtualFSInterface> sas = namespace.getAllDefinedVFS()
.stream()
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/it/grid/storm/asynch/BoL.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import it.grid.storm.griduser.AbstractGridUser;
import it.grid.storm.griduser.GridUserInterface;
import it.grid.storm.namespace.InvalidSURLException;
import it.grid.storm.namespace.NamespaceDirector;
import it.grid.storm.namespace.Namespace;
import it.grid.storm.namespace.NamespaceException;
import it.grid.storm.namespace.StoRI;
import it.grid.storm.namespace.UnapprochableSurlException;
Expand Down Expand Up @@ -197,7 +197,7 @@ public void doIt() {

StoRI fileStoRI = null;
try {
fileStoRI = NamespaceDirector.getNamespace().resolveStoRIbySURL(surl, gu);
fileStoRI = Namespace.getInstance().resolveStoRIbySURL(surl, gu);
} catch (IllegalArgumentException e) {
log.error(
"Unable to build a stori for surl '{}' and user '{}'. " + "IllegalArgumentException: {}",
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/it/grid/storm/asynch/BoLFeeder.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,19 @@

package it.grid.storm.asynch;

import java.util.Collection;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import it.grid.storm.catalogs.BoLChunkCatalog;
import it.grid.storm.catalogs.RequestSummaryCatalog;
import it.grid.storm.griduser.GridUserInterface;
import it.grid.storm.namespace.InvalidDescendantsEmptyRequestException;
import it.grid.storm.namespace.InvalidDescendantsFileRequestException;
import it.grid.storm.namespace.InvalidDescendantsPathRequestException;
import it.grid.storm.namespace.InvalidSURLException;
import it.grid.storm.namespace.NamespaceDirector;
import it.grid.storm.namespace.Namespace;
import it.grid.storm.namespace.NamespaceException;
import it.grid.storm.namespace.StoRI;
import it.grid.storm.namespace.UnapprochableSurlException;
Expand All @@ -38,11 +43,6 @@
import it.grid.storm.srm.types.TSURL;
import it.grid.storm.synchcall.data.DataHelper;

import java.util.Collection;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This class represents a BringOnLine Feeder: the Feeder that will handle the srmBringOnLine
* statements. It chops a multifile request, and for each part it checks whether the dir option is
Expand Down Expand Up @@ -247,7 +247,7 @@ private void manageIsDirectory(BoLPersistentChunkData chunkData) {

StoRI stori = null;
try {
stori = NamespaceDirector.getNamespace().resolveStoRIbySURL(surl, gu);
stori = Namespace.getInstance().resolveStoRIbySURL(surl, gu);
} catch (IllegalArgumentException e) {
log.error(
"Unable to build a stori for surl {} for user {}. " + "IllegalArgumentException: {}",
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/it/grid/storm/asynch/PtG.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import it.grid.storm.griduser.LocalUser;
import it.grid.storm.namespace.InvalidGetTURLProtocolException;
import it.grid.storm.namespace.InvalidSURLException;
import it.grid.storm.namespace.NamespaceDirector;
import it.grid.storm.namespace.Namespace;
import it.grid.storm.namespace.NamespaceException;
import it.grid.storm.namespace.StoRI;
import it.grid.storm.namespace.TURLBuildingException;
Expand Down Expand Up @@ -142,7 +142,7 @@ public void doIt() {
try {
if (!downgradedToAnonymous && requestData instanceof IdentityInputData) {
try {
fileStoRI = NamespaceDirector.getNamespace()
fileStoRI = Namespace.getInstance()
.resolveStoRIbySURL(surl, ((IdentityInputData) requestData).getUser());
} catch (UnapprochableSurlException e) {
unapprochableSurl = true;
Expand All @@ -161,7 +161,7 @@ public void doIt() {
}
} else {
try {
fileStoRI = NamespaceDirector.getNamespace().resolveStoRIbySURL(requestData.getSURL());
fileStoRI = Namespace.getInstance().resolveStoRIbySURL(requestData.getSURL());
} catch (UnapprochableSurlException e) {
failure = true;
log.info("Unable to build a stori for surl {}. " + "UnapprochableSurlException: {}", surl,
Expand Down Expand Up @@ -198,7 +198,7 @@ public void doIt() {
} else {
if (requestData.getTransferProtocols().allows(Protocol.HTTP)) {
try {
fileStoRI = NamespaceDirector.getNamespace().resolveStoRIbySURL(requestData.getSURL());
fileStoRI = Namespace.getInstance().resolveStoRIbySURL(requestData.getSURL());
} catch (UnapprochableSurlException e) {
failure = true;
log.info("Unable to build a stori for surl {}. " + "UnapprochableSurlException: {}",
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/it/grid/storm/asynch/PtGFeeder.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@

package it.grid.storm.asynch;

import java.util.Collection;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import it.grid.storm.catalogs.PtGChunkCatalog;
import it.grid.storm.catalogs.RequestSummaryCatalog;
import it.grid.storm.namespace.InvalidDescendantsEmptyRequestException;
import it.grid.storm.namespace.InvalidDescendantsFileRequestException;
import it.grid.storm.namespace.InvalidDescendantsPathRequestException;
import it.grid.storm.namespace.InvalidSURLException;
import it.grid.storm.namespace.NamespaceDirector;
import it.grid.storm.namespace.Namespace;
import it.grid.storm.namespace.NamespaceException;
import it.grid.storm.namespace.StoRI;
import it.grid.storm.namespace.UnapprochableSurlException;
Expand All @@ -37,11 +42,6 @@
import it.grid.storm.srm.types.TSURL;
import it.grid.storm.synchcall.data.DataHelper;

import java.util.Collection;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This class represents a PrepareToGet Feeder: the Feeder that will handle the srmPrepareToGet
* statements. It chops a multifile request, and for each part it checks whether the dir option is
Expand Down Expand Up @@ -263,7 +263,7 @@ private void manageIsDirectory(PtGPersistentChunkData chunkData) {
/* Build StoRI for current chunk */
StoRI stori = null;
try {
stori = NamespaceDirector.getNamespace().resolveStoRIbySURL(surl, chunkData.getUser());
stori = Namespace.getInstance().resolveStoRIbySURL(surl, chunkData.getUser());
} catch (IllegalArgumentException e) {
log.error(
"Unable to build a stori for surl {} for user {}. " + "IllegalArgumentException: {}",
Expand Down
Loading

0 comments on commit 894a8bc

Please sign in to comment.