Checkstyle cleanups
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 31 Dec 2007 10:01:30 +0000 (10:01 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Mon, 31 Dec 2007 10:01:30 +0000 (10:01 +0000)
Ensure macros are correctly populated in src before compilation

git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2509 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

build.properties
build.xml
src/edu/internet2/middleware/shibboleth/idp/session/ContainerSessionListener.java
src/edu/internet2/middleware/shibboleth/idp/session/impl/SessionManagerImpl.java

index 1ed6cbe..26e7c4e 100644 (file)
@@ -31,7 +31,8 @@ test-report.dir=${reports.dir}/unit-test
 \r
 # Directories for some build generated resources\r
 build.dir=${basedir}/build\r
-core-classes.dir=${build.dir}/core\r
+core-prep-source.dir=${build.dir}/core/src\r
+core-classes.dir=${build.dir}/core/classes\r
 test-classes.dir=${build.dir}/test\r
 test-results.dir=${build.dir}/test-results\r
 webinf-temp.dir=${build.dir}/WEB-INF\r
index b4efd1a..8e75bf3 100755 (executable)
--- a/build.xml
+++ b/build.xml
@@ -1,5 +1,5 @@
 <project name="Shibboleth Identity Provider" basedir="." default="install">
-       
+
        <!-- User based property file that overrides any property below -->
        <property file="${user.name}-build.properties" />
 
 
        <!-- Compile core (non-test) classes -->
        <target name="compile-core" depends="build-init, clean-compile">
+               <mkdir dir="${core-prep-source.dir}" />
                <mkdir dir="${core-classes.dir}" />
 
-               <javac srcdir="${core-src.dir}" destdir="${core-classes.dir}" includes="**/*.java" debug="on" source="1.5">
+               <copy todir="${core-prep-source.dir}" preservelastmodified="true">
+                       <fileset dir="${core-src.dir}" />
+                       <filterset begintoken="$" endtoken="$">
+                               <filter token="IDP_HOME" value="${idp.home}" />
+                               <filter token="IDP_VERSION" value="${version}" />
+                       </filterset>
+               </copy>
+
+               <javac srcdir="${core-prep-source.dir}" destdir="${core-classes.dir}" includes="**/*.java" debug="on" source="1.5">
                        <classpath refid="build-path" />
                </javac>
 
+               <delete dir="${core-prep-source.dir}" />
+               
        </target>
 
        <!-- Compile unit test classes -->
                <mkdir dir="${test-results.dir}" />
 
                <echo message="Excuting unit tests using endorsed directory ${java.endorsed.dirs}" />
-               <junit printsummary="off"
-                      fork="yes"
-                      forkmode="once"
-                      haltonerror="false"
-                      haltonfailure="false"
-                      dir="${basedir}"
-                      errorproperty="testFailed">
+               <junit printsummary="off" fork="yes" forkmode="once" haltonerror="false" haltonfailure="false" dir="${basedir}" errorproperty="testFailed">
                        <jvmarg value="-Djava.endorsed.dirs=${java.endorsed.dirs}" />
                        <classpath refid="test-path" />
                        <formatter type="xml" />
        <!-- Javadoc core (non-test) classes -->
        <target name="javadoc" description="Creates the JavaDoc documentatin for the project.">
                <mkdir dir="${javadoc.dir}" />
-               <javadoc packagenames="org.opensaml.*"
-                        sourcepath="${core-src.dir}"
-                        destdir="${javadoc.dir}"
-                        author="false"
-                        version="true"
-                        windowtitle="${ant.project.name} ${version} Java API"
-                        doctitle="${ant.project.name} ${version} Java API"
-                        bottom="${copyright}"
-                        overview="${core-src.dir}/overview.html">
+               <javadoc packagenames="org.opensaml.*" sourcepath="${core-src.dir}" destdir="${javadoc.dir}" author="false" version="true" windowtitle="${ant.project.name} ${version} Java API" doctitle="${ant.project.name} ${version} Java API" bottom="${copyright}" overview="${core-src.dir}/overview.html">
                        <classpath refid="build-path" />
                </javadoc>
        </target>
                        <fileset file="${dist.dir}/${jar.name}" />
                        <fileset file="${build-lib.dir}/servlet-2.4.jar" />
                </copy>
-               
+
                <if>
                        <available file="${idp.home}/conf" />
                        <then>
index 875669b..02f5061 100644 (file)
@@ -24,13 +24,11 @@ import edu.internet2.middleware.shibboleth.common.session.SessionManager;
 
 /**
  * A listener that listens for the destruction of {@link HttpSession}s. This allows the {@link SessionManager} to
- * appropriately destroy a shibboleth session whether the HTTP session is destroyed explicitly or through inactivity.
+ * appropriately destroy a Shibboleth session whether the HTTP session is destroyed explicitly or through inactivity.
  */
 public class ContainerSessionListener implements HttpSessionListener {
 
-    /**
-     * A no-op operation.
-     */
+    /** {@inheritDoc} */
     public void sessionCreated(HttpSessionEvent httpSessionEvent) {
         // we don't care about session creations
     }
index b6c52e0..0894a32 100644 (file)
@@ -37,50 +37,51 @@ public class SessionManagerImpl implements SessionManager<Session>, ApplicationC
 
     /** Spring context used to publish login and logout events. */
     private ApplicationContext appCtx;
-    
+
     /** Backing service used to store sessions. */
     private StorageService<String, SessionManagerEntry> sessionStore;
-    
+
     /** Parition in which entries are stored. */
     private String partition;
-    
+
     /** Lifetime, in milliseconds, of session. */
     private long sessionLifetime;
-    
+
     /**
      * Constructor.
-     *
+     * 
      * @param storageService service used to store sessions
      * @param lifetime lifetime, in milliseconds, of sessions
      */
-    public SessionManagerImpl(StorageService<String, SessionManagerEntry> storageService, long lifetime){
+    public SessionManagerImpl(StorageService<String, SessionManagerEntry> storageService, long lifetime) {
         sessionStore = storageService;
         partition = "session";
         sessionLifetime = lifetime;
     }
-    
+
     /**
      * Constructor.
-     *
+     * 
      * @param storageService service used to store session
      * @param storageParition partition in which sessions are stored
      * @param lifetime lifetime, in milliseconds, of sessions
      */
-    public SessionManagerImpl(StorageService<String, SessionManagerEntry> storageService, String storageParition, long lifetime){
+    public SessionManagerImpl(StorageService<String, SessionManagerEntry> storageService, String storageParition,
+            long lifetime) {
         sessionStore = storageService;
-        if(!DatatypeHelper.isEmpty(storageParition)){
+        if (!DatatypeHelper.isEmpty(storageParition)) {
             partition = DatatypeHelper.safeTrim(storageParition);
-        }else{
+        } else {
             partition = "session";
         }
         sessionLifetime = lifetime;
     }
-    
+
     /** {@inheritDoc} */
     public void setApplicationContext(ApplicationContext applicationContext) {
         appCtx = applicationContext;
     }
-    
+
     /** {@inheritDoc} */
     public Session createSession(InetAddress presenter, String principal) {
         Session session = new SessionImpl(presenter, principal);
@@ -92,77 +93,77 @@ public class SessionManagerImpl implements SessionManager<Session>, ApplicationC
 
     /** {@inheritDoc} */
     public void destroySession(String sessionID) {
-        if(sessionID == null){
+        if (sessionID == null) {
             return;
         }
-        
+
         SessionManagerEntry sessionEntry = sessionStore.get(partition, sessionID);
-        if(sessionEntry != null){
+        if (sessionEntry != null) {
             appCtx.publishEvent(new LogoutEvent(sessionEntry.getSession()));
         }
     }
 
     /** {@inheritDoc} */
     public Session getSession(String sessionID) {
-        if(sessionID == null){
+        if (sessionID == null) {
             return null;
         }
-        
+
         SessionManagerEntry sessionEntry = sessionStore.get(partition, sessionID);
-        if(sessionEntry == null){
+        if (sessionEntry == null) {
             return null;
         }
-        
-        if(sessionEntry.isExpired()){
+
+        if (sessionEntry.isExpired()) {
             destroySession(sessionEntry.getSessionId());
             return null;
-        }else{
+        } else {
             return sessionEntry.getSession();
         }
     }
-    
+
     /**
      * Session store entry.
      */
     public class SessionManagerEntry implements ExpiringObject {
-        
+
         /** User's session. */
         private Session userSession;
-        
+
         /** Manager that owns the session. */
         private SessionManager<Session> sessionManager;
-        
+
         /** Time this entry expires. */
         private DateTime expirationTime;
-        
+
         /**
          * Constructor.
-         *
+         * 
          * @param manager manager that owns the session
          * @param session user session
-         * @param sessionLifetime lifetime of session
+         * @param lifetime lifetime of session
          */
-        public SessionManagerEntry(SessionManager<Session> manager, Session session, long sessionLifetime){
+        public SessionManagerEntry(SessionManager<Session> manager, Session session, long lifetime) {
             sessionManager = manager;
             userSession = session;
-            expirationTime = new DateTime().plus(sessionLifetime);
+            expirationTime = new DateTime().plus(lifetime);
         }
-        
+
         /**
          * Gets the user session.
          * 
          * @return user session
          */
-        public Session getSession(){
+        public Session getSession() {
             return userSession;
         }
-        
+
         /**
          * Gets the ID of the user session.
          * 
          * @return ID of the user session
          */
-        public String getSessionId(){
+        public String getSessionId() {
             return userSession.getSessionID();
         }
 
@@ -175,7 +176,7 @@ public class SessionManagerImpl implements SessionManager<Session>, ApplicationC
         public boolean isExpired() {
             return expirationTime.isBeforeNow();
         }
-        
+
         /** {@inheritDoc} */
         public void onExpire() {
             sessionManager.destroySession(userSession.getSessionID());