<spring.version>4.3.1.RELEASE</spring.version>
<spring.security.version>4.1.1.RELEASE</spring.security.version>
<spring.security.oauth2.version>2.0.10.RELEASE</spring.security.oauth2.version>
+ <aspectj.version>1.7.4</aspectj.version>
</properties>
<distributionManagement>
</exclusion>
</exclusions>
</dependency>
+
+ <!-- AspectJ dependencies -->
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>${aspectj.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjtools</artifactId>
+ <version>${aspectj.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ <version>${aspectj.version}</version>
+ </dependency>
<!-- javax -->
<dependency>
--- /dev/null
+/**
+ * An AOP (AspectJ) aspect to resolve the timezone related issue https://issues.collectionspace.org/browse/DRYD-182.
+ *
+ * See related config in files: src/main/resources/META-INF/aop.xml, src/main/webapp/WEB-INF/applicationContext-security.xml
+ *
+ */
+package org.collectionspace.services.aspect;
+
+import java.util.Date;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Pointcut;
+
+@Aspect
+public class HyperJaxb3TimezoneAspect {
+
+ @Around("methodsToBeProfiled()")
+ public Object profile(ProceedingJoinPoint pjp) throws Throwable {
+ try {
+ Date fromDate = (Date)pjp.getArgs()[0];
+ XMLGregorianCalendar toDate = (XMLGregorianCalendar)pjp.getArgs()[1];
+
+ Object result = pjp.proceed();
+ //
+ // Marshal the timezone info from the 'fromDate' Date instance into the XMLGregorianCalendar 'toDate' instance
+ //
+ toDate.setTimezone(fromDate.getTimezoneOffset());
+
+ return result;
+ } finally {
+ // No cleanup needed.
+ }
+ }
+
+ /**
+ * Intercept all calls to the createCalendar() method of the XMLGregorianCalendarAsDateTime class. This is how HyperJaxb3 marshals datetime info from Hibernate/JPA into
+ * out AuthN/AuthZ class instances.
+ */
+ @Pointcut("execution(* org.jvnet.hyperjaxb3.xml.bind.annotation.adapters.XMLGregorianCalendarAsDateTime.createCalendar(java.util.Date, javax.xml.datatype.XMLGregorianCalendar))")
+ public void methodsToBeProfiled() {}
+}
\ No newline at end of file
--- /dev/null
+<!DOCTYPE aspectj PUBLIC
+ "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
+<aspectj>
+ <weaver>
+ <!-- only weave classes in our application-specific packages -->
+ <include within="org.jvnet.hyperjaxb3.xml.bind.annotation.adapters.*"/>
+ <include within="org.collectionspace.services.aspect.*"/>
+ </weaver>
+
+ <aspects>
+ <!-- weave in just this aspect -->
+ <aspect name="org.collectionspace.services.aspect.HyperJaxb3TimezoneAspect"/>
+ </aspects>
+</aspectj>
\ No newline at end of file
<bean id="userAttributeFilter"
class="org.collectionspace.authentication.spring.CSpaceUserAttributeFilter">
</bean>
+
+ <!-- Switches on the AOP (AspectJ) load-time weaving -->
+ <context:load-time-weaver/>
+
</beans>
<fileset dir="${basedir}/lib/spring"/>
</copy>
</target>
+
+ <target name="deploy_aspectj"
+ description="deploy AspectJ binaries in ${jee.server.cspace}">
+ <copy todir="${jee.server.cspace}/lib">
+ <fileset dir="${basedir}/lib/aspectj"/>
+ </copy>
+ </target>
<target name="deploy_slf4j"
description="deploy spring binaries in ${jee.server.cspace}">
<copy todir="${jee.server.cspace}/conf"
file="${src}/main/cspace/config/log/jboss-log4j-release.xml"/>
-->
+ <antcall target="deploy_aspectj" />
<antcall target="deploy_spring" />
<antcall target="deploy_slf4j" />
<antcall target="deploy_xmlmerge" />
<target name="undeploy"
description="undeploy common elements from ${jee.server.cspace}">
- <antcall target="undeploy_spring" />
+ <antcall target="undeploy_aspectj" />
+ <antcall target="undeploy_spring" />
<antcall target="undeploy_slf4j" />
<antcall target="undeploy_xmlmerge" />
<!--
</delete>
</target>
+ <target name="undeploy_aspectj"
+ description="undeploy AspectJ binaries from ${jee.server.cspace}">
+ <delete>
+ <fileset dir="${jee.server.cspace}/lib" includes="aspectj*-*.jar"/>
+ </delete>
+ </target>
+
<target name="undeploy_slf4j"
description="undeploy SLF4J binaries from ${jee.server.cspace}">
<delete>