-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Crayfish-Commons a Symfony bundle only. (#49)
* Change to symfony/flex * Coder * Correct namespace for tests (#39) Restrict symfony versions Fix deprecation in test * Finalize Crayfish-Commons in Symfony 4.4 * Don't fail if no Apix-Ldp-Resource header * Remove check for master request
- Loading branch information
Showing
29 changed files
with
1,817 additions
and
1,389 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
.idea | ||
vendor | ||
.phpunit* | ||
clover.xml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Islandora\Crayfish\Commons; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class CrayfishCommonsBundle extends Bundle | ||
{ | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace Islandora\Crayfish\Commons\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
class Configuration implements ConfigurationInterface | ||
{ | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder('crayfish_commons'); | ||
$root = $treeBuilder->getRootNode(); | ||
$root->addDefaultsIfNotSet() | ||
->children() | ||
->scalarNode('fedora_base_uri')->cannotBeEmpty()->defaultValue('http://localhost:8080/fcrepo/rest')->end() | ||
->scalarNode('syn_config')->defaultValue(__DIR__ . '/../Resources/default_syn.xml')->end() | ||
->end(); | ||
|
||
return $treeBuilder; | ||
} | ||
} |
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,64 @@ | ||
<?php | ||
|
||
namespace Islandora\Crayfish\Commons\DependencyInjection; | ||
|
||
use Islandora\Chullo\IFedoraApi; | ||
use Islandora\Crayfish\Commons\Client\GeminiClient; | ||
use Islandora\Crayfish\Commons\CmdExecuteService; | ||
use Islandora\Crayfish\Commons\EntityMapper\EntityMapper; | ||
use Islandora\Crayfish\Commons\Syn\JwtAuthenticator; | ||
use Islandora\Crayfish\Commons\Syn\JwtFactory; | ||
use Islandora\Crayfish\Commons\Syn\JwtUserProvider; | ||
use Islandora\Crayfish\Commons\Syn\SettingsParser; | ||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; | ||
use Symfony\Component\Filesystem\Exception\IOException; | ||
use Symfony\Component\HttpKernel\DependencyInjection\Extension; | ||
|
||
class CrayfishCommonsExtension extends Extension | ||
{ | ||
|
||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$configuration = new Configuration(); | ||
|
||
$config = $this->processConfiguration($configuration, $configs); | ||
|
||
$loader = new YamlFileLoader( | ||
$container, | ||
new FileLocator(realpath(__DIR__ . '/../Resources/config')) | ||
); | ||
$loader->load('crayfish_commons.yaml'); | ||
|
||
if (!$container->has('Islandora\Crayfish\Commons\Syn\SettingsParser')) { | ||
if (file_exists($config['syn_config'])) { | ||
$xml = file_get_contents($config['syn_config']); | ||
} | ||
else { | ||
throw new IOException("Security configuration not found. ${config['syn_config']}"); | ||
} | ||
|
||
$container->register('Islandora\Crayfish\Commons\Syn\SettingsParser', SettingsParser::class) | ||
->setArgument('$xml', $xml); | ||
} | ||
|
||
if (!$container->has('Islandora\Crayfish\Commons\Syn\JwtUserProvider')) { | ||
$container->register('Islandora\Crayfish\Commons\Syn\JwtUserProvider', JwtUserProvider::class); | ||
} | ||
if (!$container->has('Islandora\Crayfish\Commons\Syn\JwtFactory')) { | ||
$container->register('Islandora\Crayfish\Commons\Syn\JwtFactory', JwtFactory::class); | ||
} | ||
if (!$container->has('Islandora\Crayfish\Commons\Syn\JwtAuthenticator')) { | ||
$container->register('Islandora\Crayfish\Commons\Syn\JwtAuthenticator', JwtAuthenticator::class) | ||
->setAutowired(true); | ||
} | ||
|
||
if (!$container->has('Islandora\Chullo\IFedoraApi')) { | ||
$container->register('Islandora\Chullo\IFedoraApi', IFedoraApi::class) | ||
->setFactory('Islandora\Chullo\FedoraApi::create') | ||
->setArgument('$fedora_rest_url', $config['fedora_base_uri']); | ||
$container->setAlias('Islandora\Chullo\FedoraApi', 'Islandora\Chullo\IFedoraApi'); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
services: | ||
_defaults: | ||
autowire: true | ||
autoconfigure: true | ||
public: true | ||
|
||
# These services rely on expected container available DI injections. | ||
# Other services are loaded in the CrayfishCommonsExtension class. | ||
Islandora\Crayfish\Commons\CmdExecuteService: ~ | ||
|
||
Islandora\Crayfish\Commons\EntityMapper\: | ||
resource: '../../EntityMapper/*' | ||
|
||
Islandora\Crayfish\Commons\ApixMiddleware: | ||
tags: | ||
- { name: kernel.event_subscriber, event: kernel.request } | ||
|
||
# Aliases, if the class has not yet been instantiated it will be | ||
# in CrayfishCommonsExtension class | ||
crayfish.cmd_execute_service: | ||
alias: Islandora\Crayfish\Commons\CmdExecuteService | ||
|
||
# Map the concrete class to the interface. | ||
Islandora\Crayfish\Commons\EntityMapper\EntityMapperInterface: '@Islandora\Crayfish\Commons\EntityMapper\EntityMapper' |
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,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Default Config --> | ||
<config version='1'> | ||
</config> |
Oops, something went wrong.