Skip to content

Commit

Permalink
#1251 Setup sword:deposit class
Browse files Browse the repository at this point in the history
  • Loading branch information
j3nsch committed Oct 24, 2024
1 parent 7e486b3 commit c783ecb
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 0 deletions.
1 change: 1 addition & 0 deletions application/configs/application.ini
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,7 @@ workflow.stateChange.published.addGuestAccess = 1
console.commandProvider[] = "Opus\DeepGreen\Console\DeepGreenCommandProvider"
console.commandProvider[] = "Opus\Search\Console\SearchCommandProvider"
console.commandProvider[] = "Opus\Bibtex\Import\Console\BibtexCommandProvider"
console.commandProvider[] = "Sword_Model_SwordCommandProvider"

; Staging, Testing and Development configurations =====================================================================

Expand Down
70 changes: 70 additions & 0 deletions modules/sword/models/DepositCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php

/**
* This file is part of OPUS. The software OPUS has been originally developed
* at the University of Stuttgart with funding from the German Research Net,
* the Federal Department of Higher Education and Research and the Ministry
* of Science, Research and the Arts of the State of Baden-Wuerttemberg.
*
* OPUS 4 is a complete rewrite of the original OPUS software and was developed
* by the Stuttgart University Library, the Library Service Center
* Baden-Wuerttemberg, the Cooperative Library Network Berlin-Brandenburg,
* the Saarland University and State Library, the Saxon State Library -
* Dresden State and University Library, the Bielefeld University Library and
* the University Library of Hamburg University of Technology with funding from
* the German Research Foundation and the European Regional Development Fund.
*
* LICENCE
* OPUS is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the Licence, or any later version.
* OPUS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright Copyright (c) 2024, OPUS 4 development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class Sword_Model_DepositCommand extends Command
{
public const ARGUMENT_SWORD_FILE = 'File';

protected function configure()
{
parent::configure();

$help = <<<EOT
Depositing OPUS 4 Sword package.
EOT;

$this->setName('sword:deposit')
->setDescription('Deposit Sword package')
->setHelp($help)
->addArgument(
self::ARGUMENT_SWORD_FILE,
InputArgument::REQUIRED,
'Sword package file'
);
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
// TODO get file path
// TODO check if file exists
// TODO get content type of file (ZIP/TAR supported)
// TODO pass file to SWORD import classes

// TODO generate output/debug output

return self::SUCCESS;
}
}
46 changes: 46 additions & 0 deletions modules/sword/models/SwordCommandProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* This file is part of OPUS. The software OPUS has been originally developed
* at the University of Stuttgart with funding from the German Research Net,
* the Federal Department of Higher Education and Research and the Ministry
* of Science, Research and the Arts of the State of Baden-Wuerttemberg.
*
* OPUS 4 is a complete rewrite of the original OPUS software and was developed
* by the Stuttgart University Library, the Library Service Center
* Baden-Wuerttemberg, the Cooperative Library Network Berlin-Brandenburg,
* the Saarland University and State Library, the Saxon State Library -
* Dresden State and University Library, the Bielefeld University Library and
* the University Library of Hamburg University of Technology with funding from
* the German Research Foundation and the European Regional Development Fund.
*
* LICENCE
* OPUS is free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the Licence, or any later version.
* OPUS is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details. You should have received a copy of the GNU General Public License
* along with OPUS; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright Copyright (c) 2024, OPUS 4 development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Common\Console\CommandProviderInterface;
use Symfony\Component\Console\Command\Command;

class Sword_Model_SwordCommandProvider implements CommandProviderInterface
{
/**
* @return Command[]
*/
public function getCommands()
{
return [
new Sword_Model_DepositCommand(),
];
}
}

0 comments on commit c783ecb

Please sign in to comment.