]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/SlcExecutionBuildListener.java
Simplify new runtime
[gpl/argeo-slc.git] / org.argeo.slc.agent / src / main / java / org / argeo / slc / ant / SlcExecutionBuildListener.java
index a8dd15c7d76f89ea5c8de3f8f672fee08458ef78..dcede31b346b88cd315f219e4ad3702b8ee17bed 100644 (file)
@@ -8,19 +8,15 @@ import org.apache.log4j.LogManager;
 import org.apache.log4j.spi.LoggingEvent;\r
 import org.apache.tools.ant.BuildEvent;\r
 import org.apache.tools.ant.Project;\r
-\r
 import org.argeo.slc.core.process.SlcExecution;\r
 import org.argeo.slc.core.process.SlcExecutionNotifier;\r
 import org.argeo.slc.core.process.SlcExecutionStep;\r
-import org.argeo.slc.core.process.WebServiceSlcExecutionNotifier;\r
+import org.argeo.slc.ws.process.WebServiceSlcExecutionNotifier;\r
+import org.springframework.context.ApplicationContext;\r
+import org.springframework.context.support.AbstractApplicationContext;\r
 \r
 public class SlcExecutionBuildListener extends AppenderSkeleton implements\r
                ProjectRelatedBuildListener {\r
-       public static final String ANT_TYPE = "org.apache.tools.ant";\r
-       public static final String SLC_ANT_TYPE = "org.argeo.slc.ant";\r
-\r
-       public static final String REF_SLC_EXECUTION = "slcExecution";\r
-\r
        private Project project;\r
 \r
        // to avoid stack overflow when logging for log4j\r
@@ -48,7 +44,7 @@ public class SlcExecutionBuildListener extends AppenderSkeleton implements
                }\r
 \r
                SlcExecution slcExecution = (SlcExecution) project\r
-                               .getReference(REF_SLC_EXECUTION);\r
+                               .getReference(SlcAntConstants.REF_SLC_EXECUTION);\r
                if (slcExecution == null)\r
                        throw new SlcAntException("No SLC Execution registered.");\r
 \r
@@ -70,6 +66,11 @@ public class SlcExecutionBuildListener extends AppenderSkeleton implements
                        notifier.updateStatus(slcExecution, oldStatus, slcExecution\r
                                        .getStatus());\r
                }\r
+\r
+//             AbstractApplicationContext context = (AbstractApplicationContext) getProject()\r
+//                             .getReference(SlcProjectHelper.REF_ROOT_CONTEXT);\r
+//             if (context != null)\r
+//                     context.close();\r
        }\r
 \r
        public void messageLogged(BuildEvent event) {\r
@@ -148,7 +149,7 @@ public class SlcExecutionBuildListener extends AppenderSkeleton implements
                                        + " not consistent with listener project " + project);\r
 \r
                SlcExecution slcExecution = (SlcExecution) project\r
-                               .getReference(REF_SLC_EXECUTION);\r
+                               .getReference(SlcAntConstants.REF_SLC_EXECUTION);\r
 \r
                if (slcExecution == null)\r
                        throw new SlcAntException("No SLC Execution registered.");\r
@@ -184,7 +185,8 @@ public class SlcExecutionBuildListener extends AppenderSkeleton implements
                        // avoid StackOverflow if notification calls Log4j itself.\r
                        return;\r
                }\r
-\r
+               \r
+               // FIXME: make it more generic\r
                if (event.getLoggerName().equals(\r
                                WebServiceSlcExecutionNotifier.class.getName())) {\r
                        return;\r
@@ -194,7 +196,7 @@ public class SlcExecutionBuildListener extends AppenderSkeleton implements
 \r
                try {\r
                        SlcExecution slcExecution = (SlcExecution) project\r
-                                       .getReference(REF_SLC_EXECUTION);\r
+                                       .getReference(SlcAntConstants.REF_SLC_EXECUTION);\r
                        if (slcExecution != null) {\r
                                if (currentStepNotified) {\r
                                        slcExecution.getSteps().add(\r