+++ /dev/null
-#!/bin/sh
-
-#
-# To be overridden
-#
-TO=mathieu.baudier@gmail.com
-PROFILES=$1
-
-#
-# Code
-#
-BUILD_DIR=`pwd`
-HOSTNAME=`hostname -f`
-DATE=`date -u`
-EXIT_STATUS=0
-
-export MAVEN_OPTS=-Xmx256m
-export PATH=$PATH:/usr/local/bin
-
-# BUILD
-/usr/local/bin/mvn -up --fail-at-end deploy $PROFILES 2>&1 | tee deploy.log
-EXIT_STATUS=$PIPESTATUS
-if [ $EXIT_STATUS -eq 0 ]
-then
- mail -s "Build@$HOSTNAME SUCCESS - $DATE - $BUILD_DIR" $TO < pom.xml
-else
- mail -s "Build@$HOSTNAME FAILURE - $DATE - $BUILD_DIR" $TO < deploy.log
-fi
-
-# SDK
-#cd dist/org.argeo.slc.sdk
-#/usr/local/bin/mvn deploy
-#cd ../..
-
-# SITE
-/usr/local/bin/mvn -up --fail-at-end site-deploy $PROFILES 2>&1 | tee siteGeneration.log
-if [ $PIPESTATUS -eq 0 ]
-then
- echo No need to send email for successful site generation
-else
- mail -s "SiteGeneration@$HOSTNAME FAILURE - $DATE - $BUILD_DIR" $TO < siteGeneration.log
-fi
-
-
-exit $EXIT_STATUS
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>>>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.it.jackrabbit</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-#Sat Feb 11 18:14:08 CET 2012
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+++ /dev/null
-#Sat Feb 11 18:14:08 CET 2012
-eclipse.preferences.version=1
-pluginProject.extensions=false
-resolve.requirebundle=false
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Jackrabbit
-Bundle-SymbolicName: org.argeo.slc.it.jackrabbit
-Bundle-Version: 1.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+++ /dev/null
-source.. = src/main/java/
-output.. = target/classes/
-bin.includes = META-INF/,\
- .
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.it.webapp</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-#Tue Jun 02 18:41:08 CEST 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: SLC Integration Tests
-Bundle-SymbolicName: org.argeo.slc.it.webapp
-Bundle-Version: 0.13.1.SNAPSHOT
-Import-Package: junit.framework;version="3.8.2",
- org.argeo.slc,
- org.argeo.slc.msg,
- org.argeo.slc.runtime,
- org.argeo.slc.server,
- org.argeo.slc.server.client,
- org.argeo.slc.server.unit
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>integration-tests</artifactId>
- <version>0.13.1-SNAPSHOT</version>
- </parent>
- <groupId>org.argeo.slc.it</groupId>
- <artifactId>org.argeo.slc.it.webapp</artifactId>
- <packaging>jar</packaging>
- <name>SLC Integration Tests Web Application</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.argeo.maven.plugins</groupId>
- <artifactId>maven-argeo-osgi-plugin</artifactId>
- <version>${version.maven-argeo-osgi}</version>
- <configuration>
- <useDependencies>false</useDependencies>
- <argsToAppend>
- <arg>-clean</arg>
- </argsToAppend>
- <systemProperties>
- <argeo.osgi.bundles>
- ${basedir}/../../demo/site;in=*;ex=target;ex=pom.xml;ex=.*,
- ${project.build.directory}/lib;in=*.jar,
- </argeo.osgi.bundles>
- <!-- <argeo.osgi.bundles> ${basedir}/../../demo/site;in=*;ex=target;ex=pom.xml;ex=.*,
- ${basedir}/../../modules/server;in=*;ex=target;ex=pom.xml;ex=.*, ${basedir}/../../modules/agent;in=*;ex=target;ex=pom.xml;ex=.*
- </argeo.osgi.bundles> -->
-
- <argeo.osgi.start>
- org.springframework.osgi.extender,
- org.argeo.slc.server.main,
- org.argeo.slc.server.h2,
- org.argeo.slc.server.hibernate,
- org.argeo.slc.ria,
- org.argeo.slc.agent,
- org.argeo.slc.agent.jms,
- org.argeo.slc.demo.minimal,
- org.argeo.slc.demo.basic,
- org.argeo.slc.demo.ant
- </argeo.osgi.start>
- <argeo.server.port.http>7080</argeo.server.port.http>
- </systemProperties>
- </configuration>
- <executions>
- <execution>
- <id>equinox-start</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>equinox</goal>
- </goals>
- <configuration>
- <wait>false</wait>
- </configuration>
- </execution>
- <execution>
- <id>equinox-shutdown</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>equinox-shutdown</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skipTests>true</skipTests>
- </configuration>
- <executions>
- <execution>
- <id>surefire-it</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skipTests>false</skipTests>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>process-resources</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <includeTypes>jar</includeTypes>
- <outputDirectory>${project.build.directory}/lib</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifestFile>META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.argeo.slc.dep</groupId>
- <artifactId>org.argeo.slc.dep.sdk.rcp</artifactId>
- <version>${version.slc}</version>
- </dependency>
- <!-- Unit Tests -->
- <dependency>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.unit</artifactId>
- <scope>test</scope>
- <version>${version.slc}</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.argeo.slc.ws;
-
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createMinimalConsistentTreeTestResult;
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartError;
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartFailed;
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartPassed;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.core.test.SimpleResultPart;
-import org.argeo.slc.core.test.tree.TreeTestResult;
-import org.argeo.slc.msg.process.SlcExecutionRequest;
-import org.argeo.slc.msg.process.SlcExecutionStatusRequest;
-import org.argeo.slc.msg.process.SlcExecutionStepsRequest;
-import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;
-import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;
-import org.argeo.slc.msg.test.tree.ResultPartRequest;
-import org.argeo.slc.process.SlcExecution;
-import org.argeo.slc.process.SlcExecutionStep;
-import org.argeo.slc.unit.AbstractSpringTestCase;
-import org.argeo.slc.unit.process.SlcExecutionTestUtils;
-import org.springframework.ws.client.core.WebServiceTemplate;
-
-public class ScenarioWsIntegrationTest extends AbstractSpringTestCase {
- private Log log = LogFactory.getLog(getClass());
-
- private WebServiceTemplate template;
-
- public void setUp() {
- template = getBean(WebServiceTemplate.class);
- }
-
- public void testSinglePathScenario() {
- // Create SLC execution
- SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution();
- log.info("Send create SlcExecutionRequest for SlcExecution #"
- + slcExec.getUuid());
- template.marshalSendAndReceive(new SlcExecutionRequest(slcExec));
-
- // Add SLC execution step
- SlcExecutionStep step = new SlcExecutionStep("JUnit step");
- slcExec.getSteps().add(step);
- log.info("Send SlcExecutionStepsRequest for SlcExecution #"
- + slcExec.getUuid());
- template.marshalSendAndReceive(new SlcExecutionStepsRequest(slcExec
- .getUuid(), step));
-
- // Create test result
- TreeTestResult ttr = createMinimalConsistentTreeTestResult(slcExec);
- ttr.addResultPart(createSimpleResultPartPassed());
- log.info("Send CreateTreeTestResultRequest for result #"
- + ttr.getUuid());
- template.marshalSendAndReceive(new CreateTreeTestResultRequest(ttr));
-
- // Add failed part
- SimpleResultPart failedPart = createSimpleResultPartFailed();
- ttr.addResultPart(failedPart);
- log.info("Send ResultPartRequest for result #" + ttr.getUuid());
- template.marshalSendAndReceive(new ResultPartRequest(ttr, null,
- failedPart));
-
- // Add error part
- SimpleResultPart errorPart = createSimpleResultPartError();
- ttr.addResultPart(errorPart);
- log.info("Send ResultPartRequest for result #" + ttr.getUuid());
- template.marshalSendAndReceive(new ResultPartRequest(ttr, null,
- errorPart));
-
- // Close result
- ttr.close();
- log
- .info("Send CloseTreeTestResultRequest for result #"
- + ttr.getUuid());
- template.marshalSendAndReceive(new CloseTreeTestResultRequest(ttr
- .getUuid(), ttr.getCloseDate()));
-
- // Notify SLC execution FINISHED
- slcExec.setStatus(SlcExecution.STATUS_FINISHED);
- log.info("Send SlcExecutionStatusRequest for SlcExecution #"
- + slcExec.getUuid());
- template.marshalSendAndReceive(new SlcExecutionStatusRequest(slcExec
- .getUuid(), slcExec.getStatus()));
- }
-
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-package org.argeo.slc.ws;\r
-\r
-import org.argeo.slc.ant.unit.MinimalAntClasspathTestCase;\r
-\r
-public class SlcAntWsIntegrationTest extends MinimalAntClasspathTestCase {\r
- public void testSimpleRun() {\r
- execute("/org/argeo/slc/ant/build.xml");\r
- }\r
-\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.argeo.slc.ws;
-
-import java.util.List;
-import java.util.Vector;
-
-import org.springframework.ws.client.core.WebServiceTemplate;
-import org.springframework.ws.soap.client.SoapFaultClientException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.argeo.slc.msg.process.SlcExecutionRequest;
-import org.argeo.slc.msg.process.SlcExecutionStatusRequest;
-import org.argeo.slc.msg.process.SlcExecutionStepsRequest;
-import org.argeo.slc.process.SlcExecution;
-import org.argeo.slc.process.SlcExecutionStep;
-import org.argeo.slc.unit.AbstractSpringTestCase;
-import org.argeo.slc.unit.process.SlcExecutionTestUtils;
-import org.argeo.slc.ws.client.WebServiceUtils;
-
-public class SlcExecutionWsIntegrationTest extends AbstractSpringTestCase {
- private Log log = LogFactory.getLog(getClass());
-
- private WebServiceTemplate template;
-
- public void setUp() {
- template = getBean(WebServiceTemplate.class);
- }
-
- public void testSlcExecutionRequests() {
- SlcExecution slcExec = createAndSendSlcExecution();
-
- slcExec.setUser("otherUser");
- log.info("Send update SlcExecutionRequest for SlcExecution #"
- + slcExec.getUuid());
- template.marshalSendAndReceive(new SlcExecutionRequest(slcExec));
- }
-
- public void testSlcExecutionStatusRequest() {
- SlcExecution slcExec = createAndSendSlcExecution();
-
- slcExec.setStatus(SlcExecution.STATUS_FINISHED);
- log.info("Send SlcExecutionStatusRequest for SlcExecution #"
- + slcExec.getUuid());
- template.marshalSendAndReceive(new SlcExecutionStatusRequest(slcExec
- .getUuid(), slcExec.getStatus()));
- }
-
- public void testSendSlcExecutionStepRequest() {
- SlcExecution slcExec = createAndSendSlcExecution();
-
- SlcExecutionStep step1 = new SlcExecutionStep(
- "Logline\nAnother log line.");
- SlcExecutionStep step2 = new SlcExecutionStep(
- "Logline2\nAnother log line2.");
- List<SlcExecutionStep> steps = new Vector<SlcExecutionStep>();
- steps.add(step1);
- steps.add(step2);
-
- log.info("Send SlcExecutionStepsRequest for SlcExecution #"
- + slcExec.getUuid());
- try {
- template.marshalSendAndReceive(new SlcExecutionStepsRequest(slcExec
- .getUuid(), steps));
- } catch (SoapFaultClientException e) {
- WebServiceUtils.manageSoapException(e);
- throw e;
- }
- }
-
- protected SlcExecution createAndSendSlcExecution() {
- SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution();
-
- log.info("Send create SlcExecutionRequest for SlcExecution #"
- + slcExec.getUuid());
- template.marshalSendAndReceive(new SlcExecutionRequest(slcExec));
- return slcExec;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.argeo.slc.ws;
-
-import org.springframework.ws.client.core.WebServiceTemplate;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult;
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartRequest;
-
-import org.argeo.slc.core.test.tree.TreeTestResult;
-import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;
-import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;
-import org.argeo.slc.msg.test.tree.ResultPartRequest;
-import org.argeo.slc.unit.AbstractSpringTestCase;
-
-public class TreeTestResultWsIntegrationTest extends AbstractSpringTestCase {
- private Log log = LogFactory.getLog(getClass());
-
- private WebServiceTemplate template;
-
- public void setUp() {
- template = getBean(WebServiceTemplate.class);
- }
-
- public void testCreateTreeTestResultRequest() {
- createAndSendTreeTestResult(true);
- }
-
- public void testResultPartRequest() {
- TreeTestResult ttr = createAndSendTreeTestResult(true);
-
- ResultPartRequest req = createSimpleResultPartRequest(ttr);
-
- log.info("Send ResultPartRequest for result " + req.getResultUuid());
- template.marshalSendAndReceive(req);
- }
-
- public void testCloseTreeTestResultRequest() {
- TreeTestResult ttr = createAndSendTreeTestResult(false);
-
- ttr.close();
- CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(ttr
- .getUuid(), ttr.getCloseDate());
- log.info("Send CloseTreeTestResultRequest for result "
- + req.getResultUuid());
- template.marshalSendAndReceive(req);
- }
-
- protected TreeTestResult createAndSendTreeTestResult(boolean close) {
- TreeTestResult ttr = createCompleteTreeTestResult();
- log.info("Send CreateTreeTestResultRequest for result #"
- + ttr.getUuid());
- template.marshalSendAndReceive(new CreateTreeTestResultRequest(ttr));
-
- if (close)
- ttr.close();
- return ttr;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.argeo.slc.it.webapp;
-
-import java.net.InetAddress;
-
-import org.argeo.slc.runtime.SlcAgentDescriptor;
-import org.argeo.slc.server.unit.AbstractHttpClientTestCase;
-
-public class AgentTest extends AbstractHttpClientTestCase {
- public void testListAgents() throws Exception {
- SlcAgentDescriptor slcAgentDescriptor = getHttpClient()
- .waitForOneAgent();
- assertEquals(InetAddress.getLocalHost().getHostName(),
- slcAgentDescriptor.getHost());
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.argeo.slc.it.webapp;
-
-import org.argeo.slc.Condition;
-import org.argeo.slc.msg.ObjectList;
-import org.argeo.slc.server.client.SlcServerHttpClient;
-import org.argeo.slc.server.unit.AbstractHttpClientTestCase;
-
-public class SimpleScenarioTest extends AbstractHttpClientTestCase {
- public void testSimpleScenario() throws Exception {
- String moduleName = "org.argeo.slc.demo.basic";
- getHttpClient().startFlowDefault(moduleName, "main", null);
-
- getHttpClient().callServiceSafe(SlcServerHttpClient.LIST_RESULTS, null,
- new Condition<ObjectList>() {
-
- public Boolean check(ObjectList obj) {
- return obj.getObjects().size() == 3;
- }
- }, null);
-
- getHttpClient().callServiceSafe(SlcServerHttpClient.LIST_RESULTS, null,
- new Condition<ObjectList>() {
-
- public Boolean check(ObjectList obj) {
- return obj.getObjects().size() == 3;
- }
- }, null);
- }
-}
+++ /dev/null
-<!--\r
-\r
- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-\r
-<project default="test">\r
-\r
- <target name="test">\r
- <echo message="Hello World!" />\r
-\r
- <slc.test>\r
- <testDefinition bean="testDef" />\r
- <testData bean="testData1" />\r
- </slc.test>\r
-\r
- <slc.test>
- <testDefinition bean="testDef" />
- <testData bean="testData.context1" />
- </slc.test>
-
- <slc.test path="/testRoot/testContext">
- <testDefinition bean="testDef" />
- <testData bean="testData.context1" />
- </slc.test>
-
- <slc.closeResult>
- <result bean="testResult" />
- </slc.closeResult>\r
- </target>\r
-</project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-\r
- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <import\r
- resource="classpath:/org/argeo/slc/core/test/spring/applicationContext.xml" />\r
-\r
- <bean name="testDef"\r
- class="org.argeo.slc.core.test.BasicTestDefinition" scope="prototype" />\r
-\r
- <bean name="testData1"\r
- class="org.argeo.slc.core.test.BasicTestData">\r
- <property name="expected">\r
- <value>toto</value>\r
- </property>\r
- <property name="reached">\r
- <value>toto</value>\r
- </property>\r
- </bean>\r
-\r
- <bean id="testData.context1" parent="context.template">\r
- <property name="values">\r
- <map>\r
- <entry key="reference" value="20" />\r
- <entry key="varIntern" value="60" />\r
- </map>\r
- </property>\r
- <property name="expectedValues">\r
- <map>\r
- <entry key="reference" value="21" />\r
- <entry key="varIntern" value="60" />\r
- </map>\r
- </property>\r
- </bean>\r
-\r
- <bean id="context.template"\r
- class="org.argeo.slc.core.test.context.DefaultContextTestData"\r
- abstract="true">\r
- </bean>\r
-\r
-</beans>
\ No newline at end of file
+++ /dev/null
-<!--
-
- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <import
- resource="classpath:/org/argeo/slc/ws/client/spring/applicationContext.xml" />
- <import resource="classpath:/org/argeo/slc/ant/nonDepContext.xml" />
-
- <bean name="executionBuildListener"
- class="org.argeo.slc.ant.SlcExecutionBuildListener">
- <property name="notifiers">
- <list>
- <ref bean="slcDefault.ws.client.slcExecutionNotifier" />
- </list>
- </property>
- </bean>
-
- <bean id="testResult"
- parent="slcDefault.test.basicTreeTestResult">
- <property name="listeners">
- <list merge="true">
- <ref
- bean="slcDefault.ws.client.treeTestResultWsNotfier" />
- </list>
- </property>
- </bean>
-</beans>
+++ /dev/null
-log4j.rootLogger=WARN, console\r
-\r
-## Levels\r
-# SLC\r
-log4j.logger.org.argeo=DEBUG\r
-\r
-## Appenders\r
-# A1 is set to be a ConsoleAppender.\r
-log4j.appender.console=org.apache.log4j.ConsoleAppender\r
-\r
-# A1 uses PatternLayout.\r
-log4j.appender.console.layout=org.apache.log4j.PatternLayout\r
-log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n\r
-\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="true">
-
- <import resource="classpath:org/argeo/slc/server/client/spring.xml" />
-
- <!-- Http client -->
- <bean id="serverHttpClient" parent="slcTemplate.serverHttpClient">
- <property name="baseUrl" value="http://localhost:7080/org.argeo.slc.webapp/" />
- </bean>
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>argeo-slc</artifactId>
- <version>0.13.1-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>integration-tests</artifactId>
- <packaging>pom</packaging>
- <name>SLC Integration Tests</name>
- <profiles>
- <profile>
- <id>withIT</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>org.argeo.slc.it.webapp</module>
- </modules>
- </profile>
- <profile>
- <id>withoutIT</id>
- </profile>
- </profiles>
-</project>
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>modules</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>org.argeo.slc.agent.ext.jdbc</artifactId>
- <name>SLC Agent JDBC Extension</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Fragment-Host>org.springframework.jdbc</Fragment-Host>
- <Import-Package>
- *,
- com.mysql.jdbc;resolution:=optional,
- net.sourceforge.jtds.jdbc;resolution:=optional,
- org.hsqldb;resolution:=optional
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>modules</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>org.argeo.slc.agent.ext.xalan</artifactId>
- <name>SLC Agent Xalan Extension</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Fragment-Host>org.argeo.slc.agent.ext.xalan</Fragment-Host>
- <Import-Package>
- *,
- com.sun.org.apache.xml.internal.dtm;resolution:=optional,
- org.w3c.dom.traversal;resolution:=optional
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.agent.jms</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="false">
-
- <bean
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
- <property name="locations">
- <value>osgibundle:agent.properties</value>
- </property>
- </bean>
-
- <bean id="treeTestResultLogger" class="org.argeo.slc.core.test.tree.TreeTestResultLogger" />
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="false">
-
- <import resource="classpath:org/argeo/slc/castor/spring.xml" />
- <import resource="classpath:org/argeo/slc/activemq/destinations.xml" />
-
- <!-- Agent implementation -->
- <bean id="jmsAgent" class="org.argeo.slc.jms.JmsAgent"
- init-method="init" destroy-method="dispose">
- <property name="agentRegister" ref="slcJms.destination.agent.register" />
- <property name="agentUnregister" ref="slcJms.destination.agent.unregister" />
- <property name="modulesManager" ref="modulesManager" />
- <property name="responseDestination" ref="slcJms.destination.agent.response" />
- <property name="jmsTemplate" ref="jmsTemplate" />
- </bean>
-
- <!-- Listeners -->
- <bean id="jmsAgent.listener.request" parent="listenerTemplate">
- <property name="destination" ref="slcJms.destination.agent.request" />
- <property name="messageSelector">
- <bean factory-bean="jmsAgent" factory-method="getMessageSelector" />
- </property>
- </bean>
-
- <bean id="jmsAgent.listener.pingAll" parent="listenerTemplate">
- <property name="destination" ref="slcJms.destination.agent.pingAll" />
- <property name="messageListener" ref="jmsAgent" />
- </bean>
-
- <!-- Services -->
- <bean id="resultListener" class="org.argeo.slc.jms.JmsTreeTestResultListener">
- <property name="executionEventDestination" ref="slcJms.destination.execution.event" />
- <property name="onlyOnClose" value="${slc.agent.jms.resultListener.onlyOnClose}" />
- <property name="jmsTemplate" ref="jmsTemplate" />
- </bean>
- <bean id="attachmentUploader" class="org.argeo.slc.jms.JmsAttachmentUploader">
- <property name="destination" ref="slcJms.destination.attachment.add" />
- <property name="jmsTemplate" ref="jmsTemplate" />
- </bean>
- <bean id="slcExecutionListener" class="org.argeo.slc.jms.JmsSlcExecutionNotifier">
- <property name="executionEventDestination" ref="slcJms.destination.execution.event" />
- <property name="jmsTemplate" ref="jmsTemplate" />
- </bean>
-
- <!-- JMS -->
- <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
- <property name="messageConverter">
- <bean class="org.argeo.slc.jms.MarshallerMessageConverter">
- <property name="disableMarshalling" value="${slc.agent.jms.disableMarshalling}" />
- <property name="marshaller" ref="slcDefault.castor.marshaller" />
- <property name="unmarshaller" ref="slcDefault.castor.marshaller" />
- </bean>
- </property>
- <property name="connectionFactory" ref="jmsConnectionFactory" />
- </bean>
-
- <bean id="jmsConnectionFactory"
- class="org.springframework.jms.connection.CachingConnectionFactory">
- <property name="targetConnectionFactory">
- <bean class="org.apache.activemq.ActiveMQConnectionFactory">
- <property name="brokerURL">
- <value>${slc.server.jms.url}</value>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="jmsTransactionManager"
- class="org.springframework.jms.connection.JmsTransactionManager">
- <property name="connectionFactory" ref="jmsConnectionFactory" />
- </bean>
-
- <!-- Templates -->
- <bean id="listenerTemplate"
- class="org.springframework.jms.listener.DefaultMessageListenerContainer"
- abstract="true">
- <property name="connectionFactory" ref="jmsConnectionFactory" />
- <property name="messageListener" ref="jmsAgent" />
- <property name="transactionManager" ref="jmsTransactionManager" />
- </bean>
-
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
- xsi:schemaLocation="http://www.springframework.org/schema/osgi \r
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
- http://www.springframework.org/schema/beans \r
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <bundle id="agent" action="start" symbolic-name="org.argeo.slc.agent" />\r
-\r
- <!-- REFERENCES -->\r
- <reference id="modulesManager"\r
- interface="org.argeo.slc.execution.ExecutionModulesManager"\r
- context-class-loader="service-provider" />\r
-\r
- <!-- SERVICES -->\r
- <!-- Deprecated -->\r
- <service ref="resultListener"\r
- interface="org.argeo.slc.core.test.tree.TreeTestResultListener" />\r
- <service ref="resultListener" interface="org.argeo.slc.test.TestResultListener" />\r
-\r
- <service ref="slcExecutionListener" interface="org.argeo.slc.process.SlcExecutionNotifier" />\r
-\r
- <service ref="attachmentUploader" interface="org.argeo.slc.core.attachment.AttachmentUploader" />\r
-\r
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-slc.server.jms.url=tcp://localhost:61616
-
-# Customization
-slc.agent.jms.disableMarshalling=false
-slc.agent.jms.resultListener.onlyOnClose=false
+++ /dev/null
-bin.includes = META-INF/,\
- .
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>modules</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>org.argeo.slc.agent.jms</artifactId>
- <name>SLC Agent JMS</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Import-Package>
- *,
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.ext.activemq</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>modules</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>org.argeo.slc.ext.activemq</artifactId>
- <name>SLC ActiveMQ Extension</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Fragment-Host>org.apache.activemq</Fragment-Host>
- <Import-Package>
- *,
- org.argeo.slc.runtime,
- org.argeo.slc.execution,
- org.argeo.slc.msg,
- org.argeo.slc.build,
- org.argeo.slc.core.execution,
- org.argeo.slc.core.attachment,
- org.argeo.slc.core.structure,
- org.argeo.slc.core.structure.tree,
- org.argeo.slc.core.test,
- org.argeo.slc.core.test.tree,
- org.argeo.slc.deploy,
- org.argeo.slc.detached;resolution:=optional,
- org.argeo.slc.execution,
- org.argeo.slc.msg,
- org.argeo.slc.msg.build,
- org.argeo.slc.msg.event,
- org.argeo.slc.msg.process,
- org.argeo.slc.msg.test.tree,
- org.argeo.slc.process,
- org.argeo.slc.runtime,
- org.argeo.slc.test,
- org.argeo.slc.xml.process;resolution:=optional,
- org.argeo.slc.xml.test.tree;resolution:=optional,
- org.hibernate.collection;resolution:=optional
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server.activemq</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-#Sun Feb 14 20:09:09 CET 2010
-eclipse.preferences.version=1
-pluginProject.extensions=false
-resolve.requirebundle=false
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-SymbolicName: org.argeo.slc.server.activemq
-Import-Package: javax.jms,
- org.apache.activemq,
- org.argeo.slc.jms,
- org.springframework.beans.factory.config,
- org.springframework.jms.connection,
- org.springframework.jms.support.converter,
- org.springframework.oxm
-Bundle-Name: Active MQ Server
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
- xsi:schemaLocation="http://www.springframework.org/schema/osgi \r
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
- http://www.springframework.org/schema/beans \r
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <!-- SERVICES -->\r
- <service ref="jmsConnectionFactory" interface="javax.jms.ConnectionFactory" />\r
-\r
- <service ref="jmsCastorMessageConverter"\r
- interface="org.springframework.jms.support.converter.MessageConverter" />\r
-\r
- <reference id="marshaller" interface="org.springframework.oxm.Marshaller" />\r
- <reference id="unmarshaller" interface="org.springframework.oxm.Unmarshaller" />\r
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
- <property name="locations">
- <value>osgibundle:activemq.properties</value>
- </property>
- </bean>
-
- <!-- Connection Factory -->
- <bean id="jmsConnectionFactory"
- class="org.springframework.jms.connection.CachingConnectionFactory">
- <property name="targetConnectionFactory">
- <bean class="org.apache.activemq.ActiveMQConnectionFactory">
- <property name="brokerURL">
- <value>${slc.server.jms.url}</value>
- </property>
- </bean>
- </property>
- </bean>
-
- <bean id="jmsCastorMessageConverter" class="org.argeo.slc.jms.MarshallerMessageConverter">
- <property name="disableMarshalling" value="${slc.server.jms.disableMarshalling}" />
- <property name="marshaller" ref="marshaller" />
- <property name="unmarshaller" ref="unmarshaller" />
- </bean>
-
-
-</beans>
\ No newline at end of file
+++ /dev/null
-slc.server.jms.url=tcp://localhost:61616
-
-slc.server.jms.disableMarshalling=false
\ No newline at end of file
+++ /dev/null
-bin.includes = META-INF/
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server.agentproxy</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-SymbolicName: org.argeo.slc.server.agentproxy
-Import-Package: javax.jms,
- org.apache.activemq.command,
- org.argeo.slc.activemq,
- org.argeo.slc.jms,
- org.argeo.slc.runtime,
- org.springframework.beans.factory.config,
- org.springframework.jms.core,
- org.springframework.jms.support.converter
-Bundle-Name: Agent Proxy
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <!-- REFERENCES -->
- <reference id="jmsMessageConverter"
- interface="org.springframework.jms.support.converter.MessageConverter" />
- <reference id="jmsConnectionFactory" interface="javax.jms.ConnectionFactory" />
-
- <!-- SERVICES -->
- <service ref="agentFactory" interface="org.argeo.slc.runtime.SlcAgentFactory" />
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <import resource="classpath:org/argeo/slc/activemq/destinations.xml" />
-
- <bean
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
- <property name="locations">
- <value>osgibundle:agentproxy.properties</value>
- </property>
- </bean>
-
- <!-- Agent Factory -->
- <bean id="agentFactory" class="org.argeo.slc.jms.JmsAgentProxyFactory">
- <property name="jmsTemplate">
- <bean class="org.springframework.jms.core.JmsTemplate">
- <property name="connectionFactory" ref="jmsConnectionFactory" />
- <property name="messageConverter" ref="jmsMessageConverter" />
- <property name="receiveTimeout" value="${slc.server.jms.agentProxy.timeout}" />
- </bean>
- </property>
- <property name="requestDestination" ref="slcJms.destination.agent.request" />
- <property name="responseDestination" ref="slcJms.destination.agent.response" />
- <property name="pingAllDestination" ref="slcJms.destination.agent.pingAll" />
- </bean>
-
-
-</beans>
\ No newline at end of file
+++ /dev/null
-slc.server.jms.agentProxy.timeout=20000
\ No newline at end of file
+++ /dev/null
-bin.includes = META-INF/,\
- .
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server.castor</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-SymbolicName: org.argeo.slc.server.castor
-Import-Package: org.springframework.oxm,
- org.argeo.slc.castor,
- org.springframework.oxm.castor
-Bundle-Name: Server Castor
+++ /dev/null
-<?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:osgi="http://www.springframework.org/schema/osgi"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <import resource="classpath:org/argeo/slc/castor/spring.xml" />
-
- <osgi:service ref="slcDefault.castor.marshaller">
- <osgi:interfaces>
- <value>org.springframework.oxm.Marshaller
- </value>
- <value>org.springframework.oxm.Unmarshaller
- </value>
- </osgi:interfaces>
- </osgi:service>
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server.h2</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-#Tue Jul 13 15:43:47 CEST 2010
-eclipse.preferences.version=1
-pluginProject.extensions=false
-resolve.requirebundle=false
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Server H2
-Bundle-SymbolicName: org.argeo.slc.server.h2
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-Vendor: Argeo
-Import-Package: net.sf.ehcache.hibernate,
- org.aopalliance.aop,
- org.argeo.slc.core.attachment,
- org.argeo.slc.core.structure,
- org.argeo.slc.core.structure.tree,
- org.argeo.slc.core.test,
- org.argeo.slc.core.test.tree,
- org.argeo.slc.hibernate,
- org.argeo.slc.hibernate.attachment,
- org.argeo.slc.hibernate.process,
- org.argeo.slc.hibernate.runtime,
- org.argeo.slc.hibernate.structure,
- org.argeo.slc.hibernate.test,
- org.argeo.slc.hibernate.test.tree,
- org.argeo.slc.process,
- org.argeo.slc.runtime,
- org.argeo.slc.test,
- org.h2,
- org.h2.jdbcx,
- org.hibernate,
- org.hibernate.hql.ast,
- org.springframework.beans.factory.config,
- org.springframework.cache.ehcache,
- org.springframework.jdbc.datasource,
- org.springframework.orm.hibernate3
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
- xsi:schemaLocation="http://www.springframework.org/schema/osgi \r
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
- http://www.springframework.org/schema/beans \r
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <service ref="sessionFactory" interface="org.hibernate.SessionFactory" />\r
-\r
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"
- default-lazy-init="false">
-
- <import resource="classpath:/org/argeo/slc/hibernate/sessionFactories.xml" />
-
- <bean
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
- <property name="ignoreUnresolvablePlaceholders" value="true" />
- <property name="locations">
- <value>osgibundle:h2.properties
- </value>
- </property>
- </bean>
-
- <bean id="sessionFactory" parent="slcTemplates.sessionFactory.hibernateBasic">
- <property name="dataSource" ref="dataSource" />
- <property name="hibernateProperties">
- <value><![CDATA[
-hibernate.dialect=org.hibernate.dialect.H2Dialect
-hibernate.hbm2ddl.auto=create
-hibernate.current_session_context_class=thread
- ]]></value>
- </property>
- </bean>
-
- <bean id="dataSource"
- class="org.springframework.jdbc.datasource.DriverManagerDataSource">
- <property name="driverClassName" value="org.h2.Driver" />
- <property name="url" value="${slc.server.h2.url}" />
- <property name="username" value="sa" />
- <property name="password" value="" />
- </bean>
-
-
- <!--<bean id="dataSource" class="org.h2.jdbcx.JdbcDataSource">
- <property name="URL" value="${slc.server.h2.url}" />
- <property name="user" value="sa" />
- <property name="password" value="" />
- </bean>
-
---></beans>
\ No newline at end of file
+++ /dev/null
-bin.includes = META-INF/
+++ /dev/null
-slc.server.h2.url=jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server.hibernate</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-SymbolicName: org.argeo.slc.server.hibernate
-Import-Package: org.aopalliance.aop,
- org.argeo.slc.core.attachment,
- org.argeo.slc.core.structure,
- org.argeo.slc.core.structure.tree,
- org.argeo.slc.core.test,
- org.argeo.slc.core.test.tree,
- org.argeo.slc.dao.process,
- org.argeo.slc.dao.runtime,
- org.argeo.slc.dao.test,
- org.argeo.slc.dao.test.tree,
- org.argeo.slc.hibernate,
- org.argeo.slc.hibernate.process,
- org.argeo.slc.hibernate.runtime,
- org.argeo.slc.hibernate.test,
- org.argeo.slc.hibernate.test.tree,
- org.argeo.slc.process,
- org.argeo.slc.runtime,
- org.argeo.slc.test,
- org.hibernate,
- org.hibernate.hql.ast,
- org.hibernate.jdbc,
- org.springframework.aop,
- org.springframework.aop.framework,
- org.springframework.orm.hibernate3,
- org.springframework.orm.hibernate3.support,
- org.springframework.transaction,
- org.springframework.web.context.request
-Bundle-Name: Server Hibernate
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
- xsi:schemaLocation="http://www.springframework.org/schema/osgi \r
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
- http://www.springframework.org/schema/beans \r
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <service interface="org.argeo.slc.dao.process.SlcExecutionDao"\r
- ref="slcExecutionDao" />\r
-\r
- <service interface="org.argeo.slc.dao.test.tree.TreeTestResultDao"\r
- ref="testResultDao" />\r
- <service interface="org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao"\r
- ref="testResultCollectionDao" />\r
- <service interface="org.argeo.slc.dao.test.TestRunDescriptorDao"\r
- ref="testRunDescriptorDao" />\r
- <service interface="org.argeo.slc.dao.runtime.SlcAgentDescriptorDao"\r
- ref="slcAgentDescriptorDao" />\r
-\r
- <service\r
- interface="org.springframework.web.context.request.WebRequestInterceptor"\r
- ref="osivInterceptor" />\r
-\r
- <reference id="sessionFactory" interface="org.hibernate.SessionFactory" />\r
-\r
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"
- default-lazy-init="false">
-
- <import resource="classpath:/org/argeo/slc/hibernate/dao.xml" />
-
- <!-- DAOs -->
- <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
- <property name="sessionFactory" ref="sessionFactory" />
- <property name="allowCreate" value="false" />
- </bean>
-
- <bean id="testResultDao" parent="slcTemplates.dao.testResultDao">
- <property name="hibernateTemplate" ref="hibernateTemplate" />
- </bean>
-
- <bean id="testResultCollectionDao" parent="slcTemplates.dao.testResultCollectionDao">
- <property name="hibernateTemplate" ref="hibernateTemplate" />
- </bean>
-
- <bean id="testRunDescriptorDao" parent="slcTemplates.dao.testRunDescriptorDao">
- <property name="hibernateTemplate" ref="hibernateTemplate" />
- </bean>
-
- <bean id="slcExecutionDao" parent="slcTemplates.dao.slcExecutionDao">
- <property name="hibernateTemplate" ref="hibernateTemplate" />
- </bean>
-
- <bean id="slcAgentDescriptorDao" parent="slcTemplates.dao.slcAgentDescriptorDao">
- <property name="hibernateTemplate" ref="hibernateTemplate" />
- </bean>
-
- <bean id="osivInterceptor"
- class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
-
- <service ref="hibernateTransactionManager"
- interface="org.springframework.transaction.PlatformTransactionManager" />
-
-
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
-
- <!-- Transaction -->
- <bean id="hibernateTransactionManager"
- class="org.springframework.orm.hibernate3.HibernateTransactionManager"
- lazy-init="false">
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
-
- <!-- DAO transactions -->
- <aop:config>
- <aop:pointcut id="daoProcessMethods"
- expression="execution(* org.argeo.slc.dao.process.*.*(..))" />
- <aop:advisor advice-ref="daoAdvice" pointcut-ref="daoProcessMethods" />
- </aop:config>
-
- <aop:config>
- <aop:pointcut id="daoRuntimeMethods"
- expression="execution(* org.argeo.slc.dao.runtime.*.*(..))" />
- <aop:advisor advice-ref="daoAdvice" pointcut-ref="daoRuntimeMethods" />
- </aop:config>
-
- <aop:config>
- <aop:pointcut id="daoTestMethods"
- expression="execution(* org.argeo.slc.dao.test.*.*(..))" />
- <aop:advisor advice-ref="daoAdvice" pointcut-ref="daoTestMethods" />
- </aop:config>
-
- <aop:config>
- <aop:pointcut id="daoTestTreeMethods"
- expression="execution(* org.argeo.slc.dao.test.tree.*.*(..))" />
- <aop:advisor advice-ref="daoAdvice" pointcut-ref="daoTestTreeMethods" />
- </aop:config>
-
- <tx:advice id="daoAdvice" transaction-manager="hibernateTransactionManager">
- <tx:attributes>
- <tx:method name="get*" propagation="REQUIRED" read-only="true" />
- <tx:method name="list*" propagation="REQUIRED" read-only="true" />
- <tx:method name="*" propagation="REQUIRED" />
- </tx:attributes>
- </tx:advice>
-
- <aop:config>
- <aop:pointcut id="pointcut.services.allMethods"
- expression="execution(* org.argeo.slc.services.*.*.*(..))" />
- <aop:advisor advice-ref="advice.allMethodsRequired"
- pointcut-ref="pointcut.services.allMethods" />
- </aop:config>
-
- <tx:advice id="advice.allMethodsRequired"
- transaction-manager="hibernateTransactionManager">
- <tx:attributes>
- <tx:method name="*" propagation="REQUIRED" />
- </tx:attributes>
- </tx:advice>
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server.jcr</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-SymbolicName: org.argeo.slc.server.jcr
-Bundle-Name: Server JCR
-Import-Package: javax.jcr,
- org.argeo.jcr,
- org.argeo.jcr.mvc,
- org.argeo.jcr.spring,
- org.argeo.security,
- org.argeo.security.core,
- org.argeo.security.jcr,
- org.argeo.slc.core.attachment,
- org.argeo.slc.core.execution,
- org.argeo.slc.core.structure,
- org.argeo.slc.core.structure.tree,
- org.argeo.slc.core.test,
- org.argeo.slc.core.test.tree,
- org.argeo.slc.dao.process,
- org.argeo.slc.dao.runtime,
- org.argeo.slc.dao.test,
- org.argeo.slc.dao.test.tree,
- org.argeo.slc.execution,
- org.argeo.slc.jcr,
- org.argeo.slc.jcr.dao,
- org.argeo.slc.jcr.execution,
- org.argeo.slc.process,
- org.argeo.slc.runtime,
- org.argeo.slc.test,
- org.springframework.beans.factory.config,
- org.springframework.osgi.util,
- org.springframework.security;specification-version="2.0.6.RELEASE",
- org.springframework.web.context.request
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
- xmlns:util="http://www.springframework.org/schema/util"\r
- xsi:schemaLocation="http://www.springframework.org/schema/osgi \r
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
- http://www.springframework.org/schema/beans \r
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd\r
- http://www.springframework.org/schema/util\r
- http://www.springframework.org/schema/util/spring-util-2.5.xsd">\r
-\r
- <!-- REFERENCES -->\r
- <reference id="repository" interface="javax.jcr.Repository"\r
- filter="(argeo.jcr.repository.alias=slc)" />\r
-\r
- <reference id="modulesManager"\r
- interface="org.argeo.slc.execution.ExecutionModulesManager" />\r
- <reference id="authenticationManager"\r
- interface="org.springframework.security.AuthenticationManager" />\r
-\r
- <!-- SERVICES -->\r
- <service interface="org.argeo.slc.execution.ExecutionModulesListener"\r
- ref="executionModulesListener" />\r
- <service ref="agent" interface="org.argeo.slc.runtime.SlcAgentFactory">\r
- <service-properties>\r
- <beans:entry>\r
- <beans:key>\r
- <util:constant static-field="org.argeo.slc.jcr.SlcJcrConstants.PROPERTY_PATH" />\r
- </beans:key>\r
- <util:constant\r
- static-field="org.argeo.slc.jcr.SlcJcrConstants.VM_AGENT_FACTORY_PATH" />\r
- </beans:entry>\r
- </service-properties>\r
- </service>\r
- <service ref="agent" interface="org.argeo.slc.runtime.SlcAgent" />\r
-\r
- <!-- <service interface="org.argeo.slc.dao.process.SlcExecutionDao" -->\r
- <!-- ref="slcExecutionDao" /> -->\r
- <!-- <service interface="org.argeo.slc.dao.test.tree.TreeTestResultDao" -->\r
- <!-- ref="testResultDao" /> -->\r
- <!-- <service interface="org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao" -->\r
- <!-- ref="testResultCollectionDao" /> -->\r
- <!-- <service interface="org.argeo.slc.dao.test.TestRunDescriptorDao" -->\r
- <!-- ref="testRunDescriptorDao" /> -->\r
- <!-- <service interface="org.argeo.slc.dao.runtime.SlcAgentDescriptorDao" -->\r
- <!-- ref="slcAgentDescriptorDao" /> -->\r
-\r
- <!-- <service -->\r
- <!-- interface="org.springframework.web.context.request.WebRequestInterceptor" -->\r
- <!-- ref="osivInterceptor" /> -->\r
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <!-- <bean -->\r
- <!-- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> -->\r
- <!-- <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" \r
- /> -->\r
- <!-- <property name="locations"> -->\r
- <!-- <value>osgibundle:jcr.properties</value> -->\r
- <!-- </property> -->\r
- <!-- </bean> -->\r
-\r
- <bean id="agent" class="org.argeo.slc.jcr.execution.JcrAgent"\r
- init-method="init" destroy-method="dispose">\r
- <property name="session" ref="session" />\r
- <property name="modulesManager" ref="modulesManager" />\r
- </bean>\r
-\r
- <bean id="executionModulesListener" class="org.argeo.slc.jcr.execution.JcrExecutionModulesListener"\r
- init-method="init" destroy-method="dispose">\r
- <property name="agent" ref="agent" />\r
- <property name="session" ref="session" />\r
- </bean>\r
-\r
- <bean id="session" class="org.argeo.security.jcr.SecureThreadBoundSession">\r
- <property name="repository" ref="repository" />\r
- </bean>\r
-\r
- <bean class="org.argeo.security.core.SystemExecutionBeanPostProcessor">\r
- <property name="authenticationManager" ref="authenticationManager" />\r
- </bean>\r
-\r
- <!-- <bean id="slcAgentDescriptorDao" class="org.argeo.slc.jcr.dao.SlcAgentDescriptorDaoJcr" -->\r
- <!-- init-method="init"> -->\r
- <!-- <property name="session" ref="jcrSession" /> -->\r
- <!-- <property name="nodeMapperProvider" ref="nodeMapperProvider" /> -->\r
- <!-- </bean> -->\r
-\r
- <!-- <bean id="testRunDescriptorDao" class="org.argeo.slc.jcr.dao.TestRunDescriptorDaoJcr" -->\r
- <!-- init-method="init"> -->\r
- <!-- <property name="session" ref="jcrSession" /> -->\r
- <!-- <property name="nodeMapperProvider" ref="nodeMapperProvider" /> -->\r
- <!-- </bean> -->\r
-\r
- <!-- <bean id="slcExecutionDao" class="org.argeo.slc.jcr.dao.SlcExecutionDaoJcr" -->\r
- <!-- init-method="init"> -->\r
- <!-- <property name="session" ref="jcrSession" /> -->\r
- <!-- <property name="nodeMapperProvider" ref="nodeMapperProvider" /> -->\r
- <!-- </bean> -->\r
-\r
- <!-- <bean id="nodeMapperProvider" class="org.argeo.slc.jcr.dao.SlcNodeMapperProvider" -->\r
- <!-- init-method="init"> -->\r
- <!-- <property name="defaultNodeMapper" ref="nodeMapper" /> -->\r
- <!-- <property name="treeTestResultNodeMapper" ref="treeTestResultNodeMapper" \r
- /> -->\r
- <!-- </bean> -->\r
-\r
- <!-- <bean id="testResultDao" class="org.argeo.slc.jcr.dao.TreeTestResultDaoJcr" -->\r
- <!-- init-method="init"> -->\r
- <!-- <property name="session" ref="jcrSession" /> -->\r
- <!-- <property name="nodeMapperProvider" ref="nodeMapperProvider" /> -->\r
- <!-- </bean> -->\r
-\r
- <!-- <bean id="testResultCollectionDao" class="org.argeo.slc.jcr.dao.TreeTestResultCollectionDaoJcr" -->\r
- <!-- init-method="init"> -->\r
- <!-- <property name="session" ref="jcrSession" /> -->\r
- <!-- <property name="nodeMapperProvider" ref="nodeMapperProvider" /> -->\r
- <!-- </bean> -->\r
-\r
- <!-- <bean id="osivInterceptor" -->\r
- <!-- class="org.argeo.server.jcr.mvc.OpenSessionInViewJcrInterceptor"> -->\r
- <!-- <property name="session" ref="jcrSession" /> -->\r
- <!-- </bean> -->\r
-\r
- <!-- <bean id="bundleClassLoader" -->\r
- <!-- class="org.springframework.osgi.util.BundleDelegatingClassLoader" -->\r
- <!-- factory-method="createBundleClassLoaderFor"> -->\r
- <!-- <constructor-arg> -->\r
- <!-- <bean factory-bean="bundleContext" factory-method="getBundle" /> -->\r
- <!-- </constructor-arg> -->\r
- <!-- </bean> -->\r
-\r
- <!-- <bean id="nodeMapper" class="org.argeo.jcr.BeanNodeMapper"> -->\r
- <!-- <property name="classLoader" ref="bundleClassLoader" /> -->\r
- <!-- </bean> -->\r
-\r
- <!-- <bean id="treeTestResultNodeMapper" class="org.argeo.slc.jcr.dao.TreeTestResultNodeMapper"> -->\r
- <!-- <property name="classLoader" ref="bundleClassLoader" /> -->\r
- <!-- </bean> -->\r
-</beans>
\ No newline at end of file
+++ /dev/null
-bin.includes = META-INF/,\
- .
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server.jms</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-SymbolicName: org.argeo.slc.server.jms
-Import-Package: javax.jms,
- javax.management.j2ee.statistics,
- org.apache.activemq,
- org.apache.activemq.command,
- org.apache.commons.logging,
- org.argeo.security,
- org.argeo.security.core,
- org.argeo.slc.activemq,
- org.argeo.slc.core.attachment,
- org.argeo.slc.jms,
- org.argeo.slc.msg.event,
- org.argeo.slc.services,
- org.springframework.beans.factory.config,
- org.springframework.jms.core,
- org.springframework.jms.listener,
- org.springframework.jms.listener.adapter,
- org.springframework.jms.support.converter,
- org.springframework.transaction
-Bundle-Name: Server JMS
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"
- xmlns:osgi="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- osgi:default-timeout="5000">
-
- <!-- REFERENCES -->
- <reference id="agentService" interface="org.argeo.slc.services.AgentService" />
- <reference id="testManagerService" interface="org.argeo.slc.services.TestManagerService" />
- <reference id="slcExecutionService" interface="org.argeo.slc.services.SlcExecutionService" />
-
- <reference id="jmsConnectionFactory" interface="javax.jms.ConnectionFactory" />
- <reference id="jmsMessageConverter"
- interface="org.springframework.jms.support.converter.MessageConverter" />
-
- <reference id="attachmentsStorage"
- interface="org.argeo.slc.core.attachment.AttachmentsStorage" />
- <reference id="systemExecutionService" interface="org.argeo.security.SystemExecutionService" />
-
- <!-- SERVICES -->
- <service ref="jmsEventListener" interface="org.argeo.slc.msg.event.SlcEventListener" />
- <service ref="jmsEventPublisher" interface="org.argeo.slc.msg.event.SlcEventPublisher" />
-
-
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <import resource="classpath:org/argeo/slc/activemq/destinations.xml" />
-
- <bean
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
- <property name="locations">
- <value>osgibundle:jms.properties</value>
- </property>
- </bean>
-
- <!-- Attachments -->
- <bean id="attachmentStorage.jmsContainer.add" parent="listenerContainer">
- <property name="destination" ref="slcJms.destination.attachment.add" />
- <property name="messageListener">
- <bean class="org.argeo.slc.jms.JmsAttachmentListener">
- <property name="attachmentsStorage" ref="attachmentsStorage" />
- </bean>
- </property>
- </bean>
-
- <!-- Events -->
- <bean id="jmsEventListener" class="org.argeo.slc.jms.JmsSlcEventListener"
- init-method="init" destroy-method="close">
- <property name="jmsConnectionFactory">
- <!-- Need its own connection factory in order to set client ids (not possible
- on pool) -->
- <bean class="org.apache.activemq.ActiveMQConnectionFactory">
- <property name="brokerURL">
- <value>${slc.server.jms.url}</value>
- <!--<value>vm://localhost</value> -->
- </property>
- </bean>
- </property>
- <property name="eventsDestination" ref="slcJms.destination.events" />
- <property name="messageConverter" ref="jmsMessageConverter" />
- </bean>
-
- <bean id="jmsEventPublisher" class="org.argeo.slc.jms.JmsSlcEventPublisher">
- <property name="jmsTemplate" ref="jmsTemplate" />
- <property name="eventsDestination" ref="slcJms.destination.events" />
- </bean>
-
- <!-- Agent Service -->
- <bean id="agentService.jmsContainer.register" parent="listenerContainer">
- <property name="destination" ref="slcJms.destination.agent.register" />
- <property name="messageListener">
- <bean parent="listenerAdapterCastor">
- <constructor-arg ref="agentService" />
- <property name="defaultListenerMethod" value="register" />
- </bean>
- </property>
- </bean>
-
- <bean id="agentService.jmsContainer.unregister" parent="listenerContainer">
- <property name="destination" ref="slcJms.destination.agent.unregister" />
- <property name="messageListener">
- <bean parent="listenerAdapterCastor">
- <constructor-arg ref="agentService" />
- <property name="defaultListenerMethod" value="unregister" />
- </bean>
- </property>
- </bean>
-
- <bean parent="listenerContainer">
- <property name="destination" ref="slcJms.destination.execution.event" />
- <property name="messageListener">
- <bean class="org.argeo.slc.jms.JmsExecutionHandler">
- <property name="messageConverter" ref="jmsMessageConverter" />
- <property name="serviceMsgHandler">
- <bean class="org.argeo.slc.services.ServiceMsgHandler">
- <property name="slcExecutionService" ref="slcExecutionService" />
- <property name="testManagerService" ref="testManagerService" />
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-
- <!-- Common -->
- <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
- <property name="messageConverter" ref="jmsMessageConverter" />
- <property name="connectionFactory" ref="jmsConnectionFactory" />
- </bean>
-
- <!-- Templates -->
- <bean id="listenerContainer"
- class="org.springframework.jms.listener.DefaultMessageListenerContainer"
- abstract="true">
- <property name="connectionFactory" ref="jmsConnectionFactory" />
- <!-- <property name="transactionManager" ref="jmsTransactionManager" /> -->
- <property name="taskExecutor">
- <bean class="org.argeo.security.core.AsyncSystemTaskExecutor">
- <property name="systemExecutionService" ref="systemExecutionService" />
- </bean>
- </property>
- </bean>
-
- <bean id="listenerAdapterCastor"
- class="org.springframework.jms.listener.adapter.MessageListenerAdapter"
- abstract="true">
- <property name="messageConverter" ref="jmsMessageConverter" />
- </bean>
-
-</beans>
\ No newline at end of file
+++ /dev/null
-bin.includes = META-INF/,\
- .
+++ /dev/null
-# TODO: duplicated with activemq bundle!
-slc.server.jms.url=tcp://localhost:61616
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server.main</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-Manifest-Version: 1.0
-Require-Bundle: org.argeo.slc.specs,org.argeo.slc.support.equinox
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-Name: SLC Server Main
-Bundle-SymbolicName: org.argeo.slc.server.main
-Import-Package: org.argeo.slc.build,org.argeo.slc.osgi.build
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
-
- <bean id="eclipseUpdateSite" class="org.argeo.slc.osgi.build.EclipseUpdateSite">
- <property name="features">
- <list>
- <bean class="org.argeo.slc.osgi.build.EclipseUpdateSiteFeature">
- <property name="name" value="org.argeo.slc.dep.agent" />
- </bean>
- <bean class="org.argeo.slc.osgi.build.EclipseUpdateSiteFeature">
- <property name="name" value="org.argeo.slc.dep.detached" />
- </bean>
- </list>
- </property>
- </bean>
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <!-- Security -->
- <bundle id="security.ldap" symbolic-name="org.argeo.security.dao.ldap"
- action="start" />
- <bundle id="security.services" symbolic-name="org.argeo.security.services"
- action="start" />
-
- <!-- Servers -->
- <bundle id="activemq.broker" symbolic-name="org.argeo.server.activemq.broker"
- action="start" />
-
- <!-- SLC Middleware -->
- <bundle id="castor" symbolic-name="org.argeo.slc.server.castor"
- action="start" />
- <bundle id="activemq" symbolic-name="org.argeo.slc.server.activemq"
- action="start" />
- <bundle id="agentProxy" symbolic-name="org.argeo.slc.server.agentproxy"
- action="start" />
- <bundle id="services" symbolic-name="org.argeo.slc.server.services"
- action="start" />
- <bundle id="jms" symbolic-name="org.argeo.slc.server.jms"
- action="start" />
-
- <!-- Web -->
- <bundle id="spring.osgi.web.extender" symbolic-name="org.springframework.osgi.web.extender"
- action="start" />
- <bundle id="catalina" symbolic-name="org.argeo.dep.osgi.catalina.start"
- action="start" />
-
- <!-- Web app start order is important! Security should be first -->
- <!-- <bundle id="security.webapp" symbolic-name="org.argeo.security.webapp" -->
- <!-- action="start" /> -->
- <bundle id="slc.webapp" symbolic-name="org.argeo.slc.webapp"
- action="start" />
-
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <bean id="dynamicRuntime" class="org.argeo.slc.equinox.EquinoxRuntime" />
- <bean id="modularDistribution" class="org.argeo.slc.osgi.build.OsgiRuntimeModularDistribution">
- <property name="eclipseUpdateSite" ref="eclipseUpdateSite" />
- </bean>
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <service ref="dynamicRuntime" interface="org.argeo.slc.deploy.DynamicRuntime" />
- <service ref="modularDistribution" interface="org.argeo.slc.build.ModularDistribution" />
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-bin.includes = META-INF/,\
- .
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server.mysql</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-Manifest-Version: 1.0
-Require-Bundle: org.argeo.slc.specs,org.argeo.slc.core
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-Name: Argeo SLC MySQL
-Bundle-SymbolicName: org.argeo.slc.server.mysql
-Import-Package: com.mysql.jdbc,
- net.sf.ehcache.hibernate,
- org.apache.commons.dbcp,
- org.hibernate,
- org.hibernate.hql.ast,
- org.springframework.beans.factory.config,
- org.springframework.cache.ehcache,
- org.springframework.jdbc.datasource,
- org.springframework.orm.hibernate3
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"
- default-lazy-init="false">
-
- <import resource="classpath:/org/argeo/slc/hibernate/spring.xml" />
-
- <bean
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
- <property name="locations">
- <value>osgibundle:mysql.properties
- </value>
- </property>
- </bean>
-
- <bean id="sessionFactory" parent="slcTemplates.sessionFactory.hibernateBasic">
- <property name="dataSource" ref="dataSource" />
- <property name="hibernateProperties">
- <value><![CDATA[
- hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
- hibernate.hbm2ddl.auto=update
- hibernate.connection.autocommit=false
- ]]></value>
- </property>
- </bean>
- <!--
- <bean id="dataSource"
- class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
- <property name="targetDataSource"> <bean
- class="org.springframework.jdbc.datasource.SingleConnectionDataSource"
- destroy-method="destroy"> <property name="driverClassName"
- value="com.mysql.jdbc.Driver" /> <property name="url"
- value="jdbc:mysql://localhost/sparta_prod" /> <property
- name="username" value="root" /> <property name="password" value="" />
- <property name="suppressClose" value="true" /> <property
- name="autoCommit" value="false" /> </bean> </property> </bean>
- -->
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
- destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver" />
- <property name="url" value="${jdbc.url}" />
- <property name="username" value="${jdbc.username}" />
- <property name="password" value="${jdbc.password}" />
- <property name="testOnBorrow" value="true" />
- <property name="validationQuery" value="SELECT 1" />
- <property name="maxActive" value="10" />
- <property name="maxIdle" value="2" />
- </bean>
-
-
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
- xsi:schemaLocation="http://www.springframework.org/schema/osgi \r
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
- http://www.springframework.org/schema/beans \r
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <service ref="sessionFactory" interface="org.hibernate.SessionFactory" />\r
-\r
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-jdbc.url=jdbc:mysql://localhost/slc
-jdbc.username=root
-jdbc.password=
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server.services</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-Name: SLC Server Services
-Bundle-SymbolicName: org.argeo.slc.server.services
-Import-Package: org.aopalliance.aop,
- org.argeo.security,
- org.argeo.slc.core.attachment,
- org.argeo.slc.dao.process,
- org.argeo.slc.dao.runtime,
- org.argeo.slc.dao.test,
- org.argeo.slc.dao.test.tree,
- org.argeo.slc.msg.event,
- org.argeo.slc.msg.process,
- org.argeo.slc.process,
- org.argeo.slc.runtime,
- org.argeo.slc.services,
- org.argeo.slc.services.impl,
- org.hibernate.jdbc,
- org.springframework.aop,
- org.springframework.aop.framework,
- org.springframework.beans.factory.config
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
-
- <!-- REFERENCES -->
- <reference interface="org.argeo.slc.dao.test.tree.TreeTestResultDao"
- id="testResultDao" />
- <reference interface="org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao"
- id="testResultCollectionDao" />
- <reference interface="org.argeo.slc.dao.test.TestRunDescriptorDao"
- id="testRunDescriptorDao" />
- <reference interface="org.argeo.slc.dao.process.SlcExecutionDao"
- id="slcExecutionDao" />
- <reference interface="org.argeo.slc.dao.runtime.SlcAgentDescriptorDao"
- id="slcAgentDescriptorDao" />
-
- <reference id="agentFactory" interface="org.argeo.slc.runtime.SlcAgentFactory" />
-
- <list id="eventPublishers" interface="org.argeo.slc.msg.event.SlcEventPublisher"
- cardinality="0..N" />
-
- <reference id="systemExecutor" interface="org.argeo.security.SystemExecutionService" />
-
- <!-- SERVICES -->
- <service ref="testManagerService" interface="org.argeo.slc.services.TestManagerService" />
- <service ref="agentService" interface="org.argeo.slc.services.AgentService" />
- <service ref="slcExecutionService" interface="org.argeo.slc.services.SlcExecutionService" />
- <service ref="attachmentsStorage">
- <interfaces>
- <beans:value>org.argeo.slc.core.attachment.AttachmentsStorage
- </beans:value>
- <beans:value>org.argeo.slc.core.attachment.AttachmentUploader
- </beans:value>
- </interfaces>
- </service>
-
-
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
-
- <bean
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
- <property name="ignoreUnresolvablePlaceholders" value="true" />
- <property name="locations">
- <value>osgibundle:services.properties
- </value>
- </property>
- </bean>
-
- <!-- Attachments -->
- <bean id="attachmentsStorage" class="org.argeo.slc.core.attachment.FileAttachmentsStorage"></bean>
-
- <!-- Events -->
- <aop:aspectj-autoproxy />
-
- <bean id="eventPublisherAspect" class="org.argeo.slc.services.EventPublisherAspect">
- <property name="eventPublishers" ref="eventPublishers" />
- </bean>
-
- <!-- Services -->
- <bean id="testManagerService" class="org.argeo.slc.services.impl.TestManagerServiceImpl">
- <constructor-arg ref="testResultDao" />
- <constructor-arg ref="testRunDescriptorDao" />
- <constructor-arg ref="slcExecutionDao" />
- <constructor-arg ref="testResultCollectionDao" />
- </bean>
-
- <bean id="agentService" class="org.argeo.slc.services.impl.AgentServiceImpl">
- <constructor-arg ref="slcAgentDescriptorDao" />
- <constructor-arg ref="agentFactory" />
- <property name="pingCycle" value="${slc.server.services.pingCycle}" />
- <property name="systemExecutor" ref="systemExecutor" />
- </bean>
-
- <bean id="slcExecutionService" class="org.argeo.slc.services.impl.SlcExecutionServiceImpl">
- <constructor-arg ref="slcExecutionDao" />
- </bean>
-
-</beans>
\ No newline at end of file
+++ /dev/null
-bin.includes = META-INF/,\
- .
+++ /dev/null
-slc.server.services.pingCycle=60000
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.webapp.war</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ClassPath: WEB-INF/classes
-Bundle-Version: 1.1.3.SNAPSHOT
-Bundle-Name: SLC Webapp
-Web-ContextPath: org.argeo.slc.webapp
-Bundle-SymbolicName: org.argeo.slc.webapp
-Import-Package: javax.jcr,
- net.sf.cglib.core,
- net.sf.cglib.proxy,
- net.sf.cglib.reflect,
- org.aopalliance.aop,
- org.argeo.jackrabbit.remote,
- org.argeo.security.mvc,
- org.argeo.server,
- org.argeo.jcr.mvc,
- org.argeo.server.json,
- org.argeo.server.mvc,
- org.argeo.slc.build,
- org.argeo.slc.core.attachment,
- org.argeo.slc.core.test.tree,
- org.argeo.slc.dao.process,
- org.argeo.slc.dao.runtime,
- org.argeo.slc.dao.test,
- org.argeo.slc.dao.test.tree,
- org.argeo.slc.deploy,
- org.argeo.slc.msg.event,
- org.argeo.slc.runtime,
- org.argeo.slc.services,
- org.argeo.slc.web.ajaxplorer.file,
- org.argeo.slc.web.ajaxplorer.mvc,
- org.argeo.slc.web.mvc,
- org.argeo.slc.web.mvc.controllers,
- org.argeo.slc.web.mvc.provisioning,
- org.hibernate.hql.ast;resolution:=optional,
- org.hibernate.jdbc;resolution:=optional,
- org.springframework.aop,
- org.springframework.aop.framework,
- org.springframework.aop.scope,
- org.springframework.beans.factory.support,
- org.springframework.osgi.web.context.support,
- org.springframework.oxm,
- org.springframework.security,
- org.springframework.security.config,
- org.springframework.security.context,
- org.springframework.security.providers,
- org.springframework.security.ui,
- org.springframework.security.ui.webapp,
- org.springframework.security.userdetails,
- org.springframework.security.userdetails.memory,
- org.springframework.transaction,
- org.springframework.web.context,
- org.springframework.web.context.request,
- org.springframework.web.context.support,
- org.springframework.web.filter,
- org.springframework.web.servlet,
- org.springframework.web.servlet.handler,
- org.springframework.web.servlet.mvc,
- org.springframework.web.servlet.mvc.annotation,
- org.springframework.web.servlet.view
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
-
-
- <import resource="classpath:/org/argeo/slc/web/ajaxplorer/file/spring.xml" />
-
- <bean id="ajxpDriverHandler"
- class="org.argeo.slc.web.ajaxplorer.mvc.AjxpDriverRequestHandler">
- <property name="driver" ref="ajxpDriver" />
- </bean>
-
- <bean id="ajxpDriver" parent="driver.file.template">
- <property name="basePath" value="/home/mbaudier/dev/work/dcrawTests" />
- </bean>
-
- <bean id="urlMapping"
- class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
- <property name="mappings">
- <props>
- <prop key="**">ajxpDriverHandler</prop>
- </props>
- </property>
- </bean>
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
-
- <!--
- <import resource="classpath:/org/argeo/slc/server/spring/jmx.xml" />
- -->
-
- <!--
- security.xml has to be before osgi.xml, otherwise namespace parsing
- fails
- -->
-<!-- <import resource="security.xml" /> -->
- <import resource="osgi.xml" />
-
- <!--
- Hibernate instrumentation <bean id="osivInterceptor"
- class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
- <property name="sessionFactory" ref="sessionFactory" /> </bean>
- -->
-
-
- <!-- Properties -->
- <bean
- class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"
- lazy-init="false">
- <property name="contextOverride" value="true" />
- </bean>
-
- <!--
- Web Services transactions <aop:config> <aop:pointcut id="epMethods"
- expression="execution(*
- org.springframework.web.servlet.mvc.Controller.handleRequest(..))" />
- <aop:advisor advice-ref="epAdvice" pointcut-ref="epMethods" />
- </aop:config> <tx:advice id="epAdvice"
- transaction-manager="hibernateTransactionManager"> <tx:attributes>
- <tx:method name="*" propagation="REQUIRED" /> </tx:attributes>
- </tx:advice>
- -->
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
-
-
- <bean class="org.argeo.slc.web.mvc.controllers.RenderingResultController">
- <property name="treeTestResultDao" ref="testResultDao" />
- </bean>
-
- <!--
- Bean views for pdf & xls, resolved by the BeanNameViewResolver
- -->
- <bean name="resultExcelView" class="org.argeo.slc.web.mvc.ResultExcelView" />
- <bean name="resultPdfView" class="org.argeo.slc.web.mvc.ResultPdfView" />
-
- <bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
-
- <!--
- .xml & .xslt URI files doesn't have a bean : the
- XsltMarshallerViewResolver handle the views
- -->
- <bean id="viewResolverXslt" class="org.argeo.slc.web.mvc.XsltMarshallerViewResolver">
- <property name="viewClass">
- <value>org.argeo.slc.web.mvc.XsltMarshallerView
- </value>
- </property>
- <property name="prefix">
- <value>WEB-INF/xslt/</value>
- </property>
- <property name="suffix">
- <value>.xsl</value>
- </property>
- <property name="marshaller" ref="marshaller" />
- </bean>
-
- <bean
- class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
- <property name="interceptors">
- <list>
- <ref bean="osivInterceptor" />
- </list>
- </property>
- </bean>
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:component-scan base-package="org.argeo.jcr.mvc" />
-
- <bean name="**" class="org.argeo.jcr.mvc.JcrManagerController">
- </bean>
-
- <bean id="viewResolver" class="org.argeo.server.mvc.SerializingViewResolver">
- <property name="serializer" ref="serverMapper" />
- </bean>
-
- <bean id="serverMapper" class="org.argeo.server.json.JsonServerMapper">
- </bean>
-
- <bean class="org.argeo.server.mvc.DefaultHandlerExceptionResolver" />
-
- <bean id="handlerMapping"
- class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
- <property name="interceptors">
- <list>
- <ref bean="osivInterceptor" />
- </list>
- </property>
- </bean>
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:component-scan base-package="org.argeo.jcr.mvc" />
-
- <bean name="/*.jcr" class="org.argeo.jcr.mvc.JcrBrowserController" />
-
- <!-- Views -->
- <bean name="getJcrItem" class="org.argeo.server.mvc.SerializingView">
- <property name="serializer">
- <bean class="org.argeo.jcr.mvc.JcrXmlServerSerializer" />
- </property>
- </bean>
-
- <bean name="queryJcrNodes" class="org.argeo.server.mvc.SerializingView">
- <property name="serializer" ref="jsonSerializer" />
- </bean>
-
- <bean name="queryJcrTable" class="org.argeo.server.mvc.SerializingView">
- <property name="serializer" ref="jsonSerializer" />
- </bean>
-
- <bean name="500" class="org.argeo.server.mvc.SerializingView">
- <property name="serializer" ref="jsonSerializer" />
- </bean>
-
- <!-- Serializers -->
- <bean id="jsonSerializer" class="org.argeo.server.json.JsonServerSerializer" />
-
- <!-- MVC -->
- <bean id="handlerMapping"
- class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
- <property name="interceptors">
- <list>
- <ref bean="osivInterceptor" />
- </list>
- </property>
- </bean>
-
- <bean id="viewResolver"
- class="org.springframework.web.servlet.view.BeanNameViewResolver" />
-
- <bean class="org.argeo.server.mvc.DefaultHandlerExceptionResolver" />
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<beans:beans xmlns="http://www.springframework.org/schema/osgi"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"\r
- xsi:schemaLocation="http://www.springframework.org/schema/osgi \r
- http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd\r
- http://www.springframework.org/schema/beans \r
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <reference id="marshaller" interface="org.springframework.oxm.Marshaller" />\r
- <reference id="unmarshaller" interface="org.springframework.oxm.Unmarshaller" />\r
-\r
- <!-- DAO -->\r
- <reference id="testResultDao" interface="org.argeo.slc.dao.test.tree.TreeTestResultDao" />\r
- <reference id="testResultCollectionDao"\r
- interface="org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao" />\r
- <reference id="testRunDescriptorDao" interface="org.argeo.slc.dao.test.TestRunDescriptorDao" />\r
- <reference id="slcExecutionDao" interface="org.argeo.slc.dao.process.SlcExecutionDao" />\r
- <reference id="slcAgentDescriptorDao"\r
- interface="org.argeo.slc.dao.runtime.SlcAgentDescriptorDao" />\r
-\r
- <!-- Services -->\r
- <reference id="slcExecutionService" interface="org.argeo.slc.services.SlcExecutionService" />\r
- <reference id="testManagerService" interface="org.argeo.slc.services.TestManagerService" />\r
- <reference id="agentFactory" interface="org.argeo.slc.runtime.SlcAgentFactory" />\r
- <reference id="attachmentsStorage"\r
- interface="org.argeo.slc.core.attachment.AttachmentsStorage" />\r
-\r
- <!-- Events -->\r
- <reference id="eventListener" interface="org.argeo.slc.msg.event.SlcEventListener" />\r
-\r
- <!-- Runtime -->\r
- <reference id="dynamicRuntime" interface="org.argeo.slc.deploy.DynamicRuntime" />\r
-\r
- <!-- Provisioning -->\r
- <set id="modularDistributions" interface="org.argeo.slc.build.ModularDistribution"\r
- cardinality="0..N" />\r
-\r
- <!-- Security -->\r
- <reference id="_authenticationManager"\r
- interface="org.springframework.security.AuthenticationManager" />\r
- <!-- <reference id="userDetailsService" -->\r
- <!-- interface="org.springframework.security.userdetails.UserDetailsService" \r
- /> -->\r
-\r
- <!-- Optional reference to JCR repository -->\r
- <reference id="jcrRepository" interface="javax.jcr.Repository"\r
- cardinality="0..1" />\r
-\r
- <reference id="osivInterceptor"\r
- interface="org.springframework.web.context.request.WebRequestInterceptor" />\r
-</beans:beans>
\ No newline at end of file
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
-
- <bean name="getBundleHandler" class="org.argeo.slc.web.mvc.provisioning.BundleHandler">
- </bean>
-
- <bean name="updateSiteHandler"
- class="org.argeo.slc.web.mvc.provisioning.EclipseUpdateSiteHandler">
- </bean>
-
- <bean name="availableDistributions"
- class="org.argeo.slc.web.mvc.provisioning.AvailableDistributions">
- <property name="modularDistributions" ref="modularDistributions" />
- </bean>
-
- <bean name="availableModulesHtml"
- class="org.argeo.slc.web.mvc.provisioning.AvailableModulesHtml" />
- <bean name="availableModulesPlain"
- class="org.argeo.slc.web.mvc.provisioning.AvailableModulesPlain" />
- <bean name="availableModulesOsgiBoot"
- class="org.argeo.slc.web.mvc.provisioning.AvailableModulesOsgiBoot" />
-
- <!-- MVC -->
- <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
- <property name="interceptors">
- <list>
- <ref local="modularDistributionInterceptor" />
- </list>
- </property>
- <property name="mappings">
- <value>
- /*/*/modules.html=availableModulesHtml
- /*/*/modules=availableModulesPlain
- /*/*/modularDistribution=availableModulesOsgiBoot
- /*/*/site.xml=updateSiteHandler
- </value>
- </property>
- </bean>
-
- <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
- <property name="interceptors">
- <list>
- <ref local="modularDistributionInterceptor" />
- <ref local="eclipseUpdateSiteInterceptor" />
- </list>
- </property>
- <property name="mappings">
- <value>
- /*/*/plugins/*=getBundleHandler
- /*/*/features/*=getBundleHandler
- </value>
- </property>
- </bean>
-
- <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
- <property name="interceptors">
- <list>
- <ref local="modularDistributionInterceptor" />
- <ref local="bundleJarInterceptor" />
- </list>
- </property>
- <property name="mappings">
- <value>
- /*/*/*.jar=getBundleHandler
- </value>
- </property>
- </bean>
-
- <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
- <property name="interceptors">
- <list>
- </list>
- </property>
- <property name="mappings">
- <value>
- /distributions=availableDistributions
- </value>
- </property>
- </bean>
-
- <bean id="modularDistributionInterceptor"
- class="org.argeo.slc.web.mvc.provisioning.ModularDistributionInterceptor">
- <property name="modularDistributions" ref="modularDistributions" />
- </bean>
-
- <bean id="eclipseUpdateSiteInterceptor"
- class="org.argeo.slc.web.mvc.provisioning.EclipseUpdateSiteInterceptor" />
-
- <bean id="bundleJarInterceptor" class="org.argeo.slc.web.mvc.provisioning.BundleJarInterceptor" />
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:security="http://www.springframework.org/schema/security"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
-
- <bean id="authenticationEntryPoint"
- class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint">
- <property name="loginFormUrl"
- value="http://localhost/org.argeo.security.webapp/getCredentials.ria" />
- <property name="forceHttps" value="false" />
- </bean>
-
- <security:http entry-point-ref="authenticationEntryPoint">
- <security:intercept-url pattern="/*.service"
- access="ROLE_USER,ROLE_ADMIN,ROLE_ANONYMOUS" />
- <security:anonymous username="anonymous"
- granted-authority="ROLE_ANONYMOUS" />
- <security:remember-me key="argeo" services-ref="rememberMeServices" />
- </security:http>
-
- <bean id="rememberMeServices" class="org.argeo.security.mvc.ArgeoRememberMeServices">
- <property name="alwaysRemember" value="true" />
- <property name="userDetailsService" ref="userDetailsService" />
- <property name="key" value="${argeo.security.systemKey}" />
- </bean>
-
- <!--
-
-
- <bean id="authenticationProcessingFilter"
- class="org.springframework.security.ui.webapp.AuthenticationProcessingFilter">
- <security:custom-filter position="AUTHENTICATION_PROCESSING_FILTER" />
- <property name="authenticationManager" ref="_authenticationManager" />
- <property name="authenticationFailureUrl" value="/getCredentials.ria"
- /> <property name="defaultTargetUrl" value="/getCredentials.ria" />
- <property name="filterProcessesUrl" value="/login.ria" /> <property
- name="usernameParameter" value="username" /> <property
- name="passwordParameter" value="password" /> </bean>
- -->
-</beans>
\ No newline at end of file
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <!--<context:component-scan base-package="org.argeo.slc.web.mvc.controllers" />
-
- --><!-- Server Handling -->
- <bean class="org.argeo.slc.web.mvc.controllers.ServerController">
- <property name="dynamicRuntime" ref="dynamicRuntime" />
- </bean>
-
- <!-- Agent Handling -->
- <bean class="org.argeo.slc.web.mvc.controllers.AgentController">
- <property name="slcAgentDescriptorDao" ref="slcAgentDescriptorDao" />
- </bean>
-
- <!-- Events -->
- <bean class="org.argeo.slc.web.mvc.controllers.EventController">
- <property name="eventListenerRegister" ref="eventListenerRegister" />
- <property name="eventListener" ref="eventListener" />
- </bean>
-
- <bean name="eventListenerRegister" class="org.argeo.slc.web.mvc.WebSlcEventListenerRegister"
- scope="session">
- <aop:scoped-proxy />
- </bean>
-
- <!-- Execution -->
- <bean class="org.argeo.slc.web.mvc.controllers.ProcessController">
- <property name="agentFactory" ref="agentFactory" />
- <property name="slcExecutionDao" ref="slcExecutionDao" />
- <property name="slcExecutionService" ref="slcExecutionService" />
- <property name="marshaller" ref="marshaller" />
- <property name="unmarshaller" ref="unmarshaller" />
- <property name="attachmentsStorage" ref="attachmentsStorage" />
- </bean>
-
- <!-- Results Handling -->
- <bean class="org.argeo.slc.web.mvc.controllers.ResultController">
- <property name="treeTestResultDao" ref="testResultDao" />
- <property name="treeTestResultCollectionDao" ref="testResultCollectionDao" />
- <property name="testManagerService" ref="testManagerService" />
- <property name="attachmentsStorage" ref="attachmentsStorage" />
- </bean>
-
- <!-- Provisioning -->
- <bean name="/listModularDistributions.service"
- class="org.argeo.slc.web.mvc.provisioning.ListModularDistributions">
- <property name="modularDistributions" ref="modularDistributions" />
- </bean>
-
- <!-- MVC -->
- <bean
- class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
- <property name="interceptors">
- <list>
- <ref bean="osivInterceptor" />
- </list>
- </property>
- </bean>
-
- <bean id="viewResolver" class="org.argeo.server.mvc.SerializingViewResolver">
- <property name="serializer">
- <bean class="org.argeo.server.MarshallerServerSerializer">
- <property name="marshaller" ref="marshaller" />
- </bean>
- </property>
- </bean>
-
- <bean class="org.argeo.server.mvc.DefaultHandlerExceptionResolver" />
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- version="2.5">
-
- <display-name>SLC Web Application</display-name>
-
- <!-- SERVICE servlet -->
- <servlet>
- <servlet-name>slc-service</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
- <param-name>contextClass</param-name>
- <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>slc-service</servlet-name>
- <url-pattern>*.service</url-pattern>
- </servlet-mapping>
-
- <!-- DOC servlet : Rendering result view -->
- <servlet>
- <servlet-name>doc</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
- <param-name>contextClass</param-name>
- <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
- </init-param>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>doc</servlet-name>
- <url-pattern>*.xls</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>doc</servlet-name>
- <url-pattern>*.pdf</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>doc</servlet-name>
- <url-pattern>*.xslt</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>doc</servlet-name>
- <url-pattern>*.xml</url-pattern>
- </servlet-mapping>
-
- <!-- PROVISIONING servlet -->
- <servlet>
- <servlet-name>provisioning</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
- <param-name>contextClass</param-name>
- <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>provisioning</servlet-name>
- <url-pattern>/dist/*</url-pattern>
- </servlet-mapping>
-
- <!-- JCR servlet -->
- <servlet>
- <servlet-name>jcr</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
- <param-name>contextClass</param-name>
- <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>jcr</servlet-name>
- <url-pattern>*.jcr</url-pattern>
- </servlet-mapping>
-
- <!-- JCR-MANAGER servlet -->
- <servlet>
- <servlet-name>jcr-manager</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
- <param-name>contextClass</param-name>
- <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>jcr-manager</servlet-name>
- <url-pattern>/jcr-manager/*</url-pattern>
- </servlet-mapping>
-
- <!-- AjaXplorer servlet -->
- <servlet>
- <servlet-name>ajaxplorer</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <init-param>
- <param-name>contextClass</param-name>
- <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>ajaxplorer</servlet-name>
- <url-pattern>/ajaxplorer/*</url-pattern>
- </servlet-mapping>
-
- <!-- General -->
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/applicationContext.xml</param-value>
- </context-param>
-
- <listener>
- <display-name>Spring Context</display-name>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- <context-param>
- <param-name>contextClass</param-name>
- <param-value>org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext</param-value>
- </context-param>
-
- <!-- Security
- <filter>
- <filter-name>springSecurityFilterChain</filter-name>
- <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
- </filter>
-
- <filter-mapping>
- <filter-name>springSecurityFilterChain</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
- <context-param>
- <param-name>argeo.security.systemKey</param-name>
- <param-value>argeo</param-value>
- </context-param>
- -->
-</web-app>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<!--
-<!DOCTYPE config [
- <!ELEMENT config (iomanager , propertymanager, (collection | noncollection)? , filter?, mimetypeproperties?) >
-
- <!ELEMENT iomanager (class, iohandler*) >
- <!ELEMENT iohandler (class) >
-
- <!ELEMENT propertymanager (class, propertyhandler*) >
- <!ELEMENT propertyhandler (class) >
-
- <!ELEMENT collection (nodetypes) >
- <!ELEMENT noncollection (nodetypes) >
-
- <!ELEMENT filter (class, namespaces?, nodetypes?) >
-
- <!ELEMENT class >
- <!ATTLIST class
- name CDATA #REQUIRED
- >
- <!ELEMENT namespaces (prefix | uri)* >
- <!ELEMENT prefix (CDATA) >
- <!ELEMENT uri (CDATA) >
-
- <!ELEMENT nodetypes (nodetype)* >
- <!ELEMENT nodetype (CDATA) >
-
- <!ELEMENT mimetypeproperties (mimemapping*, defaultmimetype) >
-
- <!ELEMENT mimemapping >
- <!ATTLIST mimemapping
- extension CDATA #REQUIRED
- mimetype CDATA #REQUIRED
- >
-
- <!ELEMENT defaultmimetype (CDATA) >
-]>
--->
-
-<config>
- <!--
- Defines the IOManager implementation that is responsible for passing
- import/export request to the individual IO-handlers.
- -->
- <iomanager>
- <!-- class element defines the manager to be used. The specified class
- must implement the IOManager interface.
- Note, that the handlers are being added and called in the order
- they appear in the configuration.
- -->
- <class name="org.apache.jackrabbit.server.io.IOManagerImpl" />
- <iohandler>
- <class name="org.apache.jackrabbit.server.io.VersionHandler" />
- </iohandler>
- <iohandler>
- <class name="org.apache.jackrabbit.server.io.VersionHistoryHandler" />
- </iohandler>
- <iohandler>
- <class name="org.apache.jackrabbit.server.io.ZipHandler" />
- </iohandler>
- <iohandler>
- <class name="org.apache.jackrabbit.server.io.XmlHandler" />
- </iohandler>
- <iohandler>
- <class name="org.apache.jackrabbit.server.io.DirListingExportHandler" />
- </iohandler>
- <iohandler>
- <class name="org.apache.jackrabbit.server.io.DefaultHandler" />
- </iohandler>
- </iomanager>
- <!--
- Example config for iomanager that populates its list of handlers with
- default values. Therefore the 'iohandler' elements are omited.
- -->
- <!--
- <iomanager>
- <class name="org.apache.jackrabbit.server.io.DefaultIOManager" />
- </iomanager>
- -->
- <!--
- Defines the PropertyManager implementation that is responsible for export
- and import of resource properties.
- -->
- <propertymanager>
- <!-- class element defines the manager to be used. The specified class
- must implement the PropertyManager interface.
- Note, that the handlers are being added and called in the order
- they appear in the configuration.
- -->
- <class name="org.apache.jackrabbit.server.io.PropertyManagerImpl" />
- <propertyhandler>
- <class name="org.apache.jackrabbit.server.io.VersionHandler" />
- </propertyhandler>
- <propertyhandler>
- <class name="org.apache.jackrabbit.server.io.VersionHistoryHandler" />
- </propertyhandler>
- <propertyhandler>
- <class name="org.apache.jackrabbit.server.io.ZipHandler" />
- </propertyhandler>
- <propertyhandler>
- <class name="org.apache.jackrabbit.server.io.XmlHandler" />
- </propertyhandler>
- <propertyhandler>
- <class name="org.apache.jackrabbit.server.io.DefaultHandler" />
- </propertyhandler>
- </propertymanager>
- <!--
- Define nodetypes, that should never by displayed as 'collection'
- -->
- <noncollection>
- <nodetypes>
- <nodetype>nt:file</nodetype>
- <nodetype>nt:resource</nodetype>
- </nodetypes>
- </noncollection>
- <!--
- Example: Defines nodetypes, that should always be displayed as 'collection'.
- -->
- <!--
- <collection>
- <nodetypes>
- <nodetype>nt:folder</nodetype>
- <nodetype>rep:root</nodetype>
- </nodetypes>
- </collection>
- -->
- <!--
- Filter that allows to prevent certain items from being displayed.
- Please note, that this has an effect on PROPFIND calls only and does not
- provide limited access to those items matching any of the filters.
-
- However specifying a filter may cause problems with PUT or MKCOL if the
- resource to be created is being filtered out, thus resulting in inconsistent
- responses (e.g. PUT followed by PROPFIND on parent).
- -->
- <filter>
- <!-- class element defines the resource filter to be used. The specified class
- must implement the ItemFilter interface -->
- <class name="org.apache.jackrabbit.webdav.simple.DefaultItemFilter" />
- <!--
- Nodetype names to be used to filter child nodes.
- A child node can be filtered if the declaring nodetype of its definition
- is one of the nodetype names specified in the nodetypes Element.
- E.g. defining 'rep:root' as filtered nodetype whould result in jcr:system
- being hidden but no other child node of the root node, since those
- are defined by the nodetype nt:unstructered.
- -->
- <!--
- <nodetypes>
- <nodetype>rep:root</nodetype>
- </nodetypes>
- -->
- <!--
- Namespace prefixes or uris. Items having a name that matches any of the
- entries will be filtered.
- -->
- <namespaces>
- <prefix>rep</prefix>
- <prefix>jcr</prefix>
- <!--
- <uri>internal</uri>
- <uri>http://www.jcp.org/jcr/1.0</uri>
- -->
- </namespaces>
- </filter>
-
- <!--
- Optional 'mimetypeproperties' element.
- It defines additional or replaces existing mappings for the MimeResolver
- instance created by the ResourceConfig.
- The default mappings are defined in org.apache.jackrabbit.server.io.mimetypes.properties.
- If the default mime type defined by MimeResolver is 'application/octet-stream'.
- -->
- <!--
- <mimetypeproperties>
- <mimemapping extension="rtf" mimetype="application/rtf" />
- <mimemapping extension="ott" mimetype="application/vnd.oasis.opendocument.text-template" />
- <defaultmimetype>text/html</defaultmimetype>
- </mimetypeproperties>
- -->
-</config>
+++ /dev/null
-<?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:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
-
- <bean id="webdavServlet" class="org.argeo.server.jackrabbit.webdav.WebDavServlet">
- <property name="repository" ref="jcrRepository" />
- <property name="resourceConfiguration" value="osgibundle:/WEB-INF/webdav-config.xml" />
- </bean>
-
- <bean
- class="org.springframework.web.servlet.handler.SimpleServletPostProcessor" />
-
- <bean id="servletHandler"
- class="org.springframework.web.servlet.handler.SimpleServletHandlerAdapter" />
-
- <bean id="urlMapping"
- class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
- <property name="mappings">
- <props>
- <prop key="**">webdavServlet</prop>
- </props>
- </property>
- </bean>
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<xsl:stylesheet version="1.0"\r
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
- xmlns:slc="http://argeo.org/projects/slc/schemas"\r
- exclude-result-prefixes="slc">\r
-\r
- <xsl:output method="html" omit-xml-declaration="yes" />
-
-\r
- <xsl:template match="/">\r
- <html>\r
- <head>\r
- <title>Result</title>\r
- </head>\r
- <body style="font-family: sans-serif">\r
- <h1>\r
- Result\r
- <xsl:value-of select="slc:tree-test-result/@uuid" />\r
- </h1>\r
- <xsl:for-each\r
- select="slc:tree-test-result/slc:result-parts/slc:result-part">\r
- <h2>\r
- <xsl:value-of select="@path" />\r
- </h2>\r
- <table>\r
- <xsl:for-each\r
- select="slc:part-sub-list/slc:parts/slc:simple-result-part">\r
- <tr>\r
- <xsl:choose>\r
- <xsl:when\r
- test="slc:status = 'PASSED' ">\r
- <td style="color:green">\r
- <xsl:value-of\r
- select="slc:message" />\r
- </td>\r
- </xsl:when>\r
- <xsl:otherwise>\r
- <td style="color:red">\r
- <xsl:value-of\r
- select="slc:message" />\r
- </td>\r
- </xsl:otherwise>\r
- </xsl:choose>\r
- </tr>\r
- </xsl:for-each>\r
- </table>\r
- </xsl:for-each>\r
- </body>\r
- </html>\r
- </xsl:template>\r
-</xsl:stylesheet>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<xsl:stylesheet version="1.0"\r
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
- xmlns:slc="http://argeo.org/projects/slc/schemas"\r
- exclude-result-prefixes="slc">\r
-\r
- <xsl:template match="/">
- <xsl:copy-of select="*"/>\r
- </xsl:template>\r
-</xsl:stylesheet>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<xsl:stylesheet version="1.0"\r
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
- xmlns:slc="http://argeo.org/projects/slc/schemas"\r
- exclude-result-prefixes="slc">\r
-\r
- <xsl:output method="html" omit-xml-declaration="yes" />
-
-\r
- <xsl:template match="/">\r
- <html>\r
- <head>\r
- <title>Result</title>\r
- </head>\r
- <body style="font-family: sans-serif">\r
- <h1>\r
- Result\r
- <xsl:value-of select="slc:tree-test-result/@uuid" />\r
- </h1>\r
- <xsl:for-each\r
- select="slc:tree-test-result/slc:result-parts/slc:result-part">\r
- <h2>\r
- <xsl:value-of select="@path" />\r
- </h2>\r
- <table>\r
- <xsl:for-each\r
- select="slc:part-sub-list/slc:parts/slc:simple-result-part">\r
- <tr>\r
- <xsl:choose>\r
- <xsl:when\r
- test="slc:status = 'PASSED' ">\r
- <td style="color:green">\r
- <xsl:value-of\r
- select="slc:message" />\r
- </td>\r
- </xsl:when>\r
- <xsl:otherwise>\r
- <td style="color:red">\r
- <xsl:value-of\r
- select="slc:message" />\r
- </td>\r
- </xsl:otherwise>\r
- </xsl:choose>\r
- </tr>\r
- </xsl:for-each>\r
- </table>\r
- </xsl:for-each>\r
- </body>\r
- </html>\r
- </xsl:template>\r
-</xsl:stylesheet>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<xsl:stylesheet version="1.0"\r
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\r
- xmlns:slc="http://argeo.org/projects/slc/schemas"\r
- exclude-result-prefixes="slc">\r
-\r
- <xsl:template match="/">
- <xsl:copy-of select="*"/>\r
- </xsl:template>\r
-</xsl:stylesheet>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
- <classpathentry kind="src" output="target/classes" path="src/main/resources"/>\r
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
- <classpathentry kind="output" path="target/classes"/>\r
-</classpath>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.server</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-#Fri Aug 29 11:25:17 CEST 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+++ /dev/null
-#Mon Jul 12 16:05:07 CEST 2010
-eclipse.preferences.version=1
-org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
+++ /dev/null
-#Sun Jan 11 18:26:20 CET 2009
-eclipse.preferences.version=1
-org.springframework.ide.eclipse.core.builders.enable.beanmetadatabuilder=false
-org.springframework.ide.eclipse.core.enable.project.preferences=false
-org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.core.springvalidator=false
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanAlias-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanClass-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanConstructorArgument-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinition-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinitionHolder-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanFactory-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanInitDestroyMethod-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanReference-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.methodOverride-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.parsingProblems-org.springframework.ide.eclipse.beans.core.beansvalidator=true
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.requiredProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=false
-org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.core.springClasspath-org.springframework.ide.eclipse.core.springvalidator=false
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<beansProjectDescription>
- <version>1</version>
- <pluginVersion><![CDATA[2.2.1.v200811281800]]></pluginVersion>
- <configSuffixes>
- <configSuffix><![CDATA[xml]]></configSuffix>
- </configSuffixes>
- <enableImports><![CDATA[true]]></enableImports>
- <configs>
- </configs>
- <configSets>
- </configSets>
-</beansProjectDescription>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>runtime</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.server</artifactId>
- <name>SLC Server</name>
- <description>SLC Server</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Export-Package>
- org.argeo.slc.*,org.argeo.slc.server,org.argeo.slc.server.spring
- </Export-Package>
- <Import-Package>org.w3c.dom;version="0.0.0",
- javax.xml.*;version="0.0.0",
- org.argeo.slc.activemq;resolution:=optional,
- org.argeo.slc.execution,
- org.springframework.context.support,
- org.tmatesoft.svn.*;resolution:=optional,
- com.lowagie.*;resolution:=optional,
- com.springsource.json.*;resolution:=optional,
- org.springframework.oxm.*;resolution:=optional,
- *
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <!-- Commons -->
- <dependency>
- <groupId>org.argeo.commons.security</groupId>
- <artifactId>org.argeo.security.core</artifactId>
- <version>${version.argeo-commons}</version>
- </dependency>
-
- <!-- SLC -->
- <dependency>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.core</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
-
- <!-- Spring -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.web.servlet</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.aop</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.oxm</artifactId>
- <optional>true</optional>
- </dependency>
-
- <!-- Web -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.apache.commons.fileupload</artifactId>
- </dependency>
-
- <!-- J2EE -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>javax.servlet</artifactId>
- </dependency>
-
- <!-- AOP -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.aspectj.weaver</artifactId>
- </dependency>
-
- <!-- Docs -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>jxl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>com.lowagie.text</artifactId>
- </dependency>
-
- <!-- Security -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>com.springsource.json</artifactId>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.antlr</artifactId>
- <optional>true</optional>
- </dependency>
-
- <!-- SVN -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.tmatesoft.svn</artifactId>
- <optional>true</optional>
- </dependency>
-
- <!-- Commons VFS <dependency> <groupId>org.apache.commons</groupId> <artifactId>com.springsource.org.apache.commons.vfs</artifactId>
- </dependency> -->
- </dependencies>
-</project>
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.services;
-
-import org.argeo.slc.runtime.SlcAgentDescriptor;
-
-public interface AgentService {
- public void register(SlcAgentDescriptor slcAgentDescriptor);
-
- public void unregister(SlcAgentDescriptor slcAgentDescriptor);
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.services;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.msg.MsgConstants;
-import org.argeo.slc.msg.event.SlcEvent;
-import org.argeo.slc.msg.event.SlcEventPublisher;
-import org.argeo.slc.msg.process.SlcExecutionStatusRequest;
-import org.argeo.slc.process.SlcExecution;
-import org.argeo.slc.runtime.SlcAgentDescriptor;
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.annotation.After;
-import org.aspectj.lang.annotation.Aspect;
-
-@Aspect
-public class EventPublisherAspect {
- public final static String EVT_AGENT_REGISTERED = "agentRegistered";
- public final static String EVT_AGENT_UNREGISTERED = "agentUnregistered";
- public final static String EVT_NEW_SLC_EXECUTION = "newSlcExecution";
- public final static String EVT_UPDATE_SLC_EXECUTION_STATUS = "updateSlcExecutionStatus";
-
- private final static Log log = LogFactory
- .getLog(EventPublisherAspect.class);
-
- private List<SlcEventPublisher> eventPublishers;
-
- @After("execution(void org.argeo.slc.services.AgentService.register(..))")
- public void registerAgent(JoinPoint jp) throws Throwable {
- SlcAgentDescriptor agentDescriptor = (SlcAgentDescriptor) jp.getArgs()[0];
- SlcEvent event = new SlcEvent(EVT_AGENT_REGISTERED);
- event.getHeaders().put(MsgConstants.PROPERTY_SLC_AGENT_ID,
- agentDescriptor.getUuid());
- publishEvent(event);
- }
-
- @After("execution(void org.argeo.slc.services.AgentService.unregister(..))")
- public void unregisterAgent(JoinPoint jp) throws Throwable {
- SlcAgentDescriptor agentDescriptor = (SlcAgentDescriptor) jp.getArgs()[0];
- SlcEvent event = new SlcEvent(EVT_AGENT_UNREGISTERED);
- event.getHeaders().put(MsgConstants.PROPERTY_SLC_AGENT_ID,
- agentDescriptor.getUuid());
- publishEvent(event);
- }
-
- @After("execution(void org.argeo.slc.services.SlcExecutionService.newExecution(..))")
- public void newSlcExecution(JoinPoint jp) throws Throwable {
- SlcExecution slcExecution = (SlcExecution) jp.getArgs()[0];
- SlcEvent event = new SlcEvent(EVT_NEW_SLC_EXECUTION);
- event.getHeaders().put(MsgConstants.PROPERTY_SLC_EXECUTION_ID,
- slcExecution.getUuid());
- publishEvent(event);
- }
-
- @After("execution(void org.argeo.slc.services.SlcExecutionService.updateStatus(..))")
- public void updateSlcExecutionStatus(JoinPoint jp) throws Throwable {
- SlcExecutionStatusRequest msg = (SlcExecutionStatusRequest) jp
- .getArgs()[0];
- SlcEvent event = new SlcEvent(EVT_UPDATE_SLC_EXECUTION_STATUS);
- event.getHeaders().put(MsgConstants.PROPERTY_SLC_EXECUTION_ID,
- msg.getSlcExecutionUuid());
- event.getHeaders().put(MsgConstants.PROPERTY_SLC_EXECUTION_STATUS,
- msg.getNewStatus());
- publishEvent(event);
- }
-
- public void setEventPublishers(List<SlcEventPublisher> eventPublishers) {
- this.eventPublishers = eventPublishers;
- }
-
- protected void publishEvent(SlcEvent event) {
-
- for (Iterator<SlcEventPublisher> it = eventPublishers.iterator(); it
- .hasNext();) {
- SlcEventPublisher eventPublisher = it.next();
- if (log.isTraceEnabled())
- log.debug("Publish event: "
- + event.getHeaders().get(SlcEvent.EVENT_TYPE) + " to "
- + eventPublisher);
- eventPublisher.publish(event);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.services;
-
-import org.argeo.slc.SlcException;
-import org.argeo.slc.msg.MsgHandler;
-import org.argeo.slc.msg.process.SlcExecutionStatusRequest;
-import org.argeo.slc.msg.process.SlcExecutionStepsRequest;
-import org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest;
-import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;
-import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;
-import org.argeo.slc.msg.test.tree.ResultPartRequest;
-import org.argeo.slc.process.SlcExecution;
-
-public class ServiceMsgHandler implements MsgHandler {
- private TestManagerService testManagerService;
- private SlcExecutionService slcExecutionService;
-
- public Object handleMsg(Object msg) {
- if (msg instanceof SlcExecution)
- slcExecutionService.newExecution((SlcExecution) msg);
- else if (msg instanceof SlcExecutionStepsRequest)
- slcExecutionService.addSteps((SlcExecutionStepsRequest) msg);
- else if (msg instanceof SlcExecutionStatusRequest)
- slcExecutionService.updateStatus((SlcExecutionStatusRequest) msg);
- else if (msg instanceof CreateTreeTestResultRequest)
- testManagerService
- .createTreeTestResult((CreateTreeTestResultRequest) msg);
- else if (msg instanceof ResultPartRequest)
- testManagerService.addResultPart((ResultPartRequest) msg);
- else if (msg instanceof CloseTreeTestResultRequest)
- testManagerService
- .closeTreeTestResult((CloseTreeTestResultRequest) msg);
- else if (msg instanceof AddTreeTestResultAttachmentRequest)
- testManagerService
- .addAttachment((AddTreeTestResultAttachmentRequest) msg);
- else
- throw new SlcException("Unrecognized message type " + msg);
- return null;
- }
-
- public void setTestManagerService(TestManagerService testManagerService) {
- this.testManagerService = testManagerService;
- }
-
- public void setSlcExecutionService(SlcExecutionService slcExecutionService) {
- this.slcExecutionService = slcExecutionService;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.services;
-
-import org.argeo.slc.msg.process.SlcExecutionStatusRequest;
-import org.argeo.slc.msg.process.SlcExecutionStepsRequest;
-import org.argeo.slc.process.SlcExecution;
-
-public interface SlcExecutionService {
- public void newExecution(SlcExecution slcExecutionMsg);
-
- public void updateStatus(SlcExecutionStatusRequest msg);
-
- public void addSteps(SlcExecutionStepsRequest msg);
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.services;\r
-\r
-import org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest;\r
-import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;\r
-import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;\r
-import org.argeo.slc.msg.test.tree.ResultPartRequest;\r
-import org.argeo.slc.test.TestRunDescriptor;\r
-\r
-/** Performs complex business operations. */\r
-public interface TestManagerService {\r
- /** Performs operations related to the addition of a new test run. */\r
- public void registerTestRunDescriptor(TestRunDescriptor testRunDescriptor);\r
-\r
- /** Adds a result in a collection based on their ids. */\r
- public void addResultToCollection(String collectionId, String resultUuid);\r
-\r
- /** Removes a result from a collection based on their ids. */\r
- public void removeResultFromCollection(String collectionId,\r
- String resultUuid);\r
-\r
- public void createTreeTestResult(CreateTreeTestResultRequest msg);\r
-\r
- public void addResultPart(ResultPartRequest msg);\r
-\r
- public void addAttachment(AddTreeTestResultAttachmentRequest msg);\r
-\r
- public void closeTreeTestResult(CloseTreeTestResultRequest msg);\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.services.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Executor;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.dao.runtime.SlcAgentDescriptorDao;
-import org.argeo.slc.runtime.SlcAgent;
-import org.argeo.slc.runtime.SlcAgentDescriptor;
-import org.argeo.slc.runtime.SlcAgentFactory;
-import org.argeo.slc.services.AgentService;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.InitializingBean;
-
-public class AgentServiceImpl implements AgentService, InitializingBean,
- DisposableBean {
- private final static Log log = LogFactory.getLog(AgentServiceImpl.class);
-
- private final SlcAgentDescriptorDao slcAgentDescriptorDao;
- private final SlcAgentFactory agentFactory;
-
- private Executor systemExecutor;
-
- private Long pingCycle = 20000l;
-
- private Boolean pingThreadActive = true;
-
- public AgentServiceImpl(SlcAgentDescriptorDao slcAgentDescriptorDao,
- SlcAgentFactory agentFactory) {
- this.slcAgentDescriptorDao = slcAgentDescriptorDao;
- this.agentFactory = agentFactory;
- }
-
- public void register(SlcAgentDescriptor slcAgentDescriptor) {
- if (slcAgentDescriptorDao.getAgentDescriptor(slcAgentDescriptor
- .getUuid()) == null)
- slcAgentDescriptorDao.create(slcAgentDescriptor);
- log.info("Registered agent #" + slcAgentDescriptor.getUuid());
- }
-
- public void unregister(SlcAgentDescriptor slcAgentDescriptor) {
- slcAgentDescriptorDao.delete(slcAgentDescriptor);
- log.info("Unregistered agent #" + slcAgentDescriptor.getUuid());
- }
-
- public void afterPropertiesSet() throws Exception {
- // if (pingCycle > 0)
- // new PingThread().start();
- if (pingCycle > 0) {
- Thread authenticatedThread = new Thread("SLC Agents Ping") {
- public void run() {
- systemExecutor.execute(new AgentsPing());
- }
- };
- authenticatedThread.start();
-
- }
- }
-
- public synchronized void destroy() throws Exception {
- pingThreadActive = false;
- notifyAll();
- }
-
- public void setPingCycle(Long pingCycle) {
- this.pingCycle = pingCycle;
- }
-
- public void setSystemExecutor(Executor securityService) {
- this.systemExecutor = securityService;
- }
-
- protected class AgentsPing implements Runnable {
- public void run() {
-
- // FIXME: temporary hack so that the ping starts after the server
- // has been properly started.
- try {
- Thread.sleep(10 * 1000);
- } catch (InterruptedException e1) {
- // silent
- }
-
- log.info("Start pinging agents.");
- while (pingThreadActive) {
- List<SlcAgentDescriptor> lst = slcAgentDescriptorDao
- .listSlcAgentDescriptors();
- List<String> agentIds = new ArrayList<String>();
- for (SlcAgentDescriptor ad : lst)
- agentIds.add(ad.getUuid());
-
- if (log.isTraceEnabled())
- log.trace("Ping " + agentIds.size() + " agent(s).");
- for (String agentId : agentIds) {
- SlcAgent agent = agentFactory.getAgent(agentId);
- if (!agent.ping()) {
- log.info("Agent " + agentId + " did not reply to ping,"
- + " removing its descriptor...");
- slcAgentDescriptorDao.delete(agentId);
- }
- }
-
- lst = slcAgentDescriptorDao.listSlcAgentDescriptors();
- agentIds = new ArrayList<String>();
- for (SlcAgentDescriptor ad : lst)
- agentIds.add(ad.getUuid());
- agentFactory.pingAll(agentIds);
-
- synchronized (AgentServiceImpl.this) {
- try {
- AgentServiceImpl.this.wait(pingCycle);
- } catch (InterruptedException e) {
- // silent
- }
- }
- }
- log.info("Stopped pinging agents.");
- }
-
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.services.impl;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.execution.ExecutionProcess;
-import org.argeo.slc.execution.ExecutionStep;
-import org.argeo.slc.msg.process.SlcExecutionStatusRequest;
-import org.argeo.slc.msg.process.SlcExecutionStepsRequest;
-import org.argeo.slc.process.SlcExecutionNotifier;
-import org.argeo.slc.process.SlcExecutionStep;
-import org.argeo.slc.services.SlcExecutionService;
-
-/** In memory bridge between SLC execution notifier and service. */
-@SuppressWarnings("deprecation")
-public class SlcExecutionServiceAdapter implements SlcExecutionNotifier {
- private final static Log log = LogFactory
- .getLog(SlcExecutionServiceAdapter.class);
-
- private SlcExecutionService slcExecutionService;
-
- public void updateStatus(ExecutionProcess slcExecution, String oldStatus,
- String newStatus) {
- SlcExecutionStatusRequest req = new SlcExecutionStatusRequest(
- slcExecution.getUuid(), newStatus);
- try {
- slcExecutionService.updateStatus(req);
- } catch (Exception e) {
- log.trace("Cannot update process status " + e);
- }
- }
-
- public void addSteps(ExecutionProcess slcExecution,
- List<ExecutionStep> additionalSteps) {
- SlcExecutionStepsRequest req = new SlcExecutionStepsRequest(
- slcExecution.getUuid(), additionalSteps);
- try {
- slcExecutionService.addSteps(req);
- } catch (Exception e) {
- log.trace("Cannot add steps " + e);
- }
- }
-
- public void setSlcExecutionService(SlcExecutionService slcExecutionService) {
- this.slcExecutionService = slcExecutionService;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.services.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.dao.process.SlcExecutionDao;
-import org.argeo.slc.msg.process.SlcExecutionStatusRequest;
-import org.argeo.slc.msg.process.SlcExecutionStepsRequest;
-import org.argeo.slc.process.SlcExecution;
-import org.argeo.slc.process.SlcExecutionStep;
-import org.argeo.slc.services.SlcExecutionService;
-
-public class SlcExecutionServiceImpl implements SlcExecutionService {
- private final Log log = LogFactory.getLog(getClass());
-
- private final SlcExecutionDao slcExecutionDao;
-
- public SlcExecutionServiceImpl(SlcExecutionDao slcExecutionDao) {
- this.slcExecutionDao = slcExecutionDao;
- }
-
- public void newExecution(SlcExecution slcExecutionMsg) {
- SlcExecution slcExecutionPersisted = slcExecutionDao
- .getSlcExecution(slcExecutionMsg.getUuid());
- if (slcExecutionPersisted == null) {
- if (log.isTraceEnabled())
- log.trace("Creating SLC execution #"
- + slcExecutionMsg.getUuid());
-
- slcExecutionDao.create(slcExecutionMsg);
- } else {
- throw new SlcException(
- "There is already an SlcExecution registered with id "
- + slcExecutionMsg.getUuid());
- // if (log.isTraceEnabled())
- // log.trace("Updating SLC execution #"
- // + slcExecutionMsg.getUuid());
- //
- // slcExecutionDao.merge(slcExecutionMsg);
- }
- }
-
- public void updateStatus(SlcExecutionStatusRequest msg) {
- SlcExecution slcExecution = slcExecutionDao.getSlcExecution(msg
- .getSlcExecutionUuid());
- if (slcExecution == null)
- throw new SlcException("Could not find SLC execution #"
- + msg.getSlcExecutionUuid());
-
- slcExecution.setStatus(msg.getNewStatus());
-
- if (msg.getNewStatus().equals(SlcExecution.COMPLETED)) {
- List<SlcExecutionStep> steps = new ArrayList<SlcExecutionStep>();
- steps.add(new SlcExecutionStep(SlcExecutionStep.END,
- "Process finished."));
- slcExecutionDao.addSteps(slcExecution.getUuid(), steps);
- }
-
- if (log.isTraceEnabled())
- log.trace("Updating status for SLC execution #"
- + slcExecution.getUuid() + " to status "
- + msg.getNewStatus());
-
- slcExecutionDao.update(slcExecution);
- }
-
- public void addSteps(SlcExecutionStepsRequest msg) {
- slcExecutionDao.addSteps(msg.getSlcExecutionUuid(), msg.getSteps());
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.services.impl;
-
-import org.argeo.slc.core.attachment.Attachment;
-import org.argeo.slc.core.attachment.SimpleAttachment;
-import org.argeo.slc.core.test.tree.TreeTestResult;
-import org.argeo.slc.core.test.tree.TreeTestResultListener;
-import org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest;
-import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;
-import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;
-import org.argeo.slc.msg.test.tree.ResultPartRequest;
-import org.argeo.slc.services.TestManagerService;
-import org.argeo.slc.test.TestResultPart;
-
-/** In memory access to a test manager service */
-public class TestManagerServiceAdapter implements TreeTestResultListener {
- private Boolean onlyOnClose = false;
-
- private TestManagerService testManagerService;
-
- public void resultPartAdded(TreeTestResult testResult,
- TestResultPart testResultPart) {
- if (onlyOnClose)
- return;
-
- if (testResult.getResultParts().size() == 1
- && testResult.getResultParts().values().iterator().next()
- .getParts().size() == 1) {
- CreateTreeTestResultRequest req = new CreateTreeTestResultRequest(
- testResult);
- testManagerService.createTreeTestResult(req);
- } else {
- ResultPartRequest req = new ResultPartRequest(testResult);
- testManagerService.addResultPart(req);
- }
- }
-
- public void close(TreeTestResult testResult) {
- if (onlyOnClose) {
- CreateTreeTestResultRequest req = new CreateTreeTestResultRequest(
- testResult);
- testManagerService.createTreeTestResult(req);
- } else {
- CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(
- testResult);
- testManagerService.closeTreeTestResult(req);
- }
- }
-
- public void addAttachment(TreeTestResult testResult, Attachment attachment) {
- if (onlyOnClose)
- return;
- AddTreeTestResultAttachmentRequest req = new AddTreeTestResultAttachmentRequest();
- req.setResultUuid(testResult.getUuid());
- req.setAttachment((SimpleAttachment) attachment);
- testManagerService.addAttachment(req);
-
- }
-
- /** Publishes the test result only when it gets closed. */
- public void setOnlyOnClose(Boolean onlyOnClose) {
- this.onlyOnClose = onlyOnClose;
- }
-
- public void setTestManagerService(TestManagerService testManagerService) {
- this.testManagerService = testManagerService;
- }
-
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.services.impl;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.core.test.tree.TreeTestResultCollection;\r
-import org.argeo.slc.dao.process.SlcExecutionDao;\r
-import org.argeo.slc.dao.test.TestRunDescriptorDao;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultDao;\r
-import org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest;\r
-import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;\r
-import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;\r
-import org.argeo.slc.msg.test.tree.ResultPartRequest;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.services.TestManagerService;\r
-import org.argeo.slc.test.TestRunDescriptor;\r
-\r
-/**\r
- * Implementation of complex operations impacting the underlying data.\r
- */\r
-public class TestManagerServiceImpl implements TestManagerService {\r
- private Log log = LogFactory.getLog(getClass());\r
-\r
- private final TreeTestResultDao treeTestResultDao;\r
- private final TestRunDescriptorDao testRunDescriptorDao;\r
- private final SlcExecutionDao slcExecutionDao;\r
- private final TreeTestResultCollectionDao treeTestResultCollectionDao;\r
-\r
- private String defaultCollectionId = "default";\r
- \r
- public TestManagerServiceImpl(TreeTestResultDao treeTestResultDao,\r
- TestRunDescriptorDao testRunDescriptorDao,\r
- SlcExecutionDao slcExecutionDao,\r
- TreeTestResultCollectionDao treeTestResultCollectionDao) {\r
- this.treeTestResultDao = treeTestResultDao;\r
- this.testRunDescriptorDao = testRunDescriptorDao;\r
- this.slcExecutionDao = slcExecutionDao;\r
- this.treeTestResultCollectionDao = treeTestResultCollectionDao;\r
- }\r
-\r
- public void registerTestRunDescriptor(TestRunDescriptor testRunDescriptor) {\r
- if (testRunDescriptor != null) {\r
- if (log.isTraceEnabled())\r
- log.trace("Registering test run descriptor #"\r
- + testRunDescriptor.getTestRunUuid());\r
- testRunDescriptorDao.saveOrUpdate(testRunDescriptor);\r
-\r
- // Update tree test result collection\r
- // TODO: optimize\r
-\r
- if (testRunDescriptor.getSlcExecutionUuid() != null) {\r
- SlcExecution slcExecution = slcExecutionDao\r
- .getSlcExecution(testRunDescriptor\r
- .getSlcExecutionUuid());\r
- if (slcExecution != null) {\r
- // Use Host as collection ID if host is available\r
- String collectionId = slcExecution.getHost() != null ? slcExecution\r
- .getHost()\r
- : defaultCollectionId;\r
- addResultToCollection(collectionId, testRunDescriptor\r
- .getTestResultUuid());\r
- }\r
- } else {\r
- if (log.isTraceEnabled())\r
- log.trace("ResultUUID="\r
- + testRunDescriptor.getTestResultUuid());\r
- addResultToCollection(defaultCollectionId, testRunDescriptor\r
- .getTestResultUuid());\r
- }\r
- }\r
- }\r
-\r
- public void addResultToCollection(String collectionId, String resultUuid) {\r
- // TODO: improve collections\r
- TreeTestResultCollection ttrc = treeTestResultCollectionDao\r
- .getTestResultCollection(collectionId);\r
- if (ttrc == null) {\r
- ttrc = new TreeTestResultCollection(collectionId);\r
- treeTestResultCollectionDao.create(ttrc);\r
- }\r
- treeTestResultCollectionDao.addResultToCollection(ttrc, resultUuid);\r
- }\r
-\r
- public void removeResultFromCollection(String collectionId,\r
- String resultUuid) {\r
- TreeTestResultCollection ttrc = treeTestResultCollectionDao\r
- .getTestResultCollection(collectionId);\r
- if (ttrc != null) {\r
- treeTestResultCollectionDao.removeResultFromCollection(ttrc,\r
- resultUuid);\r
- }\r
-\r
- // Delete collection if empty\r
- // see https://www.argeo.org/bugzilla/show_bug.cgi?id=74\r
- if (ttrc.getResults().size() == 0) {\r
- treeTestResultCollectionDao.delete(ttrc);\r
- }\r
- }\r
-\r
- public void createTreeTestResult(CreateTreeTestResultRequest msg) {\r
- TreeTestResult treeTestResult = msg.getTreeTestResult();\r
-\r
- if (log.isTraceEnabled())\r
- log.trace("Creating result #" + treeTestResult.getUuid());\r
- treeTestResultDao.create(treeTestResult);\r
-\r
- registerTestRunDescriptor(msg.getTestRunDescriptor());\r
-\r
- // FIXME: temporary hack before better collection management is found\r
- if (msg.getTestRunDescriptor() == null) {\r
- addResultToCollection("default", treeTestResult.getUuid());\r
- }\r
- }\r
-\r
- public void addResultPart(ResultPartRequest msg) {\r
- // registerTestRunDescriptor(msg.getTestRunDescriptor());\r
-\r
- if (log.isTraceEnabled())\r
- log.trace("Adding result part to test result #"\r
- + msg.getResultUuid());\r
-\r
- treeTestResultDao.addResultPart(msg.getResultUuid(), msg.getPath(), msg\r
- .getResultPart(), msg.getRelatedElements());\r
- // treeTestResultDao.updateAttributes(msg.getResultUuid(), msg\r
- // .getAttributes());\r
- }\r
-\r
- public void closeTreeTestResult(CloseTreeTestResultRequest msg) {\r
- if (log.isTraceEnabled())\r
- log.trace("Closing result #" + msg.getResultUuid() + " at date "\r
- + msg.getCloseDate());\r
-\r
- treeTestResultDao.close(msg.getResultUuid(), msg.getCloseDate());\r
- }\r
-\r
- public void addAttachment(AddTreeTestResultAttachmentRequest msg) {\r
- if (log.isTraceEnabled())\r
- log.trace("Adding attachment " + msg.getAttachment()\r
- + " to result #" + msg.getResultUuid());\r
- treeTestResultDao.addAttachment(msg.getResultUuid(), msg\r
- .getAttachment());\r
-\r
- }\r
-\r
- public void setDefaultCollectionId(String defaultCollectionId) {\r
- this.defaultCollectionId = defaultCollectionId;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer;
-
-import javax.servlet.http.HttpServletRequest;
-
-public interface AjxpAction<T extends AjxpDriver>{
- public AjxpAnswer execute(T driver, HttpServletRequest request);
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer;
-
-import javax.servlet.http.HttpServletResponse;
-
-public interface AjxpAnswer {
- public static AjxpAnswer DO_NOTHING = new AjxpAnswer(){
- public void updateResponse(HttpServletResponse response) {
- }
- };
-
- public void updateResponse(HttpServletResponse response);
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer;
-
-import javax.servlet.http.HttpServletRequest;
-
-public interface AjxpDriver {
- public AjxpAnswer executeAction(HttpServletRequest request);
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer;
-
-public class AjxpDriverException extends RuntimeException {
- static final long serialVersionUID = 1l;
-
- public AjxpDriverException(String arg0) {
- super(arg0);
- }
-
- public AjxpDriverException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class SimpleAjxpDriver implements AjxpDriver {
- protected final Log log = LogFactory.getLog(getClass());
- private Map<String, AjxpAction<? extends AjxpDriver>> actions = new TreeMap<String, AjxpAction<? extends AjxpDriver>>();
-
- public AjxpAnswer executeAction(HttpServletRequest request) {
- String actionStr = request.getParameter("get_action");
- if (actionStr == null) {
- actionStr = request.getParameter("action");
- }
- if (!actions.containsKey(actionStr)) {
- throw new AjxpDriverException("Action " + actionStr
- + " not defined.");
- }
- AjxpAction action = actions.get(actionStr);
- return action.execute(this,request);
- }
-
- public void setActions(Map<String, AjxpAction<? extends AjxpDriver>> actions) {
- this.actions = actions;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.file;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-import org.argeo.slc.web.ajaxplorer.AjxpAnswer;
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;
-
-public abstract class AbstractFileDownloadAction extends FileAction {
- public AjxpAnswer execute(FileDriver driver, HttpServletRequest request) {
- String fileStr = request.getParameter(getFileParameter());
- if (fileStr == null) {
- throw new AjxpDriverException(
- "A file to download needs to be provided.");
- }
- File file = new File(driver.getBasePath() + fileStr);
- return new AxpBasicDownloadAnswer(file);
- }
-
- /** Return 'file' by default. */
- protected String getFileParameter() {
- return "file";
- }
-
- /** To be overridden. Do nothing by default. */
- protected void setHeaders(HttpServletResponse response, File file) {
- // do nothing
- }
-
- protected class AxpBasicDownloadAnswer implements AjxpAnswer {
- private final File file;
-
- public AxpBasicDownloadAnswer(File file) {
- this.file = file;
- }
-
- public void updateResponse(HttpServletResponse response) {
- InputStream in = null;
- OutputStream out = null;
- try {
- setHeaders(response, file);
-
- if (log.isDebugEnabled())
- log.debug("Download file " + file);
- in = FileUtils.openInputStream(file);
- out = response.getOutputStream();
-
- copyFile(in, out);
- out.flush();
-
- } catch (Exception e) {
- e.printStackTrace();
- throw new AjxpDriverException("Cannot download file " + file, e);
- } finally {
- IOUtils.closeQuietly(in);
- IOUtils.closeQuietly(out);
- }
-
- }
-
- protected void copyFile(InputStream in, OutputStream out)
- throws Exception {
- IOUtils.copy(in, out);
- }
-
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.file;
-
-import java.io.File;
-import java.net.URLEncoder;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;
-
-public class AjxpFile {
- private final static Log log = LogFactory.getLog(AjxpFile.class);
-
- // FIXME: more generic modif time format?
- private final static SimpleDateFormat sdf = new SimpleDateFormat(
- "dd/MM/yyyy hh:mm");
-
- private final File file;
- private final String parentPath;
- private final String filePath;
-
- private final String ext;
- private final FileType type;
-
- public AjxpFile(File file, String parentPath) {
- this.file = file;
- this.parentPath = parentPath;
- if (parentPath.equals("/")) {
- this.filePath = "/" + file.getName();
- } else {
- this.filePath = parentPath + "/" + file.getName();
- }
- this.ext = file.isDirectory() ? null : file.getName().substring(
- file.getName().indexOf('.') + 1);
- this.type = FileType.findType(ext);
- }
-
- public String toXml(final LsMode mode, final String encoding) {
- try {
- StringBuffer buf = new StringBuffer();
- buf.append("<tree");
- addAttr("text", file.getName(), buf);
- if (type != FileType.FOLDER) {
- if (mode == LsMode.SEARCH)
- addAttr("is_file", "true", buf);// FIXME: consistent value?
- else if (mode == LsMode.FILE_LIST) {
- addAttr("filename", filePath, buf);
- addAttr("is_file", "1", buf);
- addAttr("icon", type.getIcon(), buf);
-
- addAttr("modiftime", formatModifTime(), buf);
- addAttr("mimestring", type.getMimeString(), buf);
- addAttr("filesize", formatFileSize(), buf);
-
- if (type.isImage()) {
- addAttr("is_image", "1", buf);
- addAttr("image_type", type.getImageType(), buf);
- addAttr("image_width", "100", buf);// FIXME: read image
- addAttr("image_height", "100", buf);// FIXME: read image
-
- } else {
- addAttr("is_image", "0", buf);
- }
- }
-
- } else {// dir
- if (mode == LsMode.NULL || mode == LsMode.FILE_LIST) {
- addAttr("filename", filePath, buf);
- if (mode == LsMode.NULL) {
- addAttr("icon", "client/images/foldericon.png", buf);
- addAttr("openicon", "client/images/openfoldericon.png",
- buf);
- addAttr("parentName", parentPath, buf);
- addAttr("src", "content.php?dir="
- + URLEncoder.encode(filePath, encoding), buf);
- addAttr(
- "action",
- "javascript:ajaxplorer.getFoldersTree().clickNode(CURRENT_ID)",
- buf);
- } else if (mode == LsMode.FILE_LIST) {
- addAttr("icon", type.getIcon(), buf);// FIXME:
- // consistent?
- addAttr("is_file", "0", buf);
- addAttr("is_image", "0", buf);
- addAttr("mimestring", "Directory", buf);
- addAttr("modiftime", formatModifTime(), buf);
- addAttr("filesize", "-", buf);
- }
- }
-
- }
-
- addAdditionalAttrs(buf, mode, encoding);
-
- buf.append("/>");
-
- if (log.isTraceEnabled())
- log.trace(buf.toString());
-
- return buf.toString();
- } catch (Exception e) {
- throw new AjxpDriverException("Could not serialize file " + file, e);
- }
- }
-
- private String formatModifTime() {
- return sdf.format(new Date(file.lastModified()));
- }
-
- private String formatFileSize() {
- return (file.length() / 1024) + " Kb";
- }
-
- protected void addAttr(String attrName, String attrValue, StringBuffer buf) {
- buf.append(" ").append(attrName).append("=\"").append(attrValue)
- .append("\"");
- }
-
- /** To be overridden, do nothing by default. */
- protected void addAdditionalAttrs(final StringBuffer buf,
- final LsMode mode, final String encoding) {
-
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.file;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.web.ajaxplorer.AjxpAction;
-
-public abstract class FileAction implements AjxpAction<FileDriver> {
- protected final Log log = LogFactory.getLog(getClass());
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.ajaxplorer.file;\r
-\r
-import java.io.File;\r
-import java.util.Map;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.argeo.slc.web.ajaxplorer.AjxpAnswer;\r
-\r
-public class FileDeleteAction<T extends FileDriver> extends FileAction {\r
-\r
- public AjxpAnswer execute(FileDriver driver, HttpServletRequest request) {\r
- Map<Object, Object> params = request.getParameterMap();\r
- for (Object paramKey : params.keySet()) {\r
- String param = paramKey.toString();\r
- log.debug("param=" + param + " (" + params.get(paramKey));\r
- if (param.length() < 4)\r
- continue;\r
- else {\r
-\r
- if (param.substring(0, 4).equals("file")) {\r
- String[] values = (String[]) params.get(paramKey);\r
- for (String path : values) {\r
- File file = driver.getFile(path);\r
- executeDelete((T) driver, file);\r
- }\r
- }\r
- }\r
- }\r
-\r
- return AjxpAnswer.DO_NOTHING;\r
- }\r
-\r
- protected void executeDelete(T driver, File file) {\r
- log.debug("Delete file " + file);\r
- file.delete();\r
- }\r
-\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.file;
-
-import java.io.File;
-
-import javax.servlet.http.HttpServletResponse;
-
-public class FileDownloadAction extends AbstractFileDownloadAction {
-
- @Override
- protected void setHeaders(HttpServletResponse response, File file) {
- setDefaultDownloadHeaders(response, file.getName(), file.length());
- }
-
- public static void setDefaultDownloadHeaders(HttpServletResponse response,
- String fileName, Long fileLength) {
- response.setContentType("application/force-download; name=\""
- + fileName + "\"");
- response.setHeader("Content-Transfer-Encoding", "binary");
- if (fileLength != null)
- response.setContentLength(fileLength.intValue());
- response.setHeader("Content-Disposition", "attachement; filename=\""
- + fileName + "\"");
- response.setHeader("Expires", "0");
- response.setHeader("Cache-Control", "no-cache, must-revalidate");
- response.setHeader("Pragma", "no-cache");
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.file;
-
-import java.io.File;
-
-import org.argeo.slc.web.ajaxplorer.SimpleAjxpDriver;
-
-public class FileDriver extends SimpleAjxpDriver{
- private String basePath;
- private String encoding = "UTF-8";
-
- public String getBasePath() {
- return basePath;
- }
-
- public File getBaseDir(){
- return new File(getBasePath());
- }
-
- public void setBasePath(String basePath) {
- if (basePath.charAt(basePath.length() - 1) != File.separatorChar)
- basePath = basePath + File.separatorChar;
- this.basePath = basePath;
- }
-
- public String getEncoding() {
- return encoding;
- }
-
- public void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-
- public File getFile(String relpath) {
- return new File(getBasePath() + relpath).getAbsoluteFile();
- }
-
- public File getFile(String dir, String fileName) {
- return getFile(dir + File.separator + fileName);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.file;
-
-import java.io.File;
-
-import javax.servlet.http.HttpServletResponse;
-
-public class FileImageProxyAction extends AbstractFileDownloadAction {
-
- @Override
- protected void setHeaders(HttpServletResponse response, File file) {
- FileType fileType = FileType.findType(file);
- response.setContentType(fileType.getImageType());
- response.setContentLength((int) file.length());
- response.setHeader("Cache-Control", "public");
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.file;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.OutputStreamWriter;
-import java.util.List;
-import java.util.Vector;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.io.IOUtils;
-import org.argeo.slc.web.ajaxplorer.AjxpAnswer;
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;
-
-public class FileLsAction<T extends FileDriver, F extends AjxpFile> extends
- FileAction {
-
- public AjxpAnswer execute(FileDriver driver, HttpServletRequest request) {
- String modeStr = request.getParameter("mode");
- LsMode mode;
- if (modeStr == null)
- mode = LsMode.NULL;
- else if (modeStr.equals("complete"))
- mode = LsMode.COMPLETE;
- else if (modeStr.equals("file_list"))
- mode = LsMode.FILE_LIST;
- else if (modeStr.equals("search"))
- mode = LsMode.SEARCH;
- else
- throw new AjxpDriverException("Unkown mode " + modeStr);
-
- String options = request.getParameter("options");
- if (options != null) {
- if ("al".equals(options))
- mode = LsMode.FILE_LIST;
- }
-
- String path = request.getParameter("dir");
- if (path == null) {
- path = "/";
- }
-
- boolean dirOnly = false;
- if (mode == LsMode.NULL || mode == LsMode.COMPLETE) {
- dirOnly = true;
- }
-
- List<F> ajxpFiles = listFiles((T) driver, path, dirOnly);
- /*
- * File[] files = dir.listFiles(createFileFilter(request, dir));
- * List<AjxpFile> ajxpFiles = new Vector<AjxpFile>(); for (File file :
- * files) { if (file.isDirectory()) { ajxpFiles.add(new AjxpFile(file,
- * path)); } else { if (!dirOnly) ajxpFiles.add(new AjxpFile(file,
- * path)); } }
- */
- return new AxpLsAnswer(driver, ajxpFiles, mode);
- }
-
- protected List<F> listFiles(T driver, String path, boolean dirOnly) {
- File dir = driver.getFile(path);
-
- if (!dir.exists())
- throw new AjxpDriverException("Dir " + dir + " does not exist.");
-
- FileFilter filter = createFileFilter(dir);
- File[] files = dir.listFiles(filter);
- List<F> ajxpFiles = new Vector<F>();
- for (File file : files) {
- if (file.isDirectory()) {
- ajxpFiles.add((F) new AjxpFile(file, path));
- } else {
- if (!dirOnly)
- ajxpFiles.add((F) new AjxpFile(file, path));
- }
- }
- return ajxpFiles;
- }
-
- /** To be overridden. Accept all by default. */
- protected FileFilter createFileFilter(File dir) {
- return new FileFilter() {
- public boolean accept(File pathname) {
- return true;
- }
-
- };
- }
-
- protected class AxpLsAnswer implements AjxpAnswer {
- private final List<F> files;
- private final LsMode mode;
- private final FileDriver driver;
-
- public AxpLsAnswer(FileDriver driver, List<F> files, LsMode mode) {
- this.files = files;
- this.mode = mode;
- this.driver = driver;
- }
-
- public void updateResponse(HttpServletResponse response) {
- final String encoding = driver.getEncoding();
- response.setCharacterEncoding(encoding);
- response.setContentType("text/xml");
-
- ServletOutputStream out = null;
- OutputStreamWriter writer = null;
- try {
- out = response.getOutputStream();
- writer = new OutputStreamWriter(out, encoding);
- writer.write("<?xml version=\"1.0\" encoding=\"" + encoding
- + "\"?>");
- // TODO add current path
- writer.write("<tree>");
- for (AjxpFile file : files) {
- writer.write(file.toXml(mode, encoding));
- }
- writer.write("</tree>");
- writer.flush();
-
- } catch (Exception e) {
- throw new AjxpDriverException("Could not write response.", e);
- } finally {
- IOUtils.closeQuietly(writer);
- IOUtils.closeQuietly(out);
- }
- }
-
- }
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.ajaxplorer.file;\r
-\r
-import java.io.File;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.argeo.slc.web.ajaxplorer.AjxpAnswer;\r
-\r
-public class FileMkdirAction<T extends FileDriver> extends FileAction {\r
-\r
- public AjxpAnswer execute(FileDriver driver,\r
- HttpServletRequest request) {\r
- String dir = request.getParameter("dir");\r
- String dirName = request.getParameter("dirname");\r
-\r
- File newDir = driver.getFile(dir, dirName);\r
- newDir.mkdirs();\r
-\r
- postProcess((T)driver,newDir);\r
-\r
- return AjxpAnswer.DO_NOTHING;\r
- }\r
-\r
- protected void postProcess(T driver,File newDir) {\r
-\r
- }\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.file;
-
-import java.io.File;
-
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;
-
-public enum FileType {
- FOLDER("folder.png", "Directory"), UNKNOWN("mime_empty.png", "Unkown"), GIF(
- "image.png", "GIF Picture"), JPEG("image.png", "JPEG Picture"), PNG(
- "image.png", "PNG Picture");
-
- private final String icon;
- private final String mimeString;
-
- FileType(String icon, String mimeString) {
- this.icon = icon;
- this.mimeString = mimeString;
- }
-
- public String getIcon() {
- return icon;
- }
-
- public String getMimeString() {
- return mimeString;
- }
-
- public boolean isImage() {
- return this == GIF || this == JPEG || this == PNG;
- }
-
- public String getImageType() {
- switch (this) {
- case GIF:
- return "image/gif";
- case JPEG:
- return "image/jpeg";
- case PNG:
- return "image/png";
- }
- throw new AjxpDriverException("Image type undefined for " + this);
- }
-
- public static FileType findType(File file) {
- String ext = file.isDirectory() ? null : file.getName().substring(
- file.getName().indexOf('.') + 1);
- return findType(ext);
- }
-
- /**
- * Find the type based on the extension.
- *
- * @param ext
- * the extension, null for a directory
- */
- public static FileType findType(String extArg) {
- if (extArg == null)
- return FOLDER;
-
- String ext = extArg.toLowerCase();
- if (ext.equals("jpg") || ext.equals("jpeg"))
- return JPEG;
- else if (ext.equals("gif"))
- return GIF;
- else if (ext.equals("png"))
- return PNG;
- else
- return UNKNOWN;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.file;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.io.IOUtils;
-import org.argeo.slc.web.ajaxplorer.AjxpAnswer;
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-
-public class FileUploadAction<T extends FileDriver> extends FileAction {
-
- public AjxpAnswer execute(FileDriver driver, HttpServletRequest request) {
- if (!(request instanceof MultipartHttpServletRequest)) {
- throw new AjxpDriverException(
- "Cann only deal with MultipartHttpServletRequest");
- }
- MultipartHttpServletRequest mpr = (MultipartHttpServletRequest) request;
- String dir = mpr.getParameter("dir");
- String fileName = mpr.getParameter("Filename");
-
- InputStream in = null;
- OutputStream out = null;
- File file = null;
- try {
- MultipartFile mpfile = mpr.getFile("Filedata");
- in = mpfile.getInputStream();
- file = driver.getFile(dir, fileName);
- out = new FileOutputStream(file);
- IOUtils.copy(in, out);
- } catch (IOException e) {
- throw new AjxpDriverException("Cannot upload file.", e);
- } finally {
- IOUtils.closeQuietly(in);
- IOUtils.closeQuietly(out);
- }
- postProcess((T)driver, file);
-
- return AjxpAnswer.DO_NOTHING;
- }
-
- protected void postProcess(T driver,File file) {
-
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.file;
-
-public enum LsMode {
- NULL, COMPLETE, FILE_LIST, SEARCH
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.mvc;
-
-import java.io.IOException;
-import java.util.Map;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.web.ajaxplorer.AjxpAnswer;
-import org.argeo.slc.web.ajaxplorer.AjxpDriver;
-import org.springframework.web.HttpRequestHandler;
-
-public class AjxpDriverRequestHandler implements HttpRequestHandler {
-
- protected final Log log = LogFactory.getLog(getClass());
- private AjxpDriver driver;
-
- public void handleRequest(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
- long id = System.currentTimeMillis();
- try {
- if (log.isDebugEnabled())
- logRequest(id, req.getMethod(), req);
-
- AjxpAnswer answer = driver.executeAction(req);
- answer.updateResponse(resp);
-
- if (log.isTraceEnabled())
- log.trace(id + " " + req.getMethod() + " completed");
- } catch (Exception e) {
- log.error(id + " Cannot process request.", e);
- throw new ServletException("Cannot process request " + id, e);
- }
-
- }
-
- protected void logRequest(long id, String method, HttpServletRequest req) {
- if (log.isDebugEnabled()) {
- StringBuffer buf = new StringBuffer(id + " Received " + method
- + ": ");
- buf.append('{');
- @SuppressWarnings("unchecked")
- Map<String, String[]> params = req.getParameterMap();
- int count1 = 0;
- for (Map.Entry<String, String[]> entry : params.entrySet()) {
- if (count1 != 0)
- buf.append(", ");
- buf.append(entry.getKey()).append("={");
- int count2 = 0;
- for (String value : entry.getValue()) {
- if (count2 != 0)
- buf.append(',');
- buf.append(value);
- count2++;
- }
- buf.append('}');
- count1++;
- }
- buf.append('}');
- log.debug(buf.toString());
- }
- }
-
- public void setDriver(AjxpDriver driver) {
- this.driver = driver;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.ajaxplorer.mvc;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Map;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.web.ajaxplorer.AjxpAnswer;
-import org.argeo.slc.web.ajaxplorer.AjxpDriver;
-import org.springframework.beans.BeanWrapper;
-import org.springframework.beans.BeanWrapperImpl;
-import org.springframework.beans.BeansException;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-import org.springframework.web.servlet.HttpServletBean;
-
-public class AjxpDriverServlet extends HttpServletBean {
- static final long serialVersionUID = 1l;
-
- protected final Log log = LogFactory.getLog(getClass());
- private String driverBean;
- private AjxpDriver driver;
-
- @Override
- public void init(ServletConfig sc) throws ServletException {
- super.init(sc);
- WebApplicationContext context = WebApplicationContextUtils
- .getRequiredWebApplicationContext(sc.getServletContext());
- driverBean = sc.getInitParameter("driverBean");
- if (driverBean == null) {
- throw new ServletException(
- "No driver found, please set the driverBean property");
- }
-
- logger.info("Loading driver " + driverBean);
- driver = (AjxpDriver) context.getBean(driverBean);
-
- // overrideBeanProperties(sc);
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
- processRequest("GET", req, resp);
- }
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
- processRequest("POST", req, resp);
- }
-
- protected void processRequest(String method, HttpServletRequest req,
- HttpServletResponse resp) throws ServletException, IOException {
- long id = System.currentTimeMillis();
- try {
- if (log.isDebugEnabled())
- logRequest(id, method, req);
-
- AjxpAnswer answer = driver.executeAction(req);
- answer.updateResponse(resp);
-
- if (log.isDebugEnabled())
- log.debug(id + " " + method + " completed");
- } catch (Exception e) {
- log.error(id + " Cannot process request.", e);
- throw new ServletException("Cannot process request " + id, e);
- }
-
- }
-
- public void setDriverBean(String driverName) {
- this.driverBean = driverName;
- }
-
- protected void logRequest(long id, String method, HttpServletRequest req) {
- if (log.isDebugEnabled()) {
- StringBuffer buf = new StringBuffer(id + " Received " + method
- + ": ");
- buf.append('{');
- Map<String, String[]> params = req.getParameterMap();
- int count1 = 0;
- for (Map.Entry<String, String[]> entry : params.entrySet()) {
- if (count1 != 0)
- buf.append(", ");
- buf.append(entry.getKey()).append("={");
- int count2 = 0;
- for (String value : entry.getValue()) {
- if (count2 != 0)
- buf.append(',');
- buf.append(value);
- count2++;
- }
- buf.append('}');
- count1++;
- }
- buf.append('}');
- log.debug(buf.toString());
- }
- }
-
- protected void overrideBeanProperties(ServletConfig sc)
- throws ServletException {
- BeanWrapper wrapper = new BeanWrapperImpl(driver);
- Enumeration<String> en = sc.getInitParameterNames();
- while (en.hasMoreElements()) {
- String name = en.nextElement();
- if (name.indexOf(driverBean + '.') == 0
- && name.length() > (driverBean.length() + 1)) {
- String propertyName = name.substring(driverBean.length() + 1);
- String value = sc.getInitParameter(name);
- if (value != null) {
- try {
- wrapper.setPropertyValue(propertyName, value);
- } catch (BeansException e) {
- throw new ServletException("Cannot set property "
- + propertyName + " of bean " + driverBean, e);
- }
- }
- }
- }
- }
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.ajaxplorer.svn;\r
-\r
-import org.argeo.slc.web.ajaxplorer.file.AjxpFile;\r
-import org.argeo.slc.web.ajaxplorer.file.LsMode;\r
-import org.tmatesoft.svn.core.wc.SVNInfo;\r
-\r
-public class SvnAjxpFile extends AjxpFile {\r
-\r
- protected final SVNInfo info;\r
-\r
- public SvnAjxpFile(SVNInfo info, String parentPath) {\r
- super(info.getFile(), parentPath);\r
- this.info = info;\r
- }\r
-\r
- @Override\r
- protected void addAdditionalAttrs(StringBuffer buf, LsMode mode,\r
- String encoding) {\r
- addAttr("author", info.getAuthor(), buf);\r
- addAttr("revision", Long.toString(info.getRevision().getNumber()), buf);\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.ajaxplorer.svn;\r
-\r
-import java.io.File;\r
-\r
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;\r
-import org.argeo.slc.web.ajaxplorer.file.FileDeleteAction;\r
-import org.tmatesoft.svn.core.SVNException;\r
-\r
-public class SvnDeleteAction extends FileDeleteAction<SvnDriver> {\r
- @Override\r
- protected void executeDelete(SvnDriver driver, File file) {\r
- try {\r
- driver.beginWriteAction(file.getParentFile());\r
-\r
- log.debug("SVN Delete: " + file);\r
- driver.getManager().getWCClient().doDelete(file, true, false);\r
-\r
- driver.commitAll("Commit delete of " + file.getName());\r
- driver.completeWriteAction(file.getParentFile());\r
- } catch (SVNException e) {\r
- throw new AjxpDriverException("Cannot delete file " + file, e);\r
- } finally {\r
- driver.rollbackWriteAction(file.getParentFile());\r
- }\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.ajaxplorer.svn;\r
-\r
-import javax.servlet.ServletOutputStream;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.argeo.slc.web.ajaxplorer.AjxpAction;\r
-import org.argeo.slc.web.ajaxplorer.AjxpAnswer;\r
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;\r
-import org.argeo.slc.web.ajaxplorer.file.FileDownloadAction;\r
-import org.tmatesoft.svn.core.io.SVNRepository;\r
-\r
-public class SvnDownloadAction implements AjxpAction<SvnDriver> {\r
-\r
- public AjxpAnswer execute(SvnDriver driver, HttpServletRequest request) {\r
- String path = request.getParameter("file");\r
- if (path.charAt(path.length() - 1) == '/') {\r
- // probably a directory\r
- return AjxpAnswer.DO_NOTHING;\r
- }\r
-\r
- String revStr = request.getParameter("rev");\r
- Long rev = Long.parseLong(revStr);\r
- return new SvnDownloadAnswer(driver, path, rev);\r
- }\r
-\r
- public class SvnDownloadAnswer implements AjxpAnswer {\r
- private final SvnDriver driver;\r
- private final String path;\r
- private final Long rev;\r
-\r
- public SvnDownloadAnswer(SvnDriver driver, String path, Long rev) {\r
- this.driver = driver;\r
- this.path = path;\r
- this.rev = rev;\r
- }\r
-\r
- public void updateResponse(HttpServletResponse response) {\r
- ServletOutputStream out = null;\r
- try {\r
- FileDownloadAction.setDefaultDownloadHeaders(response,\r
- getFileName(), null);\r
- response.setHeader("AjaXplorer-SvnFileName", getFileName());\r
-\r
- SVNRepository repository = driver.getRepository();\r
- out = response.getOutputStream();\r
- repository.getFile(path, rev, null, out);\r
- } catch (Exception e) {\r
- throw new AjxpDriverException("Cannot download revision " + rev\r
- + " of path " + path, e);\r
- } finally {\r
- IOUtils.closeQuietly(out);\r
- }\r
- }\r
-\r
- protected String getFileName() {\r
- int lastIndexSlash = path.lastIndexOf('/');\r
- final String origFileName;\r
- if (lastIndexSlash != -1) {\r
- origFileName = path.substring(lastIndexSlash + 1);\r
- } else {\r
- origFileName = path;\r
- }\r
-\r
- int lastIndexPoint = origFileName.lastIndexOf('.');\r
- String prefix = origFileName.substring(0, lastIndexPoint);\r
- String ext = origFileName.substring(lastIndexPoint);\r
- return prefix + "-" + rev + ext;\r
- }\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.ajaxplorer.svn;\r
-\r
-import java.io.File;\r
-\r
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;\r
-import org.argeo.slc.web.ajaxplorer.file.FileDriver;\r
-import org.springframework.beans.factory.BeanNameAware;\r
-import org.tmatesoft.svn.core.SVNException;\r
-import org.tmatesoft.svn.core.SVNURL;\r
-import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory;\r
-import org.tmatesoft.svn.core.io.SVNRepository;\r
-import org.tmatesoft.svn.core.wc.SVNClientManager;\r
-import org.tmatesoft.svn.core.wc.SVNInfo;\r
-import org.tmatesoft.svn.core.wc.SVNRevision;\r
-import org.tmatesoft.svn.core.wc.admin.SVNAdminClient;\r
-\r
-public class SvnDriver extends FileDriver implements BeanNameAware {\r
- private final static String DEFAULT_DATA_PATH = System\r
- .getProperty("user.home")\r
- + File.separator + "AjaXplorerArchiver" + File.separator + "data";\r
-\r
- private final static long WRITE_ACTION_TIMEOUT = 10 * 60 * 1000;\r
-\r
- private SVNURL baseUrl;\r
- private SVNClientManager manager;\r
-\r
- private String beanName;\r
-\r
- private boolean isInWriteAction = false;\r
-\r
- public void init() {\r
- FSRepositoryFactory.setup();\r
- manager = SVNClientManager.newInstance();\r
-\r
- String basePath = getBasePath();\r
- if (basePath != null) {\r
- File baseDir = new File(basePath);\r
- if (baseDir.exists()) {// base dir exists\r
- boolean shouldCheckOut = baseDirChecks(baseDir);\r
- if (shouldCheckOut) {\r
- checkOut(baseDir);\r
- }\r
- } else {\r
- checkOut(baseDir);\r
- }\r
- } else {\r
- String defaultBasePath = DEFAULT_DATA_PATH + File.separator\r
- + "svnwc" + File.separator + beanName;\r
- log.warn("No base path provided, use " + defaultBasePath);\r
- setBasePath(defaultBasePath);\r
-\r
- File baseDir = new File(getBasePath());\r
- if (!baseDir.exists()) {\r
- baseDir.mkdirs();\r
- }\r
-\r
- if (baseDirChecks(baseDir)) {\r
- if (getBaseUrl() == null) {\r
- String defaultRepoPath = DEFAULT_DATA_PATH + File.separator\r
- + "svnrepos" + File.separator + beanName;\r
- log.warn("No base URL found, create repository at "\r
- + defaultRepoPath);\r
- baseUrl = createRepository(new File(defaultRepoPath));\r
- }\r
- checkOut(new File(getBasePath()));\r
- }\r
- }\r
- log.info("SVN driver initialized with base url " + getBaseUrl()\r
- + " and base path " + getBasePath());\r
- }\r
-\r
- /** Builds a SVN URL. */\r
- public SVNURL getSVNURL(String relativePath) {\r
- try {\r
- return baseUrl.appendPath(relativePath, false);\r
- } catch (SVNException e) {\r
- throw new AjxpDriverException(\r
- "Cannot build URL from relative path " + relativePath\r
- + " and base url " + baseUrl);\r
- }\r
- }\r
-\r
- public SVNRepository getRepository() {\r
- try {\r
- return manager.createRepository(baseUrl, true);\r
- } catch (SVNException e) {\r
- throw new AjxpDriverException("Cannot create repository for "\r
- + baseUrl, e);\r
- }\r
- }\r
-\r
- /**\r
- * Verifies that the provided existing base dir is ok and whether one should\r
- * check out. Set the base url from the working copy.\r
- * \r
- * @return whether one should check out.\r
- */\r
- protected boolean baseDirChecks(File baseDir) {\r
- if (!baseDir.isDirectory()) {\r
- throw new AjxpDriverException("Base path " + baseDir\r
- + " is not a directory.");\r
- }\r
-\r
- try {// retrieves SVN infos\r
- SVNInfo info = manager.getWCClient().doInfo(baseDir,\r
- SVNRevision.WORKING);\r
- SVNURL baseUrlTemp = info.getURL();\r
- if (baseUrl != null) {\r
- if (!baseUrl.equals(baseUrlTemp)) {\r
- throw new AjxpDriverException(\r
- "SVN URL of the working copy "\r
- + baseUrlTemp\r
- + " is not compatible with provided baseUrl "\r
- + baseUrl);\r
- }\r
- } else {\r
- this.baseUrl = baseUrlTemp;\r
- }\r
- return false;\r
- } catch (SVNException e) {// no info retrieved\r
- log\r
- .warn("Could not retrieve SVN info from "\r
- + baseDir\r
- + "("\r
- + e.getMessage()\r
- + "). Guess that it is and empty dir and try to check out from provided URL.");\r
- if (baseDir.listFiles().length != 0) {\r
- throw new AjxpDriverException("Base dir " + baseDir\r
- + " is not a working copy and not an empty dir.");\r
- }\r
- return true;\r
- }\r
- }\r
-\r
- protected void checkOut(File baseDir) {\r
- if (getBaseUrl() == null) {\r
- throw new AjxpDriverException(\r
- "No SVN URL provided, cannot check out.");\r
- }\r
-\r
- // Make sure directory exists\r
- baseDir.mkdirs();\r
-\r
- try {\r
- long revision = manager.getUpdateClient().doCheckout(getBaseUrl(),\r
- baseDir, SVNRevision.UNDEFINED, SVNRevision.HEAD, true);\r
- log.info("Checked out from " + baseUrl + " to " + baseDir\r
- + " at revision " + revision);\r
- } catch (SVNException e) {\r
- throw new AjxpDriverException("Cannot check out from " + baseUrl\r
- + " to " + baseDir, e);\r
- }\r
- }\r
-\r
- protected SVNURL createRepository(File repoDir) {\r
- try {\r
- SVNAdminClient adminClient = manager.getAdminClient();\r
- return adminClient.doCreateRepository(repoDir, null, true, false);\r
- } catch (SVNException e) {\r
- throw new AjxpDriverException("Cannot create repository at "\r
- + repoDir, e);\r
- }\r
- }\r
-\r
- private void updateIfRequired(File dir) {\r
- try {\r
- SVNInfo wcInfo = manager.getWCClient().doInfo(getBaseDir(),\r
- SVNRevision.WORKING);\r
- SVNRevision wcRev = wcInfo.getRevision();\r
- SVNInfo repoInfo = manager.getWCClient().doInfo(getBaseUrl(),\r
- null, SVNRevision.HEAD);\r
- SVNRevision repoRev = repoInfo.getRevision();\r
-\r
- if (log.isTraceEnabled())\r
- log\r
- .trace("WC Revision=" + wcRev + ", Repo Revision="\r
- + repoRev);\r
-\r
- if (!wcRev.equals(repoRev)) {\r
- log.debug("Update working copy from revision " + wcRev\r
- + " to revision " + repoRev);\r
- manager.getUpdateClient().doUpdate(getBaseDir(),\r
- SVNRevision.HEAD, true);\r
- }\r
- } catch (SVNException e) {\r
- throw new AjxpDriverException("Cannot update working copy "\r
- + getBaseDir(),e);\r
- }\r
- }\r
-\r
- public synchronized void beginWriteAction(File dir) {\r
- if (isInWriteAction) {\r
- try {\r
- wait(WRITE_ACTION_TIMEOUT);\r
- } catch (InterruptedException e) {\r
- // silent\r
- }\r
- if (isInWriteAction) {\r
- throw new AjxpDriverException(\r
- "Still in write action after timeout "\r
- + WRITE_ACTION_TIMEOUT + " ms.");\r
- }\r
- }\r
-\r
- isInWriteAction = true;\r
- updateIfRequired(dir);\r
- }\r
-\r
- public synchronized void completeWriteAction(File dir) {\r
- isInWriteAction = false;\r
- notifyAll();\r
- }\r
-\r
- public synchronized void rollbackWriteAction(File dir) {\r
- // TODO: revert?\r
- isInWriteAction = false;\r
- notifyAll();\r
- }\r
- \r
- public void commitAll(String message) throws SVNException{\r
- if(log.isTraceEnabled())\r
- log.trace("SVN Commit: " + getBaseDir());\r
- manager.getCommitClient().doCommit(new File[] { getBaseDir() }, true,\r
- message, true, true);\r
-\r
- }\r
-\r
- /** Spring bean name, set at initialization. */\r
- public void setBeanName(String beanName) {\r
- this.beanName = beanName;\r
- }\r
-\r
- public void setBaseUrl(String baseUrl) {\r
- try {\r
- this.baseUrl = SVNURL.parseURIDecoded(baseUrl);\r
- } catch (SVNException e) {\r
- throw new AjxpDriverException("Cannot parse SVN URL " + baseUrl, e);\r
- }\r
- }\r
-\r
- public SVNURL getBaseUrl() {\r
- return baseUrl;\r
- }\r
-\r
- public SVNClientManager getManager() {\r
- return manager;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.ajaxplorer.svn;\r
-\r
-import java.io.File;\r
-import java.io.PrintWriter;\r
-import java.text.SimpleDateFormat;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.web.ajaxplorer.AjxpAction;\r
-import org.argeo.slc.web.ajaxplorer.AjxpAnswer;\r
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;\r
-import org.tmatesoft.svn.core.ISVNLogEntryHandler;\r
-import org.tmatesoft.svn.core.SVNException;\r
-import org.tmatesoft.svn.core.SVNLogEntry;\r
-import org.tmatesoft.svn.core.SVNLogEntryPath;\r
-import org.tmatesoft.svn.core.wc.SVNRevision;\r
-\r
-public class SvnLogAction implements AjxpAction<SvnDriver> {\r
- private final SimpleDateFormat sdfIso = new SimpleDateFormat(\r
- "yyyy-MM-dd HH:mm:ss");\r
- private final Log log = LogFactory.getLog(getClass());\r
-\r
- public AjxpAnswer execute(SvnDriver driver, HttpServletRequest request) {\r
- String fileStr = request.getParameter("file");\r
- log.debug("Log file " + fileStr);\r
- if (fileStr == null) {\r
- throw new AjxpDriverException("A file needs to be provided.");\r
- }\r
- File file = new File(driver.getBasePath() + fileStr);\r
- return new SvnLogAnswer(driver, file);\r
- }\r
-\r
- protected class SvnLogAnswer implements AjxpAnswer {\r
- private final SvnDriver driver;\r
- private final File file;\r
-\r
- public SvnLogAnswer(SvnDriver driver, File file) {\r
- this.driver = driver;\r
- this.file = file;\r
- }\r
-\r
- public void updateResponse(HttpServletResponse response) {\r
- PrintWriter writer = null;\r
- try {\r
- writer = response.getWriter();\r
- writer.append("<tree>");\r
- writer.append("<log>");\r
-\r
- final List<SVNLogEntry> logEntries = new Vector<SVNLogEntry>();\r
- ISVNLogEntryHandler logHandler = new ISVNLogEntryHandler() {\r
- public void handleLogEntry(SVNLogEntry logEntry)\r
- throws SVNException {\r
- logEntries.add(logEntry);\r
- }\r
- };\r
-\r
- driver.getManager().getLogClient().doLog(new File[] { file },\r
- SVNRevision.create(0), SVNRevision.HEAD, true, true,\r
- 100, logHandler);\r
-\r
- for (int i = logEntries.size() - 1; i >= 0; i--) {\r
- String xml = logEntryAsXml(logEntries.get(i), file);\r
- if(log.isTraceEnabled())\r
- log.trace(xml);\r
- writer.append(xml);\r
- }\r
-\r
- writer.append("</log>");\r
- writer.append("</tree>");\r
- } catch (Exception e) {\r
- throw new AjxpDriverException(\r
- "Cannot retrieve log for " + file, e);\r
- } finally {\r
- IOUtils.closeQuietly(writer);\r
- }\r
- }\r
-\r
- }\r
-\r
- protected String logEntryAsXml(SVNLogEntry entry, File file) {\r
- StringBuffer buf = new StringBuffer();\r
- buf.append("<logentry");\r
- buf.append(" revision=\"").append(entry.getRevision()).append("\"");\r
- buf.append(" is_file=\"").append(file.isDirectory() ? "0" : "1")\r
- .append("\"");\r
- buf.append(">");\r
-\r
- buf.append("<author>").append(entry.getAuthor()).append("</author>");\r
- buf.append("<date>").append(sdfIso.format(entry.getDate())).append(\r
- "</date>");\r
-\r
- buf.append("<paths>");\r
- Map<Object, SVNLogEntryPath> paths = entry.getChangedPaths();\r
- for (SVNLogEntryPath path : paths.values()) {\r
- buf.append("<path>").append(path.getPath()).append("</path>");\r
- }\r
- buf.append("</paths>");\r
-\r
- buf.append("<msg>").append(entry.getMessage()).append("</msg>");\r
-\r
- buf.append("</logentry>");\r
- return buf.toString();\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.ajaxplorer.svn;\r
-\r
-import java.io.File;\r
-import java.io.FileFilter;\r
-import java.util.List;\r
-import java.util.Vector;\r
-\r
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;\r
-import org.argeo.slc.web.ajaxplorer.file.FileLsAction;\r
-import org.tmatesoft.svn.core.SVNException;\r
-import org.tmatesoft.svn.core.wc.SVNInfo;\r
-import org.tmatesoft.svn.core.wc.SVNRevision;\r
-import org.tmatesoft.svn.core.wc.SVNWCClient;\r
-\r
-public class SvnLsAction extends FileLsAction<SvnDriver, SvnAjxpFile> {\r
-\r
- @Override\r
- protected List<SvnAjxpFile> listFiles(SvnDriver driver, final String path,\r
- final boolean dirOnly) {\r
- try {\r
- File dir = driver.getFile(path);\r
- SVNWCClient client = driver.getManager().getWCClient();\r
-\r
- final List<SvnAjxpFile> res = new Vector<SvnAjxpFile>();\r
- FileFilter filter = createFileFilter(dir);\r
- File[] files = dir.listFiles(filter);\r
- for (File file : files) {\r
- //SVNStatus status = driver.getManager().getStatusClient().doStatus(file, false);\r
- \r
- SVNInfo info = client.doInfo(file, SVNRevision.WORKING);\r
- if (dirOnly) {\r
- if (file.isDirectory())\r
- res.add(new SvnAjxpFile(info, path));\r
- } else {\r
- res.add(new SvnAjxpFile(info, path));\r
- }\r
- }\r
- return res;\r
- } catch (SVNException e) {\r
- throw new AjxpDriverException("Cannot list svn dir " + path, e);\r
- }\r
- }\r
-\r
- @Override\r
- protected FileFilter createFileFilter(File dir) {\r
- return new FileFilter() {\r
-\r
- public boolean accept(File pathname) {\r
- if (pathname.getName().equals(".svn")) {\r
- return false;\r
- } else {\r
- return true;\r
- }\r
- }\r
-\r
- };\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.ajaxplorer.svn;\r
-\r
-import java.io.File;\r
-\r
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;\r
-import org.argeo.slc.web.ajaxplorer.file.FileMkdirAction;\r
-import org.tmatesoft.svn.core.SVNException;\r
-\r
-public class SvnMkdirAction extends FileMkdirAction<SvnDriver> {\r
- @Override\r
- protected void postProcess(SvnDriver driver, File newDir) {\r
- try {\r
- driver.beginWriteAction(newDir.getParentFile());\r
-\r
- log.debug("SVN Add: " + newDir);\r
- driver.getManager().getWCClient().doAdd(newDir, true,\r
- newDir.isDirectory(), true, true);\r
-\r
- driver.commitAll("Commit new dir " + newDir.getName());\r
- driver.completeWriteAction(newDir.getParentFile());\r
- } catch (SVNException e) {\r
- throw new AjxpDriverException("Cannot commit new dir" + newDir, e);\r
- } finally {\r
- driver.rollbackWriteAction(newDir.getParentFile());\r
- }\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.ajaxplorer.svn;\r
-\r
-import java.io.File;\r
-\r
-import org.argeo.slc.web.ajaxplorer.AjxpDriverException;\r
-import org.argeo.slc.web.ajaxplorer.file.FileUploadAction;\r
-import org.tmatesoft.svn.core.SVNException;\r
-\r
-public class SvnUploadAction extends FileUploadAction<SvnDriver> {\r
- @Override\r
- protected void postProcess(SvnDriver driver, File file) {\r
- try {\r
- driver.beginWriteAction(file.getParentFile());\r
-\r
- log.debug("SVN Add: " + file);\r
- driver.getManager().getWCClient().doAdd(file, true,\r
- file.isDirectory(), true, true);\r
-\r
- driver.commitAll("Commit file " + file.getName());\r
- driver.completeWriteAction(file.getParentFile());\r
- } catch (SVNException e) {\r
- throw new AjxpDriverException("Cannot commit file " + file, e);\r
- } finally {\r
- driver.rollbackWriteAction(file.getParentFile());\r
- }\r
- }\r
-\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.slc.msg.ExecutionAnswer;
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.mvc.AbstractController;
-
-public abstract class AbstractServiceController extends AbstractController {
- public final static String KEY_ANSWER = "__answer";
-
- private String viewName = null;
-
- @Override
- protected final ModelAndView handleRequestInternal(
- HttpServletRequest request, HttpServletResponse response)
- throws Exception {
- ModelAndView mv = new ModelAndView();
- mv.setViewName(getViewName());
- try {
- handleServiceRequest(request, response, mv);
- } catch (Exception e) {
- e.printStackTrace();
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- ExecutionAnswer answer = ExecutionAnswer.error(writer.toString());
- ModelAndView errorMv = new ModelAndView();
- errorMv.addObject(KEY_ANSWER, answer);
- errorMv.setViewName(KEY_ANSWER);
- return errorMv;
- }
-
- if (mv.getModel().size() == 0) {
- mv.addObject(KEY_ANSWER, ExecutionAnswer
- .ok("Execution completed properly"));
- }
-
- if (mv.getViewName() == null && mv.getModel().size() == 1)
- mv.setViewName(mv.getModel().keySet().iterator().next().toString());
-
- return mv;
- }
-
- protected abstract void handleServiceRequest(HttpServletRequest request,
- HttpServletResponse response, ModelAndView modelAndView)
- throws Exception;
-
- public void setViewName(String viewName) {
- this.viewName = viewName;
- }
-
- public String getViewName() {
- return viewName;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc;
-
-
-public class FileUploadBean {
- private byte[] file;
-
- public void setFile(byte[] file) {
- this.file = file;
- }
-
- public byte[] getFile() {
- return file;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc;
-
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.slc.SlcException;
-import org.springframework.web.servlet.view.AbstractView;
-
-import com.springsource.json.writer.JSONObject;
-
-/** Marshal one of the object of the map to the output. */
-public class JsonView extends AbstractView {
- private String modelKey = null;
-
- public JsonView() {
- }
-
- @Override
- @SuppressWarnings(value = { "unchecked" })
- protected void renderMergedOutputModel(Map model,
- HttpServletRequest request, HttpServletResponse response)
- throws Exception {
- final Object answer;
- if (modelKey != null) {
- if (!model.containsKey(modelKey))
- throw new SlcException("Key " + modelKey
- + " not found in model.");
- answer = model.get(modelKey);
- } else {
- if (model.size() != 1)
- throw new SlcException(
- "Model has a size different from 1. Specify a modelKey.");
- answer = model.values().iterator().next();
- }
-
- if (answer instanceof JSONObject) {
- ((JSONObject) answer).write(response.getWriter());
- } else {
- JSONObject jsonObject = new JSONObject(answer);
- jsonObject.write(response.getWriter());
- }
- }
-
- public void setModelKey(String modelKey) {
- this.modelKey = modelKey;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc;
-
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import jxl.write.Label;
-import jxl.write.WritableSheet;
-import jxl.write.WritableWorkbook;
-
-import org.argeo.slc.SlcException;
-import org.argeo.slc.core.structure.tree.TreeSPath;
-import org.argeo.slc.core.test.SlcTestUtils;
-import org.argeo.slc.core.test.tree.PartSubList;
-import org.argeo.slc.core.test.tree.TreeTestResult;
-import org.argeo.slc.test.TestResultPart;
-import org.springframework.web.servlet.view.document.AbstractJExcelView;
-
-public class ResultExcelView extends AbstractJExcelView {
- public final static String MODELKEY_RESULT = "result";
-
-
- @SuppressWarnings(value = { "unchecked" })
- protected void buildExcelDocument(Map model, WritableWorkbook workbook,
- HttpServletRequest request, HttpServletResponse response) {
- try {
- if (workbook.getNumberOfSheets() == 0) {
- workbook.createSheet("SLC", 0);
- }
- WritableSheet sheet = workbook.getSheet("SLC");
-
- TreeTestResult ttr = (TreeTestResult) model
- .get(MODELKEY_RESULT);
-
- sheet.addCell(new Label(0, 0, "Result " + ttr.getUuid()));
-
- int currentRow = 1;
- for (TreeSPath path : ttr.getResultParts().keySet()) {
- PartSubList lst = ttr.getResultParts().get(path);
- sheet.addCell(new Label(0, currentRow, "Path " + path));
- currentRow++;
- for (TestResultPart part : lst.getParts()) {
- sheet.addCell(new Label(0, currentRow, SlcTestUtils
- .statusToString(part.getStatus())));
- sheet.addCell(new Label(1, currentRow, part.getMessage()));
- currentRow++;
- }
- currentRow++;// add an empty line between paths
- }
- } catch (Exception e) {
- throw new SlcException("Could not write spreadsheet.", e);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc;
-
-import java.awt.Color;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.slc.core.structure.tree.TreeSPath;
-import org.argeo.slc.core.test.SlcTestUtils;
-import org.argeo.slc.core.test.tree.PartSubList;
-import org.argeo.slc.core.test.tree.TreeTestResult;
-import org.argeo.slc.test.TestResultPart;
-import org.argeo.slc.test.TestStatus;
-import org.springframework.web.servlet.view.document.AbstractPdfView;
-
-import com.lowagie.text.Cell;
-import com.lowagie.text.Document;
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Table;
-import com.lowagie.text.pdf.PdfWriter;
-
-public class ResultPdfView extends AbstractPdfView {
- // private static final Log log = LogFactory.getLog(ResultPdfView.class);
-
- public final static String MODELKEY_RESULT = "result";
-
- @Override
- @SuppressWarnings(value = { "unchecked" })
- protected void buildPdfDocument(Map model, Document document,
- PdfWriter writer, HttpServletRequest request,
- HttpServletResponse response) throws Exception {
- TreeTestResult ttr = (TreeTestResult) model.get(MODELKEY_RESULT);
-
- document.addTitle("Result " + ttr.getUuid());
- document.add(new Paragraph("Result " + ttr.getUuid()));
-
- for (TreeSPath path : ttr.getResultParts().keySet()) {
- PartSubList lst = ttr.getResultParts().get(path);
- document.add(new Paragraph("Path " + path));
- Table table = new Table(2, lst.getParts().size());
- for (TestResultPart part : lst.getParts()) {
- Integer status = part.getStatus();
- Cell statusCell = new Cell(SlcTestUtils.statusToString(status));
- final Color color;
- if (status.equals(TestStatus.PASSED))
- color = Color.GREEN;
- else if (status.equals(TestStatus.FAILED))
- color = Color.RED;
- else
- color = Color.MAGENTA;
-
- statusCell.setBackgroundColor(color);
- table.addCell(statusCell);
- table.addCell(part.getMessage());
- }
- document.add(table);
- }
-
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Vector;
-
-import org.argeo.slc.msg.event.SlcEventListenerDescriptor;
-import org.argeo.slc.msg.event.SlcEventListenerRegister;
-import org.springframework.web.context.request.RequestContextHolder;
-
-public class WebSlcEventListenerRegister implements SlcEventListenerRegister,
- Serializable {
- public final static String ATTR_EVENT_LISTENER = "slcEventListener";
-
- static final long serialVersionUID = 1l;
-
- // private String clientId = UUID.randomUUID().toString();
-
- /** Synchronized */
- private List<SlcEventListenerDescriptor> descriptors = new Vector<SlcEventListenerDescriptor>();
-
- public synchronized void addEventListenerDescriptor(
- SlcEventListenerDescriptor eventListenerDescriptor) {
- if (descriptors.contains(eventListenerDescriptor))
- descriptors.remove(eventListenerDescriptor);
- descriptors.add(eventListenerDescriptor);
- }
-
- public synchronized void removeEventListenerDescriptor(
- SlcEventListenerDescriptor eventListenerDescriptor) {
- descriptors.remove(eventListenerDescriptor);
- }
-
- public synchronized List<SlcEventListenerDescriptor> getDescriptorsCopy() {
- return new ArrayList<SlcEventListenerDescriptor>(descriptors);
- }
-
- public String getId() {
- return RequestContextHolder.currentRequestAttributes().getSessionId();
- }
-
- // public SlcEvent listen(SlcEventListener eventListener, Long timeout) {
- // return eventListener.listen(clientId, getDescriptorsCopy(), timeout);
- // }
-
- // public void init() {
- // clientId = getSessionId();
- // checkClientId();
- //
- // if (log.isDebugEnabled())
- // log.debug("Initialized web event listener " + clientId);
- // }
- //
- // public void close() {
- // checkClientId();
- // if (log.isDebugEnabled())
- // log.debug("Closed web event listener " + clientId);
- // }
-
- // protected void checkClientId() {
- // String sessionId = getSessionId();
- // if (clientId == null || !clientId.equals(sessionId))
- // throw new SlcException("Client id " + clientId
- // + " not consistent with web session id " + sessionId);
- // }
- //
- // protected String getSessionId() {
- // return RequestContextHolder.currentRequestAttributes().getSessionId();
- // }
- //
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.mvc;\r
-\r
-import javax.xml.parsers.DocumentBuilderFactory;\r
-import javax.xml.transform.Source;\r
-import javax.xml.transform.dom.DOMResult;\r
-import javax.xml.transform.dom.DOMSource;\r
-\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.core.test.tree.TreeTestResultCollection;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.springframework.oxm.Marshaller;\r
-import org.springframework.web.servlet.view.xslt.XsltView;\r
-import org.w3c.dom.Document;\r
-\r
-public class XsltMarshallerView extends XsltView {\r
-\r
- private Marshaller marshaller;\r
-\r
- @Override\r
- protected Class<?>[] getSourceTypes() {\r
- return new Class[] { TreeTestResult.class,\r
- TreeTestResultCollection.class, SlcExecution.class };\r
- }\r
-\r
- @Override\r
- protected Source convertSource(Object source) throws Exception {\r
- Document document = DocumentBuilderFactory.newInstance()\r
- .newDocumentBuilder().newDocument();\r
- DOMResult result = new DOMResult(document);\r
- if (!marshaller.supports(source.getClass()))\r
- throw new SlcException("Object of type " + source.getClass()\r
- + " not supported.");\r
- marshaller.marshal(source, result);\r
- return new DOMSource(result.getNode());\r
- }\r
-\r
- public void setMarshaller(Marshaller marshaller) {\r
- this.marshaller = marshaller;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.mvc;\r
-\r
-import java.io.IOException;\r
-import java.util.Map;\r
-import java.util.TreeMap;\r
-\r
-import javax.xml.transform.Source;\r
-import javax.xml.transform.TransformerException;\r
-import javax.xml.transform.URIResolver;\r
-import javax.xml.transform.stream.StreamSource;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.SlcException;\r
-import org.springframework.core.io.Resource;\r
-import org.springframework.oxm.Marshaller;\r
-import org.springframework.web.servlet.view.AbstractUrlBasedView;\r
-import org.springframework.web.servlet.view.xslt.XsltViewResolver;\r
-\r
-/**\r
- * Xslt View resolver implementing URI resolver as well.\r
- * \r
- * @see URIResolver\r
- * @see XsltViewResolver\r
- */\r
-public class XsltMarshallerViewResolver extends XsltViewResolver implements\r
- URIResolver {\r
- private final static Log log = LogFactory\r
- .getLog(XsltMarshallerViewResolver.class);\r
-\r
- private Marshaller marshaller;\r
- private Map<String, Source> cacheUriResolver = new TreeMap<String, Source>();\r
-\r
- public XsltMarshallerViewResolver() {\r
- setUriResolver(this);\r
- }\r
-\r
- @Override\r
- protected AbstractUrlBasedView buildView(String viewName) throws Exception {\r
- AbstractUrlBasedView viewT = super.buildView(viewName);\r
- XsltMarshallerView view = (XsltMarshallerView) viewT;\r
- view.setMarshaller(marshaller);\r
- return view;\r
- }\r
-\r
- public void setMarshaller(Marshaller marshaller) {\r
- this.marshaller = marshaller;\r
- }\r
-\r
- public Source resolve(String href, String base) throws TransformerException {\r
- if (log.isTraceEnabled())\r
- log.trace("Resolve URI for href=" + href + " base=" + base);\r
-\r
- Source res = null;\r
- if (isCache())\r
- res = cacheUriResolver.get(href);\r
-\r
- if (res == null)\r
- res = getStylesheetSource(href);\r
-\r
- if (res == null)\r
- res = getStylesheetSource(getPrefix() + href);\r
-\r
- if (res == null)\r
- throw new SlcException("Can't resolve URI for href=" + href\r
- + " base=" + base);\r
-\r
- if (isCache() && !cacheUriResolver.containsKey(href))\r
- cacheUriResolver.put(href, res);\r
-\r
- return res;\r
- }\r
-\r
- protected Source getStylesheetSource(String url) {\r
- if (log.isDebugEnabled()) {\r
- log.debug("Loading XSLT stylesheet from '" + url + "'");\r
- }\r
- try {\r
- final Resource stylesheetResource = getApplicationContext()\r
- .getResource(url);\r
- String systemId = url.substring(0, url.lastIndexOf('/') + 1);\r
- return new StreamSource(stylesheetResource.getInputStream(),\r
- systemId);\r
- } catch (IOException e) {\r
- if (log.isTraceEnabled())\r
- log.trace("Cannot load stylesheet " + url, e);\r
- return null;\r
- }\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.mvc.controllers;\r
-\r
-import java.util.List;\r
-import java.util.Vector;\r
-\r
-import org.argeo.slc.dao.runtime.SlcAgentDescriptorDao;\r
-import org.argeo.slc.msg.ExecutionAnswer;\r
-import org.argeo.slc.msg.ObjectList;\r
-import org.argeo.slc.runtime.SlcAgentDescriptor;\r
-import org.springframework.stereotype.Controller;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-\r
-/**\r
- * Controle and information about the agents.\r
- */\r
-\r
-@Controller\r
-public class AgentController {\r
-\r
- // IoC\r
- private SlcAgentDescriptorDao slcAgentDescriptorDao;\r
-\r
- @RequestMapping("/listAgents.service")\r
- protected ObjectList listAgents() {\r
- List<SlcAgentDescriptor> list = slcAgentDescriptorDao\r
- .listSlcAgentDescriptors();\r
- return new ObjectList(list);\r
- }\r
-\r
- @RequestMapping("/cleanAgents.service")\r
- protected ExecutionAnswer cleanAgents() {\r
-\r
- List<SlcAgentDescriptor> list = slcAgentDescriptorDao\r
- .listSlcAgentDescriptors();\r
- for (SlcAgentDescriptor t : new Vector<SlcAgentDescriptor>(list)) {\r
- slcAgentDescriptorDao.delete(t);\r
- }\r
- return ExecutionAnswer.ok("Execution completed properly");\r
- }\r
-\r
- // IoC\r
- public void setSlcAgentDescriptorDao(\r
- SlcAgentDescriptorDao slcAgentDescriptorDao) {\r
- this.slcAgentDescriptorDao = slcAgentDescriptorDao;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.mvc.controllers;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.msg.ExecutionAnswer;\r
-import org.argeo.slc.msg.event.SlcEvent;\r
-import org.argeo.slc.msg.event.SlcEventListener;\r
-import org.argeo.slc.msg.event.SlcEventListenerDescriptor;\r
-import org.argeo.slc.msg.event.SlcEventListenerRegister;\r
-import org.springframework.stereotype.Controller;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.springframework.web.bind.annotation.RequestParam;\r
-\r
-@Controller\r
-public class EventController {\r
-\r
- private final static Log log = LogFactory.getLog(EventController.class);\r
-\r
- private Long defaultTimeout = 10000l;\r
-\r
- // IoC\r
- private SlcEventListener eventListener = null;\r
- // the following bean as a Session scope.\r
- private SlcEventListenerRegister eventListenerRegister;\r
-\r
- // Business Methods\r
- @RequestMapping("/addEventListener.service")\r
- public ExecutionAnswer addEventListener(\r
- @RequestParam(SlcEvent.EVENT_TYPE) String eventType,\r
- @RequestParam(value = SlcEvent.EVENT_FILTER, required = false) String eventFilter) {\r
-\r
- eventListenerRegister\r
- .addEventListenerDescriptor(new SlcEventListenerDescriptor(\r
- eventType, eventFilter));\r
- if (log.isTraceEnabled()) {\r
- log.trace("Registered listener on register "\r
- + eventListenerRegister.getId() + " for type " + eventType\r
- + ", filter=" + eventFilter);\r
- log.trace("Nb of registered descriptors : "\r
- + eventListenerRegister.getDescriptorsCopy().size());\r
- }\r
- return ExecutionAnswer.ok("Execution completed properly");\r
-\r
- }\r
-\r
- @RequestMapping("/removeEventListener.service")\r
- public ExecutionAnswer removeEventListener(\r
- @RequestParam(SlcEvent.EVENT_TYPE) String eventType,\r
- @RequestParam(value = SlcEvent.EVENT_FILTER, required = false) String eventFilter) {\r
-\r
- eventListenerRegister\r
- .removeEventListenerDescriptor(new SlcEventListenerDescriptor(\r
- eventType, eventFilter));\r
- if (log.isTraceEnabled()) {\r
- log.trace("Removed listener from register "\r
- + eventListenerRegister.getId() + " for type " + eventType\r
- + ", filter=" + eventFilter);\r
- log.trace("Nb of registered descriptors : "\r
- + eventListenerRegister.getDescriptorsCopy().size());\r
- }\r
- return ExecutionAnswer.ok("Execution completed properly");\r
- }\r
-\r
- @RequestMapping("/pollEvent.service")\r
- public Object pollEvent(\r
- @RequestParam(value = "timeout", required = false) String timeoutStr) {\r
- final Long timeout;\r
- if (timeoutStr != null)\r
- timeout = Long.parseLong(timeoutStr);\r
- else\r
- timeout = defaultTimeout;\r
- if (log.isTraceEnabled()) {\r
- log.trace("Begin poolEvent.service :"\r
- + " Nb of registered descriptors : "\r
- + eventListenerRegister.getDescriptorsCopy().size());\r
- }\r
- SlcEvent event = eventListener.listen(eventListenerRegister.getId(),\r
- eventListenerRegister.getDescriptorsCopy(), timeout);\r
- if (event != null) {\r
- if (log.isTraceEnabled())\r
- log.trace("Event heard : " + event.toString());\r
- return event;\r
- } else {\r
- if (log.isTraceEnabled())\r
- log.trace("No Event heard - Time out: ");\r
- return ExecutionAnswer.ok("Execution completed properly");\r
- }\r
-\r
- }\r
-\r
- public void setEventListenerRegister(\r
- SlcEventListenerRegister eventListenerRegister) {\r
- this.eventListenerRegister = eventListenerRegister;\r
- }\r
-\r
- public void setDefaultTimeout(Long defaultTimeout) {\r
- this.defaultTimeout = defaultTimeout;\r
- }\r
-\r
- public void setEventListener(SlcEventListener eventListener) {\r
- this.eventListener = eventListener;\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.mvc.controllers;\r
-\r
-import java.io.BufferedReader;\r
-import java.text.SimpleDateFormat;\r
-import java.util.Comparator;\r
-import java.util.List;\r
-import java.util.SortedSet;\r
-import java.util.TreeSet;\r
-import java.util.UUID;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.core.attachment.AttachmentsStorage;\r
-import org.argeo.slc.dao.process.SlcExecutionDao;\r
-import org.argeo.slc.execution.ExecutionModuleDescriptor;\r
-import org.argeo.slc.msg.ExecutionAnswer;\r
-import org.argeo.slc.msg.MsgConstants;\r
-import org.argeo.slc.msg.ObjectList;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-import org.argeo.slc.runtime.SlcAgent;\r
-import org.argeo.slc.runtime.SlcAgentFactory;\r
-import org.argeo.slc.services.SlcExecutionService;\r
-import org.springframework.oxm.Marshaller;\r
-import org.springframework.oxm.Unmarshaller;\r
-import org.springframework.stereotype.Controller;\r
-import org.springframework.ui.Model;\r
-import org.springframework.util.Assert;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.springframework.web.bind.annotation.RequestParam;\r
-import org.springframework.xml.transform.StringSource;\r
-\r
-@Controller\r
-public class ProcessController {\r
-\r
- private final static Log log = LogFactory.getLog(ProcessController.class);\r
-\r
- private SlcExecutionDao slcExecutionDao;\r
- private SlcAgentFactory agentFactory;\r
- private Unmarshaller unmarshaller;\r
- private Marshaller marshaller;\r
- private SlcExecutionService slcExecutionService;\r
- private AttachmentsStorage attachmentsStorage;\r
-\r
- private SlcExecutionManager slcExecutionManager;\r
-\r
- @RequestMapping("/listSlcExecutions.service")\r
- protected ObjectList listSlcExecutions() {\r
- List<SlcExecution> list = slcExecutionDao.listSlcExecutions();\r
- return new ObjectList(list);\r
- }\r
-\r
- @RequestMapping("/getExecutionDescriptor.service")\r
- protected ExecutionModuleDescriptor getExecutionDescriptor(\r
- @RequestParam String agentId, @RequestParam String moduleName,\r
- @RequestParam String version) {\r
-\r
- SlcAgent slcAgent = agentFactory.getAgent(agentId);\r
-\r
- ExecutionModuleDescriptor md = slcAgent.getExecutionModuleDescriptor(\r
- moduleName, version);\r
- return md;\r
- }\r
-\r
- @RequestMapping("/listModulesDescriptors.service")\r
- protected ObjectList listModulesDescriptors(@RequestParam String agentId) {\r
- // TODO: use centralized agentId property (from MsgConstants)?\r
- SlcAgent slcAgent = agentFactory.getAgent(agentId);\r
-\r
- List<ExecutionModuleDescriptor> descriptors = slcAgent\r
- .listExecutionModuleDescriptors();\r
- SortedSet<ExecutionModuleDescriptor> set = new TreeSet<ExecutionModuleDescriptor>(\r
- new Comparator<ExecutionModuleDescriptor>() {\r
-\r
- public int compare(ExecutionModuleDescriptor md1,\r
- ExecutionModuleDescriptor md2) {\r
- String str1 = md1.getLabel() != null ? md1.getLabel()\r
- : md1.getName();\r
- String str2 = md2.getLabel() != null ? md2.getLabel()\r
- : md2.getName();\r
- return str1.compareTo(str2);\r
- }\r
- });\r
- set.addAll(descriptors);\r
- return new ObjectList(set);\r
- }\r
-\r
- @RequestMapping("/getSlcExecution.service")\r
- protected SlcExecution getSlcExecution(@RequestParam String uuid) {\r
- SlcExecution slcExecution = slcExecutionDao.getSlcExecution(uuid);\r
- initializeSEM();\r
- slcExecutionManager.retrieveRealizedFlows(slcExecution);\r
- return slcExecution;\r
- }\r
-\r
- @RequestMapping("/newSlcExecution.service")\r
- protected ExecutionAnswer newSlcExecution(HttpServletRequest request,\r
- Model model) throws Exception {\r
-\r
- String agentId = request\r
- .getParameter(MsgConstants.PROPERTY_SLC_AGENT_ID);\r
- Assert.notNull(agentId, "agent id");\r
-\r
- String answer = request.getParameter("body");\r
- if (answer == null) {\r
- // lets read the message body instead\r
- BufferedReader reader = request.getReader();\r
- StringBuffer buffer = new StringBuffer();\r
- String line = null;\r
- while (((line = reader.readLine()) != null)) {\r
- buffer.append(line);\r
- }\r
- answer = buffer.toString();\r
- }\r
-\r
- if (log.isTraceEnabled())\r
- log.debug("Received message:\n" + answer);\r
-\r
- StringSource source = new StringSource(answer);\r
- SlcExecution slcExecution = (SlcExecution) unmarshaller\r
- .unmarshal(source);\r
-\r
- // Workaround for https://www.argeo.org/bugzilla/show_bug.cgi?id=86\r
- if (slcExecution.getUuid() == null\r
- || slcExecution.getUuid().length() < 8)\r
- slcExecution.setUuid(UUID.randomUUID().toString());\r
-\r
- slcExecution.setStatus(SlcExecution.SCHEDULED);\r
- slcExecution.getSteps().add(\r
- new SlcExecutionStep(SlcExecutionStep.START,\r
- "Process started from the Web UI"));\r
-\r
- initializeSEM();\r
- slcExecutionManager.storeRealizedFlows(slcExecution);\r
- slcExecutionService.newExecution(slcExecution);\r
- SlcAgent agent = agentFactory.getAgent(agentId);\r
- //agent.runSlcExecution(slcExecution);\r
-\r
- return ExecutionAnswer.ok("Execution completed properly");\r
- }\r
-\r
- @RequestMapping("/tailSlcExecutionStepsCount.service")\r
- protected ObjectList tailSlcExecutionSteps(@RequestParam String uuid,\r
- @RequestParam Integer stepCount) {\r
- List<SlcExecutionStep> list = slcExecutionDao\r
- .tailSteps(uuid, stepCount);\r
- return new ObjectList(list);\r
- }\r
-\r
- @RequestMapping("/tailSlcExecutionStepsOffset.service")\r
- protected ObjectList tailSlcExecutionSteps(@RequestParam String uuid,\r
- @RequestParam String stepOffsetUuid) {\r
- List<SlcExecutionStep> list = slcExecutionDao.tailSteps(uuid,\r
- stepOffsetUuid);\r
- return new ObjectList(list);\r
- }\r
-\r
- @RequestMapping("/downloadSlcExecution.service")\r
- protected void downloadSlcExecution(@RequestParam String uuid,\r
- @RequestParam String ext, HttpServletResponse response)\r
- throws Exception {\r
- String contentType;\r
- // cf. http://en.wikipedia.org/wikServicei/Internet_media_type\r
- if ("csv".equals(ext))\r
- contentType = "text/csv";\r
- else if ("pdf".equals(ext))\r
- contentType = "application/pdf";\r
- else if ("zip".equals(ext))\r
- contentType = "application/zip";\r
- else if ("html".equals(ext))\r
- contentType = "application/html";\r
- else if ("txt".equals(ext) || "log".equals(ext))\r
- contentType = "text/plain";\r
- else if ("doc".equals(ext) || "docx".equals(ext))\r
- contentType = "application/msword";\r
- else if ("xls".equals(ext) || "xlsx".equals(ext))\r
- contentType = "application/vnd.ms-excel";\r
- else if ("xml".equals(ext))\r
- contentType = "text/xml";\r
- else\r
- contentType = "Content-Type: application/force-download";\r
-\r
- String name = "Process-" + uuid + "." + ext;\r
-\r
- SlcExecution process = slcExecutionDao.getSlcExecution(uuid);\r
-\r
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");\r
-\r
- // TODO: put it in a separate view\r
- if ("log".equals(ext)) {\r
- StringBuffer buf = new StringBuffer("");\r
- buf.append("#\n# PROCESS " + process.getUuid() + "\n#\n\n");\r
- buf\r
- .append("Started at " + df.format(process.getStartDate())\r
- + "\n");\r
- buf.append("Ended at " + df.format(process.getEndDate()) + "\n");\r
- buf.append("On host " + process.getHost() + "\n");\r
- buf.append("\n# LOG\n\n");\r
- for (SlcExecutionStep step : process.getSteps()) {\r
- buf.append(df.format(step.getTimestamp()));\r
- buf.append(" ");\r
- for (int i = 0; i < step.getLogLines().size(); i++) {\r
- if (i > 0)\r
- buf.append('\n');\r
- buf.append(step.getLogLines().get(i));\r
- }\r
- buf.append(" - ");\r
- buf.append(step.getType());\r
- buf.append(" - ");\r
- buf.append('[').append(step.getThread()).append(']');\r
- buf.append('\n');\r
- }\r
- prepareDownloadResponse(name, contentType, response);\r
- response.getWriter().print(buf);\r
- } else {\r
- throw new SlcException("Unsupported content type " + contentType);\r
- }\r
- }\r
-\r
- protected void prepareDownloadResponse(String name, String contentType,\r
- HttpServletResponse response) {\r
- response.setHeader("Content-Disposition", "attachment; filename=\""\r
- + name + "\"");\r
- response.setContentType(contentType + ";name=\"" + name + "\"");\r
- response.setHeader("Expires", "0");\r
- response.setHeader("Cache-Control", "no-cache, must-revalidate");\r
- response.setHeader("Pragma", "no-cache");\r
- }\r
-\r
- private void initializeSEM() {\r
- slcExecutionManager = new SlcExecutionManager(unmarshaller, marshaller,\r
- attachmentsStorage);\r
- }\r
-\r
- public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) {\r
- this.slcExecutionDao = slcExecutionDao;\r
- }\r
-\r
- public void setSlcExecutionService(SlcExecutionService slcExecutionService) {\r
- this.slcExecutionService = slcExecutionService;\r
- }\r
-\r
- public void setUnmarshaller(Unmarshaller unmarshaller) {\r
- this.unmarshaller = unmarshaller;\r
- }\r
-\r
- public void setMarshaller(Marshaller marshaller) {\r
- this.marshaller = marshaller;\r
- }\r
-\r
- public void setAttachmentsStorage(AttachmentsStorage attachmentsStorage) {\r
- this.attachmentsStorage = attachmentsStorage;\r
- }\r
-\r
- public void setAgentFactory(SlcAgentFactory agentFactory) {\r
- this.agentFactory = agentFactory;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.mvc.controllers;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultDao;\r
-import org.springframework.stereotype.Controller;\r
-import org.springframework.ui.ModelMap;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.springframework.web.bind.annotation.RequestParam;\r
-\r
-/**\r
- * Sends back the results, rendered or as collection.\r
- */\r
-\r
-@Controller\r
-public class RenderingResultController {\r
- // private static final Log log =\r
- // LogFactory.getLog(RenderingResultController.class);\r
-\r
- public final static String MODELKEY_RESULT = "result";\r
-\r
- // IoC\r
- private TreeTestResultDao treeTestResultDao;\r
-\r
- @RequestMapping("/resultView.*")\r
- public String getPdfResultView(@RequestParam("uuid") String uuid,\r
- ModelMap model, HttpServletRequest request) {\r
-\r
- TreeTestResult result = treeTestResultDao.getTestResult(uuid);\r
- if (result == null)\r
- throw new SlcException("No result found for uuid " + uuid);\r
- model.addAttribute(MODELKEY_RESULT, result);\r
-\r
- String docType = request.getRequestURI().substring(\r
- request.getRequestURI().lastIndexOf(".") + 1);\r
-\r
- if ("pdf".equals(docType))\r
- return "resultPdfView";\r
- if ("xls".equals(docType))\r
- return "resultExcelView";\r
- if ("xslt".equals(docType))\r
- return "resultXsltView";\r
- if ("xml".equals(docType))\r
- return "resultXmlView";\r
-\r
- throw new SlcException("No renderer found for files of extension "\r
- + docType);\r
- }\r
-\r
- // IoC\r
-\r
- public void setTreeTestResultDao(TreeTestResultDao treeTestResultDao) {\r
- this.treeTestResultDao = treeTestResultDao;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.mvc.controllers;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.SortedSet;\r
-\r
-import javax.servlet.ServletOutputStream;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import org.apache.commons.io.FilenameUtils;\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.core.attachment.AttachmentsStorage;\r
-import org.argeo.slc.core.attachment.SimpleAttachment;\r
-import org.argeo.slc.core.test.tree.ResultAttributes;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.core.test.tree.TreeTestResultCollection;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultDao;\r
-import org.argeo.slc.msg.ExecutionAnswer;\r
-import org.argeo.slc.msg.ObjectList;\r
-import org.argeo.slc.msg.ReferenceList;\r
-import org.argeo.slc.services.TestManagerService;\r
-import org.springframework.stereotype.Controller;\r
-import org.springframework.ui.Model;\r
-import org.springframework.util.PatternMatchUtils;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.springframework.web.bind.annotation.RequestParam;\r
-\r
-@Controller\r
-public class ResultController {\r
-\r
- // private final static Log log =\r
- // LogFactory.getLog(ServiceController.class);\r
-\r
- // Constants\r
- protected final String FORCE_DOWNLOAD = "Content-Type: application/force-download";\r
-\r
- // IoC\r
- private TreeTestResultDao treeTestResultDao;\r
- private TreeTestResultCollectionDao treeTestResultCollectionDao;\r
- private TestManagerService testManagerService;\r
- private AttachmentsStorage attachmentsStorage;\r
-\r
- // Business Methods\r
- @RequestMapping("/getResult.service")\r
- protected TreeTestResult getResult(\r
- @RequestParam(value = "uuid", required = false) String uuid) {\r
-\r
- TreeTestResult result = treeTestResultDao.getTestResult(uuid);\r
- if (result == null)\r
- throw new SlcException("No result found for uuid " + uuid);\r
- return result;\r
- }\r
-\r
- @RequestMapping("/addResultToCollection.service")\r
- protected ExecutionAnswer addResultToCollection(\r
- @RequestParam String collectionId, @RequestParam String resultUuid) {\r
- testManagerService.addResultToCollection(collectionId, resultUuid);\r
- return ExecutionAnswer.ok("Execution completed properly");\r
- }\r
-\r
- @RequestMapping("/removeResultFromCollection.service")\r
- protected ExecutionAnswer removeResultFromCollection(\r
- HttpServletRequest request) {\r
- String collectionId = request.getParameter("collectionId");\r
- String[] resultUuids = request.getParameterValues("resultUuid");\r
- String[] attrNames = request.getParameterValues("attrName");\r
- String[] attrPatterns = request.getParameterValues("attrPattern");\r
-\r
- // Checks\r
- if (collectionId == null)\r
- throw new SlcException("A collection id must be specified");\r
- if (attrNames != null\r
- && (attrPatterns == null || attrNames.length != attrPatterns.length))\r
- throw new SlcException(\r
- "There must be as many attrName as attrPatterns");\r
-\r
- // Remove specified results\r
- if (resultUuids != null)\r
- for (String resultUuid : resultUuids)\r
- testManagerService.removeResultFromCollection(collectionId,\r
- resultUuid);\r
-\r
- if (attrNames != null) {\r
- TreeTestResultCollection sourceCollection = treeTestResultCollectionDao\r
- .getTestResultCollection(collectionId);\r
-\r
- int index = 0;\r
- for (String attrName : attrNames) {\r
- String attrPattern = attrPatterns[index];// safe: checked above\r
-\r
- List<TreeTestResult> results = new ArrayList<TreeTestResult>(\r
- sourceCollection.getResults());\r
- for (TreeTestResult treeTestResult : results) {\r
- if (PatternMatchUtils.simpleMatch(attrPattern,\r
- treeTestResult.getAttributes().get(attrName))) {\r
- testManagerService.removeResultFromCollection(\r
- collectionId, treeTestResult.getUuid());\r
- }\r
- }\r
- index++;\r
- }\r
- } else {\r
- if (resultUuids == null) {// no specs\r
- // remove all\r
- // TODO: optimize\r
- TreeTestResultCollection sourceCollection = treeTestResultCollectionDao\r
- .getTestResultCollection(collectionId);\r
- List<TreeTestResult> results = new ArrayList<TreeTestResult>(\r
- sourceCollection.getResults());\r
- for (TreeTestResult treeTestResult : results) {\r
- testManagerService.removeResultFromCollection(collectionId,\r
- treeTestResult.getUuid());\r
- }\r
-\r
- }\r
- }\r
- return ExecutionAnswer.ok("Execution completed properly");\r
- }\r
-\r
- @RequestMapping("/listCollectionRefs.service")\r
- protected ReferenceList listCollectionRefs(HttpServletRequest request,\r
- HttpServletResponse response) {\r
-\r
- SortedSet<TreeTestResultCollection> results = treeTestResultCollectionDao\r
- .listCollections();\r
-\r
- ReferenceList referenceList = new ReferenceList();\r
- for (TreeTestResultCollection collection : results) {\r
- referenceList.getReferences().add(collection.getId());\r
- }\r
- return referenceList;\r
- }\r
-\r
- @RequestMapping("/listResultAttributes.service")\r
- protected ObjectList listResultAttributes(@RequestParam String id,\r
- Model model) {\r
-\r
- List<ResultAttributes> resultAttributes = treeTestResultCollectionDao\r
- .listResultAttributes(id);\r
- return new ObjectList(resultAttributes);\r
- }\r
-\r
- @RequestMapping("/listResults.service")\r
- @SuppressWarnings(value = { "unchecked" })\r
- protected ObjectList listResults(\r
- @RequestParam(value = "collectionId", required = false) String collectionId,\r
- HttpServletRequest request) {\r
- Map<String, String[]> parameterMap = request.getParameterMap();\r
- Map<String, String> attributes = new HashMap<String, String>();\r
- for (String parameter : parameterMap.keySet()) {\r
- if (parameter.startsWith("attr.")) {\r
- String key = parameter.substring("attr.".length());\r
- attributes.put(key, parameterMap.get(parameter)[0]);\r
- }\r
- }\r
-\r
- List<TreeTestResult> resultAttributes = treeTestResultCollectionDao\r
- .listResults(collectionId, attributes);\r
- return new ObjectList(resultAttributes);\r
- }\r
-\r
- @RequestMapping("/copyCollectionToCollection.service")\r
- protected ExecutionAnswer copyCollectionToCollection(\r
- @RequestParam String sourceCollectionId,\r
- @RequestParam String targetCollectionId, HttpServletRequest request) {\r
-\r
- String[] attrNames = request.getParameterValues("attrName");\r
- String[] attrPatterns = request.getParameterValues("attrPattern");\r
-\r
- // Checks\r
- if (sourceCollectionId == null || targetCollectionId == null)\r
- throw new SlcException(\r
- "Source and target collection ids must be specified");\r
- if (attrNames != null\r
- && (attrPatterns == null || attrNames.length != attrPatterns.length))\r
- throw new SlcException(\r
- "There must be as many attrName as attrPatterns");\r
-\r
- TreeTestResultCollection sourceCollection = treeTestResultCollectionDao\r
- .getTestResultCollection(sourceCollectionId);\r
- if (attrNames != null) {\r
- int index = 0;\r
- for (String attrName : attrNames) {\r
- String attrPattern = attrPatterns[index];// safe: checked above\r
-\r
- for (TreeTestResult treeTestResult : sourceCollection\r
- .getResults()) {\r
- if (PatternMatchUtils.simpleMatch(attrPattern,\r
- treeTestResult.getAttributes().get(attrName))) {\r
- testManagerService.addResultToCollection(\r
- targetCollectionId, treeTestResult.getUuid());\r
- }\r
- }\r
- index++;\r
- }\r
- } else {\r
- // remove all\r
- // TODO: optimize\r
- for (TreeTestResult treeTestResult : sourceCollection.getResults()) {\r
- testManagerService.addResultToCollection(targetCollectionId,\r
- treeTestResult.getUuid());\r
- }\r
- }\r
- return ExecutionAnswer.ok("Execution completed properly");\r
- }\r
-\r
- @RequestMapping("/getAttachment.service")\r
- protected void getAttachment(@RequestParam String uuid,\r
- @RequestParam String contentType, @RequestParam String name,\r
- HttpServletResponse response) throws Exception {\r
- if (contentType == null || "".equals(contentType.trim())) {\r
- if (name != null) {\r
- contentType = FORCE_DOWNLOAD;\r
- String ext = FilenameUtils.getExtension(name);\r
- // cf. http://en.wikipedia.org/wikServicei/Internet_media_type\r
- if ("csv".equals(ext))\r
- contentType = "text/csv";\r
- else if ("pdf".equals(ext))\r
- contentType = "application/pdf";\r
- else if ("zip".equals(ext))\r
- contentType = "application/zip";\r
- else if ("html".equals(ext))\r
- contentType = "application/html";\r
- else if ("txt".equals(ext))\r
- contentType = "text/plain";\r
- else if ("doc".equals(ext) || "docx".equals(ext))\r
- contentType = "application/msword";\r
- else if ("xls".equals(ext) || "xlsx".equals(ext))\r
- contentType = "application/vnd.ms-excel";\r
- else if ("xml".equals(ext))\r
- contentType = "text/xml";\r
- }\r
- }\r
-\r
- if (name != null) {\r
- contentType = contentType + ";name=\"" + name + "\"";\r
- response.setHeader("Content-Disposition", "attachment; filename=\""\r
- + name + "\"");\r
- }\r
- response.setHeader("Expires", "0");\r
- response.setHeader("Cache-Control", "no-cache, must-revalidate");\r
- response.setHeader("Pragma", "no-cache");\r
-\r
- SimpleAttachment resourceDescriptor = new SimpleAttachment();\r
- resourceDescriptor.setUuid(uuid);\r
- resourceDescriptor.setContentType(contentType);\r
-\r
- response.setContentType(contentType);\r
- ServletOutputStream outputStream = response.getOutputStream();\r
- attachmentsStorage.retrieveAttachment(resourceDescriptor, outputStream);\r
- }\r
-\r
- // IoC\r
-\r
- public void setTreeTestResultDao(TreeTestResultDao treeTestResultDao) {\r
- this.treeTestResultDao = treeTestResultDao;\r
- }\r
-\r
- public void setTestManagerService(TestManagerService testManagerService) {\r
- this.testManagerService = testManagerService;\r
- }\r
-\r
- public void setTreeTestResultCollectionDao(\r
- TreeTestResultCollectionDao treeTestResultCollectionDao) {\r
- this.treeTestResultCollectionDao = treeTestResultCollectionDao;\r
- }\r
-\r
- public void setAttachmentsStorage(AttachmentsStorage attachmentsStorage) {\r
- this.attachmentsStorage = attachmentsStorage;\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.mvc.controllers;\r
-\r
-import java.util.List;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-import org.apache.commons.fileupload.FileItem;\r
-import org.apache.commons.fileupload.FileItemFactory;\r
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;\r
-import org.apache.commons.fileupload.servlet.ServletFileUpload;\r
-import org.argeo.slc.BasicNameVersion;\r
-import org.argeo.slc.NameVersion;\r
-import org.argeo.slc.core.build.ResourceDistribution;\r
-import org.argeo.slc.deploy.DynamicRuntime;\r
-import org.argeo.slc.deploy.Module;\r
-import org.argeo.slc.msg.ExecutionAnswer;\r
-import org.springframework.core.io.ByteArrayResource;\r
-import org.springframework.stereotype.Controller;\r
-import org.springframework.ui.Model;\r
-import org.springframework.web.bind.annotation.RequestMapping;\r
-import org.springframework.web.bind.annotation.RequestParam;\r
-\r
-/**\r
- * Sends back the results, rendered or as collection.\r
- */\r
-\r
-@Controller\r
-public class ServerController {\r
-\r
- // IoC\r
- private DynamicRuntime<?> dynamicRuntime;\r
-\r
- // Create a factory for disk-based file items\r
- private FileItemFactory factory = new DiskFileItemFactory();\r
- // Create a new file upload handler\r
- private ServletFileUpload upload = new ServletFileUpload(factory);\r
-\r
- // SERVER HANDLING\r
-\r
- @RequestMapping("/isServerReady.service")\r
- protected ExecutionAnswer isServerReady(Model model) {\r
- // Does nothing for now, it will return an OK answer.\r
- return ExecutionAnswer.ok("Execution completed properly");\r
- }\r
-\r
- @RequestMapping("/shutdownRuntime.service")\r
- protected ExecutionAnswer shutdownRuntime(Model model) {\r
- new Thread() {\r
- public void run() {\r
- // wait in order to let call return\r
- try {\r
- Thread.sleep(3000);\r
- } catch (InterruptedException e) {\r
- // silent\r
- }\r
- dynamicRuntime.shutdown();\r
- }\r
- }.start();\r
- return ExecutionAnswer.ok("Server shutting down...");\r
- }\r
-\r
- // MODULE HANDLING\r
-\r
- @SuppressWarnings("unchecked")\r
- @RequestMapping("/installModule.service")\r
- public void installModule(HttpServletRequest request) throws Exception {\r
-\r
- // TODO : handle the exception better\r
-\r
- // Parse the request\r
- List<FileItem> items = upload.parseRequest(request);\r
-\r
- byte[] arr = null;\r
- for (FileItem item : items) {\r
- if (!item.isFormField()) {\r
- arr = item.get();\r
- break;\r
- }\r
- }\r
-\r
- ByteArrayResource res = new ByteArrayResource(arr);\r
- Module module = dynamicRuntime.installModule(new ResourceDistribution(\r
- res));\r
- // TODO: customize whether the module is started or not\r
- dynamicRuntime.startModule(module);\r
- }\r
-\r
- @RequestMapping("/uninstallModule.service")\r
- public void uninstallModule(@RequestParam(value = "name") String name,\r
- @RequestParam(value = "version") String version) {\r
- NameVersion nameVersion = new BasicNameVersion(name, version);\r
- dynamicRuntime.uninstallModule(nameVersion);\r
- }\r
-\r
- // IoC\r
- public void setDynamicRuntime(DynamicRuntime<?> dynamicRuntime) {\r
- this.dynamicRuntime = dynamicRuntime;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.web.mvc.controllers;\r
-\r
-import java.io.ByteArrayInputStream;\r
-import java.io.ByteArrayOutputStream;\r
-import java.io.InputStream;\r
-import java.util.UUID;\r
-\r
-import javax.xml.transform.stream.StreamSource;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.core.attachment.Attachment;\r
-import org.argeo.slc.core.attachment.AttachmentsStorage;\r
-import org.argeo.slc.core.attachment.SimpleAttachment;\r
-import org.argeo.slc.msg.ObjectList;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.springframework.oxm.Marshaller;\r
-import org.springframework.oxm.Unmarshaller;\r
-import org.springframework.xml.transform.StringResult;\r
-\r
-public class SlcExecutionManager {\r
- private final static Log log = LogFactory.getLog(SlcExecutionManager.class);\r
-\r
- private Unmarshaller unmarshaller;\r
- private Marshaller marshaller;\r
- private AttachmentsStorage attachmentsStorage;\r
-\r
- public SlcExecutionManager(Unmarshaller unmarshaller,\r
- Marshaller marshaller, AttachmentsStorage attachmentsStorage) {\r
-\r
- this.unmarshaller = unmarshaller;\r
- this.marshaller = marshaller;\r
- this.attachmentsStorage = attachmentsStorage;\r
- }\r
-\r
- void storeRealizedFlows(SlcExecution slcExecution) {\r
-\r
- Attachment attachment = realizedFlowsAttachment(UUID.randomUUID()\r
- .toString(), slcExecution);\r
- InputStream in = null;\r
- try {\r
- ObjectList ol = new ObjectList(slcExecution.getRealizedFlows());\r
- StringResult result = new StringResult();\r
- marshaller.marshal(ol, result);\r
- in = new ByteArrayInputStream(result.toString().getBytes());\r
- attachmentsStorage.storeAttachment(attachment, in);\r
-\r
- slcExecution.setRealizedFlowsXml(attachment.getUuid());\r
- } catch (Exception e) {\r
- log.error("Could not store realized flows as attachment #"\r
- + attachment.getUuid(), e);\r
- } finally {\r
- IOUtils.closeQuietly(in);\r
- }\r
- }\r
-\r
- void retrieveRealizedFlows(SlcExecution slcExecution) {\r
- Attachment attachment = realizedFlowsAttachment(slcExecution\r
- .getRealizedFlowsXml(), slcExecution);\r
-\r
- ByteArrayOutputStream out = null;\r
- ByteArrayInputStream in = null;\r
- try {\r
- // TODO: optimize with piped streams\r
- out = new ByteArrayOutputStream();\r
- attachmentsStorage.retrieveAttachment(attachment, out);\r
-\r
- byte[] arr = out.toByteArray();\r
- in = new ByteArrayInputStream(arr);\r
- StreamSource source = new StreamSource(in);\r
- ObjectList ol = (ObjectList) unmarshaller.unmarshal(source);\r
- ol.fill(slcExecution.getRealizedFlows());\r
- } catch (Exception e) {\r
- log.error("Could not retrieve realized flows from attachment #"\r
- + attachment.getUuid(), e);\r
- } finally {\r
- IOUtils.closeQuietly(in);\r
- IOUtils.closeQuietly(out);\r
- }\r
- }\r
-\r
- /** Unify labeling in the package */\r
- static Attachment realizedFlowsAttachment(String attachmentUuid,\r
- SlcExecution slcExecution) {\r
- return new SimpleAttachment(attachmentUuid,\r
- "RealizedFlows of SlcExecution #" + slcExecution.getUuid(),\r
- "text/xml");\r
- }\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.slc.NameVersion;
-import org.argeo.slc.build.ModularDistribution;
-import org.springframework.web.HttpRequestHandler;
-
-/** List of modules for a distribution. */
-public abstract class AbstractAvailableModules implements HttpRequestHandler {
- protected abstract void print(Writer out, String baseUrl,
- ModularDistribution md) throws IOException;
-
- public final void handleRequest(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
- response.setContentType(getContentType());
-
- ModularDistribution md = (ModularDistribution) request
- .getAttribute("modularDistribution");
-
- String baseUrl = "http://" + request.getServerName() + ":"
- + request.getServerPort() + request.getContextPath()
- + request.getServletPath() + "/" + md.getName() + "/"
- + md.getVersion() + "/";
-
- print(response.getWriter(), baseUrl, md);
- }
-
- public String getContentType() {
- return "text/plain";
- }
-
- protected String jarUrl(String baseUrl, NameVersion nameVersion) {
- return baseUrl + jarFileName(nameVersion);
- }
-
- protected String jarFileName(NameVersion nameVersion) {
- return nameVersion.getName() + "-" + nameVersion.getVersion() + ".jar";
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-public abstract class AbstractProvisioningInterceptor extends
- HandlerInterceptorAdapter {
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.slc.build.ModularDistribution;
-import org.springframework.web.HttpRequestHandler;
-
-/** List of distributions. */
-public class AvailableDistributions implements HttpRequestHandler {
- private Set<ModularDistribution> modularDistributions;
-
- public void handleRequest(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
- response.setContentType("text/html");
-
- String baseUrl = "http://" + request.getServerName() + ":"
- + request.getServerPort() + request.getContextPath()
- + request.getServletPath() + "/";
-
- Writer out = response.getWriter();
-
- out.write("<h1>Distributions</h1>");
- for (Iterator<ModularDistribution> it = modularDistributions.iterator(); it
- .hasNext();) {
- ModularDistribution md = it.next();
- out.write("<h2>" + md + "</h2>");
- out.write("Modules: ");
- String moduleBase = baseUrl + md.getName() + "/" + md.getVersion()
- + "/";
-
- String modulesListHtml = moduleBase + "modules.html";
- out.write(" <a href=\"" + modulesListHtml + "\">html</a>");
-
- String modulesListPlain = moduleBase + "modules";
- out.write(" <a href=\"" + modulesListPlain + "\">plain</a>");
-
- String modulesListOsgiBoot = moduleBase + "osgiBoot";
- out.write(" <a href=\"" + modulesListOsgiBoot + "\">osgiBoot</a>");
-
- out.write("<br/>");
-
- out.write("Eclipse update site: ");
- String updateSiteUrl = baseUrl + md.getName() + "/"
- + md.getVersion() + "/site.xml";
- out.write("<a href=\"" + updateSiteUrl + "\">" + updateSiteUrl
- + "</a>");
- }
- }
-
- public void setModularDistributions(
- Set<ModularDistribution> modularDistributions) {
- this.modularDistributions = modularDistributions;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.argeo.slc.NameVersion;
-import org.argeo.slc.build.Distribution;
-import org.argeo.slc.build.ModularDistribution;
-import org.argeo.slc.core.build.ResourceDistribution;
-
-/** List of modules for a distribution. */
-public class AvailableModulesHtml extends AbstractAvailableModules {
- @Override
- protected void print(Writer out, String baseUrl, ModularDistribution md)
- throws IOException {
- out.write("<h1>Distribution " + md + "</h1>");
-
- for (NameVersion nameVersion : md.listModulesNameVersions()) {
- Distribution distribution = md.getModuleDistribution(nameVersion
- .getName(), nameVersion.getVersion());
-
- String moduleUrl = null;
- if (distribution instanceof ResourceDistribution) {
- String url = ((ResourceDistribution) distribution)
- .getResource().getURL().toString();
- if (url.startsWith("reference:"))
- moduleUrl = url;
- }
-
- if (moduleUrl == null)
- moduleUrl = jarUrl(baseUrl, nameVersion);
-
- out.write("<a href=\"" + moduleUrl + "\">"
- + jarFileName(nameVersion) + "</a><br/>");
- }
- }
-
- @Override
- public String getContentType() {
- return "text/html";
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.argeo.slc.NameVersion;
-import org.argeo.slc.build.ModularDistribution;
-
-/** List of modules for a distribution. */
-public class AvailableModulesOsgiBoot extends AbstractAvailableModules {
- private String separator = ",";
-
- @Override
- protected void print(Writer out, String baseUrl, ModularDistribution md)
- throws IOException {
- for (NameVersion nameVersion : md.listModulesNameVersions()) {
- String fileName = nameVersion.getName() + "-"
- + nameVersion.getVersion() + ".jar";
- String moduleUrl = baseUrl + fileName;
- out.write(nameVersion.getName() + separator
- + nameVersion.getVersion() + separator + moduleUrl);
- out.write("\n");
- }
- }
-
- public void setSeparator(String separator) {
- this.separator = separator;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.argeo.slc.NameVersion;
-import org.argeo.slc.build.ModularDistribution;
-
-/** List of modules for a distribution. */
-public class AvailableModulesPlain extends AbstractAvailableModules {
- @Override
- protected void print(Writer out, String baseUrl, ModularDistribution md)
- throws IOException {
- for (NameVersion nameVersion : md.listModulesNameVersions()) {
- String fileName = nameVersion.getName() + "-"
- + nameVersion.getVersion() + ".jar";
- String moduleUrl = baseUrl + fileName;
- out.write(moduleUrl);
- out.write("\n");
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.StreamReadable;
-import org.argeo.slc.UnsupportedException;
-import org.argeo.slc.build.Distribution;
-import org.argeo.slc.build.ModularDistribution;
-import org.springframework.web.HttpRequestHandler;
-
-public class BundleHandler implements HttpRequestHandler {
- private final static Log log = LogFactory.getLog(BundleHandler.class);
-
- public void handleRequest(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
- String path = request.getPathInfo();
-
- if (log.isDebugEnabled())
- log.debug("Bundle jar Requested: " + path);
- response.setContentType("application/java-archive");
-
- String moduleName = request.getParameter("moduleName");
- if (moduleName == null)
- moduleName = request.getAttribute("moduleName").toString();
- String moduleVersion = request.getParameter("moduleVersion");
- if (moduleVersion == null)
- moduleVersion = request.getAttribute("moduleVersion").toString();
-
- ModularDistribution modularDistribution = (ModularDistribution) request
- .getAttribute("modularDistribution");
- Distribution distribution = modularDistribution.getModuleDistribution(
- moduleName, moduleVersion);
- if (distribution instanceof StreamReadable)
- IOUtils.copy(((StreamReadable) distribution).getInputStream(),
- response.getOutputStream());
- else
- throw new UnsupportedException("distribution", distribution);
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.util.StringTokenizer;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.slc.SlcException;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-public class BundleJarInterceptor extends HandlerInterceptorAdapter {
-
- @Override
- public boolean preHandle(HttpServletRequest request,
- HttpServletResponse response, Object handler) throws Exception {
- String path = request.getPathInfo();
- StringTokenizer stS = new StringTokenizer(path, "/");
- String fileName = null;
- while (stS.hasMoreTokens()) {
- String token = stS.nextToken();
- if (!stS.hasMoreTokens()) {
- fileName = token;
- }
- }
-
- int ind_ = fileName.indexOf('-');
- String moduleName;
- if (ind_ > -1)
- moduleName = fileName.substring(0, ind_);
- else
- throw new SlcException("Cannot determine version for " + fileName);
-
- String versionAndExtension = fileName.substring(ind_ + 1);
- int indExt = versionAndExtension.lastIndexOf('.');
- String moduleVersion = versionAndExtension.substring(0, indExt);
-
- request.setAttribute("moduleName", moduleName);
- request.setAttribute("moduleVersion", moduleVersion);
-
- return true;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.slc.build.ModularDistribution;
-import org.springframework.web.HttpRequestHandler;
-
-/** An Eclipse update site, serving site.xml features/* and plugins/*. */
-public class EclipseUpdateSiteHandler implements HttpRequestHandler {
- public void handleRequest(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
-
- ModularDistribution modularDistribution = (ModularDistribution) request
- .getAttribute("modularDistribution");
- response.getWriter().write(
- modularDistribution.getModulesDescriptor("eclipse").toString());
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.util.StringTokenizer;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.slc.SlcException;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-public class EclipseUpdateSiteInterceptor extends HandlerInterceptorAdapter {
- public final static String RELEASE = "RELEASE";
- public final static String LATEST = "LATEST";
-
- @Override
- public boolean preHandle(HttpServletRequest request,
- HttpServletResponse response, Object handler) throws Exception {
- String path = request.getPathInfo();
- StringTokenizer stS = new StringTokenizer(path, "/");
- String type = null;
- pathTokenizer: while (stS.hasMoreTokens()) {
- String token = stS.nextToken();
- if (token.equals("plugins") || token.equals("features")) {
- type = token;
- break pathTokenizer;
- }
- }
-
- if (type == null || !stS.hasMoreTokens())
- throw new SlcException("Cannot determine file name from path "
- + path);
-
- String fileName = stS.nextToken();
-
- int ind_ = fileName.indexOf('_');
- String moduleName;
- if (ind_ > -1)
- moduleName = fileName.substring(0, ind_);
- else
- throw new SlcException("Cannot determine version for " + fileName);
-
- String versionAndExtension = fileName.substring(ind_ + 1);
- int indExt = versionAndExtension.lastIndexOf('.');
- String moduleVersion = versionAndExtension.substring(0, indExt);
-
- request.setAttribute("moduleName", moduleName);
- request.setAttribute("moduleVersion", moduleVersion);
-
- return true;
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.slc.BasicNameVersion;
-import org.argeo.slc.NameVersion;
-import org.argeo.slc.build.BuildConstants;
-import org.argeo.slc.build.ModularDistribution;
-import org.argeo.slc.msg.ObjectList;
-import org.argeo.slc.msg.build.ModularDistributionDescriptor;
-import org.argeo.slc.web.mvc.AbstractServiceController;
-import org.springframework.web.servlet.ModelAndView;
-
-/** List of distributions. */
-public class ListModularDistributions extends AbstractServiceController
- implements Comparator<ModularDistributionDescriptor> {
- private Set<ModularDistribution> modularDistributions;
-
- private String provisioningServletPath = "/dist";
-
- @Override
- protected void handleServiceRequest(HttpServletRequest request,
- HttpServletResponse response, ModelAndView modelAndView)
- throws Exception {
-
- String baseUrl = "http://" + request.getServerName() + ":"
- + request.getServerPort() + request.getContextPath()
- + provisioningServletPath + "/";
-
- SortedSet<ModularDistributionDescriptor> descriptors = new TreeSet<ModularDistributionDescriptor>(
- this);
-
- Set<String> names = new HashSet<String>();
- Set<String> namesRelease = new HashSet<String>();
-
- // Scan distributions
- for (Iterator<ModularDistribution> it = modularDistributions.iterator(); it
- .hasNext();) {
- ModularDistribution md = it.next();
- ModularDistributionDescriptor mdd = fromNameVersion(baseUrl, md);
-
- descriptors.add(mdd);
- names.add(mdd.getName());
- if (!md.getVersion().contains(BuildConstants.SNAPSHOT))
- namesRelease.add(mdd.getName());
- }
-
- // Add LATESTs and RELEASEs
- for (String name : names)
- descriptors.add(fromNameVersion(baseUrl, new BasicNameVersion(name,
- BuildConstants.LATEST)));
- for (String name : namesRelease)
- descriptors.add(fromNameVersion(baseUrl, new BasicNameVersion(name,
- BuildConstants.RELEASE)));
-
- modelAndView.addObject(new ObjectList(descriptors));
- }
-
- public void setModularDistributions(
- Set<ModularDistribution> modularDistributions) {
- this.modularDistributions = modularDistributions;
- }
-
- public void setProvisioningServletPath(String provisioningServletPath) {
- this.provisioningServletPath = provisioningServletPath;
- }
-
- protected ModularDistributionDescriptor fromNameVersion(String baseUrl,
- NameVersion md) {
- String moduleBase = baseUrl + md.getName() + "/" + md.getVersion()
- + "/";
- ModularDistributionDescriptor mdd = new ModularDistributionDescriptor();
- mdd.setName(md.getName());
- mdd.setVersion(md.getVersion());
-
- mdd.getModulesDescriptors().put("modularDistribution",
- moduleBase + "modularDistribution");
- mdd.getModulesDescriptors().put("eclipse", moduleBase + "site.xml");
- return mdd;
-
- }
-
- /** RELEASEs first, then LATESTs, then version */
- public int compare(ModularDistributionDescriptor mdd1,
- ModularDistributionDescriptor mdd2) {
- final int BEFORE = -1;
- final int AFTER = 1;
-
- String n1 = mdd1.getName();
- String v1 = mdd1.getVersion();
- String n2 = mdd2.getName();
- String v2 = mdd2.getVersion();
-
- if (v1.equals(BuildConstants.RELEASE))
- if (v2.equals(BuildConstants.RELEASE))
- return n1.compareTo(n2);
- else
- return BEFORE;
- else if (v2.equals(BuildConstants.RELEASE))
- return AFTER;// we know 1 not RELEASE
- else if (v1.equals(BuildConstants.LATEST))
- if (v2.equals(BuildConstants.LATEST))
- return n1.compareTo(n2);
- else
- return BEFORE;
- else if (v2.equals(BuildConstants.LATEST))
- return AFTER;// we know 1 not LATEST or RELEASE
- else if (n1.equals(n2))
- return v1.compareTo(v2);
- else
- return n1.compareTo(n2);
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.web.mvc.provisioning;
-
-import java.util.Iterator;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.StringTokenizer;
-import java.util.TreeMap;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.argeo.slc.BasicNameVersion;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.build.BuildConstants;
-import org.argeo.slc.build.ModularDistribution;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-public class ModularDistributionInterceptor extends HandlerInterceptorAdapter {
- private Set<ModularDistribution> modularDistributions;
-
- @Override
- public boolean preHandle(HttpServletRequest request,
- HttpServletResponse response, Object handler) throws Exception {
- String path = request.getPathInfo();
- StringTokenizer stS = new StringTokenizer(path, "/");
- String distributionName = stS.nextToken();
- String distributionVersion = stS.nextToken();
-
- SortedMap<String, ModularDistribution> choices = new TreeMap<String, ModularDistribution>();
- distribs: for (Iterator<ModularDistribution> it = modularDistributions
- .iterator(); it.hasNext();) {
- ModularDistribution md = it.next();
- if (md.getName().equals(distributionName)) {
- if (distributionVersion.equals(BuildConstants.RELEASE)
- && md.getVersion().contains(BuildConstants.SNAPSHOT))
- continue distribs;
-
- else if (distributionVersion.equals(BuildConstants.LATEST))
- choices.put(md.getVersion(), md);
- else if (distributionVersion.equals(md.getVersion())) {
- choices.put(md.getVersion(), md);
- break distribs;
- }
- }
- }
-
- if (choices.size() == 0)
- throw new SlcException("Cannot find distribution for "
- + new BasicNameVersion(distributionName,
- distributionVersion));
-
- ModularDistribution modularDistribution = choices.get(choices
- .firstKey());
-
- request.setAttribute("modularDistribution", modularDistribution);
-
- return true;
- }
-
- public void setModularDistributions(
- Set<ModularDistribution> modularDistributions) {
- this.modularDistributions = modularDistributions;
- }
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="true">
-
- <!-- MBeans -->
- <bean id="hibernateStatistics"
- class="org.hibernate.jmx.StatisticsService" lazy-init="false">
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
-
- <!-- JMX -->
- <bean id="jmxExporter"
- class="org.springframework.jmx.export.MBeanExporter"
- lazy-init="false">
- <property name="beans">
- <map>
- <entry
- key="bean:name=hibernateStatistics,type=statistics,sessionFactory=sessionFactory"
- value-ref="hibernateStatistics" />
- </map>
- </property>
- </bean>
-
- <bean id="jxmServerConnector"
- class="org.springframework.jmx.support.ConnectorServerFactoryBean"
- lazy-init="false" depends-on="rmiRegistry">
- <property name="objectName" value="connector:name=rmi" />
- <property name="serviceUrl"
- value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/springconnector" />
- </bean>
-
- <bean id="rmiRegistry"
- class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"
- lazy-init="false">
- <property name="port" value="1099" />
- </bean>
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xmlns:aop="http://www.springframework.org/schema/aop"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"\r
- default-lazy-init="true">\r
-\r
- <bean id="driver.file.template"\r
- class="org.argeo.slc.web.ajaxplorer.file.FileDriver"\r
- abstract="true">\r
- <property name="actions">\r
- <map>\r
- <entry key="ls" value-ref="action.file.ls" />\r
- <entry key="download" value-ref="action.file.download" />\r
- <entry key="image_proxy"\r
- value-ref="action.file.image_proxy" />\r
- <entry key="upload" value-ref="action.file.upload" />\r
- <entry key="mkdir" value-ref="action.file.mkdir" />\r
- <entry key="delete" value-ref="action.file.delete" />\r
- </map>\r
- </property>\r
- </bean>\r
-\r
- <!-- ACTIONS FS -->\r
- <bean id="action.file.ls"\r
- class="org.argeo.slc.web.ajaxplorer.file.FileLsAction" />\r
-\r
- <bean id="action.file.download"\r
- class="org.argeo.slc.web.ajaxplorer.file.FileDownloadAction" />\r
-\r
- <bean id="action.file.image_proxy"\r
- class="org.argeo.slc.web.ajaxplorer.file.FileImageProxyAction" />\r
-\r
- <bean id="action.file.upload"\r
- class="org.argeo.slc.web.ajaxplorer.file.FileUploadAction" />\r
-\r
- <bean id="action.file.mkdir"\r
- class="org.argeo.slc.web.ajaxplorer.file.FileMkdirAction" />\r
-\r
- <bean id="action.file.delete"\r
- class="org.argeo.slc.web.ajaxplorer.file.FileDeleteAction" />\r
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd"\r
- default-lazy-init="true">\r
-\r
- <import resource="classpath:/org/argeo/slc/web/ajaxplorer/file/spring.xml" />\r
-\r
- <bean id="driver.svn.template" class="org.argeo.slc.web.ajaxplorer.svn.SvnDriver"\r
- init-method="init" abstract="true">\r
- <property name="actions">\r
- <map>\r
- <entry key="ls" value-ref="action.svn.ls" />\r
- <entry key="download" value-ref="action.svn.download" />\r
- <entry key="image_proxy" value-ref="action.svn.image_proxy" />\r
- <entry key="upload" value-ref="action.svn.upload" />\r
- <entry key="mkdir" value-ref="action.svn.mkdir" />\r
- <entry key="delete" value-ref="action.svn.delete" />\r
- <entry key="svnlog" value-ref="action.svn.svnlog" />\r
- <entry key="svndownload" value-ref="action.svn.svndownload" />\r
- </map>\r
- </property>\r
- </bean>\r
-\r
- <!-- ACTIONS SVN -->\r
- <bean id="action.svn.ls" class="org.argeo.slc.web.ajaxplorer.svn.SvnLsAction" />\r
-\r
- <bean id="action.svn.upload" class="org.argeo.slc.web.ajaxplorer.svn.SvnUploadAction" />\r
-\r
- <bean id="action.svn.mkdir" class="org.argeo.slc.web.ajaxplorer.svn.SvnMkdirAction" />\r
-\r
- <bean id="action.svn.delete" class="org.argeo.slc.web.ajaxplorer.svn.SvnDeleteAction" />\r
-\r
- <bean id="action.svn.svnlog" class="org.argeo.slc.web.ajaxplorer.svn.SvnLogAction" />\r
-\r
- <bean id="action.svn.download" class="org.argeo.slc.web.ajaxplorer.file.FileDownloadAction" />\r
-\r
- <bean id="action.svn.image_proxy" class="org.argeo.slc.web.ajaxplorer.file.FileImageProxyAction" />\r
-\r
- <bean id="action.svn.svndownload" class="org.argeo.slc.web.ajaxplorer.svn.SvnDownloadAction" />\r
-\r
-\r
-</beans>
\ No newline at end of file
+++ /dev/null
-Manifest-Version: 1.0
-Export-Package: org.hibernate;version="3.3.1.GA";uses:="javax.naming,j
- avax.transaction,org.hibernate.classic,org.hibernate.criterion,org.hi
- bernate.engine,org.hibernate.exception,org.hibernate.jdbc,org.hiberna
- te.metadata,org.hibernate.stat,org.hibernate.transform,org.hibernate.
- type",org.hibernate.action;version="3.3.1.GA";uses:="org.hibernate,or
- g.hibernate.cache,org.hibernate.collection,org.hibernate.engine,org.h
- ibernate.persister.collection,org.hibernate.persister.entity",org.hib
- ernate.bytecode;version="3.3.1.GA";uses:="org.hibernate.bytecode.util
- ,org.hibernate.proxy",org.hibernate.bytecode.cglib;version="3.3.1.GA"
- ;uses:="org.hibernate.bytecode,org.hibernate.bytecode.util,org.hibern
- ate.proxy,org.hibernate.repackage.cglib.asm,org.hibernate.repackage.c
- glib.beans,org.hibernate.repackage.cglib.proxy,org.hibernate.repackag
- e.cglib.reflect,org.hibernate.repackage.cglib.transform.impl",org.hib
- ernate.bytecode.javassist;version="3.3.1.GA";uses:="javassist.bytecod
- e,javassist.util.proxy,org.hibernate.bytecode,org.hibernate.bytecode.
- util,org.hibernate.proxy",org.hibernate.bytecode.util;version="3.3.1.
- GA",org.hibernate.cache;version="3.3.1.GA";uses:="javax.transaction,n
- et.sf.ehcache,net.sf.swarmcache,org.hibernate,org.hibernate.cache.acc
- ess,org.hibernate.cfg,org.hibernate.engine,org.hibernate.transaction,
- org.hibernate.type,org.jboss.cache,org.jboss.cache.optimistic,org.slf
- 4j",org.hibernate.cache.access;version="3.3.1.GA";uses:="org.hibernat
- e.cache",org.hibernate.cache.entry;version="3.3.1.GA";uses:="org.hibe
- rnate,org.hibernate.collection,org.hibernate.engine,org.hibernate.eve
- nt,org.hibernate.persister.collection,org.hibernate.persister.entity"
- ,org.hibernate.cache.impl;version="3.3.1.GA";uses:="org.hibernate.cac
- he,org.hibernate.cfg,org.hibernate.mapping",org.hibernate.cache.impl.
- bridge;version="3.3.1.GA";uses:="org.hibernate.cache,org.hibernate.ca
- che.access,org.hibernate.cfg",org.hibernate.cache.jbc2;version="3.3.1
- .GA";uses:="javax.transaction,org.hibernate.cache,org.hibernate.cfg,o
- rg.jboss.cache,org.jboss.cache.config,org.jboss.cache.notifications.a
- nnotation",org.hibernate.cache.jbc2.access;version="3.3.1.GA";uses:="
- org.hibernate.cache,org.hibernate.cache.access,org.hibernate.cache.jb
- c2",org.hibernate.cache.jbc2.builder;version="3.3.1.GA";uses:="org.hi
- bernate.cache,org.hibernate.cache.jbc2,org.hibernate.cfg,org.jboss.ca
- che,org.jgroups",org.hibernate.cache.jbc2.collection;version="3.3.1.G
- A";uses:="org.hibernate.cache,org.hibernate.cache.access,org.hibernat
- e.cache.jbc2,org.hibernate.cache.jbc2.access,org.jboss.cache",org.hib
- ernate.cache.jbc2.entity;version="3.3.1.GA";uses:="org.hibernate.cach
- e,org.hibernate.cache.access,org.hibernate.cache.jbc2,org.hibernate.c
- ache.jbc2.access,org.jboss.cache",org.hibernate.cache.jbc2.query;vers
- ion="3.3.1.GA";uses:="org.hibernate.cache,org.hibernate.cache.jbc2,or
- g.jboss.cache",org.hibernate.cache.jbc2.timestamp;version="3.3.1.GA";
- uses:="org.hibernate.cache,org.hibernate.cache.jbc2,org.jboss.cache,o
- rg.jboss.cache.notifications.annotation,org.jboss.cache.notifications
- .event",org.hibernate.cache.jbc2.util;version="3.3.1.GA";uses:="org.h
- ibernate.cache,org.jboss.cache,org.jboss.cache.config,org.jboss.cache
- .optimistic",org.hibernate.cfg;version="3.3.1.GA";uses:="org.dom4j,or
- g.hibernate,org.hibernate.bytecode,org.hibernate.cache,org.hibernate.
- connection,org.hibernate.dialect,org.hibernate.dialect.function,org.h
- ibernate.engine,org.hibernate.engine.query.sql,org.hibernate.event,or
- g.hibernate.exception,org.hibernate.hql,org.hibernate.jdbc,org.hibern
- ate.jdbc.util,org.hibernate.mapping,org.hibernate.proxy,org.hibernate
- .tool.hbm2ddl,org.hibernate.transaction,org.hibernate.type,org.w3c.do
- m,org.xml.sax",org.hibernate.classic;version="3.3.1.GA";uses:="org.hi
- bernate,org.hibernate.type",org.hibernate.collection;version="3.3.1.G
- A";uses:="org.dom4j,org.hibernate,org.hibernate.engine,org.hibernate.
- loader,org.hibernate.persister.collection,org.hibernate.type",org.hib
- ernate.connection;version="3.3.1.GA";uses:="javax.sql,org.hibernate",
- org.hibernate.context;version="3.3.1.GA";uses:="javax.transaction,org
- .hibernate,org.hibernate.classic,org.hibernate.engine,org.slf4j",org.
- hibernate.criterion;version="3.3.1.GA";uses:="org.hibernate,org.hiber
- nate.engine,org.hibernate.impl,org.hibernate.persister.collection,org
- .hibernate.transform,org.hibernate.type",org.hibernate.dialect;versio
- n="3.3.1.GA";uses:="org.hibernate,org.hibernate.dialect.function,org.
- hibernate.dialect.lock,org.hibernate.engine,org.hibernate.exception,o
- rg.hibernate.persister.entity,org.hibernate.sql,org.hibernate.type,or
- g.slf4j",org.hibernate.dialect.function;version="3.3.1.GA";uses:="org
- .hibernate,org.hibernate.dialect,org.hibernate.engine,org.hibernate.t
- ype",org.hibernate.dialect.lock;version="3.3.1.GA";uses:="org.hiberna
- te,org.hibernate.engine,org.hibernate.persister.entity",org.hibernate
- .engine;version="3.3.1.GA";uses:="javax.transaction,org.hibernate,org
- .hibernate.action,org.hibernate.cache,org.hibernate.cfg,org.hibernate
- .classic,org.hibernate.collection,org.hibernate.connection,org.hibern
- ate.dialect,org.hibernate.dialect.function,org.hibernate.engine.loadi
- ng,org.hibernate.engine.query,org.hibernate.engine.query.sql,org.hibe
- rnate.engine.transaction,org.hibernate.event,org.hibernate.exception,
- org.hibernate.id,org.hibernate.impl,org.hibernate.jdbc,org.hibernate.
- loader.custom,org.hibernate.persister.collection,org.hibernate.persis
- ter.entity,org.hibernate.property,org.hibernate.proxy,org.hibernate.s
- ql,org.hibernate.stat,org.hibernate.transform,org.hibernate.type,org.
- slf4j",org.hibernate.engine.loading;version="3.3.1.GA";uses:="org.hib
- ernate.collection,org.hibernate.engine,org.hibernate.persister.collec
- tion",org.hibernate.engine.query;version="3.3.1.GA";uses:="org.hibern
- ate,org.hibernate.engine,org.hibernate.engine.query.sql,org.hibernate
- .event,org.hibernate.hql,org.hibernate.loader.custom.sql,org.hibernat
- e.type",org.hibernate.engine.query.sql;version="3.3.1.GA";uses:="org.
- hibernate,org.hibernate.type",org.hibernate.engine.transaction;versio
- n="3.3.1.GA";uses:="org.hibernate,org.hibernate.engine,org.slf4j",org
- .hibernate.event;version="3.3.1.GA";uses:="org.hibernate,org.hibernat
- e.cfg,org.hibernate.collection,org.hibernate.engine,org.hibernate.per
- sister.collection,org.hibernate.persister.entity,org.hibernate.util",
- org.hibernate.event.def;version="3.3.1.GA";uses:="org.hibernate,org.h
- ibernate.collection,org.hibernate.engine,org.hibernate.event,org.hibe
- rnate.persister.collection,org.hibernate.persister.entity,org.hiberna
- te.type",org.hibernate.exception;version="3.3.1.GA";uses:="org.hibern
- ate,org.hibernate.dialect",org.hibernate.hql;version="3.3.1.GA";uses:
- ="org.hibernate,org.hibernate.engine,org.hibernate.event,org.hibernat
- e.transform,org.hibernate.type",org.hibernate.hql.antlr;version="3.3.
- 1.GA";uses:="antlr,antlr.collections",org.hibernate.hql.ast;version="
- 3.3.1.GA";uses:="antlr,antlr.collections,org.hibernate,org.hibernate.
- engine,org.hibernate.event,org.hibernate.hql,org.hibernate.hql.antlr,
- org.hibernate.hql.ast.tree,org.hibernate.hql.ast.util,org.hibernate.i
- d,org.hibernate.type",org.hibernate.hql.ast.exec;version="3.3.1.GA";u
- ses:="antlr.collections,org.hibernate,org.hibernate.engine,org.hibern
- ate.engine.transaction,org.hibernate.hql.ast,org.hibernate.persister.
- entity,org.slf4j",org.hibernate.hql.ast.tree;version="3.3.1.GA";uses:
- ="antlr,antlr.collections,org.hibernate,org.hibernate.dialect.functio
- n,org.hibernate.engine,org.hibernate.hql.antlr,org.hibernate.hql.ast,
- org.hibernate.hql.ast.util,org.hibernate.param,org.hibernate.persiste
- r.collection,org.hibernate.persister.entity,org.hibernate.sql,org.hib
- ernate.type,org.slf4j",org.hibernate.hql.ast.util;version="3.3.1.GA";
- uses:="antlr,antlr.collections,antlr.collections.impl,org.hibernate,o
- rg.hibernate.dialect.function,org.hibernate.engine,org.hibernate.hql.
- antlr,org.hibernate.hql.ast,org.hibernate.hql.ast.tree,org.hibernate.
- persister.collection,org.hibernate.persister.entity,org.hibernate.sql
- ,org.hibernate.type,org.slf4j",org.hibernate.hql.classic;version="3.3
- .1.GA";uses:="org.hibernate,org.hibernate.dialect,org.hibernate.engin
- e,org.hibernate.event,org.hibernate.hql,org.hibernate.loader,org.hibe
- rnate.persister.collection,org.hibernate.persister.entity,org.hiberna
- te.transform,org.hibernate.type",org.hibernate.id;version="3.3.1.GA";
- uses:="org.hibernate,org.hibernate.dialect,org.hibernate.engine,org.h
- ibernate.id.insert,org.hibernate.persister.entity,org.hibernate.sql,o
- rg.hibernate.type,org.slf4j",org.hibernate.id.enhanced;version="3.3.1
- .GA";uses:="org.hibernate,org.hibernate.dialect,org.hibernate.engine,
- org.hibernate.id,org.hibernate.type,org.slf4j",org.hibernate.id.inser
- t;version="3.3.1.GA";uses:="org.hibernate.dialect,org.hibernate.engin
- e,org.hibernate.id,org.hibernate.sql",org.hibernate.impl;version="3.3
- .1.GA";uses:="javax.naming,javax.naming.event,javax.naming.spi,javax.
- transaction,org.hibernate,org.hibernate.cache,org.hibernate.cfg,org.h
- ibernate.classic,org.hibernate.collection,org.hibernate.connection,or
- g.hibernate.criterion,org.hibernate.dialect,org.hibernate.dialect.fun
- ction,org.hibernate.engine,org.hibernate.engine.query,org.hibernate.e
- ngine.query.sql,org.hibernate.event,org.hibernate.exception,org.hiber
- nate.hql,org.hibernate.id,org.hibernate.jdbc,org.hibernate.loader,org
- .hibernate.loader.custom,org.hibernate.metadata,org.hibernate.persist
- er.collection,org.hibernate.persister.entity,org.hibernate.proxy,org.
- hibernate.stat,org.hibernate.transaction,org.hibernate.transform,org.
- hibernate.type,org.hibernate.util,org.slf4j",org.hibernate.intercept;
- version="3.3.1.GA";uses:="org.hibernate,org.hibernate.engine",org.hib
- ernate.intercept.cglib;version="3.3.1.GA";uses:="org.hibernate.engine
- ,org.hibernate.intercept,org.hibernate.repackage.cglib.transform.impl
- ",org.hibernate.intercept.javassist;version="3.3.1.GA";uses:="org.hib
- ernate.bytecode.javassist,org.hibernate.engine,org.hibernate.intercep
- t",org.hibernate.jdbc;version="3.3.1.GA";uses:="org.hibernate,org.hib
- ernate.dialect,org.hibernate.engine,org.hibernate.transaction,org.slf
- 4j",org.hibernate.jdbc.util;version="3.3.1.GA",org.hibernate.jmx;vers
- ion="3.3.1.GA";uses:="javax.naming,org.hibernate,org.hibernate.classi
- c,org.hibernate.engine,org.hibernate.metadata,org.hibernate.stat,org.
- hibernate.util",org.hibernate.loader;version="3.3.1.GA";uses:="org.hi
- bernate,org.hibernate.dialect,org.hibernate.engine,org.hibernate.hql,
- org.hibernate.persister.collection,org.hibernate.persister.entity,org
- .hibernate.sql,org.hibernate.transform,org.hibernate.type",org.hibern
- ate.loader.collection;version="3.3.1.GA";uses:="org.hibernate,org.hib
- ernate.engine,org.hibernate.loader,org.hibernate.persister.collection
- ,org.hibernate.type",org.hibernate.loader.criteria;version="3.3.1.GA"
- ;uses:="org.hibernate,org.hibernate.criterion,org.hibernate.dialect,o
- rg.hibernate.engine,org.hibernate.impl,org.hibernate.loader,org.hiber
- nate.persister.entity,org.hibernate.transform,org.hibernate.type",org
- .hibernate.loader.custom;version="3.3.1.GA";uses:="org.hibernate,org.
- hibernate.engine,org.hibernate.hql,org.hibernate.loader,org.hibernate
- .persister.collection,org.hibernate.persister.entity,org.hibernate.tr
- ansform,org.hibernate.type",org.hibernate.loader.custom.sql;version="
- 3.3.1.GA";uses:="org.hibernate,org.hibernate.engine,org.hibernate.eng
- ine.query,org.hibernate.engine.query.sql,org.hibernate.loader.custom,
- org.hibernate.persister.collection,org.hibernate.persister.entity",or
- g.hibernate.loader.entity;version="3.3.1.GA";uses:="org.hibernate,org
- .hibernate.engine,org.hibernate.loader,org.hibernate.persister.collec
- tion,org.hibernate.persister.entity,org.hibernate.transform,org.hiber
- nate.type",org.hibernate.loader.hql;version="3.3.1.GA";uses:="org.hib
- ernate,org.hibernate.dialect,org.hibernate.engine,org.hibernate.event
- ,org.hibernate.hql.ast,org.hibernate.hql.ast.tree,org.hibernate.loade
- r,org.hibernate.persister.collection,org.hibernate.persister.entity,o
- rg.hibernate.transform,org.hibernate.type",org.hibernate.lob;version=
- "3.3.1.GA",org.hibernate.mapping;version="3.3.1.GA";uses:="org.hibern
- ate,org.hibernate.dialect,org.hibernate.dialect.function,org.hibernat
- e.engine,org.hibernate.id,org.hibernate.property,org.hibernate.tool.h
- bm2ddl,org.hibernate.type",org.hibernate.metadata;version="3.3.1.GA";
- uses:="org.hibernate,org.hibernate.engine,org.hibernate.type",org.hib
- ernate.param;version="3.3.1.GA";uses:="org.hibernate.engine,org.hiber
- nate.type",org.hibernate.persister;version="3.3.1.GA";uses:="org.hibe
- rnate,org.hibernate.cache.access,org.hibernate.cfg,org.hibernate.engi
- ne,org.hibernate.mapping,org.hibernate.persister.collection,org.hiber
- nate.persister.entity",org.hibernate.persister.collection;version="3.
- 3.1.GA";uses:="org.hibernate,org.hibernate.cache,org.hibernate.cache.
- access,org.hibernate.cache.entry,org.hibernate.cfg,org.hibernate.coll
- ection,org.hibernate.dialect,org.hibernate.engine,org.hibernate.excep
- tion,org.hibernate.id,org.hibernate.loader.collection,org.hibernate.m
- apping,org.hibernate.metadata,org.hibernate.persister.entity,org.hibe
- rnate.sql,org.hibernate.type",org.hibernate.persister.entity;version=
- "3.3.1.GA";uses:="org.hibernate,org.hibernate.cache,org.hibernate.cac
- he.access,org.hibernate.cache.entry,org.hibernate.dialect.lock,org.hi
- bernate.engine,org.hibernate.id,org.hibernate.id.insert,org.hibernate
- .intercept,org.hibernate.jdbc,org.hibernate.loader.entity,org.hiberna
- te.mapping,org.hibernate.metadata,org.hibernate.sql,org.hibernate.tup
- le.entity,org.hibernate.type",org.hibernate.pretty;version="3.3.1.GA"
- ;uses:="org.hibernate,org.hibernate.engine,org.hibernate.persister.co
- llection,org.hibernate.persister.entity,org.hibernate.type",org.hiber
- nate.property;version="3.3.1.GA";uses:="org.hibernate,org.hibernate.e
- ngine,org.hibernate.mapping,org.hibernate.type,org.slf4j",org.hiberna
- te.proxy;version="3.3.1.GA";uses:="org.hibernate,org.hibernate.engine
- ,org.hibernate.type",org.hibernate.proxy.dom4j;version="3.3.1.GA";use
- s:="org.dom4j,org.hibernate,org.hibernate.engine,org.hibernate.proxy,
- org.hibernate.type",org.hibernate.proxy.map;version="3.3.1.GA";uses:=
- "org.hibernate,org.hibernate.engine,org.hibernate.proxy,org.hibernate
- .type",org.hibernate.proxy.pojo;version="3.3.1.GA";uses:="org.hiberna
- te.engine,org.hibernate.proxy,org.hibernate.type",org.hibernate.proxy
- .pojo.cglib;version="3.3.1.GA";uses:="org.hibernate,org.hibernate.eng
- ine,org.hibernate.proxy,org.hibernate.proxy.pojo,org.hibernate.repack
- age.cglib.proxy,org.hibernate.type",org.hibernate.proxy.pojo.javassis
- t;version="3.3.1.GA";uses:="javassist.util.proxy,org.hibernate,org.hi
- bernate.engine,org.hibernate.proxy,org.hibernate.proxy.pojo,org.hiber
- nate.type",org.hibernate.repackage.cglib.asm;version="3.3.1.GA",org.h
- ibernate.repackage.cglib.asm.attrs;version="3.3.1.GA";uses:="org.hibe
- rnate.repackage.cglib.asm",org.hibernate.repackage.cglib.beans;versio
- n="3.3.1.GA";uses:="org.hibernate.repackage.cglib.asm,org.hibernate.r
- epackage.cglib.core",org.hibernate.repackage.cglib.core;version="3.3.
- 1.GA";uses:="org.hibernate.repackage.cglib.asm",org.hibernate.repacka
- ge.cglib.proxy;version="3.3.1.GA";uses:="org.hibernate.repackage.cgli
- b.asm,org.hibernate.repackage.cglib.core,org.hibernate.repackage.cgli
- b.reflect",org.hibernate.repackage.cglib.reflect;version="3.3.1.GA";u
- ses:="org.hibernate.repackage.cglib.asm,org.hibernate.repackage.cglib
- .core",org.hibernate.repackage.cglib.transform;version="3.3.1.GA";use
- s:="org.apache.tools.ant,org.apache.tools.ant.types,org.hibernate.rep
- ackage.cglib.asm,org.hibernate.repackage.cglib.core",org.hibernate.re
- package.cglib.transform.hook;version="3.3.1.GA";uses:="org.codehaus.a
- spectwerkz.hook,org.hibernate.repackage.cglib.asm,org.hibernate.repac
- kage.cglib.core,org.hibernate.repackage.cglib.transform",org.hibernat
- e.repackage.cglib.transform.impl;version="3.3.1.GA";uses:="org.hibern
- ate.repackage.cglib.asm,org.hibernate.repackage.cglib.core,org.hibern
- ate.repackage.cglib.transform",org.hibernate.repackage.cglib.util;ver
- sion="3.3.1.GA";uses:="org.hibernate.repackage.cglib.asm,org.hibernat
- e.repackage.cglib.core",org.hibernate.secure;version="3.3.1.GA";uses:
- ="javax.security.auth,javax.security.jacc,org.hibernate,org.hibernate
- .cfg,org.hibernate.event",org.hibernate.sql;version="3.3.1.GA";uses:=
- "org.hibernate,org.hibernate.dialect,org.hibernate.dialect.function,o
- rg.hibernate.type",org.hibernate.stat;version="3.3.1.GA";uses:="org.h
- ibernate.cache,org.hibernate.engine",org.hibernate.tool.hbm2ddl;versi
- on="3.3.1.GA";uses:="org.apache.tools.ant,org.apache.tools.ant.taskde
- fs,org.apache.tools.ant.types,org.hibernate,org.hibernate.cfg,org.hib
- ernate.connection,org.hibernate.dialect",org.hibernate.tool.instrumen
- t;version="3.3.1.GA";uses:="org.apache.tools.ant,org.apache.tools.ant
- .types,org.hibernate.bytecode,org.hibernate.bytecode.util",org.hibern
- ate.tool.instrument.cglib;version="3.3.1.GA";uses:="org.hibernate.byt
- ecode,org.hibernate.bytecode.util,org.hibernate.tool.instrument",org.
- hibernate.tool.instrument.javassist;version="3.3.1.GA";uses:="org.hib
- ernate.bytecode,org.hibernate.bytecode.util,org.hibernate.tool.instru
- ment",org.hibernate.transaction;version="3.3.1.GA";uses:="javax.namin
- g,javax.transaction,javax.transaction.xa,org.hibernate,org.hibernate.
- engine,org.hibernate.jdbc",org.hibernate.transform;version="3.3.1.GA"
- ,org.hibernate.tuple;version="3.3.1.GA";uses:="org.dom4j,org.hibernat
- e,org.hibernate.bytecode,org.hibernate.engine,org.hibernate.id,org.hi
- bernate.mapping,org.hibernate.property,org.hibernate.type",org.hibern
- ate.tuple.component;version="3.3.1.GA";uses:="org.hibernate,org.hiber
- nate.engine,org.hibernate.mapping,org.hibernate.property,org.hibernat
- e.tuple",org.hibernate.tuple.entity;version="3.3.1.GA";uses:="org.hib
- ernate,org.hibernate.engine,org.hibernate.mapping,org.hibernate.prope
- rty,org.hibernate.proxy,org.hibernate.tuple,org.hibernate.type",org.h
- ibernate.type;version="3.3.1.GA";uses:="org.dom4j,org.hibernate,org.h
- ibernate.collection,org.hibernate.dialect,org.hibernate.engine,org.hi
- bernate.persister.collection,org.hibernate.persister.entity,org.hiber
- nate.tuple,org.hibernate.tuple.component,org.hibernate.usertype",org.
- hibernate.usertype;version="3.3.1.GA";uses:="org.hibernate,org.hibern
- ate.collection,org.hibernate.engine,org.hibernate.persister.collectio
- n,org.hibernate.type",org.hibernate.util;version="3.3.1.GA";uses:="ja
- vax.naming,javax.transaction,org.dom4j,org.dom4j.io,org.hibernate,org
- .hibernate.cfg,org.hibernate.dialect,org.hibernate.dialect.function,o
- rg.hibernate.engine,org.hibernate.property,org.hibernate.type,org.slf
- 4j,org.xml.sax"
-Bundle-Vendor: SpringSource
-Bundle-Version: 3.3.1.GA
-Tool: Bundlor 1.0.0.CI-B166
-Bundle-Name: JBoss Hibernate Object-Relational Mapper
-Bundle-ManifestVersion: 2
-Created-By: 1.5.0_15-b04 (Sun Microsystems Inc.)
-Bundle-SymbolicName: com.springsource.org.hibernate
-Import-Package: antlr;version="[2.7.6, 3.0.0)",antlr.collections;versi
- on="[2.7.6, 3.0.0)",antlr.collections.impl;version="[2.7.6, 3.0.0)",c
- om.mchange.v2.c3p0;version="[0.9.1, 0.9.2)";resolution:="optional",co
- m.opensymphony.oscache.base;version="[2.1.0, 3.0.0)";resolution:="opt
- ional",com.opensymphony.oscache.general;version="[2.1.0, 3.0.0)";reso
- lution:="optional",javassist;version="[3.3.0.ga,3.4.0)",javassist.byt
- ecode;version="[3.3.0.ga,3.4.0)",javassist.util.proxy;version="[3.3.0
- .ga,3.4.0)",javax.naming;version="0",javax.naming.event;version="0",j
- avax.naming.spi;version="0",javax.security.auth;version="0",javax.sec
- urity.jacc;version="0";resolution:="optional",javax.sql;version="0",j
- avax.transaction;version="[1.0.1, 2.0.0)";resolution:="optional",java
- x.transaction.xa;version="[1.0.1, 2.0.0)";resolution:="optional",net.
- sf.cglib.beans;version="[2.1.3, 2.2.0)",net.sf.cglib.core;version="[2
- .1.3, 2.2.0)",net.sf.cglib.proxy;version="[2.1.3, 2.2.0)",net.sf.cgli
- b.reflect;version="[2.1.3, 2.2.0)",net.sf.cglib.transform;version="[2
- .1.3, 2.2.0)",net.sf.cglib.util;version="[2.1.3, 2.2.0)",net.sf.ehcac
- he;version="[1.2.3, 2.0.0)";resolution:="optional",net.sf.swarmcache;
- version="[1.0.0.RC2a, 1.1.0)";resolution:="optional",org.apache.commo
- ns.collections.map;version="[3.2.0, 4.0.0)",org.apache.tools.ant;vers
- ion="[1.7.0, 2.0.0)";resolution:="optional",org.apache.tools.ant.task
- defs;version="[1.7.0, 2.0.0)";resolution:="optional",org.apache.tools
- .ant.types;version="[1.7.0, 2.0.0)";resolution:="optional",org.codeha
- us.aspectwerkz.hook;version="[0.8.1, 0.9.0)";resolution:="optional",o
- rg.dom4j;version="[1.6.1, 1.7.0)",org.dom4j.io;version="[1.6.1, 1.7.0
- )",org.jboss.cache;version="[1.2.2, 2.0.0)";resolution:="optional",or
- g.jboss.cache.config;version="[1.2.2, 2.0.0)";resolution:="optional",
- org.jboss.cache.lock;version="[1.2.2, 2.0.0)";resolution:="optional",
- org.jboss.cache.notifications.annotation;version="[1.2.2, 2.0.0)";res
- olution:="optional",org.jboss.cache.notifications.event;version="[1.2
- .2, 2.0.0)";resolution:="optional",org.jboss.cache.optimistic;version
- ="[1.2.2, 2.0.0)";resolution:="optional",org.jgroups;version="[2.2.7,
- 3.0.0)",org.logicalcobwebs.proxool;version="[0.8.3, 0.9.0)";resoluti
- on:="optional",org.logicalcobwebs.proxool.configuration;version="[0.8
- .3, 0.9.0)";resolution:="optional",org.slf4j;version="[1.5.2, 1.6.0)"
- ,org.w3c.dom;version="0",org.xml.sax;version="0"
-Archiver-Version: Plexus Archiver
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>>>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.support.activemq</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-#Sat Jan 10 17:12:41 CET 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+++ /dev/null
-#Sat Jan 10 17:11:12 CET 2009
-activeProfiles=
-eclipse.preferences.version=1
-fullBuildGoals=process-test-resources
-includeModules=false
-resolveWorkspaceProjects=true
-resourceFilterGoals=process-resources resources\:testResources
-version=1
+++ /dev/null
-source.. = src/main/java/,\
- src/main/resources/
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>runtime</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.support.activemq</artifactId>
- <name>SLC Support ActiveMQ</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Export-Package>
- org.argeo.slc.jms.*,org.argeo.slc.activemq
- </Export-Package>
- <Import-Package>
- javax.xml.transform;version="0.0.0",
- *
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <!-- SLC -->
- <dependency>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.core</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
-
- <!-- Spring -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.jms</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.oxm</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.transaction</artifactId>
- </dependency>
-
- <!-- AOP -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.aspectj.weaver</artifactId>
- </dependency>
-
- <!-- JMS -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>javax.jms</artifactId>
- </dependency>
-
- <!-- ActiveMQ -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.apache.activemq</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.apache.commons.pool</artifactId>
- </dependency>
-
- <!-- JEE required by ActiveMQ Core -->
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>javax.management.j2ee</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>javax.ejb</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>javax.xml.rpc</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>javax.servlet</artifactId>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import java.util.List;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.core.runtime.DefaultAgent;
-import org.argeo.slc.execution.ExecutionModuleDescriptor;
-import org.argeo.slc.msg.ExecutionAnswer;
-import org.argeo.slc.msg.MsgConstants;
-import org.argeo.slc.msg.ReferenceList;
-import org.argeo.slc.process.SlcExecution;
-import org.argeo.slc.runtime.SlcAgentDescriptor;
-import org.springframework.jms.JmsException;
-import org.springframework.jms.core.JmsTemplate;
-import org.springframework.jms.core.MessagePostProcessor;
-
-/** JMS based implementation of an SLC Agent. */
-public class JmsAgent extends DefaultAgent implements MessageListener {
- public final static String PROPERTY_QUERY = "query";
- public final static String QUERY_PING_ALL = "pingAll";
-
- private final static Log log = LogFactory.getLog(JmsAgent.class);
-
- private JmsTemplate jmsTemplate;
- private Destination agentRegister;
- private Destination agentUnregister;
-
- private Destination responseDestination;
-
- public void init() {
- super.init();
- try {
- jmsTemplate.convertAndSend(agentRegister, getAgentDescriptor());
- log.info("Agent #" + getAgentUuid() + " registered to "
- + agentRegister);
- } catch (JmsException e) {
- log.warn("Could not register agent "
- + getAgentDescriptor().getUuid()
- + " to server: "
- + e.getMessage()
- + ". The agent will stay offline but will keep listening for a ping all sent by server.");
- if (log.isTraceEnabled())
- log.debug("Original error.", e);
- }
- }
-
- @Override
- public void destroy() {
- try {
- jmsTemplate.convertAndSend(agentUnregister, getAgentDescriptor());
- log.info("Agent #" + getAgentUuid() + " unregistered from "
- + agentUnregister);
- } catch (JmsException e) {
- log.warn("Could not unregister agent " + getAgentUuid() + ": "
- + e.getMessage());
- if (log.isTraceEnabled())
- log.debug("Original error.", e);
- }
- super.destroy();
- }
-
- public void setAgentRegister(Destination agentRegister) {
- this.agentRegister = agentRegister;
- }
-
- public void setAgentUnregister(Destination agentUnregister) {
- this.agentUnregister = agentUnregister;
- }
-
- public String getMessageSelector() {
- String messageSelector = "slc_agentId='" + getAgentUuid() + "'";
- // if (log.isDebugEnabled())
- // log.debug("Message selector: " + messageSelector);
- return messageSelector;
- }
-
- public void onMessage(final Message message) {
- final String query;
- final String correlationId;
- try {
- query = message.getStringProperty(PROPERTY_QUERY);
- correlationId = message.getJMSCorrelationID();
- } catch (JMSException e1) {
- throw new SlcException("Cannot analyze incoming message " + message);
- }
-
- final Object response;
- final Destination destinationSend;
- if (QUERY_PING_ALL.equals(query)) {
- ReferenceList refList = (ReferenceList) convertFrom(message);
- if (!refList.getReferences().contains(getAgentUuid())) {
- response = getAgentDescriptor();
- destinationSend = agentRegister;
- log.info("Agent #" + getAgentUuid() + " registering to "
- + agentRegister + " in reply to a " + QUERY_PING_ALL
- + " query");
- } else {
- return;
- }
- } else {
- response = process(query, message);
- destinationSend = responseDestination;
- }
-
- // Send response
- if (log.isTraceEnabled())
- log.trace("About to send response " + response.getClass());
- jmsTemplate.convertAndSend(destinationSend, response,
- new MessagePostProcessor() {
- public Message postProcessMessage(Message messageToSend)
- throws JMSException {
- messageToSend.setStringProperty(PROPERTY_QUERY, query);
- messageToSend.setStringProperty(
- MsgConstants.PROPERTY_SLC_AGENT_ID,
- getAgentUuid());
- messageToSend.setJMSCorrelationID(correlationId);
- return messageToSend;
- }
- });
- if (log.isTraceEnabled())
- log.debug("Sent response to query '" + query
- + "' with correlationId " + correlationId);
- }
-
- /** @return response */
- public Object process(String query, Message message) {
- try {
- if ("getExecutionModuleDescriptor".equals(query)) {
- String moduleName = message.getStringProperty("moduleName");
- String version = message.getStringProperty("version");
- return getExecutionModuleDescriptor(moduleName, version);
- } else if ("listExecutionModuleDescriptors".equals(query)) {
-
- List<ExecutionModuleDescriptor> lst = listExecutionModuleDescriptors();
- SlcAgentDescriptor agentDescriptorToSend = new SlcAgentDescriptor(
- getAgentDescriptor());
- agentDescriptorToSend.setModuleDescriptors(lst);
- return agentDescriptorToSend;
- } else if ("runSlcExecution".equals(query)) {
- final SlcExecution slcExecution = (SlcExecution) convertFrom(message);
- new Thread() {
- public void run() {
- process(slcExecution);
- }
- }.start();
- return ExecutionAnswer.ok("Execution started on agent "
- + getAgentUuid());
- } else if ("ping".equals(query)) {
- return ExecutionAnswer.ok("Agent " + getAgentUuid()
- + " is alive.");
- } else {
- throw new SlcException("Unsupported query " + query);
- }
- } catch (Exception e) {
- log.error("Processing of query " + query + " failed", e);
- return ExecutionAnswer.error(e);
- }
- }
-
- protected Object convertFrom(Message message) {
- try {
- return jmsTemplate.getMessageConverter().fromMessage(message);
- } catch (JMSException e) {
- throw new SlcException("Cannot convert message", e);
- }
- }
-
- public void setResponseDestination(Destination responseDestination) {
- this.responseDestination = responseDestination;
- }
-
- public void setJmsTemplate(JmsTemplate jmsTemplate) {
- this.jmsTemplate = jmsTemplate;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import java.util.List;
-import java.util.UUID;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.execution.ExecutionModuleDescriptor;
-import org.argeo.slc.execution.ExecutionProcess;
-import org.argeo.slc.msg.ExecutionAnswer;
-import org.argeo.slc.msg.MsgConstants;
-import org.argeo.slc.process.SlcExecution;
-import org.argeo.slc.runtime.SlcAgent;
-import org.argeo.slc.runtime.SlcAgentDescriptor;
-import org.springframework.jms.core.JmsTemplate;
-import org.springframework.jms.core.MessageCreator;
-
-public class JmsAgentProxy implements SlcAgent {
- private final static Log log = LogFactory.getLog(JmsAgentProxy.class);
-
- private final String agentUuid;
- private final Destination requestDestination;
- private final Destination responseDestination;
- private final JmsTemplate jmsTemplate;
-
- public JmsAgentProxy(String agentUuid, Destination requestDestination,
- Destination responseDestination, JmsTemplate jmsTemplate) {
- this.agentUuid = agentUuid;
- this.requestDestination = requestDestination;
- this.responseDestination = responseDestination;
- this.jmsTemplate = jmsTemplate;
- }
-
- public String getAgentUuid() {
- return agentUuid;
- }
-
- public ExecutionModuleDescriptor getExecutionModuleDescriptor(
- final String moduleName, final String version) {
- return (ExecutionModuleDescriptor) sendReceive(new AgentMC(
- "getExecutionModuleDescriptor") {
- public void setArguments(Message message) throws JMSException {
- message.setStringProperty("moduleName", moduleName);
- message.setStringProperty("version", version);
- }
- });
- }
-
- public List<ExecutionModuleDescriptor> listExecutionModuleDescriptors() {
- return ((SlcAgentDescriptor) sendReceive(new AgentMC(
- "listExecutionModuleDescriptors"))).getModuleDescriptors();
- }
-
- public void runSlcExecution(SlcExecution slcExecution) {
- process(slcExecution);
- }
-
- public void process(ExecutionProcess executionProcess) {
- if (!(executionProcess instanceof SlcExecution))
- throw new SlcException("Unsupported process type "
- + executionProcess.getClass());
- sendReceive(new AgentMC("runSlcExecution",
- (SlcExecution) executionProcess));
- }
-
- public boolean ping() {
- Object response = sendReceive(new AgentMC("ping"), false);
- if (response == null)
- return false;
- else {
- ExecutionAnswer answer = (ExecutionAnswer) response;
- return ExecutionAnswer.OK.equals(answer.getStatus());
- }
- }
-
- public void kill(ExecutionProcess process) {
- throw new UnsupportedOperationException();
- }
-
- protected Object sendReceive(AgentMC messageCreator) {
- long begin = System.currentTimeMillis();
- Object res;
- try {
- res = sendReceive(messageCreator, true);
- } finally {
- if (log.isTraceEnabled())
- log.trace("To agent #" + agentUuid + " in "
- + (System.currentTimeMillis() - begin) + " ms, query '"
- + messageCreator.getQuery() + "', correlationId "
- + messageCreator.getCorrelationId());
- }
- return res;
- }
-
- /**
- * @param timeoutException
- * if true throws an exception if reception timeouted, else
- * return null
- */
- protected Object sendReceive(AgentMC messageCreator,
- boolean timeoutException) {
- String correlationId = UUID.randomUUID().toString();
- messageCreator.setCorrelationId(correlationId);
- send(messageCreator);
-
- Object response = processResponse(messageCreator, timeoutException);
-
- if (response instanceof ExecutionAnswer) {
- ExecutionAnswer answer = (ExecutionAnswer) response;
- if (ExecutionAnswer.ERROR.equals(answer.getStatus()))
- throw new SlcException("Execution of '"
- + messageCreator.getQuery() + "' failed on the agent "
- + agentUuid + ": " + answer.getMessage()
- + " (correlationId=" + correlationId + ")");
- else
- return answer;
- } else {
- return response;
- }
- }
-
- protected void send(AgentMC messageCreator) {
- jmsTemplate.send(requestDestination, messageCreator);
- }
-
- protected Object processResponse(AgentMC messageCreator,
- boolean timeoutException) {
- String correlationId = messageCreator.getCorrelationId();
- String query = messageCreator.getQuery();
- Message responseMsg = null;
- try {
- responseMsg = jmsTemplate.receiveSelected(responseDestination,
- "JMSCorrelationID='" + correlationId + "'");
- } catch (Exception e) {
- throw new SlcException("Could not receive response from agent "
- + agentUuid + " with correlationId " + correlationId
- + " (query '" + query + "')", e);
- }
-
- if (responseMsg == null) {// timeout
- if (timeoutException)
- throw new SlcException("TIMEOUT: Query '" + query + "'"
- + " with correlationId " + correlationId
- + " sent to agent " + agentUuid + " timed out.");
- else
- return null;
- }
-
- try {
- return fromMessage(responseMsg);
- } catch (Exception e) {
- throw new SlcException("Could not convert response from agent "
- + agentUuid + " with correlationId " + correlationId
- + " (query '" + query + "')", e);
- }
- }
-
- protected Object fromMessage(Message message) throws JMSException {
- return jmsTemplate.getMessageConverter().fromMessage(message);
- }
-
- protected Message toMessage(Object obj, Session session)
- throws JMSException {
- return jmsTemplate.getMessageConverter().toMessage(obj, session);
- }
-
- protected class AgentMC implements MessageCreator {
- private final String query;
- private Object body = null;
- private String correlationId;
-
- public AgentMC(String query) {
- this.query = query;
- }
-
- public AgentMC(String query, Object body) {
- this.query = query;
- this.body = body;
- }
-
- public final Message createMessage(Session session) throws JMSException {
- if (agentUuid == null)
- throw new SlcException("Agent UUID not set");
- if (correlationId == null)
- throw new SlcException("JMSCorrelationID not set");
- final Message msg;
- if (body == null)
- msg = session.createTextMessage();
- else
- msg = toMessage(body, session);
- msg.setStringProperty(MsgConstants.PROPERTY_SLC_AGENT_ID, agentUuid);
- msg.setStringProperty(JmsAgent.PROPERTY_QUERY, query);
- msg.setJMSCorrelationID(correlationId);
- setArguments(msg);
- if (msg instanceof TextMessage) {
- TextMessage textMessage = (TextMessage) msg;
- if (textMessage.getText() == null) {
- // TODO: remove workaround when upgrading to ActiveMQ 5.3
- // Workaround for
- // https://issues.apache.org/activemq/browse/AMQ-2046
- textMessage.setText("");
- }
- }
- return msg;
- }
-
- protected void setArguments(Message message) throws JMSException {
- }
-
- public String getQuery() {
- return query;
- }
-
- public String getCorrelationId() {
- return correlationId;
- }
-
- public void setCorrelationId(String correlationId) {
- this.correlationId = correlationId;
- }
-
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import java.util.List;
-import java.util.UUID;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-import org.argeo.slc.msg.ReferenceList;
-import org.argeo.slc.runtime.SlcAgent;
-import org.argeo.slc.runtime.SlcAgentFactory;
-import org.springframework.jms.core.JmsTemplate;
-import org.springframework.jms.core.MessagePostProcessor;
-
-public class JmsAgentProxyFactory implements SlcAgentFactory {
- private Destination requestDestination;
- private Destination responseDestination;
- private Destination pingAllDestination;
- private JmsTemplate jmsTemplate;
-
- public SlcAgent getAgent(String uuid) {
- return new JmsAgentProxy(uuid, requestDestination, responseDestination,
- jmsTemplate);
- }
-
- public void pingAll(List<String> activeAgentIds) {
- ReferenceList referenceList = new ReferenceList(activeAgentIds);
- jmsTemplate.convertAndSend(pingAllDestination, referenceList,
- new MessagePostProcessor() {
-
- public Message postProcessMessage(Message message)
- throws JMSException {
- message.setJMSCorrelationID(UUID.randomUUID()
- .toString());
- message.setStringProperty(JmsAgent.PROPERTY_QUERY,
- JmsAgent.QUERY_PING_ALL);
- return message;
- }
- });
- }
-
- public void setRequestDestination(Destination requestDestination) {
- this.requestDestination = requestDestination;
- }
-
- public void setResponseDestination(Destination responseDestination) {
- this.responseDestination = responseDestination;
- }
-
- public void setJmsTemplate(JmsTemplate jmsTemplate) {
- this.jmsTemplate = jmsTemplate;
- }
-
- public void setPingAllDestination(Destination pingAllDestination) {
- this.pingAllDestination = pingAllDestination;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-
-import org.apache.commons.io.IOUtils;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.core.attachment.AttachmentsStorage;
-import org.argeo.slc.core.attachment.SimpleAttachment;
-
-public class JmsAttachmentListener implements MessageListener {
- private AttachmentsStorage attachmentsStorage;
-
- public void onMessage(Message msg) {
- BytesMessage message = (BytesMessage) msg;
-
- InputStream in = null;
- try {
- SimpleAttachment attachment = new SimpleAttachment();
- attachment.setUuid(msg
- .getStringProperty(JmsAttachmentUploader.ATTACHMENT_ID));
- attachment.setName(msg
- .getStringProperty(JmsAttachmentUploader.ATTACHMENT_NAME));
- attachment
- .setContentType(msg
- .getStringProperty(JmsAttachmentUploader.ATTACHMENT_CONTENT_TYPE));
-
- // Check body length
- Long bodyLength = message.getBodyLength();
- if (bodyLength > Integer.MAX_VALUE)
- throw new SlcException("Attachment cannot be bigger than "
- + Integer.MAX_VALUE
- + " bytes with this transport. Use another transport.");
-
- byte[] buffer = new byte[bodyLength.intValue()];
- message.readBytes(buffer);
- in = new ByteArrayInputStream(buffer);
- attachmentsStorage.storeAttachment(attachment, in);
- } catch (JMSException e) {
- throw new SlcException("Could not process attachment message "
- + msg, e);
- } finally {
- IOUtils.closeQuietly(in);
- }
- }
-
- public void setAttachmentsStorage(AttachmentsStorage attachmentsStorage) {
- this.attachmentsStorage = attachmentsStorage;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.jms.BytesMessage;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.core.attachment.Attachment;
-import org.argeo.slc.core.attachment.AttachmentUploader;
-import org.springframework.core.io.Resource;
-import org.springframework.jms.JmsException;
-import org.springframework.jms.core.JmsTemplate;
-import org.springframework.jms.core.MessageCreator;
-
-public class JmsAttachmentUploader implements AttachmentUploader {
- private final static Log log = LogFactory
- .getLog(JmsAttachmentUploader.class);
-
- public final static String ATTACHMENT_ID = "slc_attachmentId";
- public final static String ATTACHMENT_NAME = "slc_attachmentName";
- public final static String ATTACHMENT_CONTENT_TYPE = "slc_attachmentContentType";
-
- private JmsTemplate jmsTemplate;
- private Destination destination;
-
- public void upload(final Attachment attachment, final Resource resource) {
- try {
- jmsTemplate.send(destination, new MessageCreator() {
-
- public Message createMessage(Session session)
- throws JMSException {
- BytesMessage message = session.createBytesMessage();
- message.setStringProperty(ATTACHMENT_ID, attachment
- .getUuid());
- message.setStringProperty(ATTACHMENT_NAME, attachment
- .getName());
- message.setStringProperty(ATTACHMENT_CONTENT_TYPE,
- attachment.getContentType());
-
- InputStream in = null;
- try {
- in = resource.getInputStream();
- byte[] buffer = new byte[1024 * 1024];
- int read = -1;
- while ((read = in.read(buffer)) > 0) {
- message.writeBytes(buffer, 0, read);
- }
- } catch (IOException e) {
- throw new SlcException(
- "Cannot write into byte message for attachment "
- + attachment + " and resource "
- + resource, e);
- } finally {
- IOUtils.closeQuietly(in);
- }
- return message;
- }
- });
- } catch (JmsException e) {
- if (log.isTraceEnabled())
- log.debug("Cannot upload", e);
- else if (log.isDebugEnabled())
- log.debug("Cannot upload: " + e.getMessage());
- }
-
- }
-
- public void setJmsTemplate(JmsTemplate jmsTemplate) {
- this.jmsTemplate = jmsTemplate;
- }
-
- public void setDestination(Destination destination) {
- this.destination = destination;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-
-import org.argeo.slc.SlcException;
-import org.argeo.slc.msg.MsgHandler;
-import org.springframework.jms.support.converter.MessageConverter;
-
-public class JmsExecutionHandler implements MessageListener {
-
- private MessageConverter messageConverter;
- private MsgHandler serviceMsgHandler;
-
- public void onMessage(Message message) {
- try {
- serviceMsgHandler.handleMsg(messageConverter.fromMessage(message));
- } catch (JMSException e) {
- throw new SlcException("Could not interpret message " + message, e);
- }
- }
-
- public void setMessageConverter(MessageConverter messageConverter) {
- this.messageConverter = messageConverter;
- }
-
- public void setServiceMsgHandler(MsgHandler serviceMsgHandler) {
- this.serviceMsgHandler = serviceMsgHandler;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicSubscriber;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.msg.event.SlcEvent;
-import org.argeo.slc.msg.event.SlcEventListener;
-import org.argeo.slc.msg.event.SlcEventListenerDescriptor;
-import org.springframework.jms.connection.ConnectionFactoryUtils;
-import org.springframework.jms.support.JmsUtils;
-import org.springframework.jms.support.converter.MessageConverter;
-
-public class JmsSlcEventListener implements SlcEventListener {
- private final static Log log = LogFactory.getLog(JmsSlcEventListener.class);
-
- // IoC
- private Topic eventsDestination;
- private ConnectionFactory jmsConnectionFactory;
- private MessageConverter messageConverter;
-
- // Initialized with init() method, released with close()
- private Connection connection = null;
-
- // One by instance
- private String connectionClientId = getClass() + "#"
- + UUID.randomUUID().toString();
- private Boolean isClosed = false;
-
- private List<String> subscriberIds = new ArrayList<String>();
-
- // private Map<String, ListeningClient> clients = Collections
- // .synchronizedMap(new HashMap<String, ListeningClient>());
-
- public SlcEvent listen(String subscriberId,
- List<SlcEventListenerDescriptor> descriptors, Long timeout) {
- if (descriptors.size() == 0) {
- // No listener, just waiting
- try {
- if (log.isTraceEnabled())
- log.trace("No event listener registered, sleeping...");
- Thread.sleep(timeout);
- } catch (InterruptedException e) {
- // silent
- }
- return null;
- } else {
- Object obj = null;
- synchronized (subscriberIds) {
- while (subscriberIds.contains(subscriberId)) {
- try {
- subscriberIds.wait(500);
- if (isClosed)
- return null;
- } catch (InterruptedException e) {
- // silent
- }
- }
- subscriberIds.add(subscriberId);
- Session session = null;
- TopicSubscriber topicSubscriber = null;
- try {
- // ListeningClient client = (ListeningClient)
- // getClient(clientId);
- session = connection.createSession(false,
- Session.AUTO_ACKNOWLEDGE);
- topicSubscriber = session.createDurableSubscriber(
- eventsDestination, subscriberId,
- createSelector(descriptors), true);
- Message message = topicSubscriber.receive(timeout);
- obj = messageConverter.fromMessage(message);
- } catch (JMSException e) {
- throw new SlcException("Cannot poll events for subscriber "
- + subscriberId, e);
- } finally {
- JmsUtils.closeMessageConsumer(topicSubscriber);
- JmsUtils.closeSession(session);
- subscriberIds.remove(subscriberId);
- subscriberIds.notifyAll();
- }
-
- }
-
- if (obj == null)
- return null;
- else
- return (SlcEvent) obj;
- }
- }
-
- /** Returns null if no filter */
- protected String createSelector(List<SlcEventListenerDescriptor> descriptors) {
- if (descriptors.size() == 0)
- throw new SlcException("No listeners, cannot generate JMS selector");
-
- StringBuffer buf = new StringBuffer(256);
- Boolean first = true;
- for (SlcEventListenerDescriptor descriptor : descriptors) {
- if (first)
- first = false;
- else
- buf.append(" OR ");
-
- buf.append('(');
- buf.append(SlcEvent.EVENT_TYPE).append("=").append('\'').append(
- descriptor.getEventType()).append('\'');
- if (descriptor.getFilter() != null) {
- buf.append(" AND ");
- buf.append('(').append(descriptor.getFilter()).append(')');
- }
- buf.append(')');
- }
- if (log.isTraceEnabled())
- log.trace("selector created : " + buf.toString());
- return buf.toString();
- }
-
- public boolean isClosed() {
- return isClosed;
- }
-
- // Ioc
- public void setEventsDestination(Topic eventsDestination) {
- this.eventsDestination = eventsDestination;
- }
-
- public void setJmsConnectionFactory(ConnectionFactory jmsConnectionFactory) {
- this.jmsConnectionFactory = jmsConnectionFactory;
- }
-
- public void setMessageConverter(MessageConverter messageConverter) {
- this.messageConverter = messageConverter;
- }
-
- // Life Cycle
- public void init() {
- try {
- connection = jmsConnectionFactory.createConnection();
- connection.setClientID(connectionClientId);
- connection.start();
- } catch (JMSException e) {
- throw new SlcException("Could not init connection", e);
- }
- }
-
- public void close() {
- ConnectionFactoryUtils.releaseConnection(connection,
- jmsConnectionFactory, true);
- isClosed = true;
- synchronized (subscriberIds) {
- subscriberIds.notifyAll();
- }
- }
-
- // public void close(String clientId) {
- // // Session session = null;
- // // // ListeningClient client = getClient(clientId);
- // // // Connection connection = client.getConnection();
- // // try {
- // // session = client.getSession();
- // // session.unsubscribe(clientId);
- // // } catch (JMSException e) {
- // // log.warn("Could not unsubscribe client " + clientId, e);
- // // } finally {
- // // JmsUtils.closeSession(session);
- // // }
- // //
- // // // synchronized (client) {
- // // // clients.remove(clientId);
- // // // client.notify();
- // // // }
- // }
-
- // protected ListeningClient getClient(String clientId) {
- // ListeningClient client = clients.get(clientId);
- // if (client == null) {
- // // Lazy init
- // client = new ListeningClient(connection);
- // clients.put(clientId, client);
- // }
- // return client;
- // }
-
- // protected class ListeningClient {
- // private final Connection connection;
- // private final Session session;
- //
- // public ListeningClient(Connection connection) {
- // super();
- // this.connection = connection;
- // try {
- // session = connection.createSession(false,
- // Session.AUTO_ACKNOWLEDGE);
- // } catch (JMSException e) {
- // throw new SlcException("Cannot create session");
- // }
- // }
- //
- // public Connection getConnection() {
- // return connection;
- // }
- //
- // public Session getSession() {
- // return session;
- // }
- //
- // }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import java.util.Map;
-
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.msg.event.SlcEvent;
-import org.argeo.slc.msg.event.SlcEventPublisher;
-import org.springframework.jms.core.JmsTemplate;
-import org.springframework.jms.core.MessagePostProcessor;
-
-public class JmsSlcEventPublisher implements SlcEventPublisher {
- private static final Log log = LogFactory
- .getLog(JmsSlcEventPublisher.class);
- private Destination eventsDestination;
- private JmsTemplate jmsTemplate;
-
- public void publish(final SlcEvent event) {
- if (jmsTemplate.getDeliveryMode() != DeliveryMode.PERSISTENT)
- throw new SlcException(
- "Delivery mode has to be persistent in order to have durable subscription");
-
- jmsTemplate.convertAndSend(eventsDestination, event,
- new MessagePostProcessor() {
-
- public Message postProcessMessage(Message message)
- throws JMSException {
- Map<String, String> headers = event.getHeaders();
- for (String key : headers.keySet()) {
- message.setStringProperty(key, headers.get(key));
- }
- return message;
- }
- });
- if (log.isTraceEnabled()) {
- log.trace("Event " + event.toString() + " sent to "
- + eventsDestination.toString());
- }
-
- }
-
- public void setEventsDestination(Destination eventsDestination) {
- this.eventsDestination = eventsDestination;
- }
-
- public void setJmsTemplate(JmsTemplate jmsTemplate) {
- this.jmsTemplate = jmsTemplate;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import java.util.List;
-
-import javax.jms.Destination;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.UnsupportedException;
-import org.argeo.slc.execution.ExecutionProcess;
-import org.argeo.slc.execution.ExecutionStep;
-import org.argeo.slc.msg.process.SlcExecutionStatusRequest;
-import org.argeo.slc.msg.process.SlcExecutionStepsRequest;
-import org.argeo.slc.process.SlcExecution;
-import org.argeo.slc.process.SlcExecutionNotifier;
-import org.argeo.slc.process.SlcExecutionStep;
-import org.springframework.jms.JmsException;
-import org.springframework.jms.core.JmsTemplate;
-
-@SuppressWarnings("deprecation")
-public class JmsSlcExecutionNotifier implements SlcExecutionNotifier {
- private final static Log log = LogFactory
- .getLog(JmsSlcExecutionNotifier.class);
-
- private JmsTemplate jmsTemplate;
-
- private Destination executionEventDestination;
-
- // private Destination updateStatusDestination;
-
- public void updateStatus(ExecutionProcess slcExecution, String oldStatus,
- String newStatus) {
- SlcExecutionStatusRequest req = new SlcExecutionStatusRequest(
- slcExecution.getUuid(), newStatus);
- convertAndSend(req);
- }
-
- public void addSteps(ExecutionProcess slcExecution,
- List<ExecutionStep> additionalSteps) {
- SlcExecutionStepsRequest req = new SlcExecutionStepsRequest(
- slcExecution.getUuid(), additionalSteps);
- convertAndSend(req);
- }
-
- public void newExecution(SlcExecution slcExecution) {
- throw new UnsupportedException();
- }
-
- public void updateExecution(SlcExecution slcExecution) {
- throw new UnsupportedException();
- }
-
- public void setJmsTemplate(JmsTemplate jmsTemplate) {
- this.jmsTemplate = jmsTemplate;
- }
-
- public void setExecutionEventDestination(
- Destination executionEventDestination) {
- this.executionEventDestination = executionEventDestination;
- }
-
- protected void convertAndSend(Object req) {
- try {
- jmsTemplate.convertAndSend(executionEventDestination, req);
- } catch (JmsException e) {
- log.warn("Send request " + req.getClass() + " to server: "
- + e.getMessage());
- if (log.isTraceEnabled())
- log.debug("Original error.", e);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import javax.jms.Destination;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.argeo.slc.core.attachment.Attachment;
-import org.argeo.slc.core.attachment.SimpleAttachment;
-import org.argeo.slc.core.test.tree.TreeTestResult;
-import org.argeo.slc.core.test.tree.TreeTestResultListener;
-import org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest;
-import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;
-import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;
-import org.argeo.slc.msg.test.tree.ResultPartRequest;
-import org.argeo.slc.test.TestResultPart;
-import org.springframework.jms.JmsException;
-import org.springframework.jms.core.JmsTemplate;
-
-/** JMS based tree test result listener implementation. */
-public class JmsTreeTestResultListener implements TreeTestResultListener {
- private final Log log = LogFactory.getLog(getClass());
-
- private Boolean onlyOnClose = false;
- private JmsTemplate jmsTemplate;
-
- private Destination executionEventDestination;
-
- public void resultPartAdded(TreeTestResult testResult,
- TestResultPart testResultPart) {
- if (onlyOnClose)
- return;
-
- try {
- if (testResult.getResultParts().size() == 1
- && testResult.getResultParts().values().iterator().next()
- .getParts().size() == 1) {
- CreateTreeTestResultRequest req = new CreateTreeTestResultRequest(
- testResult);
-
- if (log.isTraceEnabled())
- log.trace("Send create result request for result "
- + testResult.getUuid());
-
- jmsTemplate.convertAndSend(executionEventDestination, req);
- } else {
- ResultPartRequest req = new ResultPartRequest(testResult);
-
- if (log.isTraceEnabled())
- log.trace("Send result parts for result "
- + testResult.getUuid());
-
- jmsTemplate.convertAndSend(executionEventDestination, req);
- }
- } catch (JmsException e) {
- log.warn("Could not notify result part to server: "
- + e.getMessage());
- if (log.isTraceEnabled())
- log.debug("Original error.", e);
- } catch (Exception e) {
- throw new SlcException("Could not notify to JMS", e);
- }
- }
-
- public void close(TreeTestResult testResult) {
- try {
- if (onlyOnClose) {
- CreateTreeTestResultRequest req = new CreateTreeTestResultRequest(
- testResult);
-
- if (log.isTraceEnabled())
- log.trace("Send onClose create result request for result "
- + testResult.getUuid());
-
- jmsTemplate.convertAndSend(executionEventDestination, req);
- } else {
- CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(
- testResult);
-
- if (log.isTraceEnabled())
- log.trace("Send close result request for result "
- + testResult.getUuid());
-
- jmsTemplate.convertAndSend(executionEventDestination, req);
-
- }
- } catch (JmsException e) {
- log.warn("Could not notify result close to server: "
- + e.getMessage());
- if (log.isTraceEnabled())
- log.debug("Original error.", e);
- } catch (Exception e) {
- throw new SlcException("Could not notify to JMS", e);
- }
- }
-
- public void addAttachment(TreeTestResult testResult, Attachment attachment) {
- if (onlyOnClose)
- return;
-
- try {
- AddTreeTestResultAttachmentRequest req = new AddTreeTestResultAttachmentRequest();
- req.setResultUuid(testResult.getUuid());
- req.setAttachment((SimpleAttachment) attachment);
- jmsTemplate.convertAndSend(executionEventDestination, req);
-
- } catch (JmsException e) {
- log
- .warn("Could not notify attachment to server: "
- + e.getMessage());
- if (log.isTraceEnabled())
- log.debug("Original error.", e);
- } catch (Exception e) {
- throw new SlcException("Could not notify to JMS", e);
- }
-
- }
-
- /** Publishes the test result only when it gets closed. */
- public void setOnlyOnClose(Boolean onlyOnClose) {
- this.onlyOnClose = onlyOnClose;
- }
-
- public void setJmsTemplate(JmsTemplate jmsTemplate) {
- this.jmsTemplate = jmsTemplate;
- }
-
- public void setExecutionEventDestination(
- Destination executionEventDestination) {
- this.executionEventDestination = executionEventDestination;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.SlcException;
-import org.springframework.jms.support.converter.MessageConversionException;
-import org.springframework.jms.support.converter.MessageConverter;
-import org.springframework.oxm.Marshaller;
-import org.springframework.oxm.Unmarshaller;
-import org.springframework.xml.transform.StringResult;
-import org.springframework.xml.transform.StringSource;
-
-public class MarshallerMessageConverter implements MessageConverter {
- private final static Log log = LogFactory
- .getLog(MarshallerMessageConverter.class);
-
- private Marshaller marshaller;
- private Unmarshaller unmarshaller;
-
- /** Use unmarshalled ObjectMessages instead of TextMessages */
- private Boolean disableMarshalling = false;
-
- /** @return the converted message or null if the message itself is null */
- @SuppressWarnings("unchecked")
- public Object fromMessage(Message message) throws JMSException,
- MessageConversionException {
- long begin = System.currentTimeMillis();
- if (message == null)
- return null;
- if (log.isTraceEnabled()) {
- Enumeration<String> names = message.getPropertyNames();
- while (names.hasMoreElements()) {
- String name = names.nextElement();
- log.trace("JMS Property: " + name + "="
- + message.getObjectProperty(name));
- }
- }
-
- Object res;
- if (message instanceof TextMessage) {
- String text = ((TextMessage) message).getText();
- if (text == null)
- throw new SlcException(
- "Cannot unmarshall message without body: " + message);
- try {
- res = unmarshaller.unmarshal(new StringSource(text));
- } catch (Exception e) {
- throw new SlcException("Could not unmarshall " + text, e);
- }
- } else if (message instanceof ObjectMessage) {
- res = ((ObjectMessage) message).getObject();
- if (res == null)
- throw new SlcException("Message without body: " + message);
- } else {
- throw new SlcException("This type of messages is not supported: "
- + message);
- }
- if (log.isTraceEnabled())
- log.trace("'From' message processed in " + (System.currentTimeMillis() - begin)
- + " ms");
- return res;
- }
-
- public Message toMessage(Object object, Session session)
- throws JMSException, MessageConversionException {
- long begin = System.currentTimeMillis();
- Message msg;
- if (disableMarshalling) {
- msg = session.createObjectMessage();
- ((ObjectMessage) msg).setObject((Serializable) object);
- } else {
- StringResult result = new StringResult();
- try {
- marshaller.marshal(object, result);
- } catch (Exception e) {
- throw new SlcException("Could not marshall " + object, e);
- }
- msg = session.createTextMessage();
- ((TextMessage) msg).setText(result.toString());
- }
- if (log.isTraceEnabled())
- log.trace("'To' message processed in " + (System.currentTimeMillis() - begin)
- + " ms");
- return msg;
- }
-
- public void setMarshaller(Marshaller marshaller) {
- this.marshaller = marshaller;
- }
-
- public void setUnmarshaller(Unmarshaller unmarshaller) {
- this.unmarshaller = unmarshaller;
- }
-
- public void setDisableMarshalling(Boolean disableMarshalling) {
- this.disableMarshalling = disableMarshalling;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.jms;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-
-import org.argeo.slc.SlcException;
-import org.argeo.slc.msg.ExecutionAnswer;
-import org.springframework.jms.listener.adapter.MessageListenerAdapter;
-
-public class ServiceMessageListenerAdapter extends MessageListenerAdapter {
- public final static String DEFAULT_METHOD_NAME_PARAMETER = "action";
- public final static String BODY_ARGUMENT = "BODY";
-
- private Map<String, List<String>> methodArguments = new HashMap<String, List<String>>();
-
- private static String methodNameParameter = DEFAULT_METHOD_NAME_PARAMETER;
-
- @Override
- protected Object extractMessage(Message message) throws JMSException {
- return new ExtractedMessage(message);
- }
-
- @Override
- protected String getListenerMethodName(Message originalMessage,
- Object extractedMessage) throws JMSException {
- return ((ExtractedMessage) extractedMessage).methodName;
- }
-
- @Override
- protected Object[] buildListenerArguments(Object extractedMessage) {
- return ((ExtractedMessage) extractedMessage).arguments;
- }
-
- @Override
- public void onMessage(Message message, Session session) throws JMSException {
- try {// hacked and simplified from parent class
- // Regular case: find a handler method reflectively.
- Object convertedMessage = extractMessage(message);
- String methodName = getListenerMethodName(message, convertedMessage);
-
- // Invoke the handler method with appropriate arguments.
- Object[] listenerArguments = buildListenerArguments(convertedMessage);
- Object result = invokeListenerMethod(methodName, listenerArguments);
- if (result != null) {
- handleResult(result, message, session);
- } else {
- ExecutionAnswer answer = ExecutionAnswer.ok("Execution of "
- + methodName + " on " + getDelegate() + " succeeeded.");
- Message okMessage = getMessageConverter().toMessage(answer,
- session);
- sendResponse(session, getResponseDestination(message,
- okMessage, session), okMessage);
- }
- } catch (Exception e) {
- if (session == null)
- return;
-
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- ExecutionAnswer answer = ExecutionAnswer.error(writer.toString());
- Message errorMessage = getMessageConverter().toMessage(answer,
- session);
- sendResponse(session, getResponseDestination(message, errorMessage,
- session), errorMessage);
- }
- }
-
- protected class ExtractedMessage {
- private final String methodName;
- private final Object[] arguments;
-// private final Message originalMessage;
-
- public ExtractedMessage(Message originalMessage) throws JMSException {
-// this.originalMessage = originalMessage;
-
- if (!originalMessage.propertyExists(methodNameParameter))
- throw new SlcException("No property " + methodNameParameter
- + " in incoming message,"
- + " cannot determine service method");
-
- methodName = originalMessage.getStringProperty(methodNameParameter);
-
- if (!methodArguments.containsKey(methodName)) {// no arg specified
- arguments = new Object[0];
- } else {
- List<String> parameterNames = methodArguments.get(methodName);
- List<Object> arguments = new ArrayList<Object>();
- int count = 0;
- for (String name : parameterNames) {
- if (name.equals(BODY_ARGUMENT)) {
- Object body = getMessageConverter().fromMessage(
- originalMessage);
- arguments.add(body);
- } else {
- if (!originalMessage.propertyExists(name))
- throw new SlcException("No property " + name
- + " in incoming message,"
- + " cannot determine argument #" + count);
- arguments.add(originalMessage.getObjectProperty(name));
- }
- count++;
- }
- this.arguments = arguments.toArray();
- }
- }
- }
-
- public void setMethodArguments(Map<String, List<String>> methodArguments) {
- this.methodArguments = methodArguments;
- }
-
- public static void setMethodNameParameter(String methodNameParameter) {
- ServiceMessageListenerAdapter.methodNameParameter = methodNameParameter;
- }
-
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="false">
-
- <!-- Events -->
- <bean id="slcJms.destination.events" p:physicalName="events"
- parent="slcJms.amTopic" />
-
- <!-- Attachments -->
- <bean id="slcJms.destination.attachment.add" p:physicalName="attachment.add"
- parent="slcJms.amQueue" />
-
- <!-- Agent service -->
- <bean id="slcJms.destination.agent.register" p:physicalName="agent.register"
- parent="slcJms.amTopic" />
- <bean id="slcJms.destination.agent.unregister" p:physicalName="agent.unregister"
- parent="slcJms.amTopic" />
- <bean id="slcJms.destination.agent.request" p:physicalName="agent.request"
- parent="slcJms.amQueue" />
- <bean id="slcJms.destination.agent.response" p:physicalName="agent.response"
- parent="slcJms.amQueue" />
- <bean id="slcJms.destination.agent.pingAll" p:physicalName="agent.pingAll"
- parent="slcJms.amTopic" />
-
- <bean id="slcJms.destination.execution.event" p:physicalName="execution.event"
- parent="slcJms.amQueue" />
-
- <!-- Templates -->
- <bean id="slcJms.amQueue" class="org.apache.activemq.command.ActiveMQQueue"
- abstract="true" />
- <bean id="slcJms.amTopic" class="org.apache.activemq.command.ActiveMQTopic"
- abstract="true" />
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.support.castor</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-#Fri Aug 29 11:10:18 CEST 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+++ /dev/null
-additional.bundles = org.argeo.slc.unit,\
- junit,\
- org.apache.xml.serializer,\
- org.apache.xerces
-source.. = src/main/java/,\
- src/main/resources/,\
- src/test/java/,\
- src/test/resources/
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>runtime</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <artifactId>org.argeo.slc.support.castor</artifactId>
- <name>SLC Support Castor</name>
- <description>Implementations of SLC Specs using Castor</description>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Export-Package>
- org.argeo.slc.*
- </Export-Package>
- <Import-Package>
- org.argeo.slc.*;resolution:=optional,
- org.argeo.slc.deploy;resolution:=optional,
- org.argeo.slc.build;resolution:=optional,
- org.argeo.slc.execution;resolution:=optional,
- org.argeo.slc.core.attachment;resolution:=optional,
- org.argeo.slc.core.structure;resolution:=optional,
- org.argeo.slc.core.structure.tree;resolution:=optional,
- org.argeo.slc.core.test;resolution:=optional,
- org.argeo.slc.core.test.tree;resolution:=optional,
- org.argeo.slc.runtime;resolution:=optional,
- org.argeo.slc.core.execution;resolution:=optional,
- org.argeo.slc.msg;resolution:=optional,
- org.argeo.slc.msg.build;resolution:=optional,
- org.argeo.slc.msg.process;resolution:=optional,
- org.argeo.slc.msg.event;resolution:=optional,
- org.argeo.slc.msg.test.tree;resolution:=optional,
- org.argeo.slc.detached;resolution:=optional,
- org.apache.xml.serialize;resolution:=optional,
- org.apache.xerces.jaxp;resolution:=optional,
- org.w3c.dom.*;version="0.0.0";resolution:=optional,
- org.xml.sax.*;version="0.0.0";resolution:=optional,
- javax.xml.transform.*;version="0.0.0";resolution:=optional,
- javax.xml.parsers.*;version="0.0.0";resolution:=optional,
- org.springframework.xml.validation;resolution:=optional,
- org.apache.commons.io,
- org.springframework.oxm,
- org.springframework.core,
- org.springframework.xml.transform,
- org.springframework.core.io,
- *
- </Import-Package>
- <Fragment-Host>org.castor</Fragment-Host>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
-
- <dependency>
- <groupId>org.argeo.slc</groupId>
- <artifactId>org.argeo.slc.core</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.oxm</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.castor</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.apache.xerces</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.apache.xalan</artifactId>
- </dependency>
-
- <!-- Unit Tests -->
- <dependency>
- <groupId>org.argeo.slc</groupId>
- <artifactId>org.argeo.slc.unit</artifactId>
- <scope>test</scope>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.castor.execution;
-
-import org.argeo.slc.core.execution.PrimitiveAccessor;
-import org.argeo.slc.core.execution.PrimitiveUtils;
-import org.exolab.castor.mapping.AbstractFieldHandler;
-
-public class PrimitiveFieldHandler extends AbstractFieldHandler {
-
- @Override
- public Object getValue(Object object) throws IllegalStateException {
- if (object == null)
- return null;
-
- Object value = ((PrimitiveAccessor) object).getValue();
- return value != null ? value.toString() : null;
- }
-
- @Override
- public Object newInstance(Object parent, Object[] args)
- throws IllegalStateException {
- return null;
- }
-
- @Override
- public Object newInstance(Object parent) throws IllegalStateException {
- return null;
- }
-
- @Override
- public void resetValue(Object object) throws IllegalStateException,
- IllegalArgumentException {
- }
-
- @Override
- public void setValue(Object object, Object value)
- throws IllegalStateException, IllegalArgumentException {
- PrimitiveAccessor primitiveAccessor = (PrimitiveAccessor) object;
- String type = primitiveAccessor.getType();
- String str = value.toString();
- primitiveAccessor.setValue(PrimitiveUtils.convert(type, str));
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.castor.structure.tree;
-
-import org.exolab.castor.mapping.AbstractFieldHandler;
-import org.exolab.castor.mapping.MapItem;
-
-import org.argeo.slc.core.structure.tree.TreeSPath;
-
-public class TreeSPathFieldHandler extends AbstractFieldHandler {
-
- @Override
- public Object getValue(Object object) throws IllegalStateException {
- MapItem part = (MapItem) object;
- return ((TreeSPath) part.getKey()).getAsUniqueString();
- }
-
- @Override
- public Object newInstance(Object parent) throws IllegalStateException {
- return null;
- }
-
- @Override
- public Object newInstance(Object parent, Object[] args)
- throws IllegalStateException {
- return null;
- }
-
- @Override
- public void resetValue(Object object) throws IllegalStateException,
- IllegalArgumentException {
- MapItem part = (MapItem) object;
- part.setKey(null);
- }
-
- @Override
- public void setValue(Object object, Object value)
- throws IllegalStateException, IllegalArgumentException {
- MapItem part = (MapItem) object;
- part.setKey(new TreeSPath(value.toString()));
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.castor.test.tree;
-
-import org.argeo.slc.core.test.SimpleResultPart;
-import org.argeo.slc.core.test.SlcTestUtils;
-import org.argeo.slc.test.TestStatus;
-import org.exolab.castor.mapping.AbstractFieldHandler;
-
-public class StatusFieldHandler extends AbstractFieldHandler {
-
- @Override
- public Object getValue(Object object) throws IllegalStateException {
- SimpleResultPart part = (SimpleResultPart) object;
- return SlcTestUtils.statusToString(part.getStatus());
- }
-
- @Override
- public Object newInstance(Object parent) throws IllegalStateException {
- return null;
- }
-
- @Override
- public Object newInstance(Object parent, Object[] args)
- throws IllegalStateException {
- return null;
- }
-
- @Override
- public void resetValue(Object object) throws IllegalStateException,
- IllegalArgumentException {
- SimpleResultPart part = (SimpleResultPart) object;
- // ERROR by default since it should be explicitely set
- part.setStatus(TestStatus.ERROR);
- }
-
- @Override
- public void setValue(Object object, Object value)
- throws IllegalStateException, IllegalArgumentException {
- SimpleResultPart part = (SimpleResultPart) object;
- Integer status = SlcTestUtils.stringToStatus((String) value);
- part.setStatus(status);
- }
-
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.xml.process;\r
-\r
-import java.io.File;\r
-import java.io.FileWriter;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import javax.xml.transform.stream.StreamResult;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.execution.ExecutionProcess;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionNotifier;\r
-import org.argeo.slc.execution.ExecutionStep;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-import org.springframework.oxm.Marshaller;\r
-\r
-/** @deprecated Probably not even working anymore */\r
-public class FileSlcExecutionNotifier implements SlcExecutionNotifier {\r
- // private final static SimpleDateFormat sdf = new SimpleDateFormat(\r
- // "yyyyMMdd-HHmmss");\r
- //\r
- // private String basePath;\r
- private Marshaller marshaller;\r
-\r
- private Map<String, String> uuidToDir = new HashMap<String, String>();\r
-\r
- public void addSteps(ExecutionProcess slcExecution,\r
- List<ExecutionStep> additionalSteps) {\r
- writeSlcExecution(slcExecution);\r
- }\r
-\r
- public void updateStatus(ExecutionProcess slcExecution, String oldStatus,\r
- String newStatus) {\r
- writeSlcExecution(slcExecution);\r
- }\r
-\r
- protected void writeSlcExecution(ExecutionProcess process) {\r
- if (!(process instanceof SlcExecution))\r
- throw new SlcException("Unsupported process type "\r
- + process.getClass());\r
- SlcExecution slcExecution = (SlcExecution) process;\r
- FileWriter out = null;\r
- try {\r
- out = new FileWriter(getFilePath(slcExecution));\r
- marshaller.marshal(slcExecution, new StreamResult(out));\r
- } catch (Exception e) {\r
- throw new SlcException("Cannot marshall SlcExecution to "\r
- + getFilePath(slcExecution), e);\r
- } finally {\r
- IOUtils.closeQuietly(out);\r
- }\r
- }\r
-\r
- protected String getFileName(SlcExecution slcExecution) {\r
- return "SlcExecution-" + slcExecution.getUuid() + ".xml";\r
- }\r
-\r
- protected String getFilePath(SlcExecution slcExecution) {\r
- String dirPath = uuidToDir.get(slcExecution.getUuid());\r
- return dirPath + File.separator + "SlcExecution-"\r
- + slcExecution.getUuid() + ".xml";\r
- }\r
-\r
- public void setBasePath(String basePath) {\r
- // this.basePath = basePath;\r
- }\r
-\r
- public void setMarshaller(Marshaller marshaller) {\r
- this.marshaller = marshaller;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.xml.test.tree;\r
-\r
-import java.io.File;\r
-import java.io.FileOutputStream;\r
-import java.io.InputStream;\r
-import java.io.OutputStream;\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-import javax.xml.parsers.DocumentBuilder;\r
-import javax.xml.parsers.DocumentBuilderFactory;\r
-import javax.xml.transform.Templates;\r
-import javax.xml.transform.Transformer;\r
-import javax.xml.transform.TransformerFactory;\r
-import javax.xml.transform.dom.DOMResult;\r
-import javax.xml.transform.dom.DOMSource;\r
-import javax.xml.transform.stream.StreamResult;\r
-import javax.xml.transform.stream.StreamSource;\r
-\r
-import org.springframework.core.io.Resource;\r
-import org.springframework.oxm.Marshaller;\r
-import org.springframework.xml.transform.StringResult;\r
-import org.w3c.dom.Document;\r
-\r
-import org.apache.commons.io.IOUtils;\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.test.TestResultListener;\r
-import org.argeo.slc.test.TestResultPart;\r
-\r
-/** Build a report based on a tree test result using an XSLT stylesheet. */\r
-public class XsltReportGenerator implements TestResultListener<TreeTestResult> {\r
- private final static Log log = LogFactory.getLog(XsltReportGenerator.class);\r
-\r
- private DocumentBuilder documentBuilder = null;\r
-\r
- private Resource xsltStyleSheet;\r
-\r
- private Templates templates;\r
-\r
- private Marshaller marshaller;\r
-\r
- private String outputDir;\r
- private String outputFileExtension = "html";\r
-\r
- private Boolean logXml = false;\r
-\r
- private Map<String, String> xsltParameters = new HashMap<String, String>();\r
-\r
- public void init() {\r
- if (templates != null)\r
- return;\r
-\r
- if (xsltStyleSheet == null)\r
- throw new SlcException("XSLT style sheet not specified.");\r
-\r
- InputStream in = null;\r
- try {\r
- TransformerFactory transformerFactory = TransformerFactory\r
- .newInstance();\r
- in = xsltStyleSheet.getInputStream();\r
- StreamSource xsltSource = new StreamSource(in);\r
- templates = transformerFactory.newTemplates(xsltSource);\r
- } catch (Exception e) {\r
- throw new SlcException("Could not initialize templates", e);\r
- } finally {\r
- IOUtils.closeQuietly(in);\r
- }\r
- }\r
-\r
- public void resultPartAdded(TreeTestResult testResult,\r
- TestResultPart testResultPart) {\r
-\r
- }\r
-\r
- public void close(TreeTestResult testResult) {\r
- if (templates == null)\r
- throw new SlcException("XSLT template not initialized");\r
-\r
- File file = getFile(testResult);\r
- OutputStream out = null;\r
-\r
- try {\r
- Transformer transformer = templates.newTransformer();\r
- for (String paramKey : xsltParameters.keySet()) {\r
- transformer\r
- .setParameter(paramKey, xsltParameters.get(paramKey));\r
- if (log.isTraceEnabled())\r
- log.trace("Set XSLT parameter " + paramKey + " to "\r
- + xsltParameters.get(paramKey));\r
- }\r
-\r
- if (documentBuilder == null)\r
- documentBuilder = DocumentBuilderFactory.newInstance()\r
- .newDocumentBuilder();\r
-\r
- Document document = documentBuilder.newDocument();\r
- DOMResult marshallResult = new DOMResult(document);\r
- marshaller.marshal(testResult, marshallResult);\r
-\r
- if (logXml) {\r
- Transformer identityTransformer = TransformerFactory\r
- .newInstance().newTransformer();\r
- StringResult xmlResult = new StringResult();\r
- identityTransformer.transform(new DOMSource(marshallResult\r
- .getNode()), xmlResult);\r
- log.info("Marshalled XML:\n" + xmlResult);\r
- }\r
-\r
- DOMSource transfoSource = new DOMSource(marshallResult.getNode());\r
-\r
- if (outputDir != null) {\r
- File dir = new File(outputDir);\r
- dir.mkdirs();\r
- out = new FileOutputStream(file);\r
- StreamResult outputResult = new StreamResult(out);\r
- transformer.transform(transfoSource, outputResult);\r
- } else {\r
- // print on console if no output dir\r
- StringResult result = new StringResult();\r
- transformer.transform(transfoSource, result);\r
- log.info("Generated report:\n" + result);\r
- }\r
- } catch (Exception e) {\r
- throw new SlcException(\r
- "Could not transform test result to " + file, e);\r
- } finally {\r
- IOUtils.closeQuietly(out);\r
- }\r
- }\r
-\r
- public Resource getXsltStyleSheet() {\r
- return xsltStyleSheet;\r
- }\r
-\r
- public void setXsltStyleSheet(Resource xsltStyleSheet) {\r
- this.xsltStyleSheet = xsltStyleSheet;\r
- }\r
-\r
- public void setTemplates(Templates templates) {\r
- this.templates = templates;\r
- }\r
-\r
- public void setMarshaller(Marshaller marshaller) {\r
- this.marshaller = marshaller;\r
- }\r
-\r
- public void setOutputDir(String outputDir) {\r
- this.outputDir = outputDir;\r
- }\r
-\r
- public void setOutputFileExtension(String outputFileExtension) {\r
- this.outputFileExtension = outputFileExtension;\r
- }\r
-\r
- protected File getFile(TreeTestResult result) {\r
- Long time = System.currentTimeMillis();\r
- return new File(outputDir + File.separator + time + "-"\r
- + result.getUuid() + "." + outputFileExtension);\r
- }\r
-\r
- public void setLogXml(Boolean logXml) {\r
- this.logXml = logXml;\r
- }\r
-\r
- public void setXsltParameters(Map<String, String> xsltParameters) {\r
- this.xsltParameters = xsltParameters;\r
- }\r
-\r
-}\r
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
-\r
-<mapping>\r
- <description>Attachment objects XML mapping</description>\r
-\r
- <class name="org.argeo.slc.core.attachment.SimpleAttachment">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="uuid" type="string" />\r
- <field name="name" type="string" />\r
- <field name="contentType" type="string" />\r
- </class>\r
-\r
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<mapping>
- <description>Build objects XML mapping</description>
-
- <class name="org.argeo.slc.BasicNameVersion">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="name">
- <bind-xml name="name" node="attribute" />
- </field>
- <field name="version">
- <bind-xml name="version" node="attribute" />
- </field>
- </class>
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
-\r
-<mapping>\r
- <description>Execution objects XML mapping</description>\r
-\r
- <class name="org.argeo.slc.execution.ExecutionModuleDescriptor">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="name" />\r
- <field name="version" />\r
- <field name="label" />\r
- <field name="description" />\r
- <field name="executionFlows" collection="arraylist"\r
- type="org.argeo.slc.execution.ExecutionFlowDescriptor">\r
- <bind-xml auto-naming="deriveByClass" location="execution-flows" />\r
- </field>\r
- <field name="executionSpecs" collection="arraylist"\r
- type="org.argeo.slc.execution.ExecutionSpec">\r
- <bind-xml auto-naming="deriveByClass" location="execution-specs" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.execution.ExecutionFlowDescriptor">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="name" identity="true">\r
- <bind-xml name="name" node="attribute" />\r
- </field>\r
- <field name="path">\r
- <bind-xml name="path" node="attribute" />\r
- </field>\r
- <field name="executionSpec">\r
- <bind-xml name="executionSpec" node="attribute" reference="true" />\r
- </field>\r
- <field name="values" collection="map">\r
- <bind-xml name="value" location="values">\r
- <class name="org.exolab.castor.mapping.MapItem">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="key" type="string">\r
- <bind-xml name="key" node="attribute" />\r
- </field>\r
- <field name="value"\r
- type="org.argeo.slc.core.execution.AbstractExecutionValue">\r
- <bind-xml auto-naming="deriveByClass" />\r
- </field>\r
- </class>\r
- </bind-xml>\r
- </field>\r
- </class>\r
-\r
- <!-- Specs -->\r
- <class name="org.argeo.slc.core.execution.DefaultExecutionSpec">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="name" identity="true">\r
- <bind-xml name="name" node="attribute" />\r
- </field>\r
- <field name="attributes" collection="map">\r
- <bind-xml name="value" location="values">\r
- <class name="org.exolab.castor.mapping.MapItem">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="key" type="string">\r
- <bind-xml name="key" node="attribute" />\r
- </field>\r
- <field name="value"\r
- type="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
- <bind-xml auto-naming="deriveByClass" />\r
- </field>\r
- </class>\r
- </bind-xml>\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="isParameter">\r
- <bind-xml name="isParameter" node="attribute" />\r
- </field>\r
- <field name="isFrozen">\r
- <bind-xml name="isFrozen" node="attribute" />\r
- </field>\r
- <field name="isHidden">\r
- <bind-xml name="isHidden" node="attribute" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.PrimitiveSpecAttribute"\r
- extends="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="type">\r
- <bind-xml name="type" node="attribute" />\r
- </field>\r
- <field name="value" type="string"\r
- handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler">\r
- <bind-xml node="text" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.RefSpecAttribute"\r
- extends="org.argeo.slc.core.execution.AbstractSpecAttribute">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="targetClassName">\r
- <bind-xml name="targetClassName" node="attribute" />\r
- </field>\r
- <field name="choices" collection="arraylist"\r
- type="org.argeo.slc.core.execution.RefValueChoice">\r
- <bind-xml auto-naming="deriveByClass" location="choices" />\r
- </field>\r
- </class>\r
-\r
- <!-- Values -->\r
- <class name="org.argeo.slc.core.execution.AbstractExecutionValue">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.PrimitiveValue"\r
- extends="org.argeo.slc.core.execution.AbstractExecutionValue">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="type">\r
- <bind-xml name="type" node="attribute" />\r
- </field>\r
- <field name="value" type="string"\r
- handler="org.argeo.slc.castor.execution.PrimitiveFieldHandler">\r
- <bind-xml node="text" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.RefValue" extends="org.argeo.slc.core.execution.AbstractExecutionValue">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="ref">\r
- <bind-xml name="ref" node="attribute" />\r
- </field>\r
- <field name="type">\r
- <bind-xml name="type" node="attribute" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.execution.RefValueChoice">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="name">\r
- <bind-xml name="name" node="attribute" />\r
- </field>\r
- <field name="description" />\r
- </class>\r
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<!-- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org> Licensed under
- the Apache License, Version 2.0 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of the License
- at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
- law or agreed to in writing, software distributed under the License is distributed
- on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- express or implied. See the License for the specific language governing permissions
- and limitations under the License. -->
-
-
-<mapping>
- <description>Message objects XML mapping</description>
-
- <!-- TODO: use XML entities to factorize patterns -->
-
- <!-- BASIC -->
- <class name="org.argeo.slc.msg.ExecutionAnswer">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="status" />
- <field name="message" />
- </class>
-
- <class name="org.argeo.slc.msg.ReferenceList">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="references" collection="arraylist" type="string">
- <bind-xml name="ref" />
- </field>
- </class>
-
- <class name="org.argeo.slc.msg.ObjectList">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="objects" collection="arraylist" type="java.io.Serializable">
- <bind-xml auto-naming="deriveByClass" />
- </field>
- </class>
-
- <!-- BUILD -->
- <class name="org.argeo.slc.msg.build.ModularDistributionDescriptor"
- extends="org.argeo.slc.BasicNameVersion">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="modulesDescriptors" collection="map">
- <bind-xml name="modulesDescriptor" location="modulesDescriptors">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="string">
- <bind-xml name="type" node="attribute" />
- </field>
- <field name="value" type="string">
- <bind-xml name="url" node="attribute" />
- </field>
- </class>
- </bind-xml>
- </field>
- </class>
-
- <!-- TESTS -->
- <class name="org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="treeTestResult" type="org.argeo.slc.core.test.tree.TreeTestResult" />
- <field name="testRunDescriptor" />
- </class>
-
- <class name="org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="resultUuid" />
- <field name="closeDate" />
- </class>
-
- <class name="org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="resultUuid" />
- <field name="attachment" type="org.argeo.slc.core.attachment.SimpleAttachment">
- <bind-xml auto-naming="deriveByClass" />
- </field>
- </class>
-
- <class name="org.argeo.slc.msg.test.tree.ResultPartRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="resultUuid" />
- <field name="resultPart" type="org.argeo.slc.core.test.SimpleResultPart">
- <bind-xml auto-naming="deriveByClass" />
- </field>
-
- <field name="relatedElements" collection="map">
- <bind-xml name="element" location="related-elements">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="org.argeo.slc.core.structure.tree.TreeSPath"
- handler="org.argeo.slc.castor.structure.tree.TreeSPathFieldHandler">
- <bind-xml name="path" node="attribute" />
- </field>
- <field name="value" type="org.argeo.slc.core.structure.SimpleSElement">
- <bind-xml auto-naming="deriveByClass" />
- </field>
- </class>
- </bind-xml>
- </field>
- <field name="path">
- <bind-xml auto-naming="deriveByClass" />
- </field>
- <field name="testRunDescriptor" />
- <field name="attributes" collection="hashtable">
- <bind-xml name="attribute" location="attributes">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="string">
- <bind-xml name="name" node="attribute" />
- </field>
- <field name="value" type="string">
- <bind-xml node="text" />
- </field>
- </class>
- </bind-xml>
- </field>
- </class>
-
- <class name="org.argeo.slc.core.test.tree.ResultAttributes">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="uuid" />
- <field name="closeDate" />
- <field name="attributes" collection="hashtable">
- <bind-xml name="attribute" location="attributes">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="string">
- <bind-xml name="name" node="attribute" />
- </field>
- <field name="value" type="string">
- <bind-xml node="text" />
- </field>
- </class>
- </bind-xml>
- </field>
- <field name="attachments" collection="arraylist"
- type="org.argeo.slc.core.attachment.SimpleAttachment">
- <bind-xml auto-naming="deriveByClass" location="attachments" />
- </field>
- </class>
-
-
- <!-- PROCESS -->
- <class name="org.argeo.slc.msg.process.SlcExecutionStepsRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="slcExecutionUuid" />
- <field name="steps" collection="arraylist"
- type="org.argeo.slc.process.SlcExecutionStep">
- <bind-xml auto-naming="deriveByClass" location="steps" />
- </field>
- </class>
-
- <class name="org.argeo.slc.msg.process.SlcExecutionStatusRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="slcExecutionUuid" />
- <field name="newStatus" />
- </class>
-
- <class name="org.argeo.slc.msg.process.SlcExecutionRequest">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="slcExecution" type="org.argeo.slc.process.SlcExecution" />
- </class>
-
- <!-- EVENTS -->
-
- <class name="org.argeo.slc.msg.event.SlcEvent">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="headers" collection="map">
- <bind-xml name="header" location="headers">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="string">
- <bind-xml name="name" node="attribute" />
- </field>
- <field name="value" type="string">
- <bind-xml node="text" />
- </field>
- </class>
- </bind-xml>
- </field>
- </class>
-
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
-\r
-<mapping>\r
- <description>Process objects XML mapping</description>\r
-\r
- <class name="org.argeo.slc.process.SlcExecution">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="uuid" identity="true">\r
- <bind-xml node="attribute" />\r
- </field>\r
- <field name="status" />\r
- <field name="type" />\r
- <field name="host" />\r
- <field name="user" />\r
- <field name="realizedFlows" collection="arraylist"\r
- type="org.argeo.slc.process.RealizedFlow">\r
- <bind-xml auto-naming="deriveByClass" location="realized-flows" />\r
- </field>\r
- <field name="steps" collection="arraylist"\r
- type="org.argeo.slc.process.SlcExecutionStep">\r
- <bind-xml auto-naming="deriveByClass" location="steps" />\r
- </field>\r
- <field name="attributes" collection="map">\r
- <bind-xml name="attribute" location="attributes">\r
- <class name="org.exolab.castor.mapping.MapItem">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="key" type="string">\r
- <bind-xml name="name" node="attribute" />\r
- </field>\r
- <field name="value" type="string">\r
- <bind-xml node="text" />\r
- </field>\r
- </class>\r
- </bind-xml>\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.process.RealizedFlow">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="moduleName"/>\r
- <field name="moduleVersion" />\r
- <field name="flowDescriptor">\r
- <bind-xml auto-naming="deriveByClass" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.process.SlcExecutionStep">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="uuid" identity="true">\r
- <bind-xml node="attribute" />\r
- </field>\r
- <field name="type" />\r
- <field name="thread" />\r
- <field name="timestamp" />\r
- <field name="logLines" collection="arraylist" type="string">\r
- <bind-xml name="log-line" location="log-lines" />\r
- </field>\r
- </class>\r
-\r
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.org/mapping.dtd">\r
-\r
-<mapping>\r
- <description>Runtime objects XML mapping</description>\r
-\r
- <class name="org.argeo.slc.runtime.SlcAgentDescriptor">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="uuid" identity="true">\r
- <bind-xml node="attribute" />\r
- </field>\r
- <field name="host" />\r
- <field name="moduleDescriptors" collection="arraylist"\r
- type="org.argeo.slc.execution.ExecutionModuleDescriptor">\r
- <bind-xml auto-naming="deriveByClass" />\r
- </field>\r
- </class>\r
-</mapping>
\ No newline at end of file
+++ /dev/null
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-
-<!-- Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org> Licensed under
- the Apache License, Version 2.0 (the "License"); you may not use this file
- except in compliance with the License. You may obtain a copy of the License
- at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
- law or agreed to in writing, software distributed under the License is distributed
- on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
- express or implied. See the License for the specific language governing permissions
- and limitations under the License. -->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="true">
-
- <bean id="slcDefault.castor.marshaller" class="org.springframework.oxm.castor.CastorMarshaller">
- <property name="mappingLocations">
- <list>
- <value>classpath:org/argeo/slc/castor/common.xml</value>
- <value>classpath:org/argeo/slc/castor/msg.xml</value>
- <value>classpath:org/argeo/slc/castor/process.xml</value>
- <value>classpath:org/argeo/slc/castor/runtime.xml</value>
- <value>classpath:org/argeo/slc/castor/structure.xml</value>
- <value>classpath:org/argeo/slc/castor/test.xml</value>
- <value>classpath:org/argeo/slc/castor/execution.xml</value>
- <value>classpath:org/argeo/slc/castor/attachment.xml</value>
- </list>
- </property>
- <property name="whitespacePreserve" value="true" />
- <property name="encoding" value="UTF-8" />
- </bean>
-
- <bean id="slcDefault.castor.xsltReportGenerator" class="org.argeo.slc.xml.test.tree.XsltReportGenerator"
- init-method="init">
- <property name="xsltStyleSheet"
- value="classpath:/org/argeo/slc/core/test/tree/basicReport.xslt" />
- <property name="marshaller" ref="slcDefault.castor.marshaller" />
- <property name="logXml" value="false" />
- <property name="outputDir" value="${user.dir}/results/html" />
- </bean>
-
- <bean name="slcDefault.castor.fileSlcExecutionNotifier" class="org.argeo.slc.xml.process.FileSlcExecutionNotifier">
- <property name="basePath" value="${user.dir}/process" />
- <property name="marshaller" ref="slcDefault.castor.marshaller" />
- </bean>
-
-</beans>
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<mapping>\r
- <description>Structure related objects XML mapping</description>\r
-\r
- <class name="org.argeo.slc.core.structure.tree.TreeSPath"\r
- auto-complete="false">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="asUniqueString" type="string">\r
- <bind-xml node="attribute" />\r
- </field>\r
- </class>\r
-\r
- <class name="org.argeo.slc.core.structure.SimpleSElement"\r
- auto-complete="false">\r
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"\r
- ns-prefix="slc" />\r
- <field name="label" type="string" />\r
- <field name="tags" collection="map">\r
- <bind-xml name="tag" location="tags">\r
- <class name="org.exolab.castor.mapping.MapItem">\r
- <map-to\r
- ns-uri="http://argeo.org/projects/slc/schemas" ns-prefix="slc" />\r
- <field name="key" type="string">\r
- <bind-xml name="name" node="attribute" />\r
- </field>\r
- <field name="value" type="string">\r
- <bind-xml name="tag-value" />\r
- </field>\r
- </class>\r
- </bind-xml>\r
- </field>\r
- </class>\r
-</mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<mapping>
- <description>Test objects XML mapping</description>
-
- <class name="org.argeo.slc.test.TestRunDescriptor" auto-complete="false">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="testRunUuid" />
- <field name="slcExecutionUuid" />
- <field name="slcExecutionStepUuid" />
- <field name="testResultUuid" />
- <field name="deployedSytemId" />
- </class>
-
- <class name="org.argeo.slc.core.test.tree.TreeTestResult"
- auto-complete="false">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="uuid" type="string">
- <bind-xml name="uuid" node="attribute" />
- </field>
- <field name="closeDate" />
- <field name="attributes" collection="map">
- <bind-xml name="attribute" location="attributes">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="string">
- <bind-xml name="name" node="attribute" />
- </field>
- <field name="value" type="string">
- <bind-xml node="text" />
- </field>
- </class>
- </bind-xml>
- </field>
- <field name="resultParts" collection="sortedmap">
- <bind-xml name="result-part" location="result-parts">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="org.argeo.slc.core.structure.tree.TreeSPath"
- handler="org.argeo.slc.castor.structure.tree.TreeSPathFieldHandler">
- <bind-xml name="path" node="attribute" />
- </field>
- <field name="value" type="org.argeo.slc.core.test.tree.PartSubList">
- <bind-xml name="part-sub-list" />
- </field>
- </class>
- </bind-xml>
- </field>
- <field name="elements" collection="sortedmap">
- <bind-xml name="element" location="elements">
- <class name="org.exolab.castor.mapping.MapItem">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="key" type="org.argeo.slc.core.structure.tree.TreeSPath"
- handler="org.argeo.slc.castor.structure.tree.TreeSPathFieldHandler">
- <bind-xml name="path" node="attribute" />
- </field>
- <field name="value" type="org.argeo.slc.core.structure.SimpleSElement">
- <bind-xml auto-naming="deriveByClass" />
- </field>
- </class>
- </bind-xml>
- </field>
- <field name="attachments" collection="arraylist"
- type="org.argeo.slc.core.attachment.SimpleAttachment">
- <bind-xml auto-naming="deriveByClass" location="attachments" />
- </field>
- </class>
-
- <class name="org.argeo.slc.core.test.tree.PartSubList"
- auto-complete="false">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="parts" collection="arraylist"
- type="org.argeo.slc.core.test.SimpleResultPart">
- <bind-xml auto-naming="deriveByClass" location="parts" />
- </field>
- </class>
-
- <class name="org.argeo.slc.core.test.SimpleResultPart"
- auto-complete="false">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="testRunUuid" type="string" />
- <field name="message" type="string" />
- <field name="status" type="string"
- handler="org.argeo.slc.castor.test.tree.StatusFieldHandler" />
- <field name="exceptionMessage" type="string" />
- </class>
-
- <class name="org.argeo.slc.core.test.tree.TreeTestResultCollection"
- auto-complete="false">
- <map-to ns-uri="http://argeo.org/projects/slc/schemas"
- ns-prefix="slc" />
- <field name="id" type="string">
- <bind-xml name="id" node="attribute" />
- </field>
- <field name="results" collection="set"
- type="org.argeo.slc.core.test.tree.TreeTestResult">
- <bind-xml auto-naming="deriveByClass" location="results" />
- </field>
- </class>
-</mapping>
\ No newline at end of file
+++ /dev/null
-Argeo SLC Site
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.castor;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.argeo.slc.unit.AbstractSpringTestCase;
-import org.argeo.slc.unit.UnitXmlUtils;
-import org.springframework.oxm.Marshaller;
-import org.springframework.oxm.Unmarshaller;
-import org.springframework.xml.transform.StringResult;
-import org.springframework.xml.transform.StringSource;
-import org.springframework.xml.validation.XmlValidator;
-
-public abstract class AbstractCastorTestCase extends AbstractSpringTestCase {
- protected Log log = LogFactory.getLog(getClass());
-
- private Marshaller marshaller;
- private Unmarshaller unmarshaller;
-
- @Override
- public void setUp() {
- marshaller = getBean(Marshaller.class);
- unmarshaller = getBean(Unmarshaller.class);
- }
-
- protected StringResult marshal(Object obj) throws Exception {
- return marshal(obj, false);
- }
-
- protected StringResult marshalAndValidate(Object obj) throws Exception {
- return marshal(obj, true);
- }
-
- protected StringResult marshal(Object obj, boolean validate)
- throws Exception {
- StringResult xml = new StringResult();
- marshaller.marshal(obj, xml);
-
- log.info("Marshalled " + obj.getClass() + ": " + xml + "\n");
-
- if (validate)
- UnitXmlUtils.assertXmlValidation(getBean(XmlValidator.class),
- new StringSource(xml.toString()));
- return xml;
- }
-
- @SuppressWarnings("unchecked")
- protected <T> T unmarshal(StringResult xml) throws Exception {
- return (T) unmarshaller.unmarshal(new StringSource(xml.toString()));
- }
-
- @SuppressWarnings("unchecked")
- protected <T> T marshUnmarsh(Object obj, boolean validate) throws Exception {
- StringResult xml = marshal(obj, validate);
- return (T) unmarshal(xml);
- }
-
- @SuppressWarnings("unchecked")
- protected <T> T marshUnmarsh(Object obj) throws Exception {
- return (T) marshUnmarsh(obj, true);
- }
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import org.argeo.slc.msg.ExecutionAnswer;\r
-\r
-public class ExecutionAnswerCastorTest extends AbstractCastorTestCase {\r
- public void testMarshUnmarshOk() throws Exception {\r
- ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.OK,\r
- "No problem!");\r
- ExecutionAnswer answerUnm = marshUnmarsh(answer);\r
- assertExecutionAnswer(answer, answerUnm);\r
- }\r
-\r
- public void testMarshUnmarshError() throws Exception {\r
- ExecutionAnswer answer = new ExecutionAnswer(ExecutionAnswer.ERROR,\r
- "Oooops...");\r
- ExecutionAnswer answerUnm = marshUnmarsh(answer);\r
- assertExecutionAnswer(answer, answerUnm);\r
- }\r
-\r
- public static void assertExecutionAnswer(ExecutionAnswer expected,\r
- ExecutionAnswer reached) {\r
- assertEquals(expected.getStatus(), reached.getStatus());\r
- assertEquals(expected.getMessage(), reached.getMessage());\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.argeo.slc.execution.ExecutionFlowDescriptor;\r
-import org.argeo.slc.execution.ExecutionModuleDescriptor;\r
-import org.argeo.slc.execution.ExecutionSpec;\r
-import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils;\r
-\r
-public class ExecutionModuleDescriptorCastorTest extends AbstractCastorTestCase {\r
- public void testMarshUnmarsh() throws Exception {\r
- ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor();\r
- moduleDescriptor.setName("test.module");\r
- moduleDescriptor.setVersion("1.0.0");\r
- moduleDescriptor.setLabel("Test Module");\r
- moduleDescriptor.setDescription("module descriptor");\r
-\r
- ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils\r
- .createSimpleExecutionFlowDescriptor();\r
-\r
- List<ExecutionFlowDescriptor> flows = new ArrayList<ExecutionFlowDescriptor>();\r
- flows.add(flowDescriptor);\r
- moduleDescriptor.setExecutionFlows(flows);\r
-\r
- List<ExecutionSpec> specs = new ArrayList<ExecutionSpec>();\r
- specs.add(flowDescriptor.getExecutionSpec());\r
- moduleDescriptor.setExecutionSpecs(specs);\r
-\r
- marshUnmarsh(moduleDescriptor, false);\r
- }\r
-\r
- public void testMarshUnmarshMini() throws Exception {\r
- ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor();\r
- moduleDescriptor.setName("test.moodule");\r
- moduleDescriptor.setVersion("1.0.0");\r
- marshUnmarsh(moduleDescriptor, false);\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import org.argeo.slc.msg.ObjectList;\r
-import org.argeo.slc.msg.build.ModularDistributionDescriptor;\r
-\r
-public class ModularDistributionCastorTest extends AbstractCastorTestCase {\r
- public void testModularDistributionDescriptor() throws Exception {\r
- ModularDistributionDescriptor mdd = new ModularDistributionDescriptor();\r
- mdd.setName("name");\r
- mdd.setVersion("0.1.0");\r
- mdd.getModulesDescriptors().put("eclipse",\r
- "http://localhost/updateSite");\r
- mdd.getModulesDescriptors().put("modularDistribution",\r
- "http://localhost/modularDistribution");\r
-\r
- marshUnmarsh(mdd, false);\r
- }\r
-\r
- public void testModularDistributionDescriptorList() throws Exception {\r
- ModularDistributionDescriptor mdd = new ModularDistributionDescriptor();\r
- mdd.setName("name");\r
- mdd.setVersion("0.1.0");\r
- mdd.getModulesDescriptors().put("eclipse",\r
- "http://localhost/updateSite");\r
- mdd.getModulesDescriptors().put("modularDistribution",\r
- "http://localhost/modularDistribution");\r
-\r
- ModularDistributionDescriptor mdd2 = new ModularDistributionDescriptor();\r
- mdd2.setName("name2");\r
- mdd2.setVersion("0.1.1");\r
- mdd2.getModulesDescriptors().put("eclipse",\r
- "http://localhost/updateSite2");\r
- mdd2.getModulesDescriptors().put("modularDistribution",\r
- "http://localhost/modularDistribution2");\r
-\r
- ObjectList ol = new ObjectList();\r
- ol.getObjects().add(mdd);\r
- ol.getObjects().add(mdd2);\r
-\r
- marshUnmarsh(ol, false);\r
- }\r
-\r
-}\r
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Mathieu Baudier
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.slc.castor;
-
-import org.argeo.slc.msg.ObjectList;
-import org.argeo.slc.runtime.SlcAgentDescriptor;
-
-public class ObjectListCastorTest extends AbstractCastorTestCase {
-
- public void testAgentDescriptorList() throws Exception {
- SlcAgentDescriptor agentDescriptor = SlcAgentDescriptorCastorTest
- .createMiniAgentDescriptor();
- ObjectList lst = new ObjectList();
- lst.getObjects().add(agentDescriptor);
- ObjectList lstUnm = (ObjectList) marshUnmarsh(lst, false);
- assertEquals(1, lstUnm.getObjects().size());
- }
-}
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.argeo.slc.execution.ExecutionModuleDescriptor;\r
-import org.argeo.slc.runtime.SlcAgentDescriptor;\r
-\r
-public class SlcAgentDescriptorCastorTest extends AbstractCastorTestCase {\r
- public void testMarshUnmarshMini() throws Exception {\r
- SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor();\r
- SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor,\r
- false);\r
- assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm);\r
- }\r
-\r
- public void testMarshUnmarshWithModuleDescriptor() throws Exception {\r
- SlcAgentDescriptor agentDescriptor = createMiniAgentDescriptor();\r
-\r
- List<ExecutionModuleDescriptor> lst = new ArrayList<ExecutionModuleDescriptor>();\r
- ExecutionModuleDescriptor moduleDescriptor = new ExecutionModuleDescriptor();\r
- moduleDescriptor.setName("test.moodule");\r
- moduleDescriptor.setVersion("1.0.0");\r
- lst.add(moduleDescriptor);\r
- agentDescriptor.setModuleDescriptors(lst);\r
-\r
- SlcAgentDescriptor agentDescriptorUnm = marshUnmarsh(agentDescriptor,\r
- false);\r
- assertSlcAgentDescriptor(agentDescriptor, agentDescriptorUnm);\r
- }\r
-\r
- protected static SlcAgentDescriptor createMiniAgentDescriptor() {\r
- SlcAgentDescriptor agentDescriptor = new SlcAgentDescriptor();\r
- agentDescriptor.setHost("localhost");\r
- agentDescriptor.setUuid("555");\r
- return agentDescriptor;\r
- }\r
-\r
- protected static void assertSlcAgentDescriptor(SlcAgentDescriptor expected,\r
- SlcAgentDescriptor reached) {\r
- assertNotNull(reached);\r
- assertEquals(expected.getHost(), reached.getHost());\r
- assertEquals(expected.getUuid(), expected.getUuid());\r
- assertEquals(expected.getModuleDescriptors().size(), reached\r
- .getModuleDescriptors().size());\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import java.text.SimpleDateFormat;\r
-import java.util.UUID;\r
-\r
-import org.argeo.slc.msg.process.SlcExecutionRequest;\r
-import org.argeo.slc.msg.process.SlcExecutionStepsRequest;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-import org.argeo.slc.unit.process.SlcExecutionTestUtils;\r
-import org.springframework.xml.transform.StringResult;\r
-\r
-public class SlcExecutionCastorTest extends AbstractCastorTestCase {\r
- public void testMarshalling() throws Exception {\r
- SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution();\r
-\r
- SlcExecutionRequest msgSave = new SlcExecutionRequest();\r
- msgSave.setSlcExecution(slcExec);\r
-\r
- StringResult msgSaveXml = marshalAndValidate(msgSave);\r
-\r
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");\r
- SlcExecutionStep step0 = new SlcExecutionStep();\r
- step0.setUuid(UUID.randomUUID().toString());\r
- step0.setTimestamp(sdf.parse("2008-04-17 18:21"));\r
- step0.setType("LOG");\r
- step0.addLog("A log message\nand another line");\r
-\r
- SlcExecutionStep step1 = new SlcExecutionStep();\r
- step1.setUuid(UUID.randomUUID().toString());\r
- step1.setTimestamp(sdf.parse("2008-04-17 18:25"));\r
- step1.setType("LOG");\r
- step1.addLog("A nother log message");\r
-\r
- SlcExecutionStepsRequest msgNotif = new SlcExecutionStepsRequest();\r
- msgNotif.addStep(step0);\r
- msgNotif.addStep(step1);\r
- msgNotif.setSlcExecutionUuid(slcExec.getUuid());\r
-\r
- StringResult msgNotifXml = marshalAndValidate(msgNotif);\r
-\r
- SlcExecutionRequest msgSaveUnm = unmarshal(msgSaveXml);\r
- assertNotNull(msgSaveUnm);\r
- SlcExecutionTestUtils.assertSlcExecution(slcExec, msgSaveUnm\r
- .getSlcExecution());\r
-\r
- SlcExecutionStepsRequest msgNotifUnm = unmarshal(msgNotifXml);\r
- assertNotNull(msgNotifUnm);\r
- assertEquals(slcExec.getUuid(), msgNotifUnm.getSlcExecutionUuid());\r
- assertEquals(2, msgNotifUnm.getSteps().size());\r
- SlcExecutionTestUtils.assertSlcExecutionStep(step0, msgNotifUnm\r
- .getSteps().get(0));\r
- SlcExecutionTestUtils.assertSlcExecutionStep(step1, msgNotifUnm\r
- .getSteps().get(1));\r
-\r
- SlcExecution slcExecUnm = msgSaveUnm.getSlcExecution();\r
- slcExecUnm.getSteps().addAll(msgNotifUnm.getSteps());\r
-\r
- SlcExecutionRequest msgUpdate = new SlcExecutionRequest();\r
- msgUpdate.setSlcExecution(slcExecUnm);\r
- StringResult msgUpdateXml = marshalAndValidate(msgUpdate);\r
-\r
- SlcExecutionRequest msgUpdateUnm = unmarshal(msgUpdateXml);\r
- assertNotNull(msgUpdateUnm);\r
- }\r
-\r
- public void testMarshUnmarsh() throws Exception {\r
- SlcExecution slcExec = SlcExecutionTestUtils\r
- .createSlcExecutionWithRealizedFlows();\r
- marshUnmarsh(slcExec, false);\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import static org.argeo.slc.unit.UnitUtils.assertDateSec;\r
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult;\r
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createSimpleResultPartRequest;\r
-\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;\r
-import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;\r
-import org.argeo.slc.msg.test.tree.ResultPartRequest;\r
-import org.argeo.slc.unit.test.tree.UnitTestTreeUtil;\r
-import org.springframework.xml.transform.StringResult;\r
-\r
-public class TreeTestResultCastorTest extends AbstractCastorTestCase {\r
- public void testMarshUnmarsh() throws Exception {\r
- TreeTestResult ttr = createCompleteTreeTestResult();\r
-\r
- StringResult xml = marshalAndValidate(ttr);\r
-\r
- TreeTestResult ttrUnm = unmarshal(xml);\r
-\r
- UnitTestTreeUtil.assertTreeTestResult(ttr, ttrUnm);\r
- }\r
-\r
- public void testCreateTreeTestResultRequest() throws Exception {\r
- CreateTreeTestResultRequest req = new CreateTreeTestResultRequest();\r
- req.setTreeTestResult(createCompleteTreeTestResult());\r
-\r
- StringResult xml = marshalAndValidate(req);\r
-\r
- CreateTreeTestResultRequest reqUnm = unmarshal(xml);\r
-\r
- UnitTestTreeUtil.assertTreeTestResult(req.getTreeTestResult(), reqUnm\r
- .getTreeTestResult());\r
- }\r
-\r
- public void testResultPartRequest() throws Exception {\r
- TreeTestResult ttr = createCompleteTreeTestResult();\r
- ResultPartRequest req = createSimpleResultPartRequest(ttr);\r
-\r
- StringResult xml = marshalAndValidate(req);\r
-\r
- ResultPartRequest reqUnm = unmarshal(xml);\r
-\r
- UnitTestTreeUtil\r
- .assertPart(req.getResultPart(), reqUnm.getResultPart());\r
- }\r
-\r
- public void testCloseTreeTestResultRequest() throws Exception {\r
- TreeTestResult ttr = createCompleteTreeTestResult();\r
- ttr.close();\r
-\r
- CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(ttr\r
- .getUuid(), ttr.getCloseDate());\r
-\r
- StringResult xml = marshalAndValidate(req);\r
-\r
- CloseTreeTestResultRequest reqUnm = unmarshal(xml);\r
-\r
- assertEquals(ttr.getUuid(), reqUnm.getResultUuid());\r
- assertDateSec(ttr.getCloseDate(), ttr.getCloseDate());\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.castor;\r
-\r
-import static org.argeo.slc.unit.test.tree.TreeTestResultTestUtils.createCompleteTreeTestResult;\r
-\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.core.test.tree.TreeTestResultCollection;\r
-import org.argeo.slc.unit.test.tree.UnitTestTreeUtil;\r
-import org.springframework.xml.transform.StringResult;\r
-\r
-public class TreeTestResultCollectionCastorTest extends AbstractCastorTestCase {\r
- public void testMarshUnmarsh() throws Exception {\r
- TreeTestResult ttr = createCompleteTreeTestResult();\r
- TreeTestResult ttr2 = createCompleteTreeTestResult();\r
-\r
- TreeTestResultCollection ttrc = new TreeTestResultCollection();\r
- ttrc.setId("testCollection");\r
- ttrc.getResults().add(ttr);\r
- ttrc.getResults().add(ttr2);\r
-\r
- StringResult xml = marshalAndValidate(ttrc);\r
-\r
- TreeTestResultCollection ttrcUnm = unmarshal(xml);\r
-\r
- assertEquals(ttrc.getId(), ttrcUnm.getId());\r
- assertEquals(ttrc.getResults().size(), ttrcUnm.getResults().size());\r
- for (TreeTestResult ttrT : ttrc.getResults()) {\r
- if (ttrT.getUuid().equals(ttr.getUuid()))\r
- UnitTestTreeUtil.assertTreeTestResult(ttr, ttrT);\r
- else\r
- UnitTestTreeUtil.assertTreeTestResult(ttr2, ttrT);\r
- }\r
- }\r
-}\r
+++ /dev/null
-# Set root logger level to DEBUG and its only appender to A1.\r
-log4j.rootLogger=WARN, console\r
-\r
-## Levels\r
-# Slc\r
-log4j.logger.org.argeo=DEBUG\r
-\r
-# Castor\r
-log4j.logger.org.exolab.castor=WARN\r
-\r
-# Spring\r
-log4j.logger.org.springframework=WARN\r
-\r
-\r
-## Appenders\r
-# A1 is set to be a ConsoleAppender.\r
-log4j.appender.console=org.apache.log4j.ConsoleAppender\r
-\r
-# A1 uses PatternLayout.\r
-log4j.appender.console.layout=org.apache.log4j.PatternLayout\r
-log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n\r
-\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <import resource="classpath:/org/argeo/slc/xml/spring.xml" />\r
- <import resource="classpath:/org/argeo/slc/castor/spring.xml" />\r
-\r
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<classpath>\r
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
- <classpathentry kind="src" output="target/classes" path="src/main/resources"/>\r
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
- <classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
- <classpathentry kind="output" path="target/classes"/>\r
-</classpath>\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.support.hibernate</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-#Fri Aug 29 11:24:23 CEST 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+++ /dev/null
-#Mon Feb 14 20:13:33 CET 2011
-eclipse.preferences.version=1
-selfhosting.binExcludes=/org.argeo.slc.support.hibernate/target/test-classes,/org.argeo.slc.support.hibernate/target/test-classes
+++ /dev/null
-additional.bundles = org.springframework.transaction,\
- org.argeo.slc.unit,\
- junit,\
- org.springframework.oxm,\
- org.springframework.xml,\
- org.dom4j,\
- org.springframework.jdbc,\
- org.springframework.context.support,\
- net.sf.ehcache,\
- org.hsqldb,\
- org.apache.commons.collections,\
- antlr,\
- org.argeo.slc.support.castor,\
- org.castor,\
- org.apache.xml.serializer,\
- org.apache.xerces,\
- org.h2
-source.. = src/main/java/,\
- src/main/resources/,\
- src/test/java/,\
- src/test/resources/
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>runtime</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.support.hibernate</artifactId>
- <name>SLC Support Hibernate</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Fragment-Host>org.argeo.slc.core</Fragment-Host>
- <Import-Package>!org.argeo.slc.core.*,org.hibernate.proxy,javassist.util.proxy,*</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <!-- FIXME java.lang.NoClassDefFoundError: javax/transaction/TransactionManager -->
- <skipTests>true</skipTests>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.core</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.hibernate</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>net.sf.ehcache</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>edu.emory.mathcs.backport</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.orm</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.jdbc</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.context.support</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.transaction</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.apache.commons.dbcp</artifactId>
- </dependency>
-
- <!-- Unit Tests -->
- <dependency>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.unit</artifactId>
- <scope>test</scope>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.support.castor</artifactId>
- <scope>test</scope>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.hsqldb</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.h2</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
+++ /dev/null
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<assembly xmlns="http://maven.apache.org/POM/4.0.0"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.0-SNAPSHOT.xsd">\r
- <id>base</id>\r
- <includeBaseDirectory>false</includeBaseDirectory>\r
- <formats>\r
- <format>zip</format>\r
- </formats>\r
- <fileSets>\r
- <fileSet>\r
- <directory>src/base</directory>\r
- <outputDirectory></outputDirectory>\r
- </fileSet>\r
- </fileSets>\r
-</assembly>
\ No newline at end of file
+++ /dev/null
-#! /bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Extract launch and ant arguments, (see details below).
-ant_exec_args=
-no_config=false
-use_jikes_default=false
-ant_exec_debug=false
-show_help=false
-for arg in "$@" ; do
- if [ "$arg" = "--noconfig" ] ; then
- no_config=true
- elif [ "$arg" = "--usejikes" ] ; then
- use_jikes_default=true
- elif [ "$arg" = "--execdebug" ] ; then
- ant_exec_debug=true
- elif [ my"$arg" = my"--h" -o my"$arg" = my"--help" ] ; then
- show_help=true
- ant_exec_args="$ant_exec_args -h"
- else
- if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then
- show_help=true
- fi
- ant_exec_args="$ant_exec_args \"$arg\""
- fi
-done
-
-# Source/default ant configuration
-if $no_config ; then
- rpm_mode=false
- usejikes=$use_jikes_default
-else
- # load system-wide ant configuration (ONLY if ANT_HOME has NOT been set)
- if [ -z "$ANT_HOME" -o "$ANT_HOME" = "/usr/share/ant" ]; then
- if [ -f "/etc/ant.conf" ] ; then
- . /etc/ant.conf
- fi
- fi
-
- # load user ant configuration
- if [ -f "$HOME/.ant/ant.conf" ] ; then
- . $HOME/.ant/ant.conf
- fi
- if [ -f "$HOME/.antrc" ] ; then
- . "$HOME/.antrc"
- fi
-
- # provide default configuration values
- if [ -z "$rpm_mode" ] ; then
- rpm_mode=false
- fi
- if [ -z "$usejikes" ] ; then
- usejikes=$use_jikes_default
- fi
-fi
-
-# Setup Java environment in rpm mode
-if $rpm_mode ; then
- if [ -f /usr/share/java-utils/java-functions ] ; then
- . /usr/share/java-utils/java-functions
- set_jvm
- set_javacmd
- fi
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-case "`uname`" in
- CYGWIN*) cygwin=true ;;
- Darwin*) darwin=true
- if [ -z "$JAVA_HOME" ] ; then
- JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
- fi
- ;;
-esac
-
-if [ -z "$ANT_HOME" -o ! -d "$ANT_HOME" ] ; then
- ## resolve links - $0 may be a link to ant's home
- PRG="$0"
- progname=`basename "$0"`
-
- # need this for relative symlinks
- while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
- done
-
- ANT_HOME=`dirname "$PRG"`/..
-
- # make it fully qualified
- ANT_HOME=`cd "$ANT_HOME" && pwd`
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$ANT_HOME" ] &&
- ANT_HOME=`cygpath --unix "$ANT_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# set ANT_LIB location
-ANT_LIB="${ANT_HOME}/lib"
-
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- JAVACMD="$JAVA_HOME/jre/sh/java"
- elif [ -x "$JAVA_HOME/jre/bin/java" ] ; then
- JAVACMD="$JAVA_HOME/jre/bin/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- else
- JAVACMD=`which java 2> /dev/null `
- if [ -z "$JAVACMD" ] ; then
- JAVACMD=java
- fi
- fi
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly."
- echo " We cannot execute $JAVACMD"
- exit 1
-fi
-
-# Build local classpath using just the launcher in non-rpm mode or
-# use the Jpackage helper in rpm mode with basic and default jars
-# specified in the ant.conf configuration. Because the launcher is
-# used, libraries linked in ANT_HOME/lib will also be included, but this
-# is discouraged as it is not java-version safe. A user should
-# request optional jars and their dependencies via the OPT_JAR_LIST
-# variable
-if $rpm_mode && [ -x /usr/bin/build-classpath ] ; then
- LOCALCLASSPATH="$(/usr/bin/build-classpath ant ant-launcher jaxp_parser_impl xml-commons-apis)"
-
- # If no optional jars have been specified then build the default list
- if [ -z "$OPT_JAR_LIST" ] ; then
- for file in /etc/ant.d/*; do
- if [ -f "$file" ]; then
- case "$file" in
- *~) ;;
- *#*) ;;
- *.rpmsave) ;;
- *.rpmnew) ;;
- *)
- for dep in `cat "$file"`; do
- case "$OPT_JAR_LIST" in
- *"$dep"*) ;;
- *) OPT_JAR_LIST="$OPT_JAR_LIST${OPT_JAR_LIST:+ }$dep"
- esac
- done
- esac
- fi
- done
- fi
-
- # If the user requested to try to add some other jars to the classpath
- if [ -n "$OPT_JAR_LIST" ] ; then
- _OPTCLASSPATH="$(/usr/bin/build-classpath $OPT_JAR_LIST 2> /dev/null)"
- if [ -n "$_OPTCLASSPATH" ] ; then
- LOCALCLASSPATH="$LOCALCLASSPATH:$_OPTCLASSPATH"
- fi
- fi
-
- # Explicitly add javac path to classpath, assume JAVA_HOME set
- # properly in rpm mode
- if [ -f "$JAVA_HOME/lib/tools.jar" ] ; then
- LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar"
- fi
- if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then
- LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip"
- fi
-
- # if CLASSPATH_OVERRIDE env var is set, LOCALCLASSPATH will be
- # user CLASSPATH first and ant-found jars after.
- # In that case, the user CLASSPATH will override ant-found jars
- #
- # if CLASSPATH_OVERRIDE is not set, we'll have the normal behaviour
- # with ant-found jars first and user CLASSPATH after
- if [ -n "$CLASSPATH" ] ; then
- # merge local and specified classpath
- if [ -z "$LOCALCLASSPATH" ] ; then
- LOCALCLASSPATH="$CLASSPATH"
- elif [ -n "$CLASSPATH_OVERRIDE" ] ; then
- LOCALCLASSPATH="$CLASSPATH:$LOCALCLASSPATH"
- else
- LOCALCLASSPATH="$LOCALCLASSPATH:$CLASSPATH"
- fi
-
- # remove class path from launcher -cp option
- CLASSPATH=""
- fi
-else
- # not using rpm_mode; use launcher to determine classpaths
- if [ -z "$LOCALCLASSPATH" ] ; then
- LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar
- else
- LOCALCLASSPATH=$ANT_LIB/ant-launcher.jar:$LOCALCLASSPATH
- fi
-fi
-
-if [ -n "$JAVA_HOME" ] ; then
- # OSX hack to make Ant work with jikes
- if $darwin ; then
- OSXHACK="${JAVA_HOME}/../Classes"
- if [ -d "${OSXHACK}" ] ; then
- for i in "${OSXHACK}"/*.jar
- do
- JIKESPATH="$JIKESPATH:$i"
- done
- fi
- fi
-fi
-
-# Allow Jikes support (off by default)
-if $usejikes; then
- ANT_OPTS="$ANT_OPTS -Dbuild.compiler=jikes"
-fi
-
-# For Cygwin, switch paths to appropriate format before running java
-# For PATHs convert to unix format first, then to windows format to ensure
-# both formats are supported. Probably this will fail on directories with ;
-# in the name in the path. Let's assume that paths containing ; are more
-# rare than windows style paths on cygwin.
-if $cygwin; then
- if [ "$OS" = "Windows_NT" ] && cygpath -m .>/dev/null 2>/dev/null ; then
- format=mixed
- else
- format=windows
- fi
- ANT_HOME=`cygpath --$format "$ANT_HOME"`
- ANT_LIB=`cygpath --$format "$ANT_LIB"`
- JAVA_HOME=`cygpath --$format "$JAVA_HOME"`
- LCP_TEMP=`cygpath --path --unix "$LOCALCLASSPATH"`
- LOCALCLASSPATH=`cygpath --path --$format "$LCP_TEMP"`
- if [ -n "$CLASSPATH" ] ; then
- CP_TEMP=`cygpath --path --unix "$CLASSPATH"`
- CLASSPATH=`cygpath --path --$format "$CP_TEMP"`
- fi
- CYGHOME=`cygpath --$format "$HOME"`
-fi
-
-# Show script help if requested
-if $show_help ; then
- echo $0 '[script options] [options] [target [target2 [target3] ..]]'
- echo 'Script Options:'
- echo ' --help, --h print this message and ant help'
- echo ' --noconfig suppress sourcing of /etc/ant.conf,'
- echo ' $HOME/.ant/ant.conf, and $HOME/.antrc'
- echo ' configuration files'
- echo ' --usejikes enable use of jikes by default, unless'
- echo ' set explicitly in configuration files'
- echo ' --execdebug print ant exec line generated by this'
- echo ' launch script'
- echo ' '
-fi
-# add a second backslash to variables terminated by a backslash under cygwin
-if $cygwin; then
- case "$ANT_HOME" in
- *\\ )
- ANT_HOME="$ANT_HOME\\"
- ;;
- esac
- case "$CYGHOME" in
- *\\ )
- CYGHOME="$CYGHOME\\"
- ;;
- esac
- case "$JIKESPATH" in
- *\\ )
- JIKESPATH="$JIKESPATH\\"
- ;;
- esac
- case "$LOCALCLASSPATH" in
- *\\ )
- LOCALCLASSPATH="$LOCALCLASSPATH\\"
- ;;
- esac
- case "$CLASSPATH" in
- *\\ )
- CLASSPATH="$CLASSPATH\\"
- ;;
- esac
-fi
-# Execute ant using eval/exec to preserve spaces in paths,
-# java options, and ant args
-ant_sys_opts=
-if [ -n "$CYGHOME" ]; then
- if [ -n "$JIKESPATH" ]; then
- ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\" -Dcygwin.user.home=\"$CYGHOME\""
- else
- ant_sys_opts="-Dcygwin.user.home=\"$CYGHOME\""
- fi
-else
- if [ -n "$JIKESPATH" ]; then
- ant_sys_opts="-Djikes.class.path=\"$JIKESPATH\""
- fi
-fi
-ant_exec_command="exec \"$JAVACMD\" $ANT_OPTS -classpath \"$LOCALCLASSPATH\" -Dant.home=\"$ANT_HOME\" -Dant.library.dir=\"$ANT_LIB\" $ant_sys_opts org.apache.tools.ant.launch.Launcher $ANT_ARGS -cp \"$CLASSPATH\" $ant_exec_args"
-if $ant_exec_debug ; then
- echo $ant_exec_command
-fi
-eval $ant_exec_command
+++ /dev/null
-@echo off\r
-\r
-REM Licensed to the Apache Software Foundation (ASF) under one or more\r
-REM contributor license agreements. See the NOTICE file distributed with\r
-REM this work for additional information regarding copyright ownership.\r
-REM The ASF licenses this file to You under the Apache License, Version 2.0\r
-REM (the "License"); you may not use this file except in compliance with\r
-REM the License. You may obtain a copy of the License at\r
-REM \r
-REM http://www.apache.org/licenses/LICENSE-2.0\r
-REM \r
-REM Unless required by applicable law or agreed to in writing, software\r
-REM distributed under the License is distributed on an "AS IS" BASIS,\r
-REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-REM See the License for the specific language governing permissions and\r
-REM limitations under the License.\r
-\r
-REM This is an inordinately troublesome piece of code, particularly because it\r
-REM tries to work on both Win9x and WinNT-based systems. If we could abandon '9x\r
-REM support, things would be much easier, but sadly, it is not yet time.\r
-REM Be cautious about editing this, and only add WinNT specific stuff in code that\r
-REM only runs on WinNT.\r
-\r
-if "%HOME%"=="" goto homeDrivePathPre\r
-if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"\r
-\r
-:homeDrivePathPre\r
-if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePre\r
-if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePre\r
-if exist "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat"\r
-\r
-:userProfilePre\r
-if "%USERPROFILE%"=="" goto alpha\r
-if "%USERPROFILE%"=="%HOME%" goto alpha\r
-if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto alpha\r
-if exist "%USERPROFILE%\antrc_pre.bat" call "%USERPROFILE%\antrc_pre.bat"\r
-\r
-:alpha\r
-\r
-if "%OS%"=="Windows_NT" @setlocal\r
-if "%OS%"=="WINNT" @setlocal\r
-\r
-if "%ANT_HOME%"=="" goto setDefaultAntHome\r
-\r
-:stripAntHome\r
-if not _%ANT_HOME:~-1%==_\ goto checkClasspath\r
-set ANT_HOME=%ANT_HOME:~0,-1%\r
-goto stripAntHome\r
-\r
-:setDefaultAntHome\r
-rem %~dp0 is expanded pathname of the current script under NT\r
-set ANT_HOME=%~dp0..\r
-\r
-:checkClasspath\r
-set _USE_CLASSPATH=yes\r
-rem CLASSPATH must not be used if it is equal to ""\r
-if "%CLASSPATH%"=="""" set _USE_CLASSPATH=no\r
-if "%CLASSPATH%"=="" set _USE_CLASSPATH=no\r
-\r
-rem Slurp the command line arguments. This loop allows for an unlimited number\r
-rem of arguments (up to the command line limit, anyway).\r
-set ANT_CMD_LINE_ARGS=%1\r
-if ""%1""=="""" goto doneStart\r
-shift\r
-:setupArgs\r
-if ""%1""=="""" goto doneStart\r
-if ""%1""==""-noclasspath"" goto clearclasspath\r
-set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1\r
-shift\r
-goto setupArgs\r
-\r
-rem here is there is a -noclasspath in the options\r
-:clearclasspath\r
-set _USE_CLASSPATH=no\r
-shift\r
-goto setupArgs\r
-\r
-rem This label provides a place for the argument list loop to break out\r
-rem and for NT handling to skip to.\r
-\r
-:doneStart\r
-\r
-if _USE_CLASSPATH==no goto findAntHome\r
-\r
-:stripClasspath\r
-if not _%CLASSPATH:~-1%==_\ goto findAntHome\r
-set CLASSPATH=%CLASSPATH:~0,-1%\r
-goto stripClasspath\r
-\r
-:findAntHome\r
-rem find ANT_HOME if it does not exist due to either an invalid value passed\r
-rem by the user or the %0 problem on Windows 9x\r
-if exist "%ANT_HOME%\lib\ant.jar" goto checkJava\r
-\r
-rem check for ant in Program Files\r
-if not exist "%ProgramFiles%\ant" goto checkSystemDrive\r
-set ANT_HOME=%ProgramFiles%\ant\r
-goto checkJava\r
-\r
-:checkSystemDrive\r
-rem check for ant in root directory of system drive\r
-if not exist %SystemDrive%\ant\lib\ant.jar goto checkCDrive\r
-set ANT_HOME=%SystemDrive%\ant\r
-goto checkJava\r
-\r
-:checkCDrive\r
-rem check for ant in C:\ant for Win9X users\r
-if not exist C:\ant\lib\ant.jar goto noAntHome\r
-set ANT_HOME=C:\ant\r
-goto checkJava\r
-\r
-:noAntHome\r
-echo ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME.\r
-goto end\r
-\r
-:checkJava\r
-set _JAVACMD=%JAVACMD%\r
-\r
-if "%JAVA_HOME%" == "" goto noJavaHome\r
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome\r
-if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe\r
-goto checkJikes\r
-\r
-:noJavaHome\r
-if "%_JAVACMD%" == "" set _JAVACMD=java.exe\r
-\r
-:checkJikes\r
-if not "%JIKESPATH%"=="" goto runAntWithJikes\r
-\r
-:runAnt\r
-if "%_USE_CLASSPATH%"=="no" goto runAntNoClasspath\r
-:runAntWithClasspath\r
-"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS%\r
-rem Check the error code of the Ant build\r
-if not "%OS%"=="Windows_NT" goto onError\r
-set ANT_ERROR=%ERRORLEVEL%\r
-goto end\r
-\r
-:runAntNoClasspath\r
-"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS%\r
-rem Check the error code of the Ant build\r
-if not "%OS%"=="Windows_NT" goto onError\r
-set ANT_ERROR=%ERRORLEVEL%\r
-goto end\r
-\r
-:runAntWithJikes\r
-\r
-if not _%JIKESPATH:~-1%==_\ goto checkJikesAndClasspath\r
-set JIKESPATH=%JIKESPATH:~0,-1%\r
-goto runAntWithJikes\r
-\r
-:checkJikesAndClasspath\r
-\r
-if "%_USE_CLASSPATH%"=="no" goto runAntWithJikesNoClasspath\r
-\r
-:runAntWithJikesAndClasspath\r
-"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS%\r
-rem Check the error code of the Ant build\r
-if not "%OS%"=="Windows_NT" goto onError\r
-set ANT_ERROR=%ERRORLEVEL%\r
-goto end\r
-\r
-:runAntWithJikesNoClasspath\r
-"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS%\r
-rem Check the error code of the Ant build\r
-if not "%OS%"=="Windows_NT" goto onError\r
-set ANT_ERROR=%ERRORLEVEL%\r
-goto end\r
-\r
-:onError\r
-rem Windows 9x way of checking the error code. It matches via brute force.\r
-for %%i in (1 10 100) do set err%%i=\r
-for %%i in (0 1 2) do if errorlevel %%i00 set err100=%%i\r
-if %err100%==2 goto onError200\r
-if %err100%==0 set err100=\r
-for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%%i0 set err10=%%i\r
-if "%err100%"=="" if %err10%==0 set err10=\r
-:onError1\r
-for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%err10%%%i set err1=%%i\r
-goto onErrorEnd\r
-:onError200\r
-for %%i in (0 1 2 3 4 5) do if errorlevel 2%%i0 set err10=%%i\r
-if err10==5 for %%i in (0 1 2 3 4 5) do if errorlevel 25%%i set err1=%%i\r
-if not err10==5 goto onError1\r
-:onErrorEnd\r
-set ANT_ERROR=%err100%%err10%%err1%\r
-for %%i in (1 10 100) do set err%%i=\r
-\r
-:end\r
-rem bug ID 32069: resetting an undefined env variable changes the errorlevel.\r
-if not "%_JAVACMD%"=="" set _JAVACMD=\r
-if not "%_ANT_CMD_LINE_ARGS%"=="" set ANT_CMD_LINE_ARGS=\r
-\r
-if "%ANT_ERROR%"=="0" goto mainEnd\r
-\r
-rem Set the return code if we are not in NT. We can only set\r
-rem a value of 1, but it's better than nothing.\r
-if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1\r
-\r
-rem Set the ERRORLEVEL if we are running NT.\r
-if "%OS%"=="Windows_NT" color 00\r
-\r
-goto omega\r
-\r
-:mainEnd\r
-\r
-rem If there were no errors, we run the post script.\r
-if "%OS%"=="Windows_NT" @endlocal\r
-if "%OS%"=="WINNT" @endlocal\r
-\r
-if "%HOME%"=="" goto homeDrivePathPost\r
-if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"\r
-\r
-:homeDrivePathPost\r
-if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePost\r
-if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePost\r
-if exist "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat"\r
-\r
-:userProfilePost\r
-if "%USERPROFILE%"=="" goto omega\r
-if "%USERPROFILE%"=="%HOME%" goto omega\r
-if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto omega\r
-if exist "%USERPROFILE%\antrc_post.bat" call "%USERPROFILE%\antrc_post.bat"\r
-\r
-:omega\r
-\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.hibernate.process;\r
-\r
-import java.sql.SQLException;\r
-import java.util.List;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.dao.process.SlcExecutionDao;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-import org.hibernate.HibernateException;\r
-import org.hibernate.Session;\r
-import org.springframework.orm.hibernate3.HibernateCallback;\r
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
-\r
-public class SlcExecutionDaoHibernate extends HibernateDaoSupport implements\r
- SlcExecutionDao {\r
- private final static Log log = LogFactory\r
- .getLog(SlcExecutionDaoHibernate.class);\r
-\r
- public void create(SlcExecution slcExecution) {\r
- getHibernateTemplate().save(slcExecution);\r
- }\r
-\r
- public void update(final SlcExecution slcExecution) {\r
- getHibernateTemplate().update(slcExecution);\r
- }\r
-\r
- public void merge(final SlcExecution slcExecution) {\r
- getHibernateTemplate().merge(slcExecution);\r
- }\r
-\r
- public SlcExecution getSlcExecution(String uuid) {\r
- return (SlcExecution) getHibernateTemplate().get(SlcExecution.class,\r
- uuid);\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public List<SlcExecution> listSlcExecutions() {\r
- return (List<SlcExecution>) getHibernateTemplate().loadAll(\r
- SlcExecution.class);\r
- }\r
-\r
- public void addSteps(final String slcExecutionId,\r
- final List<SlcExecutionStep> additionalSteps) {\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- SlcExecution slcExecution = getSlcExecution(session,\r
- slcExecutionId);\r
- slcExecution.getSteps().addAll(additionalSteps);\r
- session.update(slcExecution);\r
- return slcExecution;\r
- }\r
- });\r
-\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public List<SlcExecutionStep> tailSteps(final String slcExecutionId,\r
- final Integer nbrOfSteps) {\r
- return (List<SlcExecutionStep>) getHibernateTemplate().execute(\r
- new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- SlcExecution slcExecution = getSlcExecution(session,\r
- slcExecutionId);\r
- // TODO: do a query count() instead?\r
- int stepCount = slcExecution.getSteps().size();\r
- if (stepCount > nbrOfSteps) {\r
- return session.createFilter(\r
- slcExecution.getSteps(), "")\r
- .setFirstResult(stepCount - nbrOfSteps)\r
- .setMaxResults(nbrOfSteps).list();\r
- } else {\r
- return slcExecution.getSteps();\r
- }\r
- }\r
- });\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public List<SlcExecutionStep> tailSteps(final String slcExecutionId,\r
- final String slcExecutionStepId) {\r
- Object[] values = { slcExecutionStepId, slcExecutionId };\r
- List<Integer> indexes = getHibernateTemplate().findByNamedQuery(\r
- SlcExecutionStep.class.getName() + ".stepIndex", values);\r
-\r
- Integer index = indexes.get(0);\r
- if (log.isTraceEnabled()){\r
- log.trace(indexes.size());\r
- log.trace("Index " + index + " for step " + slcExecutionStepId\r
- + " in process " + slcExecutionId);\r
- }\r
- Object[] values2 = { slcExecutionId, index };\r
- return getHibernateTemplate().findByNamedQuery(\r
- SlcExecutionStep.class.getName() + ".stepsAfter", values2);\r
- }\r
-\r
- protected SlcExecution getSlcExecution(Session session,\r
- String slcExecutionId) {\r
- SlcExecution slcExecution = (SlcExecution) session.get(\r
- SlcExecution.class, slcExecutionId);\r
-\r
- if (slcExecution == null)\r
- throw new SlcException("Could not find SLC execution "\r
- + slcExecutionId);\r
-\r
- return slcExecution;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.hibernate.runtime;\r
-\r
-import java.util.List;\r
-\r
-import org.argeo.slc.dao.runtime.SlcAgentDescriptorDao;\r
-import org.argeo.slc.runtime.SlcAgentDescriptor;\r
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
-\r
-public class SlcAgentDescriptorDaoHibernate extends HibernateDaoSupport\r
- implements SlcAgentDescriptorDao {\r
-\r
- public void create(SlcAgentDescriptor slcAgentDescriptor) {\r
- getHibernateTemplate().save(slcAgentDescriptor);\r
- }\r
-\r
- public void delete(SlcAgentDescriptor slcAgentDescriptor) {\r
- getHibernateTemplate().delete(slcAgentDescriptor);\r
- }\r
-\r
- public void delete(String agentId) {\r
- Object obj = getHibernateTemplate().get(SlcAgentDescriptor.class,\r
- agentId);\r
- if (obj != null)\r
- getHibernateTemplate().delete(obj);\r
- }\r
-\r
- public SlcAgentDescriptor getAgentDescriptor(String agentId) {\r
-\r
- return (SlcAgentDescriptor) getHibernateTemplate().get(\r
- SlcAgentDescriptor.class, agentId);\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public List<SlcAgentDescriptor> listSlcAgentDescriptors() {\r
- return (List<SlcAgentDescriptor>) getHibernateTemplate().loadAll(\r
- SlcAgentDescriptor.class);\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.hibernate.test;\r
-\r
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
-\r
-import org.argeo.slc.dao.test.TestRunDescriptorDao;\r
-import org.argeo.slc.test.TestRunDescriptor;\r
-\r
-public class TestRunDescriptorDaoHibernate extends HibernateDaoSupport\r
- implements TestRunDescriptorDao {\r
-\r
- public TestRunDescriptor getTestRunDescriptor(String id) {\r
- return (TestRunDescriptor) getHibernateTemplate().get(\r
- TestRunDescriptor.class, id);\r
- }\r
-\r
- public void saveOrUpdate(TestRunDescriptor testRunDescriptor) {\r
- getHibernateTemplate().saveOrUpdate(testRunDescriptor);\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.hibernate.test.tree;\r
-\r
-import java.sql.SQLException;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.SortedSet;\r
-import java.util.TreeSet;\r
-\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.core.test.tree.ResultAttributes;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.core.test.tree.TreeTestResultCollection;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao;\r
-import org.hibernate.HibernateException;\r
-import org.hibernate.LockMode;\r
-import org.hibernate.Session;\r
-import org.springframework.orm.hibernate3.HibernateCallback;\r
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
-\r
-/** Hibernate implementation of collections DAO. */\r
-public class TreeTestResultCollectionDaoHibernate extends HibernateDaoSupport\r
- implements TreeTestResultCollectionDao {\r
-\r
- public void create(TreeTestResultCollection ttrCollection) {\r
- getHibernateTemplate().save(ttrCollection);\r
- }\r
-\r
- public TreeTestResultCollection getTestResultCollection(String id) {\r
- return (TreeTestResultCollection) getHibernateTemplate().get(\r
- TreeTestResultCollection.class, id);\r
- }\r
-\r
- public void update(TreeTestResultCollection ttrCollection) {\r
- getHibernateTemplate().update(ttrCollection);\r
- }\r
-\r
- public void delete(TreeTestResultCollection ttrCollection) {\r
- getHibernateTemplate().delete(ttrCollection);\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public SortedSet<TreeTestResultCollection> listCollections() {\r
- return new TreeSet<TreeTestResultCollection>(getHibernateTemplate()\r
- .find("from TreeTestResultCollection"));\r
- }\r
-\r
- public void addResultToCollection(final TreeTestResultCollection ttrc,\r
- final String resultUuid) {\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- session.lock(ttrc, LockMode.NONE);\r
- TreeTestResult ttr = (TreeTestResult) session.get(\r
- TreeTestResult.class, resultUuid);\r
- ttrc.getResults().add(ttr);\r
- session.update(ttrc);\r
- return ttrc;\r
- }\r
- });\r
- }\r
-\r
- public void removeResultFromCollection(final TreeTestResultCollection ttrc,\r
- final String resultUuid) {\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- session.lock(ttrc, LockMode.NONE);\r
- TreeTestResult ttr = (TreeTestResult) session.get(\r
- TreeTestResult.class, resultUuid);\r
- if (ttrc.getResults().remove(ttr))\r
- session.update(ttrc);\r
- return ttrc;\r
- }\r
- });\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public List<ResultAttributes> listResultAttributes(String collectionId) {\r
- List<ResultAttributes> list;\r
- if (collectionId == null)\r
- list = getHibernateTemplate().find(\r
- "select new org.argeo.slc.core.test.tree.ResultAttributes(ttr)"\r
- + " from TreeTestResult ttr");\r
- else\r
- list = getHibernateTemplate()\r
- .find(\r
- "select new org.argeo.slc.core.test.tree.ResultAttributes(ttr) "\r
- + " from TreeTestResult ttr, TreeTestResultCollection ttrc "\r
- + " where ttr in elements(ttrc.results) and ttrc.id=?",\r
- collectionId);\r
-\r
- return list;\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public List<TreeTestResult> listResults(String collectionId,\r
- Map<String, String> attributes) {\r
- List<TreeTestResult> list;\r
-\r
- if (collectionId == null) {\r
- if (attributes == null || attributes.size() == 0)\r
- list = getHibernateTemplate().find("from TreeTestResult");\r
- else if (attributes.size() == 1) {\r
- Map.Entry<String, String> entry = attributes.entrySet()\r
- .iterator().next();\r
- Object[] args = { entry.getKey(), entry.getValue() };\r
- list = getHibernateTemplate().find(\r
- "select ttr from TreeTestResult ttr"\r
- + " where attributes[?]=?", args);\r
- } else {\r
- throw new SlcException(\r
- "Multiple attributes filter are currently not supported.");\r
- }\r
- } else {\r
- if (attributes == null || attributes.size() == 0)\r
- list = getHibernateTemplate()\r
- .find(\r
- "select ttr "\r
- + " from TreeTestResult ttr, TreeTestResultCollection ttrc "\r
- + " where ttr in elements(ttrc.results) and ttrc.id=?",\r
- collectionId);\r
- else if (attributes.size() == 1) {\r
- Map.Entry<String, String> entry = attributes.entrySet()\r
- .iterator().next();\r
- Object[] args = { collectionId, entry.getKey(),\r
- entry.getValue() };\r
- list = getHibernateTemplate()\r
- .find(\r
- "select ttr from TreeTestResult ttr, TreeTestResultCollection ttrc "\r
- + " where ttr in elements(ttrc.results) and ttrc.id=?"\r
- + " and attributes[?]=?", args);\r
- } else {\r
- throw new SlcException(\r
- "Multiple attributes filter are currently not supported.");\r
- }\r
- }\r
- return list;\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.hibernate.test.tree;\r
-\r
-import java.sql.SQLException;\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.SortedMap;\r
-\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.core.attachment.SimpleAttachment;\r
-import org.argeo.slc.core.structure.tree.TreeSPath;\r
-import org.argeo.slc.core.test.SimpleResultPart;\r
-import org.argeo.slc.core.test.tree.PartSubList;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultDao;\r
-import org.argeo.slc.structure.StructureElement;\r
-import org.argeo.slc.test.TestResult;\r
-import org.hibernate.HibernateException;\r
-import org.hibernate.Session;\r
-import org.springframework.orm.hibernate3.HibernateCallback;\r
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
-import org.springframework.util.Assert;\r
-\r
-/**\r
- * The Hibernate implementation for tree-based result of the test result dao.\r
- * \r
- * @see TreeTestResult\r
- */\r
-public class TreeTestResultDaoHibernate extends HibernateDaoSupport implements\r
- TreeTestResultDao {\r
-\r
- public void create(TestResult testResult) {\r
- getHibernateTemplate().save(testResult);\r
- }\r
-\r
- public void update(TestResult testResult) {\r
- getHibernateTemplate().saveOrUpdate(testResult);\r
- }\r
-\r
- public TreeTestResult getTestResult(String uuid) {\r
- List<?> list = getHibernateTemplate().find(\r
- "from TreeTestResult where uuid=?", uuid);\r
- if (list.size() == 0) {\r
- return null;\r
- } else {\r
- return (TreeTestResult) list.get(0);\r
- }\r
-\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public List<TreeTestResult> listTestResults() {\r
- return (List<TreeTestResult>) getHibernateTemplate().find(\r
- "from TreeTestResult");\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- public List<TreeTestResult> listResults(TreeSPath path) {\r
- List<TreeTestResult> list = getHibernateTemplate().find(\r
- "from TreeTestResult res where ? in indices(res.resultParts)",\r
- path.getAsUniqueString());\r
- return list;\r
- }\r
-\r
- public void close(final String testResultId, final Date closeDate) {\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- TreeTestResult treeTestResult = getTreeTestResult(session,\r
- testResultId);\r
- treeTestResult.setCloseDate(closeDate);\r
- session.update(treeTestResult);\r
- return treeTestResult;\r
- }\r
- });\r
- }\r
-\r
- public void addResultPart(final String testResultId, final TreeSPath path,\r
- final SimpleResultPart resultPart,\r
- final Map<TreeSPath, StructureElement> relatedElements) {\r
-\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- TreeTestResult treeTestResult = getTreeTestResult(session,\r
- testResultId);\r
- PartSubList lst = treeTestResult.getResultParts().get(path);\r
- if (lst == null) {\r
- lst = new PartSubList();\r
- treeTestResult.getResultParts().put(path, lst);\r
- }\r
- lst.getParts().add(resultPart);\r
- if (relatedElements != null)\r
- treeTestResult.getElements().putAll(relatedElements);\r
-\r
- session.update(treeTestResult);\r
- return treeTestResult;\r
- }\r
- });\r
-\r
- }\r
-\r
- public void addAttachment(final String testResultId,\r
- final SimpleAttachment attachment) {\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- TreeTestResult treeTestResult = getTreeTestResult(session,\r
- testResultId);\r
-\r
- // Check is there is already such an attachment\r
- Assert.notNull(attachment, "attachment is null");\r
- Assert.notNull(session, "session is null");\r
- SimpleAttachment att = (SimpleAttachment) session.get(\r
- attachment.getClass(), attachment.getUuid());\r
- if (att != null)\r
- throw new SlcException(\r
- "There is already an attachement with id "\r
- + attachment.getUuid());\r
-\r
- treeTestResult.getAttachments().add(attachment);\r
- session.update(treeTestResult);\r
- return treeTestResult;\r
- }\r
- });\r
-\r
- }\r
-\r
- protected TreeTestResult getTreeTestResult(Session session,\r
- String testResultId) {\r
- TreeTestResult treeTestResult = (TreeTestResult) session.get(\r
- TreeTestResult.class, testResultId);\r
- if (treeTestResult == null)\r
- throw new SlcException("No result with id " + testResultId);\r
- return treeTestResult;\r
- }\r
-\r
- public void updateAttributes(final String testResultId,\r
- final SortedMap<String, String> attributes) {\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- TreeTestResult treeTestResult = getTreeTestResult(session,\r
- testResultId);\r
- treeTestResult.setAttributes(attributes);\r
-\r
- session.update(treeTestResult);\r
- return treeTestResult;\r
- }\r
- });\r
- }\r
-\r
-}\r
+++ /dev/null
-<html>\r
-<head></head>\r
-<body>\r
-Hibernate based DAO implementations for tree-based SLC Test.\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.core.attachment">\r
- <class name="SimpleAttachment" table="SIMPLE_ATTACHMENT">\r
- <cache usage="nonstrict-read-write" />\r
- <id name="uuid" column="UUID" />
- <property name="name" column="NAME" not-null="true" />\r
- <property name="contentType" column="CONTENT_TYPE" not-null="true" />\r
- </class>
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="true">
-
- <bean id="slcTemplates.dao.testResultDao"
- class="org.argeo.slc.hibernate.test.tree.TreeTestResultDaoHibernate"
- abstract="true">
- </bean>
-
- <bean id="slcTemplates.dao.testResultCollectionDao"
- class="org.argeo.slc.hibernate.test.tree.TreeTestResultCollectionDaoHibernate"
- abstract="true">
- </bean>
-
- <bean id="slcTemplates.dao.testRunDescriptorDao"
- class="org.argeo.slc.hibernate.test.TestRunDescriptorDaoHibernate"
- abstract="true">
- </bean>
-
- <bean id="slcTemplates.dao.slcExecutionDao"
- class="org.argeo.slc.hibernate.process.SlcExecutionDaoHibernate"
- abstract="true">
- </bean>
-
- <bean id="slcTemplates.dao.slcAgentDescriptorDao"
- class="org.argeo.slc.hibernate.runtime.SlcAgentDescriptorDaoHibernate"
- abstract="true">
- </bean>
-</beans>
\ No newline at end of file
+++ /dev/null
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:noNamespaceSchemaLocation="ehcache.xsd">
-
- <diskStore path="java.io.tmpdir" />
-
- <defaultCache maxElementsInMemory="10000" overflowToDisk="false" />
-
- <cache name="org.argeo.slc.core.test.tree.TreeTestResult"
- maxElementsInMemory="1000" />
- <cache name="org.argeo.slc.core.test.tree.TreeTestResult.attributes"
- maxElementsInMemory="1000" />
- <cache name="org.argeo.slc.core.test.tree.PartSubList"
- maxElementsInMemory="5000" />
- <cache name="org.argeo.slc.core.test.tree.PartSubList.parts"
- maxElementsInMemory="10000" />
- <cache name="org.argeo.slc.core.test.SimpleResultPart"
- maxElementsInMemory="10000" />
- <cache name="org.argeo.slc.core.test.tree.TreeTestResult.resultParts"
- maxElementsInMemory="10000" />
- <cache name="org.argeo.slc.core.test.tree.TreeTestResult.elements"
- maxElementsInMemory="10000" />
- <cache name="org.argeo.slc.core.structure.SimpleSElement"
- maxElementsInMemory="10000" />
- <cache name="org.argeo.slc.core.structure.SimpleSElement.tags"
- maxElementsInMemory="20000" />
-
- <cache name="org.argeo.slc.core.test.tree.TreeTestResultCollection"
- maxElementsInMemory="100" />
- <cache name="org.argeo.slc.core.test.tree.TreeTestResultCollection.results"
- maxElementsInMemory="1000" />
-
- <cache name="org.argeo.slc.process.SlcExecution"
- maxElementsInMemory="1000" />
- <cache name="org.argeo.slc.process.SlcExecution.attributes"
- maxElementsInMemory="5000" />
- <cache name="org.argeo.slc.process.SlcExecution.steps"
- maxElementsInMemory="10000" />
- <cache name="org.argeo.slc.process.SlcExecutionStep"
- maxElementsInMemory="10000" />
- <cache name="org.argeo.slc.process.SlcExecutionStep.logLines"
- maxElementsInMemory="100000" />
-
- <cache name="org.argeo.slc.test.TestRunDescriptor"
- maxElementsInMemory="1000" />
-
- <cache name="org.argeo.slc.runtime.SlcAgentDescriptor"
- maxElementsInMemory="100" />
-
- <cache name="org.argeo.slc.core.attachment.SimpleAttachment"
- maxElementsInMemory="100000" />
- <cache name="org.argeo.slc.core.test.tree.TreeTestResult.attachments"
- maxElementsInMemory="100000" />
-
-</ehcache>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.process">\r
- <class name="RealizedFlow" table="REALIZED_FLOW">\r
- <cache usage="read-write" />\r
-\r
- <id column="ID" />\r
- <property name="moduleName" column="MODULE_NAME" />\r
- <property name="moduleVersion" column="MODULE_VERSION" />\r
-\r
- </class>
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.process">\r
- <class name="SlcExecution" table="SLC_EXECUTION">\r
- <cache usage="read-write" />\r
-\r
- <id name="uuid" column="UUID" />\r
- <property name="host" column="HOST" />\r
- <property name="user" column="USER" />\r
- <property name="type" column="TYPE" />\r
- <property name="status" column="STATUS" />
- <property name="realizedFlowsXml" column="REALIZED_FLOWS_XML"
- type="text" />\r
- <list name="steps" cascade="all" table="SLC_EXECUTIONS_STEPS"\r
- lazy="true">\r
- <cache usage="read-write" />\r
- <key column="SLC_EXECUTION_ID" />\r
- <list-index column="INDX" />\r
- <one-to-many class="org.argeo.slc.process.SlcExecutionStep" />
- </list>
-
- <map name="attributes" table="SLC_EXEC_ATTRS_MAP" cascade="all"
- lazy="false" sort="natural">
- <cache usage="read-write" />
-
- <key column="PARENT_ID" />
- <map-key column="ATTR_NAME" type="string" />
- <element column="NAME" type="string" />
- </map>
-
- </class>
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.process">\r
- <class name="SlcExecutionStep" table="SLC_EXECUTION_STEP">\r
- <cache usage="nonstrict-read-write" />\r
-\r
- <id name="uuid" column="UUID" />\r
- <property name="type" column="TYPE" />
- <property name="thread" column="THREAD" />
- <property name="timestamp" column="TSTAMP" type="imm_timestamp" />\r
-\r
- <list name="logLines" cascade="all" lazy="false"\r
- table="SLC_EXECUTION_STEP_LOG_LINE">
- <cache usage="nonstrict-read-write" />
- <key column="SLC_EXECUTION_STEP_ID" />
- <list-index column="INDX" />
- <element column="LOG_LINE" type="text" />
- </list>
-
- <query name="stepIndex"><![CDATA[
-select index(step)
- from SlcExecution process
- join process.steps step
- with step.uuid = ?
- where process.uuid = ?
- ]]></query>
- <query name="stepsAfter"><![CDATA[
-select step
- from SlcExecution process
- join process.steps step
- where process.uuid = ?
- and index(step) > ?
- ]]></query>
- </class>
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.runtime">\r
- <class name="SlcAgentDescriptor" table="SLC_AGENT_DESCRIPTOR">\r
- <cache usage="read-write" />\r
-\r
- <id name="uuid" column="UUID" />\r
- <property name="host" column="HOST" />
-<!--
- <map name="executionSpecs" table="AGENT_EXEC_SPEC_MAP" cascade="all"
- sort="natural">
- <cache usage="nonstrict-read-write" />
- <key column="PARENT_ID" />
- <map-key column="KEY" type="string" />
- <many-to-many class="org.argeo.slc.process.SlcExecutionSpec"
- column="ELEMENT_ID" unique="true" />
- </map>
- -->\r
- </class>
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="true">
-
- <bean id="slcTemplates.sessionFactory.hibernateBasic" abstract="true"
- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="mappingResources">
- <list>
- <value>
- org/argeo/slc/hibernate/structure/SimpleSElement.hbm.xml
- </value>
- <value>
- org/argeo/slc/hibernate/test/SimpleResultPart.hbm.xml
- </value>
- <value>
- org/argeo/slc/hibernate/test/tree/TreeTestResult.hbm.xml
- </value>
- <value>
- org/argeo/slc/hibernate/test/tree/TreeTestResultCollection.hbm.xml
- </value>
- <value>
- org/argeo/slc/hibernate/test/tree/PartSubList.hbm.xml
- </value>
- <value>
- org/argeo/slc/hibernate/test/TestRunDescriptor.hbm.xml
- </value>
- <value>
- org/argeo/slc/hibernate/process/SlcExecution.hbm.xml
- </value>
- <value>
- org/argeo/slc/hibernate/process/SlcExecutionStep.hbm.xml
- </value>
- <value>
- org/argeo/slc/hibernate/runtime/SlcAgentDescriptor.hbm.xml
- </value>
- <value>
- org/argeo/slc/hibernate/attachment/SimpleAttachment.hbm.xml
- </value>
- </list>
- </property>
- <property name="cacheProvider" ref="slcDefault.cacheProvider.ehCache" />
- </bean>
-
- <bean id="slcDefault.cacheProvider.ehCache" class="net.sf.ehcache.hibernate.SingletonEhCacheProvider"
- depends-on="slcDefault.cacheProvider.ehCacheManager">
- </bean>
-
- <bean id="slcDefault.cacheProvider.ehCacheManager"
- class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
- <property name="shared" value="true" />
- <property name="configLocation"
- value="classpath:/org/argeo/slc/hibernate/ehcache.xml" />
- </bean>
-
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="true">
-
- <import resource="dao.xml" />
- <import resource="sessionFactories.xml" />
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.core.structure">\r
- <class name="SimpleSElement" table="SIMPLE_SELEMENT">\r
- <cache usage="nonstrict-read-write" />\r
- <id name="tid" column="T_ID">\r
- <generator class="native" />\r
- </id>\r
- <property name="label" column="LABEL" not-null="true" />\r
- <map name="tags" table="SIMPLE_SELEMENT_TAGS" cascade="all"
- lazy="false" sort="natural">
- <cache usage="nonstrict-read-write" />
- <key column="PARENT_ID" />
- <map-key type="string" column="NAME" />
- <element type="string" column="VALUE" />
- </map>
- </class>
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.core.test">\r
- <class name="SimpleResultPart" table="SIMPLE_RESULT_PART">\r
- <cache usage="nonstrict-read-write" />\r
- <id name="tid" column="T_ID">\r
- <generator class="native" />\r
- </id>\r
- <property name="status" column="STATUS" not-null="true" />\r
- <property name="message" column="MESSAGE" not-null="true" />\r
- <property name="exceptionMessage" column="EXCEPTION_MESSAGE"
- type="text" not-null="false" lazy="true" />
- <property name="testRunUuid" column="TEST_RUN_UUID"
- not-null="false" />
- </class>
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.test">\r
- <class name="TestRunDescriptor" table="TEST_RUN_DESCRIPTOR">\r
- <cache usage="nonstrict-read-write" />
- <id name="testRunUuid" column="TEST_RUN_UUID" />\r
- <property name="slcExecutionUuid" column="SLC_EXEC_UUID"\r
- not-null="false" />\r
- <property name="slcExecutionStepUuid"\r
- column="SLC_EXEC_STEP_UUID" not-null="false" />\r
- <property name="testResultUuid" column="TEST_RESULT_UUID"\r
- not-null="false" />\r
- <property name="deployedSytemId" column="DEPLOYED_SYSTEM_ID"\r
- not-null="false" />\r
- </class>\r
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.core.test.tree">\r
- <class name="PartSubList" table="PART_SUB_LIST">\r
- <cache usage="nonstrict-read-write" />\r
- <id name="tid" column="T_ID">\r
- <generator class="native" />\r
- </id>\r
- <list name="parts" cascade="all" table="PARTS_LIST">\r
- <cache usage="nonstrict-read-write" />\r
- <key column="PART_SUBLIST_ID" />\r
- <list-index column="INDX" />\r
- <many-to-many
- class="org.argeo.slc.core.test.SimpleResultPart" column="PART_ID"
- unique="true" />
- </list>
- </class>
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.core.test.tree">\r
- <class name="TreeTestResult" table="TREE_TEST_RESULT">\r
- <cache usage="read-write" />\r
- <id name="uuid" column="UUID" />\r
-\r
- <property name="closeDate" column="CLOSE_DATE" type="timestamp"\r
- not-null="false" />
-
- <map name="attributes" table="TTR_ATTRS_MAP" cascade="all" lazy="false"
- sort="natural">
- <cache usage="read-write" />
- <key column="PARENT_ID" />
- <map-key column="ATTR_NAME" type="string" />
- <element column="NAME" type="string" />
- </map>
-
- <map name="resultParts" table="RESULT_PARTS_MAP" cascade="all"
- sort="natural">
- <cache usage="nonstrict-read-write" />
- <key column="PARENT_ID" />
- <composite-map-key class="org.argeo.slc.core.structure.tree.TreeSPath">
- <key-property name="asUniqueString" column="PATH" />
- </composite-map-key>
- <many-to-many class="PartSubList" column="PART_SUB_LIST_ID"
- unique="true" />
- </map>
-
- <map name="elements" table="RESULT_ELEMENTS_MAP" cascade="all"
- sort="natural">
- <cache usage="nonstrict-read-write" />
- <key column="PARENT_ID" />
- <composite-map-key class="org.argeo.slc.core.structure.tree.TreeSPath">
- <key-property name="asUniqueString" column="PATH" />
- </composite-map-key>
- <many-to-many class="org.argeo.slc.core.structure.SimpleSElement"
- column="ELEMENT_ID" unique="true" />
- </map>
-
- <list name="attachments" table="RESULTS_ATTACHMENTS" cascade="all">
- <cache usage="nonstrict-read-write" />
- <key column="RESULT_ATTACHMENT_ID" />
- <list-index column="INDX" />
- <many-to-many class="org.argeo.slc.core.attachment.SimpleAttachment"
- column="ATTACHMENT_ID" unique="true" />
- </list>
- </class>
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"\r
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">\r
-<hibernate-mapping package="org.argeo.slc.core.test.tree">\r
- <class name="TreeTestResultCollection"
- table="TREE_TEST_RESULT_COLLECTION">
- <cache usage="nonstrict-read-write" />
- <id name="id" column="ID" />
-
- <set name="results" table="TTR_COLLECTION_RESULTS"
- sort="natural">
- <cache usage="read-write" />
- <key column="PARENT_ID" />
- <many-to-many class="TreeTestResult" column="TTR"/>
- </set>
- </class>
-</hibernate-mapping>
\ No newline at end of file
+++ /dev/null
-Argeo SLC Site
\ No newline at end of file
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.hibernate.process;\r
-\r
-import java.sql.SQLException;\r
-\r
-import org.argeo.slc.dao.process.SlcExecutionDao;\r
-import org.argeo.slc.hibernate.unit.HibernateTestCase;\r
-import org.argeo.slc.msg.ObjectList;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.unit.process.SlcExecutionTestUtils;\r
-import org.hibernate.HibernateException;\r
-import org.hibernate.Session;\r
-import org.springframework.orm.hibernate3.HibernateCallback;\r
-import org.springframework.oxm.Marshaller;\r
-import org.springframework.oxm.Unmarshaller;\r
-import org.springframework.xml.transform.StringResult;\r
-import org.springframework.xml.transform.StringSource;\r
-\r
-public class CastorSlcExecutionHibernateTest extends HibernateTestCase {\r
-\r
- public void testSaveWithRealizedFlowsXml() throws Exception {\r
- SlcExecutionDao dao = getBean(SlcExecutionDao.class);\r
-\r
- SlcExecution slcExec = SlcExecutionTestUtils\r
- .createSlcExecutionWithRealizedFlows();\r
-\r
- ObjectList ol = new ObjectList(slcExec.getRealizedFlows());\r
- StringResult result = new StringResult();\r
- getBean(Marshaller.class).marshal(ol, result);\r
- slcExec.setRealizedFlowsXml(result.toString());\r
-\r
- dao.create(slcExec);\r
-\r
- SlcExecution slcExecPersisted = dao.getSlcExecution(slcExec.getUuid());\r
- assertSlcExecution(slcExec, slcExecPersisted);\r
-\r
- StringSource source = new StringSource(slcExecPersisted\r
- .getRealizedFlowsXml());\r
- ObjectList ol2 = (ObjectList) getBean(Unmarshaller.class).unmarshal(\r
- source);\r
- ol2.fill(slcExec.getRealizedFlows());\r
-\r
- }\r
-\r
- public void assertSlcExecution(final SlcExecution expected,\r
- final SlcExecution persisted) {\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- session.refresh(persisted);\r
- SlcExecutionTestUtils.assertSlcExecution(expected, persisted);\r
- return null;\r
- }\r
- });\r
- }\r
-\r
- @Override\r
- protected String getApplicationContextLocation() {\r
- return "org/argeo/slc/hibernate/withCastor.xml";\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.hibernate.process;\r
-\r
-import java.sql.SQLException;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.argeo.slc.dao.process.SlcExecutionDao;\r
-import org.argeo.slc.hibernate.unit.HibernateTestCase;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-import org.argeo.slc.unit.process.SlcExecutionTestUtils;\r
-import org.hibernate.HibernateException;\r
-import org.hibernate.Session;\r
-import org.springframework.orm.hibernate3.HibernateCallback;\r
-\r
-public class SlcExecutionHibernateTest extends HibernateTestCase {\r
-\r
- public void testSave() {\r
- SlcExecutionDao dao = getBean(SlcExecutionDao.class);\r
-\r
- SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution();\r
- slcExec.getSteps().add(new SlcExecutionStep("A log line"));\r
- slcExec.getSteps().add(new SlcExecutionStep("Two log\nlines"));\r
-\r
- dao.create(slcExec);\r
-\r
- SlcExecution slcExecPersisted = dao.getSlcExecution(slcExec.getUuid());\r
- assertSlcExecution(slcExec, slcExecPersisted);\r
- }\r
-\r
- public void testTailSteps() {\r
- SlcExecutionDao dao = getBean(SlcExecutionDao.class);\r
-\r
- SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution();\r
- int totalStepCount = 20;\r
- for (int i = 0; i < totalStepCount; i++) {\r
- slcExec.getSteps().add(new SlcExecutionStep("Log " + i));\r
- }\r
- dao.create(slcExec);\r
-\r
- int lastStepsCount = 7;\r
- List<SlcExecutionStep> firstSteps = dao.tailSteps(slcExec.getUuid(),\r
- lastStepsCount);\r
- assertEquals(lastStepsCount, firstSteps.size());\r
-\r
- SlcExecutionStep lastStep = firstSteps.get(lastStepsCount - 1);\r
-\r
- List<SlcExecutionStep> additionalSteps = new ArrayList<SlcExecutionStep>();\r
- int additionalStepsCount = 13;\r
- for (int i = 0; i < additionalStepsCount; i++) {\r
- additionalSteps.add(new SlcExecutionStep("Additonal log " + i));\r
- }\r
- dao.addSteps(slcExec.getUuid(), additionalSteps);\r
-\r
- List<SlcExecutionStep> lastSteps = dao.tailSteps(slcExec.getUuid(),\r
- lastStep.getUuid());\r
- assertEquals(additionalStepsCount, lastSteps.size());\r
- }\r
-\r
- public void testModify() {\r
- SlcExecutionDao dao = getBean(SlcExecutionDao.class);\r
-\r
- // slcExecution Creation\r
- SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution();\r
- slcExec.getSteps().add(new SlcExecutionStep("A log line"));\r
- slcExec.getSteps().add(new SlcExecutionStep("Two log\nlines"));\r
-\r
- dao.create(slcExec);\r
-\r
- // slcExecution retrieval and update\r
- final SlcExecution slcExecRetrieved = dao.getSlcExecution(slcExec\r
- .getUuid());\r
-\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- session.refresh(slcExecRetrieved);\r
- List<String> logLineListStep0 = slcExecRetrieved.getSteps()\r
- .get(0).getLogLines();\r
- for (String logLine : logLineListStep0)\r
- logLine = logLine + "appended Log text";\r
-\r
- slcExecRetrieved.getSteps().get(0)\r
- .setLogLines(logLineListStep0);\r
- slcExecRetrieved.getSteps().add(\r
- new SlcExecutionStep("Three \n log \n lines"));\r
- return null;\r
- }\r
- });\r
-\r
- dao.update(slcExecRetrieved);\r
-\r
- // updated slcExecution retrieval and comparison\r
- SlcExecution slcExecUpdated = dao.getSlcExecution(slcExec.getUuid());\r
-\r
- assertSlcExecution(slcExecRetrieved, slcExecUpdated);\r
- }\r
-\r
- public void assertSlcExecution(final SlcExecution expected,\r
- final SlcExecution persisted) {\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- session.refresh(persisted);\r
- SlcExecutionTestUtils.assertSlcExecution(expected, persisted);\r
- return null;\r
- }\r
- });\r
- }\r
-\r
- @Override\r
- protected String getApplicationContextLocation() {\r
- return "org/argeo/slc/hibernate/applicationContext.xml";\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.hibernate.test.tree;\r
-\r
-import org.argeo.slc.core.structure.tree.TreeSPath;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultDao;\r
-import org.argeo.slc.hibernate.unit.HibernateTestCase;\r
-import org.argeo.slc.unit.test.tree.TreeTestResultTestUtils;\r
-import org.springframework.oxm.Marshaller;\r
-import org.springframework.oxm.Unmarshaller;\r
-import org.springframework.xml.transform.StringResult;\r
-import org.springframework.xml.transform.StringSource;\r
-\r
-public class CastorTestResultDaoHibernateTest extends HibernateTestCase {\r
-\r
- public void testUnmarshallAndCreate() throws Exception {\r
- TreeTestResult ttr = TreeTestResultTestUtils\r
- .createCompleteTreeTestResult();\r
-\r
- StringResult result = new StringResult();\r
- getBean(Marshaller.class).marshal(ttr, result);\r
-\r
- StringSource source = new StringSource(result.toString());\r
- TreeTestResult ttrUnm = (TreeTestResult) getBean(Unmarshaller.class)\r
- .unmarshal(source);\r
-\r
- for (TreeSPath path : ttrUnm.getResultParts().keySet()) {\r
- log.debug("Path: " + path.getClass() + ": " + path);\r
- }\r
-\r
- TreeTestResultDao ttrDao = getBean(TreeTestResultDao.class);\r
- ttrDao.create(ttrUnm);\r
- TreeTestResult ttrPersist = ttrDao.getTestResult(ttr.getUuid());\r
-\r
- TreeTestResultDaoHibernateTest.assertInHibernate(\r
- getHibernateTemplate(), ttr, ttrPersist);\r
- }\r
-\r
- @Override\r
- protected String getApplicationContextLocation() {\r
- return "org/argeo/slc/hibernate/withCastor.xml";\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.hibernate.test.tree;\r
-\r
-import java.sql.SQLException;\r
-import java.util.Date;\r
-\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.core.test.tree.TreeTestResultCollection;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultDao;\r
-import org.argeo.slc.hibernate.unit.HibernateTestCase;\r
-import org.argeo.slc.unit.test.tree.TreeTestResultTestUtils;\r
-import org.argeo.slc.unit.test.tree.UnitTestTreeUtil;\r
-import org.hibernate.HibernateException;\r
-import org.hibernate.Session;\r
-import org.springframework.orm.hibernate3.HibernateCallback;\r
-\r
-public class TreeTestResultCollectionDaoHibernateTest extends HibernateTestCase {\r
-\r
- public void testScenario() {\r
- TreeTestResultDao ttrDao = getBean(TreeTestResultDao.class);\r
- TreeTestResultCollectionDao ttrcDao = getBean(TreeTestResultCollectionDao.class);\r
-\r
- String ttrcName = "testCollection";\r
-\r
- TreeTestResult ttr1 = TreeTestResultTestUtils\r
- .createCompleteTreeTestResult();\r
- ttrDao.create(ttr1);\r
-\r
- TreeTestResultCollection ttrc = new TreeTestResultCollection(ttrcName);\r
- ttrcDao.create(ttrc);\r
-\r
- ttrc.getResults().add(ttr1);\r
- ttrcDao.update(ttrc);\r
-\r
- final TreeTestResult ttr2 = TreeTestResultTestUtils\r
- .createCompleteTreeTestResult();\r
- ttrDao.create(ttr2);\r
-\r
- ttrc.getResults().add(ttr2);\r
- ttrcDao.update(ttrc);\r
-\r
- ttrc.getResults().remove(ttr1);\r
- ttrcDao.update(ttrc);\r
-\r
- final TreeTestResultCollection ttrcPersist = ttrcDao\r
- .getTestResultCollection(ttrcName);\r
-\r
- // Because of lazy initialization\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- session.refresh(ttrcPersist);\r
- assertEquals(1, ttrcPersist.getResults().size());\r
- UnitTestTreeUtil.assertTreeTestResult(ttr2, ttrcPersist\r
- .getResults().iterator().next());\r
- return null;\r
- }\r
- });\r
- }\r
-\r
- public void testResultsWithSameCloseDate() {\r
- TreeTestResultDao ttrDao = getBean(TreeTestResultDao.class);\r
- TreeTestResultCollectionDao ttrcDao = getBean(TreeTestResultCollectionDao.class);\r
-\r
- String ttrcName = "testCollection";\r
-\r
- Date closeDate = new Date();\r
-\r
- // TTR1\r
- TreeTestResult ttr1 = TreeTestResultTestUtils\r
- .createCompleteTreeTestResult();\r
- ttr1.setCloseDate(closeDate);\r
- ttrDao.create(ttr1);\r
-\r
- // TTR2\r
- TreeTestResult ttr2 = TreeTestResultTestUtils\r
- .createCompleteTreeTestResult();\r
- ttr2.setCloseDate(closeDate);\r
- ttrDao.create(ttr2);\r
-\r
- // TTRC\r
- TreeTestResultCollection ttrc = new TreeTestResultCollection(ttrcName);\r
- ttrc.getResults().add(ttr1);\r
- ttrc.getResults().add(ttr2);\r
- ttrcDao.create(ttrc);\r
-\r
- final TreeTestResultCollection ttrcPersist = ttrcDao\r
- .getTestResultCollection(ttrcName);\r
- // Because of lazy initialization\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- session.refresh(ttrcPersist);\r
- assertEquals(2, ttrcPersist.getResults().size());\r
- return null;\r
- }\r
- });\r
- }\r
-\r
- @Override\r
- protected String getApplicationContextLocation() {\r
- return "org/argeo/slc/hibernate/applicationContext.xml";\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.hibernate.test.tree;\r
-\r
-import java.sql.SQLException;\r
-\r
-import org.argeo.slc.core.structure.SimpleSElement;\r
-import org.argeo.slc.core.structure.tree.TreeSPath;\r
-import org.argeo.slc.core.structure.tree.TreeSRegistry;\r
-import org.argeo.slc.core.test.SimpleResultPart;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.dao.test.tree.TreeTestResultDao;\r
-import org.argeo.slc.hibernate.unit.HibernateTestCase;\r
-import org.argeo.slc.test.TestStatus;\r
-import org.argeo.slc.unit.test.tree.TreeTestResultTestUtils;\r
-import org.argeo.slc.unit.test.tree.UnitTestTreeUtil;\r
-import org.hibernate.HibernateException;\r
-import org.hibernate.Session;\r
-import org.springframework.orm.hibernate3.HibernateCallback;\r
-import org.springframework.orm.hibernate3.HibernateTemplate;\r
-\r
-public class TreeTestResultDaoHibernateTest extends HibernateTestCase {\r
- private TreeTestResultDao testResultDao = null;\r
-\r
- @Override\r
- public void setUp() {\r
- testResultDao = getBean(TreeTestResultDao.class);\r
- }\r
-\r
- public void testCreate() {\r
-\r
- TreeTestResult ttr = TreeTestResultTestUtils\r
- .createCompleteTreeTestResult();\r
- testResultDao.create(ttr);\r
-\r
- TreeTestResult ttrPersisted = (TreeTestResult) testResultDao\r
- .getTestResult(ttr.getUuid());\r
-\r
- assertInHibernate(ttr, ttrPersisted);\r
- }\r
-\r
- public void testUpdate() {\r
- TreeTestResult ttr = TreeTestResultTestUtils\r
- .createCompleteTreeTestResult();\r
- testResultDao.create(ttr);\r
-\r
- final TreeTestResult ttrUpdated = (TreeTestResult) testResultDao\r
- .getTestResult(ttr.getUuid());\r
-\r
- // Modifying ttrUpdated\r
-\r
- /**\r
- * this closeDate update commented because the assertTreeTestResult will\r
- * find a unexpected discrepancy in the date.\r
- * ttrUpdated.setCloseDate(new Date());\r
- */\r
-\r
- String pathStr = "/test";\r
- final TreeSPath path = new TreeSPath(pathStr);\r
-\r
- final TreeSRegistry registry = new TreeSRegistry();\r
- SimpleSElement elem = new SimpleSElement("Unit Test");\r
- elem.getTags().put("myTag", "myTagValue");\r
- registry.register(path, elem);\r
-\r
- getHibernateTemplate().execute(new HibernateCallback() {\r
-\r
- public Object doInHibernate(Session session)\r
- throws HibernateException, SQLException {\r
- session.refresh(ttrUpdated);\r
- ttrUpdated.notifyCurrentPath(registry, path);\r
-\r
- ttrUpdated.addResultPart(TreeTestResultTestUtils\r
- .createSimpleResultPartPassed());\r
- ttrUpdated.addResultPart(TreeTestResultTestUtils\r
- .createSimpleResultPartFailed());\r
- ttrUpdated.addResultPart(TreeTestResultTestUtils\r
- .createSimpleResultPartError());\r
- return null;\r
- }\r
- });\r
-\r
- testResultDao.update(ttrUpdated);\r
-\r
- // comparison of ttrUpdated and ttrRetrieved\r
- TreeTestResult ttrRetrieved = (TreeTestResult) testResultDao\r
- .getTestResult(ttr.getUuid());\r
-\r
- assertInHibernate(ttrUpdated, ttrRetrieved);\r
- }\r
-\r
- public void testMultipleUpdateScenario() throws Exception {\r
- TreeSRegistry registry = new TreeSRegistry();\r
-\r
- TreeSPath path = new TreeSPath("/root/test");\r
- SimpleSElement elem = new SimpleSElement("Unit Test");\r
- elem.getTags().put("myTag", "myTagValue");\r
- registry.register(path, elem);\r
-\r
- TreeTestResult ttr = TreeTestResultTestUtils\r
- .createSimpleTreeTestResult();\r
- ttr.notifyCurrentPath(registry, path);\r
- ttr\r
- .addResultPart(new SimpleResultPart(TestStatus.PASSED,\r
- "First test"));\r
-\r
- testResultDao.create(ttr);\r
-\r
- path = new TreeSPath("/root/test2/subtest");\r
- elem = new SimpleSElement("Sub Test");\r
- elem.getTags().put("myTag", "myTagValue");\r
- registry.register(path, elem);\r
-\r
- ttr.notifyCurrentPath(registry, path);\r
- ttr\r
- .addResultPart(new SimpleResultPart(TestStatus.PASSED,\r
- "Second test"));\r
-\r
- testResultDao.update(ttr);\r
-\r
- ttr.notifyCurrentPath(registry, path);\r
- ttr.addResultPart(new SimpleResultPart(TestStatus.PASSED,\r
- "Third test with same path"));\r
-\r
- testResultDao.update(ttr);\r
-\r
- ttr.close();\r
-\r
- testResultDao.close(ttr.getUuid(), ttr.getCloseDate());\r
-\r
- TreeTestResult ttrRetrieved = (TreeTestResult) testResultDao\r
- .getTestResult(ttr.getUuid());\r
-\r
- assertInHibernate(ttr, ttrRetrieved);\r
-\r
- }\r
-\r
- @Override\r
- protected String getApplicationContextLocation() {\r
- return "org/argeo/slc/hibernate/applicationContext.xml";\r
- }\r
-\r
- public static void assertInHibernate(HibernateTemplate template,\r
- final TreeTestResult ttrExpected, final TreeTestResult ttrPersisted) {\r
- template.execute(new HibernateCallback() {\r
- public Object doInHibernate(Session session) {\r
- session.refresh(ttrPersisted);\r
- UnitTestTreeUtil\r
- .assertTreeTestResult(ttrExpected, ttrPersisted);\r
- return null;\r
- }\r
-\r
- });\r
-\r
- }\r
-\r
- public void assertInHibernate(final TreeTestResult ttrExpected,\r
- final TreeTestResult ttrPersisted) {\r
- assertInHibernate(getHibernateTemplate(), ttrExpected, ttrPersisted);\r
- }\r
-\r
-}\r
+++ /dev/null
-# Set root logger level to DEBUG and its only appender to A1.\r
-log4j.rootLogger=WARN, console\r
-\r
-## Levels\r
-# Slc\r
-log4j.logger.org.argeo=DEBUG\r
-log4j.logger.org.argeo.slc.hibernate.process=TRACE\r
-\r
-# Castor\r
-log4j.logger.org.exolab.castor=WARN\r
-\r
-# Spring\r
-#log4j.logger.org.springframework=INFO\r
-# Hibernate\r
-log4j.logger.org.hibernate=WARN\r
-#log4j.logger.org.hibernate.SQL=TRACE\r
-#log4j.logger.org.hibernate.tool.hbm2ddl=TRACE\r
-#log4j.logger.org.hibernate.type=TRACE\r
-\r
-\r
-## Appenders\r
-# A1 is set to be a ConsoleAppender.\r
-log4j.appender.console=org.apache.log4j.ConsoleAppender\r
-\r
-# A1 uses PatternLayout.\r
-log4j.appender.console.layout=org.apache.log4j.PatternLayout\r
-log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c%n\r
-\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <import resource="classpath:/org/argeo/slc/hibernate/spring.xml" />\r
- <!--\r
-\r
- <bean id="sessionFactory"\r
- parent="slcTemplates.sessionFactory.hibernateBasic"> <property\r
- name="dataSource" ref="dataSource" /> <property\r
- name="hibernateProperties"> <value><![CDATA[\r
- hibernate.dialect=org.hibernate.dialect.HSQLDialect\r
- hibernate.hbm2ddl.auto=create\r
- hibernate.current_session_context_class=thread ]]></value> </property>\r
- </bean> <bean id="dataSource"\r
- class="org.springframework.jdbc.datasource.SingleConnectionDataSource"\r
- destroy-method="destroy" lazy-init="true"> <property\r
- name="driverClassName" value="org.hsqldb.jdbcDriver" /> <property\r
- name="url" value="jdbc:hsqldb:mem:test" /> <property name="username"\r
- value="sa" /> <property name="password" value="" /> <property\r
- name="suppressClose" value="true" /> </bean>\r
- -->\r
-\r
- <bean id="sessionFactory" parent="slcTemplates.sessionFactory.hibernateBasic">\r
- <property name="dataSource" ref="dataSource" />\r
- <property name="hibernateProperties">\r
- <value><![CDATA[\r
-hibernate.dialect=org.hibernate.dialect.H2Dialect\r
-hibernate.hbm2ddl.auto=create\r
-hibernate.current_session_context_class=thread\r
-hibernate.jdbc.batch_size=20\r
- ]]></value>\r
- </property>\r
- </bean>\r
- \r
- <bean id="dataSource"\r
- class="org.springframework.jdbc.datasource.SingleConnectionDataSource"\r
- destroy-method="destroy" lazy-init="true">\r
- <property name="driverClassName" value="org.h2.Driver" />\r
- <property name="url" value="jdbc:h2:mem:test" />\r
- <property name="username" value="sa" />\r
- <property name="password" value="" />\r
- <property name="suppressClose" value="true" />\r
- </bean>\r
- \r
- <bean id="testResultDao" parent="slcTemplates.dao.testResultDao">\r
- <property name="sessionFactory" ref="sessionFactory" />\r
- </bean>\r
- <bean id="testResultCollectionDao" parent="slcTemplates.dao.testResultCollectionDao">\r
- <property name="sessionFactory" ref="sessionFactory" />\r
- </bean>\r
-\r
- <bean id="slcExecutionDao" parent="slcTemplates.dao.slcExecutionDao">\r
- <property name="sessionFactory" ref="sessionFactory" />\r
- </bean>\r
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-\r
- Copyright (C) 2007-2012 Mathieu Baudier\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
-\r
--->\r
-<beans xmlns="http://www.springframework.org/schema/beans"\r
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
-\r
- <import resource="applicationContext.xml" />\r
- <import resource="classpath:/org/argeo/slc/castor/spring.xml" />\r
-</beans>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.argeo.slc.support.ws.client</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-#Fri Aug 29 11:31:46 CEST 2008
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.argeo.slc</groupId>
- <artifactId>runtime</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.support.ws.client</artifactId>
- <packaging>jar</packaging>
- <name>SLC Support Web Services Client (deprecated)</name>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Export-Package>
- org.argeo.slc.ws.*
- </Export-Package>
- <Import-Package>org.w3c.dom;version="0.0.0",
- javax.xml.*;version="0.0.0",
- org.xml.*;version="0.0.0",
- org.springframework.ws.*;resolution:="optional",
- org.springframework.core;resolution:="optional",
- *
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.support.simple</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.argeo.slc.runtime</groupId>
- <artifactId>org.argeo.slc.support.castor</artifactId>
- <version>1.1.3-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>org.springframework.ws</artifactId>
- </dependency>
- <dependency>
- <groupId>org.argeo.tp</groupId>
- <artifactId>com.sun.xml.messaging.saaj</artifactId>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.ws.client;\r
-\r
-import java.io.IOException;\r
-\r
-import javax.xml.transform.Source;\r
-\r
-import org.springframework.ws.client.WebServiceClientException;\r
-import org.springframework.ws.client.WebServiceIOException;\r
-import org.springframework.ws.client.support.interceptor.ClientInterceptor;\r
-import org.springframework.ws.context.MessageContext;\r
-import org.springframework.xml.validation.XmlValidator;\r
-import org.xml.sax.SAXParseException;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-\r
-public class ValidatingClientInterceptor implements ClientInterceptor {\r
- private final static Log log = LogFactory\r
- .getLog(ValidatingClientInterceptor.class);\r
-\r
- private Boolean validateRequest = true;\r
- private Boolean validateResponse = false;\r
- private XmlValidator validator = null;\r
-\r
- public boolean handleFault(MessageContext messageContext)\r
- throws WebServiceClientException {\r
- return true;\r
- }\r
-\r
- public boolean handleRequest(MessageContext messageContext)\r
- throws WebServiceClientException {\r
- if (validateRequest) {\r
- if (messageContext.getRequest() == null)\r
- return true;\r
-\r
- Source source = messageContext.getRequest().getPayloadSource();\r
- try {\r
- return validate(source);\r
- } catch (IOException e) {\r
- throw new WebServiceIOException("Cannot validate request", e);\r
- }\r
- } else {\r
- return true;\r
- }\r
- }\r
-\r
- public boolean handleResponse(MessageContext messageContext)\r
- throws WebServiceClientException {\r
- if (validateResponse) {\r
- if (messageContext.getResponse() == null)\r
- return true;\r
-\r
- Source source = messageContext.getResponse().getPayloadSource();\r
- try {\r
- return validate(source);\r
- } catch (IOException e) {\r
- throw new WebServiceIOException("Cannot validate response", e);\r
- }\r
- } else {\r
- return true;\r
- }\r
- }\r
-\r
- protected boolean validate(Source source) throws IOException {\r
- SAXParseException[] exceptions = validator.validate(source);\r
- if (exceptions.length != 0) {\r
- for (SAXParseException ex : exceptions) {\r
- log.error(ex.getMessage());\r
- }\r
- return false;\r
- } else {\r
- return true;\r
- }\r
- }\r
-\r
- public void setValidateRequest(Boolean validateRequest) {\r
- this.validateRequest = validateRequest;\r
- }\r
-\r
- public void setValidateResponse(Boolean validateResponse) {\r
- this.validateResponse = validateResponse;\r
- }\r
-\r
- public void setValidator(XmlValidator validator) {\r
- this.validator = validator;\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.ws.client;\r
-\r
-import java.util.Iterator;\r
-\r
-import javax.xml.transform.Source;\r
-import javax.xml.transform.dom.DOMSource;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.springframework.ws.client.core.WebServiceTemplate;\r
-import org.springframework.ws.soap.SoapFaultDetail;\r
-import org.springframework.ws.soap.SoapFaultDetailElement;\r
-import org.springframework.ws.soap.client.SoapFaultClientException;\r
-import org.springframework.xml.transform.StringResult;\r
-import org.w3c.dom.Node;\r
-\r
-public abstract class WebServiceUtils {\r
- private final static Log log = LogFactory.getLog(WebServiceUtils.class);\r
-\r
- public static Object marshalSendAndReceiveSafe(WebServiceTemplate template,\r
- Object req) {\r
- try {\r
- Object resp = marshalSendAndReceive(template, req);\r
- return resp;\r
- } catch (Exception e) {\r
- log.error("Cannot send web servicerequest: " + e.getMessage());\r
- if (log.isDebugEnabled()) {\r
- log.debug("Webservice exception details: ", e);\r
- }\r
- return null;\r
- }\r
- }\r
-\r
- public static Object marshalSendAndReceive(WebServiceTemplate template,\r
- Object req) {\r
- if (log.isTraceEnabled()) {\r
- try {\r
- StringResult result = new StringResult();\r
- template.getMarshaller().marshal(req, result);\r
- log.trace("About to send " + result);\r
- } catch (Exception e) {\r
- log.error("Cannot marshall " + req + " for logging", e);\r
- }\r
- }\r
- Object resp = template.marshalSendAndReceive(req);\r
- return resp;\r
- }\r
-\r
- public static void manageSoapException(SoapFaultClientException e) {\r
- log\r
- .error("WS root cause: "\r
- + e.getSoapFault().getFaultStringOrReason());\r
- if (log.isTraceEnabled()) {\r
- StringBuffer stack = new StringBuffer("");\r
- SoapFaultDetail detail = e.getSoapFault().getFaultDetail();\r
- if (detail != null) {\r
- Iterator<SoapFaultDetailElement> it = (Iterator<SoapFaultDetailElement>) detail\r
- .getDetailEntries();\r
- while (it.hasNext()) {\r
- SoapFaultDetailElement elem = it.next();\r
- if (elem.getName().getLocalPart().equals("StackElement")) {\r
- Source source = elem.getSource();\r
- if (source instanceof DOMSource) {\r
- Node node = ((DOMSource) source).getNode();\r
- // stack.append(node.getTextContent()).append('\n');\r
- stack\r
- .append(\r
- node.getChildNodes().item(0)\r
- .getNodeValue()).append(\r
- '\n');\r
- }\r
- }\r
- }\r
-\r
- if (stack.length() > 0)\r
- log.error("WS root cause stack: " + stack);\r
- }\r
- }\r
- }\r
-\r
- private WebServiceUtils() {\r
-\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.ws.process;\r
-\r
-import java.util.List;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.msg.process.SlcExecutionRequest;\r
-import org.argeo.slc.msg.process.SlcExecutionStatusRequest;\r
-import org.argeo.slc.msg.process.SlcExecutionStepsRequest;\r
-import org.argeo.slc.execution.ExecutionStep;\r
-import org.argeo.slc.execution.ExecutionProcess;\r
-import org.argeo.slc.process.SlcExecution;\r
-import org.argeo.slc.process.SlcExecutionNotifier;\r
-import org.argeo.slc.process.SlcExecutionStep;\r
-import org.argeo.slc.ws.client.WebServiceUtils;\r
-import org.springframework.ws.client.WebServiceIOException;\r
-import org.springframework.ws.client.core.WebServiceTemplate;\r
-import org.springframework.ws.soap.client.SoapFaultClientException;\r
-\r
-public class WebServiceSlcExecutionNotifier implements SlcExecutionNotifier {\r
- private WebServiceTemplate template;\r
-\r
- private Log log = LogFactory.getLog(getClass());\r
-\r
- private Boolean cannotConnect = false;\r
-\r
- public void newExecution(ExecutionProcess process) {\r
- SlcExecution slcExecution = (SlcExecution) process;\r
- if (cannotConnect)\r
- return;\r
-\r
- SlcExecutionRequest req = new SlcExecutionRequest();\r
- req.setSlcExecution(slcExecution);\r
- try {\r
- WebServiceUtils.marshalSendAndReceive(template, req);\r
- if (log.isTraceEnabled())\r
- log.trace("Notified creation of slc execution "\r
- + slcExecution.getUuid());\r
- } catch (SoapFaultClientException e) {\r
- WebServiceUtils.manageSoapException(e);\r
- } catch (WebServiceIOException e) {\r
- manageIoException(e);\r
- }\r
- }\r
-\r
- public void updateExecution(SlcExecution slcExecution) {\r
- if (cannotConnect)\r
- return;\r
-\r
- SlcExecutionRequest req = new SlcExecutionRequest();\r
- req.setSlcExecution(slcExecution);\r
- try {\r
- WebServiceUtils.marshalSendAndReceive(template, req);\r
- if (log.isTraceEnabled())\r
- log.trace("Notified update of slc execution "\r
- + slcExecution.getUuid());\r
- } catch (SoapFaultClientException e) {\r
- WebServiceUtils.manageSoapException(e);\r
- } catch (WebServiceIOException e) {\r
- manageIoException(e);\r
- }\r
- }\r
-\r
- public void updateStatus(ExecutionProcess process, String oldStatus,\r
- String newStatus) {\r
- SlcExecution slcExecution = (SlcExecution) process;\r
- if (cannotConnect)\r
- return;\r
-\r
- SlcExecutionStatusRequest req = new SlcExecutionStatusRequest(\r
- slcExecution.getUuid(), newStatus);\r
- try {\r
- WebServiceUtils.marshalSendAndReceive(template, req);\r
- if (log.isTraceEnabled())\r
- log.trace("Notified status update of slc execution "\r
- + slcExecution.getUuid());\r
- } catch (SoapFaultClientException e) {\r
- WebServiceUtils.manageSoapException(e);\r
- } catch (WebServiceIOException e) {\r
- manageIoException(e);\r
- }\r
- }\r
-\r
- public void addSteps(ExecutionProcess process,\r
- List<ExecutionStep> additionalSteps) {\r
- SlcExecution slcExecution = (SlcExecution) process;\r
- if (cannotConnect)\r
- return;\r
-\r
- SlcExecutionStepsRequest req = new SlcExecutionStepsRequest(\r
- slcExecution.getUuid(), additionalSteps);\r
- try {\r
- WebServiceUtils.marshalSendAndReceive(template, req);\r
- if (log.isTraceEnabled())\r
- log.trace("Added steps to slc execution "\r
- + slcExecution.getUuid());\r
- } catch (SoapFaultClientException e) {\r
- WebServiceUtils.manageSoapException(e);\r
- } catch (WebServiceIOException e) {\r
- manageIoException(e);\r
- }\r
- }\r
-\r
- public void setTemplate(WebServiceTemplate template) {\r
- this.template = template;\r
- }\r
-\r
- protected void manageIoException(WebServiceIOException e) {\r
- if (!cannotConnect) {\r
- log.error("Cannot connect to " + template.getDefaultUri()\r
- + ". Won't try again.", e);\r
- cannotConnect = true;\r
- }\r
- }\r
-\r
-}\r
+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Mathieu Baudier\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.ws.test.tree;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest;\r
-import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest;\r
-import org.argeo.slc.msg.test.tree.ResultPartRequest;\r
-import org.argeo.slc.test.TestResultListener;\r
-import org.argeo.slc.test.TestResultPart;\r
-import org.argeo.slc.ws.client.WebServiceUtils;\r
-import org.springframework.ws.client.WebServiceIOException;\r
-import org.springframework.ws.client.core.WebServiceTemplate;\r
-import org.springframework.ws.soap.client.SoapFaultClientException;\r
-\r
-public class WebServiceTreeTestResultNotifier implements\r
- TestResultListener<TreeTestResult> {\r
- private WebServiceTemplate template;\r
- private Boolean onlyOnClose = false;\r
-\r
- private Log log = LogFactory.getLog(getClass());\r
-\r
- private Boolean cannotConnect = false;\r
-\r
- public void resultPartAdded(TreeTestResult testResult,\r
- TestResultPart testResultPart) {\r
- if (onlyOnClose)\r
- return;\r
-\r
- if (cannotConnect)\r
- return;\r
-\r
- try {\r
- if (testResult.getResultParts().size() == 1\r
- && testResult.getResultParts().values().iterator().next()\r
- .getParts().size() == 1) {\r
- CreateTreeTestResultRequest req = new CreateTreeTestResultRequest(\r
- testResult);\r
-\r
- if (log.isDebugEnabled())\r
- log.debug("Send create result request for result "\r
- + testResult.getUuid());\r
-\r
- WebServiceUtils.marshalSendAndReceive(template, req);\r
- } else {\r
- ResultPartRequest req = new ResultPartRequest(testResult);\r
-\r
- if (log.isDebugEnabled())\r
- log.debug("Send result parts for result "\r
- + testResult.getUuid());\r
-\r
- WebServiceUtils.marshalSendAndReceive(template, req);\r
- }\r
- } catch (SoapFaultClientException e) {\r
- WebServiceUtils.manageSoapException(e);\r
-\r
- } catch (WebServiceIOException e) {\r
- manageIoException(e);\r
- }\r
- }\r
-\r
- public void close(TreeTestResult testResult) {\r
- if (cannotConnect)\r
- return;\r
-\r
- try {\r
- if (onlyOnClose) {\r
- CreateTreeTestResultRequest req = new CreateTreeTestResultRequest(\r
- testResult);\r
-\r
- if (log.isDebugEnabled())\r
- log.debug("Send create result request for result "\r
- + testResult.getUuid());\r
-\r
- WebServiceUtils.marshalSendAndReceive(template, req);\r
- } else {\r
- CloseTreeTestResultRequest req = new CloseTreeTestResultRequest(\r
- testResult);\r
-\r
- if (log.isDebugEnabled())\r
- log.debug("Send close result request for result "\r
- + testResult.getUuid());\r
-\r
- WebServiceUtils.marshalSendAndReceive(template, req);\r
-\r
- }\r
- } catch (SoapFaultClientException e) {\r
- WebServiceUtils.manageSoapException(e);\r
- } catch (WebServiceIOException e) {\r
- manageIoException(e);\r
- }\r
- }\r
-\r
- public void setTemplate(WebServiceTemplate template) {\r
- this.template = template;\r
- }\r
-\r
- public void setOnlyOnClose(Boolean onlyOnClose) {\r
- this.onlyOnClose = onlyOnClose;\r
- }\r
-\r
- protected void manageIoException(WebServiceIOException e) {\r
- if (!cannotConnect) {\r
- log.error("Cannot connect to " + template.getDefaultUri()\r
- + ". Won't try again.", e);\r
- cannotConnect = true;\r
- }\r
- }\r
-}\r
+++ /dev/null
-<!--
-
- Copyright (C) 2007-2012 Mathieu Baudier
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
- default-lazy-init="true">
-
- <import
- resource="classpath:/org/argeo/slc/castor/spring/applicationContext.xml" />
- <import
- resource="classpath:/org/argeo/slc/xml/spring/applicationContext.xml" />
-
- <bean id="slcDefault.ws.client.webServiceTemplate"
- parent="slcTemplate.ws.client.webServiceTemplate">
- <constructor-arg ref="slcDefault.ws.client.messageFactory" />
- <property name="defaultUri" value="${slc.ws.uri}" />
- </bean>
-
- <bean
- class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
- lazy-init="false">
- <property name="systemPropertiesModeName"
- value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
- <property name="ignoreUnresolvablePlaceholders" value="true" />
- <property name="properties">
- <props>
- <prop key="slc.ws.uri">
- http://localhost:9090/org.argeo.slc.webapp/slcService/
- </prop>
- </props>
- </property>
- </bean>
-
- <bean id="slcTemplate.ws.client.webServiceTemplate"
- class="org.springframework.ws.client.core.WebServiceTemplate"
- abstract="true">
- <property name="marshaller" ref="slcDefault.castor.marshaller" />
- <property name="unmarshaller"
- ref="slcDefault.castor.marshaller" />
- <property name="interceptors">
- <list>
- <bean
- class="org.argeo.slc.ws.client.ValidatingClientInterceptor">
- <property name="validator"
- ref="slcDefault.xml.xsdValidator" />
- </bean>
- </list>
- </property>
- </bean>
-
- <bean id="slcDefault.ws.client.messageFactory"
- class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory" />
-
- <bean name="slcDefault.ws.client.treeTestResultWsNotfier"
- class="org.argeo.slc.ws.test.tree.WebServiceTreeTestResultNotifier">
- <property name="template"
- ref="slcDefault.ws.client.webServiceTemplate" />
- <property name="onlyOnClose" value="false" />
- </bean>
-
- <bean name="slcDefault.ws.client.slcExecutionNotifier"
- class="org.argeo.slc.ws.process.WebServiceSlcExecutionNotifier">
- <property name="template"
- ref="slcDefault.ws.client.webServiceTemplate" />
- </bean>
-
-</beans>