Skip to content

Commit

Permalink
Merge pull request #163 from futures/SpringShortcuts
Browse files Browse the repository at this point in the history
Spring shortcuts - looks good to me.
  • Loading branch information
barmintor committed Nov 22, 2013
2 parents 3937171 + 23ec317 commit 36125ff
Show file tree
Hide file tree
Showing 29 changed files with 202 additions and 236 deletions.
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:c="http://www.springframework.org/schema/c"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
Expand All @@ -12,18 +14,13 @@
<context:component-scan base-package="org.fcrepo.kernel.services" />

<bean name="modeshapeRepofactory" class="org.fcrepo.kernel.spring.ModeShapeRepositoryFactoryBean"
depends-on="authenticationProvider">
<property name="repositoryConfiguration" value="${fcrepo.modeshape.configuration:repository.json}" />
</bean>

<bean name="pep" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg value="org.fcrepo.auth.FedoraPolicyEnforcementPoint" />
</bean>

<bean name="authenticationProvider" class="org.fcrepo.auth.ServletContainerAuthenticationProvider">
<property name="pep" ref="pep"/>
</bean>
depends-on="authenticationProvider" p:repositoryConfiguration="${fcrepo.modeshape.configuration:repository.json}"/>

<bean name="pep" class="org.mockito.Mockito" factory-method="mock" c:classToMock="org.fcrepo.auth.FedoraPolicyEnforcementPoint"/>

<bean name="authenticationProvider" class="org.fcrepo.auth.ServletContainerAuthenticationProvider"
p:pep-ref="pep"/>

<bean class="org.modeshape.jcr.JcrRepositoryFactory" />

</beans>
13 changes: 6 additions & 7 deletions fcrepo-auth-common/src/test/resources/spring-test/repo.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
Expand All @@ -12,15 +13,13 @@
<context:component-scan base-package="org.fcrepo.kernel.services" />

<bean name="modeshapeRepofactory" class="org.fcrepo.kernel.spring.ModeShapeRepositoryFactoryBean"
depends-on="authenticationProvider">
<property name="repositoryConfiguration" value="${fcrepo.modeshape.configuration:repository.json}" />
</bean>

depends-on="authenticationProvider" p:repositoryConfiguration="${fcrepo.modeshape.configuration:repository.json}"/>

<bean name="pep" class="org.fcrepo.auth.integration.PermitRootAndPathEndsWithPermitSuffixPEP"/>

<bean name="authenticationProvider" class="org.fcrepo.auth.ServletContainerAuthenticationProvider">
<property name="pep" ref="pep"/>
</bean>
<bean name="authenticationProvider" class="org.fcrepo.auth.ServletContainerAuthenticationProvider"
p:pep-ref="pep"/>


<bean class="org.modeshape.jcr.JcrRepositoryFactory" />

Expand Down
2 changes: 1 addition & 1 deletion fcrepo-auth-common/src/test/resources/spring-test/rest.xml
Expand Up @@ -10,5 +10,5 @@
<!-- Mints PIDs-->
<bean class="org.fcrepo.kernel.identifiers.UUIDPidMinter"/>

<context:component-scan base-package="org.fcrepo.http, org.fcrepo.kernel.services, org.fcrepo.serialization" />
<context:component-scan base-package="org.fcrepo.http, org.fcrepo.kernel.services, org.fcrepo.serialization" />
</beans>
Expand Up @@ -2,19 +2,20 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:property-placeholder/>

<!-- show stack traces for easier debugging -->
<!-- <bean id="wildcardExceptionmapper" class="org.fcrepo.http.commons.exceptionhandlers.WildcardExceptionMapper" >
<!-- <bean id="wildcardExceptionmapper" class="org.fcrepo.http.commons.exceptionhandlers.WildcardExceptionMapper" >
<property name="showStackTrace" value="true" />
</bean> -->
<bean id="containerWrapper" class="org.fcrepo.http.commons.test.util.ContainerWrapper" init-method="start" destroy-method="stop" >
<property name="port" value="${test.port:8080}"/>
<property name="configLocation" value="classpath:web.xml" />
</bean>

<bean id="containerWrapper"
class="org.fcrepo.http.commons.test.util.ContainerWrapper"
init-method="start" destroy-method="stop" p:port="${test.port:8080}"
p:configLocation="classpath:web.xml"/>

</beans>
7 changes: 3 additions & 4 deletions fcrepo-auth-oauth/src/test/resources/spring-test/repo.xml
Expand Up @@ -2,6 +2,7 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
Expand All @@ -11,11 +12,9 @@
<context:annotation-config/>

<bean name="modeshapeRepofactory"
class="org.fcrepo.kernel.spring.ModeShapeRepositoryFactoryBean">
<property name="repositoryConfiguration" value="${fcrepo.modeshape.configuration:config/rest-sessions/repository.json}"/>
</bean>
class="org.fcrepo.kernel.spring.ModeShapeRepositoryFactoryBean"
p:repositoryConfiguration="${fcrepo.modeshape.configuration:config/rest-sessions/repository.json}"/>

<bean class="org.modeshape.jcr.JcrRepositoryFactory"/>


</beans>
31 changes: 15 additions & 16 deletions fcrepo-auth-oauth/src/test/resources/spring-test/security.xml
Expand Up @@ -2,34 +2,33 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:u="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

<!-- Context that supports the actual ModeShape JCR itself -->

<context:annotation-config/>

<bean name="oauthFilter" class="org.fcrepo.auth.oauth.filter.OAuthFilter">
<property name="realm" value="fedora"/>
<property name="provider">
<bean class="org.fcrepo.auth.oauth.DefaultOAuthResourceProvider">
<!-- mints JCR Sessions : needs to reappear here because it can't be autowired from the enclosed contexts-->
</bean>
</property>
<property name="parameterStyles">
<set
value-type="org.apache.oltu.oauth2.common.message.types.ParameterStyle">
<value>QUERY</value>
<value>HEADER</value>
</set>
</property>
<bean name="oauthFilter" class="org.fcrepo.auth.oauth.filter.OAuthFilter"
p:realm="fedora" p:provider-ref="defaultOAuthResourceProvider"
p:parameterStyles-ref="parameterStyles"/>

<bean id="defaultOAuthResourceProvider" class="org.fcrepo.auth.oauth.DefaultOAuthResourceProvider">
<!-- mints JCR Sessions : needs to reappear here because it can't be autowired from the enclosed contexts-->
</bean>

<u:set id="parameterStyles" value-type="org.apache.oltu.oauth2.common.message.types.ParameterStyle">
<value>QUERY</value>
<value>HEADER</value>
</u:set>

<bean name="wrapFilter"
class="org.fcrepo.auth.oauth.test.filter.AuthenticatedRequestWrappingFilter"/>


<bean name="authNFilter"
class="org.fcrepo.auth.oauth.filter.RestrictToAuthNFilter"/>

Expand Down
Expand Up @@ -2,14 +2,14 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:property-placeholder/>

<bean id="containerWrapper" class="org.fcrepo.http.commons.test.util.ContainerWrapper"
init-method="start" destroy-method="stop">
<property name="port" value="${test.port:8080}"/>
<property name="configLocation" value="classpath:web.xml"/>
</bean>
init-method="start" destroy-method="stop"
p:port="${test.port:8080}" p:configLocation="classpath:web.xml"/>

</beans>
Expand Up @@ -7,6 +7,7 @@
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">

<context:annotation-config />

<context:component-scan base-package="org.fcrepo.kernel.services" />

<task:scheduler id="taskScheduler" />
Expand Down

This file was deleted.

Expand Up @@ -3,6 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
Expand All @@ -20,9 +21,8 @@
<bean class="org.fcrepo.kernel.identifiers.UUIDPidMinter"/>

<util:list id="dcgenerators" value-type="org.fcrepo.generator.dublincore.DCGenerator">
<bean class="org.fcrepo.generator.dublincore.WellKnownDatastreamGenerator">
<property name="wellKnownDsid" value="DC"/>
</bean>
<bean class="org.fcrepo.generator.dublincore.WellKnownDatastreamGenerator"
p:wellKnownDsid="DC"/>
<bean class="org.fcrepo.generator.dublincore.JcrPropertiesGenerator"/>
</util:list>

Expand Down
23 changes: 11 additions & 12 deletions fcrepo-generator-dc/src/test/resources/spring-test/repo.xml
@@ -1,23 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<!-- Context that supports the actual ModeShape JCR itself -->
<!-- Context that supports the actual ModeShape JCR itself -->

<context:annotation-config/>
<context:annotation-config/>

<context:property-placeholder/>
<context:property-placeholder/>

<bean name="modeshapeRepofactory"
class="org.fcrepo.kernel.spring.ModeShapeRepositoryFactoryBean">
<property name="repositoryConfiguration" value="${fcrepo.modeshape.configuration:/config/rest-sessions/repository.json}"/>
</bean>
<bean name="modeshapeRepofactory"
class="org.fcrepo.kernel.spring.ModeShapeRepositoryFactoryBean"
p:repositoryConfiguration="${fcrepo.modeshape.configuration:/config/rest-sessions/repository.json}"/>


<bean class="org.modeshape.jcr.JcrRepositoryFactory"/>
<bean class="org.modeshape.jcr.JcrRepositoryFactory"/>

</beans>
Expand Up @@ -2,19 +2,18 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:property-placeholder/>

<!-- show stack traces for easier debugging -->
<bean id="wildcardExceptionmapper" class="org.fcrepo.http.commons.exceptionhandlers.WildcardExceptionMapper" >
<property name="showStackTrace" value="true" />
</bean>
<bean id="wildcardExceptionmapper" class="org.fcrepo.http.commons.exceptionhandlers.WildcardExceptionMapper"
p:showStackTrace="true"/>

<bean id="containerWrapper" class="org.fcrepo.http.commons.test.util.ContainerWrapper" init-method="start" destroy-method="stop" >
<property name="port" value="${test.port:8080}"/>
<property name="configLocation" value="classpath:web.xml" />
</bean>
<bean id="containerWrapper" class="org.fcrepo.http.commons.test.util.ContainerWrapper"
init-method="start" destroy-method="stop"
p:port="${test.port:8080}" p:configLocation="classpath:web.xml"/>

</beans>
8 changes: 4 additions & 4 deletions fcrepo-http-api/src/test/resources/spring-test/repo.xml
Expand Up @@ -2,6 +2,7 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
Expand All @@ -11,10 +12,9 @@
<context:annotation-config/>

<bean name="modeshapeRepofactory"
class="org.fcrepo.kernel.spring.ModeShapeRepositoryFactoryBean">
<property name="repositoryConfiguration" value="${fcrepo.modeshape.configuration:test_repository.json}"/>
</bean>
class="org.fcrepo.kernel.spring.ModeShapeRepositoryFactoryBean"
p:repositoryConfiguration="${fcrepo.modeshape.configuration:test_repository.json}"/>

<bean class="org.modeshape.jcr.JcrRepositoryFactory"/>

</beans>
Expand Up @@ -2,13 +2,15 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:property-placeholder/>

<bean id="containerWrapper" class="org.fcrepo.http.commons.test.util.ContainerWrapper" init-method="start" destroy-method="stop" >
<property name="port" value="${test.port:8080}"/>
<property name="configLocation" value="classpath:web.xml" />
</bean>
</beans>

<bean id="containerWrapper"
class="org.fcrepo.http.commons.test.util.ContainerWrapper"
init-method="start" destroy-method="stop" p:port="${test.port:8080}"
p:configLocation="classpath:web.xml"/>

</beans>
26 changes: 0 additions & 26 deletions fcrepo-jms/src/main/resources/spring/jms.xml

This file was deleted.

12 changes: 6 additions & 6 deletions fcrepo-jms/src/test/resources/spring-test/jms.xml
Expand Up @@ -2,21 +2,21 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<!-- Context that supports JMS publication-->

<context:annotation-config/>

<!-- publishes events from the internal bus to JMS, in Atom format -->
<bean class="org.fcrepo.jms.observer.JMSTopicPublisher"/>

<bean class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false&amp;broker.enableStatistics=false"/>
</bean>

<bean class="org.fcrepo.jms.legacy.LegacyMethodEventFactory" />
<bean class="org.apache.activemq.ActiveMQConnectionFactory"
p:brokerURL="vm://localhost?broker.persistent=false&amp;broker.useJmx=false&amp;broker.enableStatistics=false"/>

<bean class="org.fcrepo.jms.legacy.LegacyMethodEventFactory"/>

</beans>

0 comments on commit 36125ff

Please sign in to comment.