-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EASY-2438: Convert to maven multi-module (#149)
* convert to maven multi-module * use DANS formatting * remove .idea folder
- Loading branch information
1 parent
f2ceef3
commit 61d642d
Showing
128 changed files
with
767 additions
and
490 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<!-- | ||
Copyright (C) 2015 DANS - Data Archiving and Networked Services ([email protected]) | ||
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. | ||
--> | ||
<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> | ||
|
||
<parent> | ||
<groupId>nl.knaw.dans.shared</groupId> | ||
<artifactId>dans-scala-app-project</artifactId> | ||
<version>5.1.0</version> | ||
<relativePath /> | ||
</parent> | ||
|
||
<groupId>nl.knaw.dans.easy</groupId> | ||
<artifactId>easy-stage-dataset</artifactId> | ||
<version>1.8.6-SNAPSHOT</version> | ||
|
||
<name>EASY Stage Dataset Command</name> | ||
<inceptionYear>2015</inceptionYear> | ||
|
||
<properties> | ||
<main-class>nl.knaw.dans.easy.stage.command.Command</main-class> | ||
<easy.licenses.version>1.0.5</easy.licenses.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>nl.knaw.dans.easy</groupId> | ||
<artifactId>easy-stage-dataset-lib</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.rogach</groupId> | ||
<artifactId>scallop_2.12</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<repositories> | ||
<repository> | ||
<id>dans-releases</id> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
<url>https://maven.dans.knaw.nl/releases/</url> | ||
</repository> | ||
<repository> | ||
<id>dans-snapshots</id> | ||
<releases> | ||
<enabled>false</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
<url>https://maven.dans.knaw.nl/snapshots/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>resources</id> | ||
<phase>generate-resources</phase> | ||
<goals> | ||
<goal>unpack</goal> | ||
</goals> | ||
<configuration> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>nl.knaw.dans.easy</groupId> | ||
<artifactId>easy-licenses</artifactId> | ||
<version>${easy.licenses.version}</version> | ||
<outputDirectory>${project.build.directory}/easy-licenses</outputDirectory> | ||
</artifactItem> | ||
</artifactItems> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>rpm</id> | ||
<activation> | ||
<activeByDefault>false</activeByDefault> | ||
<file> | ||
<exists>/usr/local/bin/rpm</exists> | ||
</file> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>rpm-maven-plugin</artifactId> | ||
<configuration> | ||
<group>Applications/Archiving</group> | ||
<mappings combine.children="append"> | ||
<mapping> | ||
<directory>/opt/${dans-provider-name}/${project.artifactId}/bin</directory> | ||
<filemode>755</filemode> | ||
<sources> | ||
<source> | ||
<location>src/main/assembly/dist/bin/easy-stage-file-item</location> | ||
</source> | ||
</sources> | ||
</mapping> | ||
<mapping> | ||
<directory>/etc/opt/${dans-provider-name}/${project.artifactId}/lic</directory> | ||
<configuration>${rpm-replace-configuration}</configuration> | ||
<sources> | ||
<source> | ||
<location>target/easy-licenses/licenses</location> | ||
</source> | ||
</sources> | ||
</mapping> | ||
</mappings> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...nd/src/main/scala/nl.knaw.dans.easy.stage.command/fileitem/EasyStageFileItemCommand.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* Copyright (C) 2015 DANS - Data Archiving and Networked Services ([email protected]) | ||
* | ||
* 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 nl.knaw.dans.easy.stage.command.fileitem | ||
|
||
import java.nio.file.Paths | ||
import java.sql.SQLException | ||
|
||
import com.yourmediashelf.fedora.client.FedoraClientException | ||
import nl.knaw.dans.easy.stage.command.Configuration | ||
import nl.knaw.dans.easy.stage.fileitem.{ EasyFilesAndFoldersImpl, EasyStageFileItem, FileItemSettings } | ||
import nl.knaw.dans.easy.stage.lib._ | ||
import nl.knaw.dans.lib.logging.DebugEnhancedLogging | ||
import resource._ | ||
|
||
import scala.util.{ Success, Try } | ||
|
||
object EasyStageFileItemCommand extends DebugEnhancedLogging { | ||
|
||
def main(args: Array[String]) { | ||
val configuration = Configuration(Paths.get(System.getProperty("app.home"))) | ||
val clo = new FileItemCommandLineOptions(args, configuration) | ||
Fedora.setFedoraConnectionSettings( | ||
configuration.properties.getString("fcrepo.url"), | ||
configuration.properties.getString("fcrepo.user"), | ||
configuration.properties.getString("fcrepo.password")) | ||
getSettingsRows(clo, configuration) | ||
.map(seqOfSettings => | ||
for (settings <- seqOfSettings; | ||
s <- settings) { | ||
EasyStageFileItem.run(s) | ||
.map(_ => logger.info(s"Staging SUCCESS of $settings")) | ||
.recover { case t: Throwable => | ||
logger.error(s"Staging FAIL of $settings", t) | ||
if (t.isInstanceOf[SQLException] || t.isInstanceOf[FedoraClientException]) return | ||
} | ||
}) | ||
.recover { case t: Throwable => logger.error(s"Staging FAIL of $clo with repo url ${ configuration.properties.getString("fcrepo.url") }", t) } | ||
} | ||
|
||
def getSettingsRows(clo: FileItemCommandLineOptions, configuration: Configuration): Try[Seq[ManagedResource[FileItemSettings]]] = { | ||
if (clo.datasetId.isDefined) | ||
Success( | ||
managed(new EasyFilesAndFoldersImpl( | ||
databaseUrl = configuration.properties.getString("db-connection-url"), | ||
databaseUser = configuration.properties.getString("db-connection-user"), | ||
databasePassword = configuration.properties.getString("db-connection-password"))) | ||
.map(FileItemApplySettings(clo, _)) :: Nil) | ||
else { | ||
val trailArgs = Seq(clo.sdoSetDir().toString) | ||
CSV(clo.csvFile(), clo.longOptionNames) | ||
.map { | ||
case (csv, warning) => | ||
for (w <- warning) | ||
logger.warn(w) | ||
|
||
val rows = csv.getRows | ||
if (rows.isEmpty) logger.warn("Empty CSV file") | ||
rows.map(options => { | ||
logger.info(s"Options: ${ options.mkString(" ") }") | ||
managed(new EasyFilesAndFoldersImpl( | ||
databaseUrl = configuration.properties.getString("db-connection-url"), | ||
databaseUser = configuration.properties.getString("db-connection-user"), | ||
databasePassword = configuration.properties.getString("db-connection-password"))) | ||
.map(FileItemApplySettings(new FileItemCommandLineOptions(options ++ trailArgs, configuration), _)) | ||
}) | ||
} | ||
} | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
command/src/main/scala/nl.knaw.dans.easy.stage.command/fileitem/FileItemApplySettings.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Copyright (C) 2015 DANS - Data Archiving and Networked Services ([email protected]) | ||
* | ||
* 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 nl.knaw.dans.easy.stage.command.fileitem | ||
|
||
import nl.knaw.dans.easy.stage.fileitem.{ EasyFilesAndFolders, FileItemSettings } | ||
import nl.knaw.dans.easy.stage.lib.FedoraRelationObject | ||
|
||
object FileItemApplySettings { | ||
/** new file or folder for an existing dataset */ | ||
def apply(conf: FileItemCommandLineOptions, easyFilesAndFolders: EasyFilesAndFolders) = | ||
new FileItemSettings( | ||
sdoSetDir = conf.sdoSetDir.toOption, | ||
file = conf.file.toOption, | ||
datastreamLocation = conf.dsLocation.toOption, | ||
size = conf.size.toOption, | ||
accessibleTo = conf.accessibleTo(), | ||
visibleTo = conf.visibleTo(), | ||
creatorRole = conf.creatorRole(), | ||
ownerId = conf.ownerId.toOption.map(_.trim).filter(_.nonEmpty), | ||
datasetId = conf.datasetId.toOption, | ||
pathInDataset = conf.pathInDataset.toOption, | ||
format = conf.format.toOption, | ||
subordinate = FedoraRelationObject(conf.datasetId()), | ||
easyFilesAndFolders = easyFilesAndFolders) { | ||
override def toString: String = conf.toString | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.