Skip to content

Commit

Permalink
dcache: Replaced org.dcache.util.list.DirectoryStream with java.nio.f…
Browse files Browse the repository at this point in the history
…ile.DirectoryStream

Motivation: Since java7 is already released for years, we can finally drop the custom interface and adopt it's JDK provided analogue

Modification: Removed org.dcache.util.list.DirectoryStream and replaced it with java.nio.file.DirectoryStream, adding a few catch clauses and generic type casts

Result: dcache now uses java.nio.file.DirectoryStream and org.dcache.util.list.DirectoryStream could be deleted

Fixes: #gh-issue
Ticket: dCache#3821
Target: master

Signed-off-by: JPOstholt <[email protected]>
  • Loading branch information
JPOstholt committed Feb 13, 2019
1 parent 690d7f9 commit db89517
Show file tree
Hide file tree
Showing 19 changed files with 2,021 additions and 1,072 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<archetype-descriptor
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
name="xrootd4j-channelhandler-plugin"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<requiredProperties>
<requiredProperty key="dcache">
<defaultValue>5.1.0-SNAPSHOT</defaultValue>
</requiredProperty>
<requiredProperty key="name">
<defaultValue>${package}.${artifactId}</defaultValue>
</requiredProperty>
<requiredProperty key="description"/>
</requiredProperties>
<fileSets>
<fileSet filtered="true" packaged="true" encoding="UTF-8">
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/assembly</directory>
<includes>
<include>**/*.xml</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/defaults</directory>
<includes>
<include>**/*.properties</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory></directory>
<includes>
<include>**/*.md</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8">
<directory></directory>
<includes>
<include>LICENSE.txt</include>
</includes>
</fileSet>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/resources</directory>
<includes>
<include>**/org.dcache.pool.nearline.spi.NearlineStorageProvider</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Nearline Storage Plugin for dCache
==================================

This is nearline storage plugin for dCache.

To compile the plugin, run:

mvn package

This produces a tarball in the `target` directory containing the plugin.

Using the plugin with dCache
----------------------------

To use this plugin with dCache, place the directory containing this
file in /usr/local/share/dcache/plugins/ on a dCache pool. Restart
the pool to load the plugin.

To verify that the plugin is loaded, navigate to the pool in the dCache admin
shell and issue the command:

hsm show providers

The plugin should be listed.

To activate the plugin, create an HSM instance using:

hsm create osm name ${name} [-key=value]...

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<packaging>jar</packaging>

<name>${description}</name>

<properties>
<version.dcache>${dcache}</version.dcache>
</properties>

<licenses>
<license>
<name>GNU Lesser General Public License 3</name>
<url>http://www.gnu.org/licenses/lgpl-3.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<repositories>
<repository>
<id>dcache.repository</id>
<url>https://download.dcache.org/nexus/content/groups/public</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.dcache</groupId>
<artifactId>dcache-nearline-spi</artifactId>
<version>${version.dcache}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/plugin.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<formats>
<format>dir</format>
<format>tar.gz</format>
</formats>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
<assembly>
<id>tarball</id>
<includeBaseDirectory>true</includeBaseDirectory>

<dependencySets>
<dependencySet>
<excludes>
<exclude>org.dcache:dcache-nearline-spi:*</exclude>
</excludes>
<useProjectArtifact>true</useProjectArtifact>
<useTransitiveFiltering>true</useTransitiveFiltering>
</dependencySet>
</dependencySets>

<fileSets>
<fileSet>
<includes>
<include>LICENSE*</include>
</includes>
</fileSet>
<fileSet>
<directory>src/main/docs</directory>
<outputDirectory></outputDirectory>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>src/main/defaults</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.properties</include>
</includes>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
${symbol_pound} This Java properties file contains the default values used by
${symbol_pound} the plugin.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Nearline Storage Plugin for dCache
==================================

This is nearline storage plugin for dCache.

Using the plugin with dCache
----------------------------

To use this plugin with dCache, place the directory containing this
file in /usr/local/share/dcache/plugins/ on a dCache pool. Restart
the pool to load the plugin.

To verify that the plugin is loaded, navigate to the pool in the dCache admin
shell and issue the command:

hsm show providers

The plugin should be listed.

To activate the plugin, create an HSM instance using:

hsm create osm name ${name} [-key=value]...

Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package};

import java.util.Map;
import java.util.UUID;

import org.dcache.pool.nearline.spi.FlushRequest;
import org.dcache.pool.nearline.spi.NearlineStorage;
import org.dcache.pool.nearline.spi.RemoveRequest;
import org.dcache.pool.nearline.spi.StageRequest;

public class PluginNearlineStorage implements NearlineStorage
{
protected final String type;
protected final String name;

public PluginNearlineStorage(String type, String name)
{
this.type = type;
this.name = name;
}

/**
* Flush all files in {@code requests} to nearline storage.
*
* @param requests
*/
@Override
public void flush(Iterable<FlushRequest> requests)
{
throw new UnsupportedOperationException("Not implemented");
}

/**
* Stage all files in {@code requests} from nearline storage.
*
* @param requests
*/
@Override
public void stage(Iterable<StageRequest> requests)
{
throw new UnsupportedOperationException("Not implemented");
}

/**
* Delete all files in {@code requests} from nearline storage.
*
* @param requests
*/
@Override
public void remove(Iterable<RemoveRequest> requests)
{
throw new UnsupportedOperationException("Not implemented");
}

/**
* Cancel any flush, stage or remove request with the given id.
* <p>
* The failed method of any cancelled request should be called with a
* CancellationException. If the request completes before it can be
* cancelled, then the cancellation should be ignored and the completed
* or failed method should be called as appropriate.
* <p>
* A call to cancel must be non-blocking.
*
* @param uuid id of the request to cancel
*/
@Override
public void cancel(UUID uuid)
{

}

/**
* Applies a new configuration.
*
* @param properties
* @throws IllegalArgumentException if the configuration is invalid
*/
@Override
public void configure(Map<String, String> properties) throws IllegalArgumentException
{

}

/**
* Cancels all requests and initiates a shutdown of the nearline storage
* interface.
* <p>
* This method does not wait for actively executing requests to
* terminate.
*/
@Override
public void shutdown()
{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package};

import java.util.Properties;

import org.dcache.pool.nearline.spi.NearlineStorage;
import org.dcache.pool.nearline.spi.NearlineStorageProvider;

public class PluginNearlineStorageProvider implements NearlineStorageProvider
{
@Override
public String getName()
{
return "${name}";
}

@Override
public String getDescription()
{
return "${description}";
}

@Override
public NearlineStorage createNearlineStorage(String type, String name)
{
return new PluginNearlineStorage(type, name);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
${package}.PluginNearlineStorageProvider
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package=org.dcache.it
version=0.1-SNAPSHOT
groupId=archetype.it
artifactId=basic
dcache=2.16.3
name=myplugin
description=My plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package
Loading

0 comments on commit db89517

Please sign in to comment.