incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r898994 [2/7] - in /incubator/hise/trunk: ./ hise-services/ hise-services/src/main/java/org/apache/hise/api/ hise-services/src/main/java/org/apache/hise/dao/ hise-services/src/main/java/org/apache/hise/engine/ hise-services/src/main/java/or...
Date Wed, 13 Jan 2010 23:20:58 GMT
Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/HISEEngine.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/HISEEngine.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/HISEEngine.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/HISEEngine.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,142 @@
+package org.apache.hise.engine;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.lang.Validate;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hise.dao.HISEDao;
+import org.apache.hise.dao.Job;
+import org.apache.hise.engine.jaxws.HISEJaxWSClient;
+import org.apache.hise.engine.store.HISEDD;
+import org.apache.hise.engine.store.TaskDD;
+import org.apache.hise.lang.TaskDefinition;
+import org.apache.hise.runtime.Task;
+import org.apache.hise.utils.DOMUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class HISEEngine {
+    private static Log log = LogFactory.getLog(HISEEngine.class);
+    
+    public static class TaskInfo {
+        public String taskKey;
+        public TaskDefinition taskDefinition;
+        public HISEDD parent;
+        public TaskDD dd;
+    }
+    
+    public final Map<String, QName> tasksMap = new HashMap<String, QName>();
+    public final Map<QName, TaskInfo> tasks = new HashMap<QName, TaskInfo>();
+    private HISEDao hiseDao;
+    
+    public HISEDao getHiseDao() {
+        return hiseDao;
+    }
+
+    public void setHiseDao(HISEDao hiseDao) {
+        this.hiseDao = hiseDao;
+    }
+
+    public static QName getCanonicalQName(QName q) {
+        String ns = q.getNamespaceURI();
+        ns = ns.endsWith("/") ? ns.substring(0, ns.length() - 1) : ns;
+        return new QName(ns, q.getLocalPart());
+    }
+    
+    public static String tasksKey(QName portType, String operation) {
+        return getCanonicalQName(portType) + ";" + operation; 
+    }
+
+    public void registerTask(TaskInfo ti) {
+        log.debug("registering route " + ti.taskKey + " -> " + ti.taskDefinition.getTaskName());
+        
+        if (tasks.containsKey(ti.taskDefinition.getTaskName()) || tasksMap.containsKey(ti.taskKey)) {
+            throw new IllegalArgumentException("Unable to deploy " + ti + " is already deployed.");
+        }
+        
+        tasksMap.put(ti.taskKey, ti.taskDefinition.getTaskName());
+        tasks.put(ti.taskDefinition.getTaskName(), ti);
+        
+        log.debug("registered");
+    }
+    
+    public TaskDefinition getTaskDefinition(QName taskName) {
+        Validate.notNull(tasks.get(taskName), "" + taskName + " not found");
+        return tasks.get(taskName).taskDefinition;
+    }
+    
+    public QName getTaskName(QName portType, String operation) {
+        QName n = tasksMap.get(tasksKey(portType, operation));
+        Validate.notNull(n, "Task for " + portType + " " + operation + " not found in routing table.");
+        return n;
+    }
+    
+    public Node receive(QName portType, String operation, Element body, String createdBy, Node requestHeader) {
+        QName taskName = getTaskName(portType, operation);
+        assert(taskName != null);
+        log.debug("routed " + portType + " " + operation + " -> " + taskName);
+        Task t = Task.create(this, getTaskDefinition(taskName), createdBy, DOMUtils.getFirstElement(body), requestHeader);
+        return t.getTaskEvaluator().evaluateApproveResponseHeader();
+    }
+    
+    public void sendResponse(QName taskName, Node body, Node epr) {
+        TaskInfo ti = tasks.get(taskName);
+        log.debug("sending response for " + taskName + " to " + DOMUtils.domToString(epr) + " body " + DOMUtils.domToString(body) + " " + ti.dd.sender);
+        HISEJaxWSClient c = (HISEJaxWSClient) ti.dd.sender;
+        log.debug("result: " + c.invoke(body, epr));
+    }
+    
+    
+    public void executeJob(Job job) {
+        Task t = Task.load(this, job.getTask().getId());
+        try {
+            t.setCurrentJob(job);
+            t.getClass().getMethod(job.getAction() + "JobAction").invoke(t);
+        } catch (Exception e) {
+            throw new RuntimeException("timer job failed", e);
+        }
+    }
+    
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public Task createTask(QName taskName, String createdBy, String requestXml) {
+//
+//        Validate.notNull(taskName);
+//        Validate.notNull(requestXml);
+//        
+//        log.info("Creating task: " + taskName + " , createdBy: " + createdBy);
+//
+//        TaskDefinition taskDefinition = getTaskDefinition(taskName);
+//
+//        Task newTask = new Task();
+//        newTask.init(taskDefinition, createdBy, requestXml);
+//        return newTask;
+//    }
+
+//    /**
+//     * {@inheritDoc}
+//     */
+//    public List<org.apache.hise.dao.Task> getMyTasks(String personName, TaskTypes taskType, GenericHumanRole genericHumanRole, String workQueue, List<org.apache.hise.dao.Task.Status> statuses,
+//            String whereClause, String orderByClause, String createdOnClause, Integer maxTasks, Integer offset) {
+//
+//        Person person = null;
+//
+//        EntityManager em = entityManagerFactory.createEntityManager();
+//        if (workQueue == null) {
+//            person = new AssigneeDao(em).getPerson(personName);
+//        }
+//
+//        return new TaskDao(em).getTasks(person, taskType, genericHumanRole, workQueue, statuses,
+//                whereClause, orderByClause, createdOnClause, maxTasks, offset);
+//    }
+    
+//    public Person loadUser(String userId, EntityManager em) {
+//        return new AssigneeDao(em).getPerson(userId);
+//    }
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/HISEEngine.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/Scheduler.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/Scheduler.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/Scheduler.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/Scheduler.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,71 @@
+package org.apache.hise.engine;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hise.dao.Job;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallback;
+import org.springframework.transaction.support.TransactionTemplate;
+
+public class Scheduler {
+    private static Log __log = LogFactory.getLog(Scheduler.class);
+    
+    private HISEEngine hiseEngine;
+    private ScheduledExecutorService executor;
+    private PlatformTransactionManager transactionManager;
+    
+    private class CheckJobs implements Runnable {
+
+        public void run() {
+            Date currentEventDateTime = Calendar.getInstance().getTime();
+            __log.debug("scheduler CheckJobs at " + currentEventDateTime);
+            List<Job> jobs = hiseEngine.getHiseDao().listJobs(currentEventDateTime, 50);
+            __log.debug("jobs: " + jobs);
+
+            for (Job j : jobs) {
+                try {
+                    final Job j2 = j;
+                    TransactionTemplate t = new TransactionTemplate(transactionManager);
+                    t.execute(new TransactionCallback() {
+
+                        public Object doInTransaction(TransactionStatus ts) {
+                            __log.debug("Executing job " + j2);
+                            hiseEngine.executeJob(j2);
+                            hiseEngine.getHiseDao().remove(j2);
+                            return null;
+                        }
+                        
+                    });
+                } catch (Throwable t) {
+                    __log.warn("Job execution failed " + j, t);
+                }
+            }
+        }
+    }
+    
+    public void init() {
+        executor = Executors.newSingleThreadScheduledExecutor();
+        executor.scheduleWithFixedDelay(new CheckJobs(), 10000, 10000, TimeUnit.MILLISECONDS);
+    }
+    
+    
+    public HISEEngine getHiseEngine() {
+        return hiseEngine;
+    }
+
+    public void setHiseEngine(HISEEngine hiseEngine) {
+        this.hiseEngine = hiseEngine;
+    }
+
+    public void destroy() {
+        executor.shutdown();
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/Scheduler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/HISEJaxWSClient.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/HISEJaxWSClient.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/HISEJaxWSClient.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/HISEJaxWSClient.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,81 @@
+package org.apache.hise.engine.jaxws;
+
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.Service;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import org.apache.commons.lang.Validate;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.hise.utils.XQueryEvaluator;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+public class HISEJaxWSClient {
+    private static Log __log = LogFactory.getLog(HISEJaxWSClient.class);
+    
+    private MessageFactory messageFactory;
+    
+    URL wsdlDocumentLocation;
+    QName serviceName;
+    
+    private Service destinationService;
+    private QName destinationPort;
+    private XQueryEvaluator evaluator = new XQueryEvaluator();
+    
+    public void init() throws Exception {
+        messageFactory = MessageFactory.newInstance();
+        destinationService = Service.create(wsdlDocumentLocation, serviceName);
+        destinationPort = null;
+        {
+            Iterator<QName> it = destinationService.getPorts();
+            while (it.hasNext()) {
+                QName p = it.next();
+                System.out.println(p);
+                destinationPort = p;
+            }
+        }
+        Validate.notNull(destinationPort, "Can't find port for service " + serviceName + " in " + wsdlDocumentLocation);
+    }
+    
+    public void setWsdlDocumentLocation(URL wsdlDocumentLocation) {
+        this.wsdlDocumentLocation = wsdlDocumentLocation;
+    }
+
+    public void setServiceName(QName serviceName) {
+        this.serviceName = serviceName;
+    }
+
+    public String getAddressFromEpr(Node epr) {
+        return (String) evaluator.evaluateExpression("declare namespace wsa=\"http://www.w3.org/2005/08/addressing\"; string(wsa:EndpointReference/wsa:Address)", epr).get(0);
+    }
+
+    public Node invoke(Node message, Node epr) {
+        try {            
+            String address = getAddressFromEpr(epr);
+            
+            Dispatch<SOAPMessage> dispatch = destinationService.createDispatch(destinationPort, SOAPMessage.class, Service.Mode.MESSAGE);
+            __log.debug("sending to address " + address);
+            dispatch.getRequestContext().put(Dispatch.ENDPOINT_ADDRESS_PROPERTY, address);
+            
+            SOAPMessage m;
+            m = messageFactory.createMessage();
+            Document doc = m.getSOAPBody().getOwnerDocument();
+            m.getSOAPBody().appendChild(doc.importNode(message, true));
+            return dispatch.invoke(m).getSOAPBody();
+        } catch (SOAPException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/HISEJaxWSClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/HISEJaxWSService.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/HISEJaxWSService.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/HISEJaxWSService.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/HISEJaxWSService.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+package org.apache.hise.engine.jaxws;
+
+import javax.annotation.Resource;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceException;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hise.engine.HISEEngine;
+import org.springframework.orm.jpa.JpaCallback;
+import org.springframework.orm.jpa.JpaTemplate;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.support.TransactionCallback;
+import org.springframework.transaction.support.TransactionTemplate;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+@WebServiceProvider
+@ServiceMode(value = Service.Mode.MESSAGE)
+public class HISEJaxWSService implements Provider<SOAPMessage> {
+    private static Log __log = LogFactory.getLog(HISEJaxWSService.class);
+
+    private HISEEngine hiseEngine;
+    private WebServiceContext context;
+    private JpaTransactionManager transactionManager;
+    private MessageFactory messageFactory;
+    private TransactionTemplate transactionTemplate;
+
+    public HISEJaxWSService() throws Exception {
+        messageFactory = MessageFactory.newInstance();
+    }
+
+    public void init() {
+        transactionTemplate = new TransactionTemplate(transactionManager);
+    }
+    
+    public void setHiseEngine(HISEEngine hiseEngine) {
+        this.hiseEngine = hiseEngine;
+    }
+
+    public WebServiceContext getContext() {
+        return context;
+    }
+
+    public void setTransactionManager(JpaTransactionManager transactionManager) {
+        this.transactionManager = transactionManager;
+    }
+
+    @Resource
+    public void setContext(WebServiceContext context) {
+        this.context = context;
+    }
+
+    public SOAPMessage invoke(final SOAPMessage request) {
+        return (SOAPMessage) transactionTemplate.execute(new TransactionCallback() {
+            public Object doInTransaction(TransactionStatus arg0) {
+                try {
+                    // TransactionStatus tx = transactionManager.getTransaction(new DefaultTransactionDefinition());
+                    assert transactionManager.isValidateExistingTransaction();
+                    MessageContext c = context.getMessageContext();
+                    Object operationInfo = c.get("org.apache.cxf.service.model.OperationInfo");
+                    QName operation = (QName) operationInfo.getClass().getMethod("getName").invoke(operationInfo);
+                    QName portType = (QName) c.get("javax.xml.ws.wsdl.interface");
+                    QName operation2 = (QName) c.get("javax.xml.ws.wsdl.operation");
+
+                    Element body = request.getSOAPBody();
+                    __log.debug("invoking " + request + " operation:" + operation + " portType:" + portType + " operation2:" + operation2);
+                    Node approveResponseHeader = hiseEngine.receive(portType, operation.getLocalPart(), body, context.getUserPrincipal().getName(), request.getSOAPHeader());
+                    SOAPMessage m = messageFactory.createMessage();
+                    
+                    Document doc = m.getSOAPHeader().getOwnerDocument();
+                    m.getSOAPHeader().appendChild(doc.importNode(approveResponseHeader, true));
+                    return m;
+                } catch (Exception e) {
+                    throw new RuntimeException("Error during receiving message ", e);
+                }
+            }
+        });
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/HISEJaxWSService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,416 @@
+/*
+ * 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.
+ */
+
+package org.apache.hise.engine.jaxws;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.hise.dao.GenericHumanRole;
+import org.apache.hise.dao.OrgEntity;
+import org.apache.hise.dao.TaskOrgEntity;
+import org.apache.hise.engine.HISEEngine;
+import org.apache.hise.engine.wsdl.IllegalAccessFault;
+import org.apache.hise.engine.wsdl.IllegalArgumentFault;
+import org.apache.hise.engine.wsdl.IllegalOperationFault;
+import org.apache.hise.engine.wsdl.IllegalStateFault;
+import org.apache.hise.engine.wsdl.RecipientNotAllowed;
+import org.apache.hise.engine.wsdl.TaskOperations;
+import org.apache.hise.lang.xsd.htd.TOrganizationalEntity;
+import org.apache.hise.lang.xsd.htda.TAttachment;
+import org.apache.hise.lang.xsd.htda.TAttachmentInfo;
+import org.apache.hise.lang.xsd.htda.TComment;
+import org.apache.hise.lang.xsd.htda.TStatus;
+import org.apache.hise.lang.xsd.htda.TTask;
+import org.apache.hise.lang.xsd.htda.TTaskAbstract;
+import org.apache.hise.lang.xsd.htda.TTaskQueryResultSet;
+import org.apache.hise.lang.xsd.htdt.TTime;
+import org.apache.hise.runtime.Task;
+import org.springframework.beans.BeanUtils;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Implementation of WS-HT API. Operations are executed by end users, i.e. actual or potential owners. The identity of the user is implicitly passed when invoking any of the operations listed in the table below. The participant operations listed below only apply to tasks unless explicitly noted otherwise. The authorization column indicates people of which roles are authorized to perform the operation. Stakeholders of the task are not mentioned explicitly. They have the same authorization rights as business administrators.
+ * 
+ * @author Witek Wołejszo
+ * @author Warren Crossing
+ */
+@Transactional
+@WebService
+public class TaskOperationsImpl implements TaskOperations {
+
+    private HISEEngine hiseEngine;
+
+    private WebServiceContext context;
+
+    public TaskOperationsImpl()  {
+    }
+    
+    public void init() throws Exception {
+        context = (WebServiceContext) Class.forName("org.apache.cxf.jaxws.context.WebServiceContextImpl").newInstance();
+    }
+
+    public void setHiseEngine(HISEEngine hiseEngine) {
+        this.hiseEngine = hiseEngine;
+    }
+
+//    @Resource
+//    public void setContext(WebServiceContext context) {
+//        this.context = context;
+//    }
+
+    protected String getUserString() {
+        return context.getUserPrincipal().getName();
+    }
+    
+    protected OrgEntity loadUser() {
+        return hiseEngine.getHiseDao().getOrgEntity(getUserString());
+    }
+    
+    public void claim(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+        Task task = Task.load(hiseEngine, Long.valueOf(identifier));
+        task.claim(loadUser());
+    }
+
+    public List<org.apache.hise.lang.xsd.htda.TTask> getMyTasks(String taskType, String genericHumanRole, String workQueue, List<TStatus> status, String whereClause, String createdOnClause, Integer maxTasks) throws IllegalArgumentFault, IllegalStateFault {
+        List<org.apache.hise.lang.xsd.htda.TTask> l = new ArrayList<org.apache.hise.lang.xsd.htda.TTask>();
+        OrgEntity user = loadUser();
+        List<org.apache.hise.dao.Task> k = hiseEngine.getHiseDao().getUserTasks(user, taskType, GenericHumanRole.valueOf(genericHumanRole), workQueue, status, whereClause, createdOnClause, maxTasks);
+        for (org.apache.hise.dao.Task u : k) {
+            TTask t = convertTask(u);
+            l.add(t);
+        }
+        return l;
+    }
+
+    // private void translateIllegalStateException(HTException xHT) throws IllegalStateFault {
+    // if (xHT instanceof org.apache.hise.lang.faults.HTIllegalStateException) {
+    // IllegalState state = new IllegalState();
+    //
+    // state.setStatus(translateStatusAPI(((org.apache.hise.lang.faults.HTIllegalStateException)xHT).getExceptionInfo()));
+    // throw new IllegalStateFault(xHT.getMessage(), state, xHT);
+    // }
+    // }
+    //
+    // private void translateIllegalAccessException(HTException xHT) throws IllegalAccessFault {
+    // if (xHT instanceof org.apache.hise.lang.faults.HTIllegalAccessException) {
+    // throw new IllegalAccessFault(xHT.getMessage(), ((org.apache.hise.lang.faults.HTIllegalAccessException)xHT).getExceptionInfo(), xHT);
+    // }
+    // }
+    //
+    // private void translateIllegalOperationException(HTException xHT) throws IllegalOperationFault {
+    // if (xHT instanceof org.apache.hise.lang.faults.HTIllegalOperationException) {
+    // throw new IllegalOperationFault(xHT.getMessage(), ((HTIllegalOperationException) xHT).getExceptionInfo(), xHT);
+    // }
+    // }
+    //
+    // private void translateIllegalArgumentException(HTException xHT) throws IllegalArgumentFault {
+    // if (xHT instanceof org.apache.hise.lang.faults.HTIllegalArgumentException) {
+    // throw new IllegalArgumentFault(xHT.getMessage(), ((org.apache.hise.lang.faults.HTIllegalArgumentException) xHT).getExceptionInfo(), xHT);
+    // }
+    // }
+    //
+    // private void translateRecipientNotAllowedException(HTException xHT) throws RecipientNotAllowed {
+    // if (xHT instanceof org.apache.hise.lang.faults.HTRecipientNotAllowedException) {
+    // throw new RecipientNotAllowed(xHT.getMessage(), ((org.apache.hise.lang.faults.HTRecipientNotAllowedException) xHT).getExceptionInfo(), xHT);
+    // }
+    // }
+    //
+    // private Long translateTaskIdentifier(String identifier) throws HTIllegalArgumentException {
+    // if (null == identifier) {
+    // throw new org.apache.hise.lang.faults.HTIllegalArgumentException("Must specific a Task id.","Id");
+    // }
+    //
+    // try {
+    // return Long.valueOf(identifier);
+    // } catch (NumberFormatException xNF) {
+    // throw new HTIllegalArgumentException("Task identifier must be a number.", "Id: " + identifier);
+    // }
+    // }
+
+    // /**
+    // * Translates a single task to TTask.
+    // *
+    // * @param task The input task object.
+    // * @return The Human Task WebService API task object.
+    // */
+    // private org.apache.hise.lang.xsd.htda.TTask translateOneTaskAPI(Task task) {
+    // org.apache.hise.lang.xsd.htda.TTask ttask = new org.apache.hise.lang.xsd.htda.TTask();
+    //
+    // ttask.setId(Long.toString(task.getId()));
+    // ttask.setTaskType("TASK");
+    // ttask.setName(task.getTaskName());
+    // ttask.setStatus(this.translateStatusAPI(task.getStatus()));
+    // ttask.setCreatedOn(task.getCreatedOn());
+    // /*
+    // ttask.setPriority(task.getPriority());
+    // */
+    // //ttask.setTaskInitiator(task.getCreatedBy());
+    // /*ttask.setTaskStakeholders(task.getTaskStakeholders());
+    // ttask.setPotentialOwners(task.getPotentialOwners());
+    // ttask.setBusinessAdministrators(task.getBusinessAdministrators());
+    // ttask.setActualOwner(task.getActualOwner());
+    // ttask.setNotificationRecipients(task.getNotificationRecipients());
+    // */
+    // ttask.setCreatedBy(task.getCreatedBy().toString());
+    // ttask.setActivationTime(task.getActivationTime());
+    // ttask.setExpirationTime(task.getExpirationTime());
+    // ttask.setIsSkipable(task.isSkippable());
+    // /*ttask.setHasPotentialOwners(task.getHasPotentialOwners());
+    // ttask.setStartByExists(task.getStartByExists());
+    // ttask.setCompleteByExists(task.getCompleteByExists());
+    // ttask.setPresentationName(task.getPresentationName());
+    // ttask.setPresentationSubject(task.getPresentationSubject());
+    // ttask.setRenderingMethodExists(task.getRenderingMethodExists());
+    // ttask.setHasOutput(task.getHasOutput());
+    // */
+    //
+    // //TODO implement cjeck
+    // //ttask.setHasFault(null != task.getFault());
+    // ttask.setHasFault(false);
+    //
+    // ttask.setHasAttachments(!task.getAttachments().isEmpty());
+    // //ttask.setHasComments(!task.getComments().isEmpty());
+    //
+    // ttask.setEscalated(task.isEscalated());
+    // return ttask;
+    // }
+
+    // private List<org.apache.hise.lang.xsd.htda.TTask> translateTaskAPI(List<Task> in) {
+    // List<org.apache.hise.lang.xsd.htda.TTask> result = new ArrayList<org.apache.hise.lang.xsd.htda.TTask>();
+    // for (Task task : in) {
+    // result.add(this.translateOneTaskAPI(task));
+    // }
+    // return result;
+    // }
+
+    // private List<Task.Status> translateStatusAPI(List<TStatus> in) {
+    // List<Task.Status> result = new ArrayList<Task.Status>();
+    // for (TStatus status : in) {
+    // result.add(Task.Status.fromValue(in.toString()));
+    // }
+    //
+    // return result;
+    // }
+
+    // private TStatus translateStatusAPI(Task.Status in) {
+    // return TStatus.fromValue(in.toString());
+    // }
+    
+    private static TTask convertTask(org.apache.hise.dao.Task u) {
+        TTask t = new TTask();
+        t.setId("" + u.getId());
+        t.setTaskType(u.isNotification() ? "NOTIFICATION" : "TASK");
+        t.setCreatedOn(u.getCreatedOn());
+        t.setActivationTime(u.getActivationTime());
+        if (u.getActualOwner() != null) t.setActualOwner(u.getActualOwner().getName());
+        t.setCreatedBy(u.getCreatedBy());
+        t.setName(u.getTaskDefinitionName());
+        t.setStatus(TStatus.valueOf(u.getStatus().toString()));
+        return t;
+    }
+
+    public org.apache.hise.lang.xsd.htda.TTask getTaskInfo(String identifier) throws IllegalArgumentFault {
+        return convertTask(hiseEngine.getHiseDao().loadTask(Long.parseLong(identifier)));
+    }
+
+    public TTaskQueryResultSet query(String selectClause, String whereClause, String orderByClause, Integer maxTasks, Integer taskIndexOffset) throws IllegalArgumentFault, IllegalStateFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void release(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+        OrgEntity user = loadUser();
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        t.release(user);
+    }
+
+    public void start(String identifier) throws IllegalArgumentFault, IllegalStateFault, IllegalAccessFault {
+        OrgEntity user = loadUser();
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        t.start(user);
+    }
+
+    public void activate(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void addAttachment(String identifier, String name, String accessType, Object attachment) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void addComment(String identifier, String text) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void complete(String identifier, Object taskData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        OrgEntity user = loadUser();
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        t.complete(user);
+    }
+
+    public void delegate(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, RecipientNotAllowed, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void deleteAttachments(String identifier, String attachmentName) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void deleteFault(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void deleteOutput(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void fail(String identifier, String faultName, Object faultData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault, IllegalOperationFault {
+        OrgEntity user = loadUser();
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        t.fail(user);
+    }
+
+    public void forward(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        t.forward(organizationalEntity);
+    }
+
+    public List<TAttachmentInfo> getAttachmentInfos(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<TAttachment> getAttachments(String identifier, String attachmentName) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<TComment> getComments(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void getFault(String identifier, Holder<String> faultName, Holder<Object> faultData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault, IllegalOperationFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public Object getInput(String identifier, String part) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<TTaskAbstract> getMyTaskAbstracts(String taskType, String genericHumanRole, String workQueue, List<TStatus> status, String whereClause, String createdOnClause, Integer maxTasks) throws IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Object getOutput(String identifier, String part) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Object getRendering(Object identifier, QName renderingType) throws IllegalArgumentFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<QName> getRenderingTypes(Object identifier) throws IllegalArgumentFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getTaskDescription(String identifier, String contentType) throws IllegalArgumentFault {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void nominate(String identifier, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void remove(String identifier) throws IllegalAccessFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void resume(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        OrgEntity user = loadUser();
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        t.resume(user);
+    }
+
+    public void setFault(String identifier, String faultName, Object faultData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault, IllegalOperationFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setGenericHumanRole(String identifier, String genericHumanRole, TOrganizationalEntity organizationalEntity) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setOutput(String identifier, String part, Object taskData) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void setPriority(String identifier, BigInteger priority) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void skip(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault, IllegalOperationFault {
+        // TODO Auto-generated method stub
+    }
+
+    public void stop(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        OrgEntity user = loadUser();
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        t.stop(user);
+    }
+
+    public void suspend(String identifier) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        OrgEntity user = loadUser();
+        Task t = Task.load(hiseEngine, Long.parseLong(identifier));
+        t.suspend(user);
+    }
+
+    public void suspendUntil(String identifier, TTime time) throws IllegalAccessFault, IllegalStateFault, IllegalArgumentFault {
+        // TODO Auto-generated method stub
+
+    }
+
+}
\ No newline at end of file

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TaskOperationsImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TransactionHandler.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TransactionHandler.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TransactionHandler.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TransactionHandler.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+package org.apache.hise.engine.jaxws;
+
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.DefaultTransactionDefinition;
+
+/**
+ * Adds transactions support for in-out web services.
+ * This is workaround for not working @Transactional + @Resource web services.
+ */
+public class TransactionHandler implements Handler<MessageContext> {
+    private static Log __log = LogFactory.getLog(TransactionHandler.class);
+    public static final String TRANSACTION = "org.apache.hise.transaction";
+    
+    private JpaTransactionManager transactionManager;
+
+    public void setTransactionManager(JpaTransactionManager transactionManager) {
+        this.transactionManager = transactionManager;
+    }
+
+    public void close(MessageContext arg0) {
+        __log.debug("closed");
+    }
+
+    public boolean handleFault(MessageContext arg0) {
+        __log.debug("handleFault");
+        assert Boolean.TRUE.equals(arg0.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
+        TransactionStatus tx = (TransactionStatus) arg0.get(TRANSACTION); 
+        arg0.put(TRANSACTION, null);
+        if (tx != null) {
+            transactionManager.commit(tx);
+        }
+        return true;
+    }
+
+    public boolean handleMessage(MessageContext arg0) {
+        __log.debug("handleMessage outbound:" + arg0.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY));
+        
+        if (Boolean.FALSE.equals(arg0.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY))) {
+            TransactionStatus tx = transactionManager.getTransaction(new DefaultTransactionDefinition());
+            assert transactionManager.isValidateExistingTransaction();
+            arg0.put(TRANSACTION, tx);
+        } else {
+            TransactionStatus tx = (TransactionStatus) arg0.get(TRANSACTION); 
+            arg0.put(TRANSACTION, null);
+            assert tx != null;
+            transactionManager.commit(tx);
+        }
+        return true;
+    }
+
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/jaxws/TransactionHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/CompileException.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/CompileException.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/CompileException.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/CompileException.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,10 @@
+package org.apache.hise.engine.store;
+
+public class CompileException extends Exception {
+    private static final long serialVersionUID = 1L;
+
+    public CompileException(String arg0, Throwable arg1) {
+        super(arg0, arg1);
+    }
+    
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/CompileException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HISEDD.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HISEDD.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HISEDD.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HISEDD.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,26 @@
+package org.apache.hise.engine.store;
+
+import java.util.List;
+
+import org.springframework.core.io.Resource;
+
+public class HISEDD {
+    private List<TaskDD> tasksDI;
+    private Resource humanInteractionsResource;
+
+    public List<TaskDD> getTasksDI() {
+        return tasksDI;
+    }
+
+    public void setTasksDI(List<TaskDD> tasksDI) {
+        this.tasksDI = tasksDI;
+    }
+
+    public Resource getHumanInteractionsResource() {
+        return humanInteractionsResource;
+    }
+
+    public void setHumanInteractionsResource(Resource humanInteractionsResource) {
+        this.humanInteractionsResource = humanInteractionsResource;
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HISEDD.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HISEDeployer.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HISEDeployer.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HISEDeployer.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HISEDeployer.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,43 @@
+package org.apache.hise.engine.store;
+
+import org.apache.commons.lang.Validate;
+import org.apache.hise.engine.HISEEngine;
+import org.apache.hise.engine.HISEEngine.TaskInfo;
+import org.apache.hise.lang.HumanInteractions;
+import org.apache.hise.lang.TaskDefinition;
+
+public class HISEDeployer {
+    public HISEEngine hiseEngine;
+    public HISEDD deploymentInfo;
+    
+    public void init() throws CompileException {
+        deploy(deploymentInfo);
+    }
+    
+    public void deploy(HISEDD di) throws CompileException {
+        HumanInteractions tasks = HumanInteractionsCompiler.compile(di.getHumanInteractionsResource());
+        
+        for (TaskDD t : di.getTasksDI()) {
+            TaskDefinition d = tasks.getTaskDefinitions().get(t.getTaskName());
+            Validate.notNull(d, "Can't find Task name specified in deployment descriptor " + t.getTaskName());
+            TaskInfo ti = new HISEEngine.TaskInfo();
+            ti.dd = t;
+            ti.parent = di;
+            ti.taskKey = HISEEngine.tasksKey(d.getInterface().getPortType(), d.getInterface().getOperation());
+            ti.taskDefinition = d;
+            hiseEngine.registerTask(ti);
+        }
+    }
+
+    public void setHiseEngine(HISEEngine hiseEngine) {
+        this.hiseEngine = hiseEngine;
+    }
+
+    public HISEDD getDeploymentInfo() {
+        return deploymentInfo;
+    }
+
+    public void setDeploymentInfo(HISEDD deploymentInfo) {
+        this.deploymentInfo = deploymentInfo;
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HISEDeployer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HumanInteractionsCompiler.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HumanInteractionsCompiler.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HumanInteractionsCompiler.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HumanInteractionsCompiler.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ */
+
+package org.apache.hise.engine.store;
+
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.commons.lang.Validate;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hise.lang.HumanInteractions;
+import org.apache.hise.lang.TaskDefinition;
+import org.apache.hise.lang.xsd.htd.TGenericHumanRole;
+import org.apache.hise.lang.xsd.htd.THumanInteractions;
+import org.apache.hise.lang.xsd.htd.TTask;
+import org.apache.hise.utils.DOMUtils;
+import org.springframework.core.io.Resource;
+import org.w3c.dom.Document;
+
+public class HumanInteractionsCompiler {
+    private static final Log log = LogFactory.getLog(HumanInteractionsCompiler.class);
+
+    private Map<String, String> xmlNamespaces;
+
+    private HumanInteractionsCompiler() {
+    }
+
+    public static HumanInteractions compile(Resource resource) throws CompileException {
+        Validate.notNull(resource, "Specified resource is null");
+        try {
+            HumanInteractionsCompiler c = new HumanInteractionsCompiler();
+            log.debug("compiling " + resource);
+            return c.compile2(resource);
+        } catch (Exception e) {
+            throw new CompileException("Compile error for " + resource, e);
+        }
+    }
+
+    private HumanInteractions compile2(Resource resource) throws Exception {
+        Validate.notNull(resource);
+
+        Resource htdXml = resource;
+        THumanInteractions hiDoc;
+        {
+            JAXBContext jaxbContext = JAXBContext.newInstance("org.apache.hise.lang.xsd.htd");
+            Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+            DocumentBuilderFactory f = DOMUtils.getDocumentBuilderFactory();
+            f.setNamespaceAware(true);
+            DocumentBuilder b = f.newDocumentBuilder();
+            Document d = b.parse(htdXml.getInputStream());
+            hiDoc = ((JAXBElement<THumanInteractions>) unmarshaller.unmarshal(d)).getValue();
+        }
+
+        HumanInteractions humanInteractions = new HumanInteractions();
+
+        for (TTask tTask : hiDoc.getTasks().getTask()) {
+            TaskDefinition taskDefinition = new TaskDefinition(tTask, this.xmlNamespaces, hiDoc.getTargetNamespace());
+            compileTaskDef(taskDefinition);
+            
+            QName name = taskDefinition.getTaskName();
+            if (humanInteractions.getTaskDefinitions().containsKey(name)) {
+                throw new RuntimeException("Duplicate task found, name: " + name + " resource: " + resource);
+            }
+            humanInteractions.getTaskDefinitions().put(name, taskDefinition);
+        }
+
+        return humanInteractions;
+    }
+
+    void compileTaskDef(TaskDefinition t) {
+        for (JAXBElement<TGenericHumanRole> e: t.gettTask().getPeopleAssignments().getGenericHumanRole()) {
+            log.debug(e);
+        }
+    }
+    
+    // /**
+    // * Creates HumanInteractions instance, passing DOM Document instance to its constructor.
+    // *
+    // * @param htdXml
+    // * @return
+    // * @throws IOException
+    // * @throws ParserConfigurationException
+    // * @throws SAXException
+    // */
+    // private HumanInteractions createHumanIteractionsInstance(Resource htdXml) throws Exception {
+    // InputStream is;
+    //
+    // // dom
+    // is = htdXml.getInputStream();
+    //
+    // DocumentBuilderFactory factory = DOMUtils.getDocumentBuilderFactory();
+    // factory.setNamespaceAware(true);
+    //
+    // DocumentBuilder builder = factory.newDocumentBuilder();
+    // Document document = builder.parse(is);
+    //
+    // return new HumanInteractions(document, this.peopleQuery);
+    // return null;
+    // }
+    //
+    // /**
+    // * Just a very simple, stub org.apache.hise.model.spec.PeopleQuery implementation, which simply creates Assignee instances with a given name.
+    // *
+    // * @param logicalPeopleGroupName
+    // * the logical people group name
+    // * @param input
+    // * the input message that created the task
+    // * @return collection of assignees.
+    // */
+    // public List<Assignee> evaluate(String logicalPeopleGroupName, Map<String, Message> input) {
+    // List<Assignee> assignees = new ArrayList<Assignee>();
+    // Group group = new Group();
+    // group.setName(logicalPeopleGroupName);
+    // assignees.add(group);
+    // return assignees;
+    // }
+
+    // public QName getTaskName(QName portType, String operation) {
+    // return engine.tasksMap.get(HISEEngine.tasksKey(portType, operation));
+    // }
+
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/HumanInteractionsCompiler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/TaskDD.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/TaskDD.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/TaskDD.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/TaskDD.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,30 @@
+package org.apache.hise.engine.store;
+
+import javax.xml.namespace.QName;
+
+public class TaskDD {
+    public QName taskName;
+    public Object handler;
+    public Object sender;
+    
+    public QName getTaskName() {
+        return taskName;
+    }
+    public void setTaskName(QName taskName) {
+        this.taskName = taskName;
+    }
+    public Object getHandler() {
+        return handler;
+    }
+    public void setHandler(Object handler) {
+        this.handler = handler;
+    }
+    public Object getSender() {
+        return sender;
+    }
+    public void setSender(Object sender) {
+        this.sender = sender;
+    }
+    
+    
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/engine/store/TaskDD.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/HumanInteractions.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/HumanInteractions.java?rev=898994&r1=898993&r2=898994&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/HumanInteractions.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/HumanInteractions.java Wed Jan 13 23:20:54 2010
@@ -19,11 +19,10 @@
 
 package org.apache.hise.lang;
 
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 
-import org.apache.hise.api.HumanInteractionsManager;
-import org.apache.hise.api.PeopleQuery;
-import org.w3c.dom.Document;
+import javax.xml.namespace.QName;
 
 
 /**
@@ -36,43 +35,9 @@
  */
 public class HumanInteractions {
 
-    private Document document;
+    private final Map<QName, TaskDefinition> taskDefinitions = new HashMap<QName, TaskDefinition>();
 
-    private List<TaskDefinition> taskDefinitions;
-    
-    private PeopleQuery peopleQuery;
-
-    /**
-     * Private constructor to prevent instantiation.
-     */
-    private HumanInteractions() {
-    }
-
-    /**
-     * Constructor called by {@link HumanInteractionsManager implementation}.
-     * @param document the human interactions DOM document
-     * @param peopleQuery
-     */
-    public HumanInteractions(Document document, PeopleQuery peopleQuery) {
-        super();
-        this.setDocument(document);
-        this.peopleQuery = peopleQuery;
-    }
-
-    public void setTaskDefinitions(List<TaskDefinition> taskDefinitions) {
-        this.taskDefinitions = taskDefinitions;
-    }
-
-    public void setDocument(Document document) {
-        this.document = document;
-    }
-
-    public Document getDocument() {
-        return document;
-    }
-
-    public List<TaskDefinition> getTaskDefinitions() {
+    public Map<QName, TaskDefinition> getTaskDefinitions() {
         return taskDefinitions;
     }
-
 }

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java?rev=898994&r1=898993&r2=898994&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/lang/TaskDefinition.java Wed Jan 13 23:20:54 2010
@@ -19,36 +19,19 @@
 
 package org.apache.hise.lang;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
-import javax.xml.xpath.XPathConstants;
 
 import org.apache.commons.lang.Validate;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.hise.api.PeopleQuery;
-import org.apache.hise.api.TemplateEngine;
-import org.apache.hise.engine.RegexpTemplateEngine;
-import org.apache.hise.lang.faults.HTException;
-import org.apache.hise.runtime.Assignee;
-import org.apache.hise.runtime.GenericHumanRole;
-import org.apache.hise.runtime.Group;
-import org.apache.hise.runtime.Person;
-import org.apache.hise.runtime.Task;
-import org.apache.hise.utils.XmlUtils;
+import org.apache.hise.lang.xsd.htd.TFrom;
+import org.apache.hise.lang.xsd.htd.TLiteral;
+import org.apache.hise.lang.xsd.htd.TTask;
+import org.apache.hise.lang.xsd.htd.TTaskInterface;
+import org.apache.hise.utils.DOMUtils;
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import org.apache.hise.lang.xsd.htd.*;
 
 /**
  * Holds information about task version runnable in TouK Human Task engine. Task
@@ -62,16 +45,10 @@
  */
 public class TaskDefinition {
 
-    private final Log log = LogFactory.getLog(TaskDefinition.class);
-    
-    private TemplateEngine templateEngine;
-
-    private final PeopleQuery peopleQuery;
+    private static final Log log = LogFactory.getLog(TaskDefinition.class);
 
     private final TTask tTask;
 
-    private final boolean instantiable = true;
-    
     private String targetNamespace; 
     
     /**
@@ -81,19 +58,15 @@
 
     // ==================== CONSTRUCTOR =========================
 
-    public TaskDefinition(TTask taskDefinition, PeopleQuery peopleQuery, Map<String, String> xmlNamespaces, String targetNamespace) {
+    public TaskDefinition(TTask taskDefinition, Map<String, String> xmlNamespaces, String targetNamespace) {
 
         super();
 
         Validate.notNull(taskDefinition);
-        Validate.notNull(peopleQuery);
 
         this.tTask = taskDefinition;
-        this.peopleQuery = peopleQuery;
         this.xmlNamespaces = xmlNamespaces;
         this.targetNamespace = targetNamespace;
-        
-        this.templateEngine = new RegexpTemplateEngine();
     }
 
     
@@ -101,233 +74,224 @@
         return tTask.getInterface();
     }
     
-    /**
-     * Returns description of the Task.
-     * @param lang
-     * @param contentType
-     * @param task
-     * @return
-     */
-    public String getDescription(String lang, String contentType, Task task) {
-
-        Validate.notNull(lang);
-        Validate.notNull(contentType);
-        Validate.notNull(task);
-        
-        String descriptionTamplate = null;
-
-        List<TDescription> tDescriptions = this.tTask.getPresentationElements().getDescription();
-        for (TDescription x : tDescriptions) {
-            if (lang.equals(x.getLang()) && contentType.equals(x.getContentType())) {
-                descriptionTamplate = x.getContent().get(0).toString();
-                break;
-            }
-        }
-        
-        if (descriptionTamplate == null) {
-            return "error";
-        }
-
-        //retrieve presentation parameters
-        Map<String, Object> presentationParameters = task.getPresentationParameterValues();
-
-        return this.templateEngine.merge(descriptionTamplate, presentationParameters).trim();
-    }
-
-    /**
-     * Returns task's priority. 0 is the highest priority, larger numbers identify lower priorities.
-     * @param task  The task priority is evaluated for.
-     * @return      Priority or null if it is not specified.
-     */
-    public Integer getPriority(Task task) {
-        
-        Validate.notNull(task);
-        
-        if (this.tTask.getPriority() != null) {
-            String priorityXPath = this.tTask.getPriority().getContent().get(0).toString().trim();
-            Validate.notNull(priorityXPath);
-            
-            Double d = (Double) task.evaluateXPath(priorityXPath, XPathConstants.NUMBER);
-            
-            return d.intValue();
-        }
-        
-        return null;
-    }
     
-    /**
-     * Returns values of Task presentation parameters.
-     * @param task      The task presentation parameters values are evaluated for.
-     * @return          Map from parameter name to its value.
-     */
-    public Map<String, Object> getTaskPresentationParameters(Task task) {
-
-        Validate.notNull(task);
-
-        Map<String, Object> result = new HashMap<String, Object>();
-
-        List<TPresentationParameter> presentationParameters = this.tTask.getPresentationElements().getPresentationParameters().getPresentationParameter();
-
-        for(TPresentationParameter presentationParameter : presentationParameters) {
-
-            //TODO do not instantiate each time
-            QName returnType = new XmlUtils().getReturnType(presentationParameter.getType());
-            String parameterName = presentationParameter.getName().trim();
-            String parameterXPath = presentationParameter.getContent().get(0).toString().trim();
-            
-            Validate.notNull(returnType);
-            Validate.notNull(parameterName);
-            Validate.notNull(parameterXPath);
-
-            Object o = task.evaluateXPath(parameterXPath, returnType);
-
-            result.put(parameterName, o);
-        }
-
-        return result;
-    }
-
-    /**
-     * Evaluates assignees of generic human role.
-     * @param humanRoleName The generic human role.
-     * @param task          The task instance we evaluate assignees for.
-     * @return list of task assignees or empty list, when no assignments were made to this task.
-     */
-    public Set<Assignee> evaluateHumanRoleAssignees(GenericHumanRole humanRoleName, Task task) throws HTException {
-        
-        Validate.notNull(humanRoleName);
-        Validate.notNull(task);
-        
-        Set<Assignee> evaluatedAssigneeList = new HashSet<Assignee>();
-        
-        //look for logical people group
-        List<JAXBElement<TGenericHumanRole>> ghrList = this.tTask.getPeopleAssignments().getGenericHumanRole();
-        for (int i=0; i < ghrList.size(); i++) {
-            
-            JAXBElement<TGenericHumanRole> ghr = ghrList.get(i);
-            
-            if (ghr.getName().getLocalPart().equals(humanRoleName.toString())) {
-
-                if (ghr.getValue().getFrom() != null && ghr.getValue().getFrom().getLogicalPeopleGroup() != null) { 
-                    String logicalPeopleGroupName = ghr.getValue().getFrom().getLogicalPeopleGroup().toString();
-                    List<Assignee> peopleQueryResult = this.peopleQuery.evaluate(logicalPeopleGroupName, null);
-                    evaluatedAssigneeList.addAll(peopleQueryResult);
-                }
-            }
-        }
-
-        //look for literal
-        for (JAXBElement<TGenericHumanRole> ghr : this.tTask.getPeopleAssignments().getGenericHumanRole()) {
-
-            if (humanRoleName.toString().equals(ghr.getName().getLocalPart())) {
-                
-                //get extension element by localPart name
-                assert ghr.getValue().getFrom() != null;
-                log.debug(ghr.getValue().getFrom().getContent());
-                Element e = (Element) new XmlUtils().getElementByLocalPart(ghr.getValue().getFrom().getContent(), "literal");
-                if (e != null) {
-                    
-                    Node organizationalEntityNode = e.getFirstChild();
-                    
-                    try {
-                        
-                        JAXBContext jaxbContext = JAXBContext.newInstance("org.apache.hise.lang.xsd.htd");
-                        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
-                        //InputStream is = organizationalEntity
-                        JAXBElement<TOrganizationalEntity> organizationalEntity = (JAXBElement<TOrganizationalEntity>) unmarshaller.unmarshal(organizationalEntityNode);
-                        
-                        TGrouplist groupList =  organizationalEntity.getValue().getGroups();
-                        if (groupList != null) {
-                            for (String group : groupList.getGroup()) {
-                                evaluatedAssigneeList.add(new Group(group));
-                            }
-                        }
-                        
-                        TUserlist userList =  organizationalEntity.getValue().getUsers();
-                        if (userList != null) {
-                            for (String user : userList.getUser()) {
-                                evaluatedAssigneeList.add(new Person(user));
-                            }
-                        }
-                        
-                    } catch (JAXBException e2) {
-                        log.error(e2);
-                        throw  new HTException("Error evaluating human role for task: " + this.tTask.getName());
-                    }
-                }
-            }
-        }
-
-        return evaluatedAssigneeList;
-    }
-
-    /**
-     * TODO test
-     * Returns task's presentation name in a required language.
-     * @param lang subject language according ISO, e.g. en-US, pl, de-DE
-     * @return name
-     */
-    public String getName(String lang) {
-
-        Validate.notNull(lang);
-        
-        List<TText> tTexts = this.tTask.getPresentationElements().getName();
-        for (TText x : tTexts) {
-            if (lang.equals(x.getLang())) {
-                return x.getContent().get(0).toString();
-            }
-        }
-        
-        return "error";
-    }
-
-    /**
-     * Returns a task subject in a required language.
-     * @param lang subject language according ISO, e.g. en-US, pl, de-DE
-     * @param task The task subject value is evaluated for.
-     * @return subject
-     */
-    public String getSubject(String lang, Task task) {
-        
-        Validate.notNull(lang);
-        Validate.notNull(task);
-        
-        String subjectTemplate = null;
-
-        List<TText> tTexts = this.tTask.getPresentationElements().getSubject();
-        for (TText x : tTexts) {
-            if (lang.equals(x.getLang())) {
-                subjectTemplate = x.getContent().get(0).toString();
-                break;
-            }
-        }
-        
-        if (subjectTemplate == null) {
-            return "error";
-        }
-        
-        Map<String, Object> presentationParameterValues = task.getPresentationParameterValues();
-
-        return this.templateEngine.merge(subjectTemplate, presentationParameterValues).trim();
-    }
-
-    // ================ GETTERS + SETTERS ===================
-
-    public boolean getInstantiable() {
-        return this.instantiable;
-    }
+    
+//    /**
+//     * Returns description of the Task.
+//     * @param lang
+//     * @param contentType
+//     * @param task
+//     * @return
+//     */
+//    public String getDescription(String lang, String contentType, Task task) {
+//
+//        Validate.notNull(lang);
+//        Validate.notNull(contentType);
+//        Validate.notNull(task);
+//        
+//        String descriptionTamplate = null;
+//
+//        List<TDescription> tDescriptions = this.tTask.getPresentationElements().getDescription();
+//        for (TDescription x : tDescriptions) {
+//            if (lang.equals(x.getLang()) && contentType.equals(x.getContentType())) {
+//                descriptionTamplate = x.getContent().get(0).toString();
+//                break;
+//            }
+//        }
+//        
+//        if (descriptionTamplate == null) {
+//            return "error";
+//        }
+//
+//        //retrieve presentation parameters
+//        Map<String, Object> presentationParameters = task.getPresentationParameterValues();
+//
+//        return this.templateEngine.merge(descriptionTamplate, presentationParameters).trim();
+//    }
+
+//    /**
+//     * Returns task's priority. 0 is the highest priority, larger numbers identify lower priorities.
+//     * @param task  The task priority is evaluated for.
+//     * @return      Priority or null if it is not specified.
+//     */
+//    public Integer getPriority(Task task) {
+//        
+//        Validate.notNull(task);
+//        
+//        if (this.tTask.getPriority() != null) {
+//            return Integer.parseInt(task.evaluateExpression(tTask.getPriority()).toString());
+//        }
+//        
+//        return null;
+//    }
+//    /**
+//     * Returns values of Task presentation parameters.
+//     * @param task      The task presentation parameters values are evaluated for.
+//     * @return          Map from parameter name to its value.
+//     */
+//    public Map<String, Object> getTaskPresentationParameters(Task task) {
+//
+//        Validate.notNull(task);
+//
+//        Map<String, Object> result = new HashMap<String, Object>();
+//
+//        List<TPresentationParameter> presentationParameters = this.tTask.getPresentationElements().getPresentationParameters().getPresentationParameter();
+//
+//        for(TPresentationParameter presentationParameter : presentationParameters) {
+//
+//            //TODO do not instantiate each time
+//            QName returnType = new XmlUtils().getReturnType(presentationParameter.getType());
+//            String parameterName = presentationParameter.getName().trim();
+//            String parameterXPath = presentationParameter.getContent().get(0).toString().trim();
+//            
+//            Validate.notNull(returnType);
+//            Validate.notNull(parameterName);
+//            Validate.notNull(parameterXPath);
+//
+//            TExpression e = new TExpression();
+//            e.getContent().add(parameterXPath);
+//            Object o = task.evaluateExpression(e);
+//            result.put(parameterName, o);
+//        }
+//
+//        return result;
+//    }
+
+//    /**
+//     * Evaluates assignees of generic human role.
+//     * @param humanRoleName The generic human role.
+//     * @param task          The task instance we evaluate assignees for.
+//     * @return list of task assignees or empty list, when no assignments were made to this task.
+//     */
+//    public Set<Assignee> evaluateHumanRoleAssignees(GenericHumanRole humanRoleName, Task task) {
+//        
+//        Validate.notNull(humanRoleName);
+//        Validate.notNull(task);
+//        
+//        Set<Assignee> evaluatedAssigneeList = new HashSet<Assignee>();
+//        
+//        //look for logical people group
+//        List<JAXBElement<TGenericHumanRole>> ghrList = this.tTask.getPeopleAssignments().getGenericHumanRole();
+//        for (int i=0; i < ghrList.size(); i++) {
+//            
+//            JAXBElement<TGenericHumanRole> ghr = ghrList.get(i);
+//            
+//            if (ghr.getName().getLocalPart().equals(humanRoleName.toString())) {
+//
+//                if (ghr.getValue().getFrom() != null && ghr.getValue().getFrom().getLogicalPeopleGroup() != null) { 
+//                    String logicalPeopleGroupName = ghr.getValue().getFrom().getLogicalPeopleGroup().toString();
+//                    List<Assignee> peopleQueryResult = this.peopleQuery.evaluate(logicalPeopleGroupName, null);
+//                    evaluatedAssigneeList.addAll(peopleQueryResult);
+//                }
+//            }
+//        }
+//
+//        //look for literal
+//        for (JAXBElement<TGenericHumanRole> ghr : this.tTask.getPeopleAssignments().getGenericHumanRole()) {
+//
+//            if (humanRoleName.toString().equals(ghr.getName().getLocalPart())) {
+//                
+//                //get extension element by localPart name
+//                assert ghr.getValue().getFrom() != null;
+//                log.debug(ghr.getValue().getFrom().getContent());
+//                Element e = (Element) new XmlUtils().getElementByLocalPart(ghr.getValue().getFrom().getContent(), "literal");
+//                if (e != null) {
+//                    
+//                    Node organizationalEntityNode = e.getFirstChild();
+//                    
+//                    try {
+//                        
+//                        JAXBContext jaxbContext = JAXBContext.newInstance("org.apache.hise.lang.xsd.htd");
+//                        Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+//                        //InputStream is = organizationalEntity
+//                        JAXBElement<TOrganizationalEntity> organizationalEntity = (JAXBElement<TOrganizationalEntity>) unmarshaller.unmarshal(organizationalEntityNode);
+//                        
+//                        TGrouplist groupList =  organizationalEntity.getValue().getGroups();
+//                        if (groupList != null) {
+//                            for (String group : groupList.getGroup()) {
+//                                evaluatedAssigneeList.add(new Group(group));
+//                            }
+//                        }
+//                        
+//                        TUserlist userList =  organizationalEntity.getValue().getUsers();
+//                        if (userList != null) {
+//                            for (String user : userList.getUser()) {
+//                                evaluatedAssigneeList.add(new Person(user));
+//                            }
+//                        }
+//                        
+//                    } catch (JAXBException e2) {
+//                        log.error(e2);
+//                        throw  new RuntimeException("Error evaluating human role for task: " + this.tTask.getName());
+//                    }
+//                }
+//            }
+//        }
+//
+//        return evaluatedAssigneeList;
+//    }
+
+//    /**
+//     * TODO test
+//     * Returns task's presentation name in a required language.
+//     * @param lang subject language according ISO, e.g. en-US, pl, de-DE
+//     * @return name
+//     */
+//    public String getName(String lang) {
+//
+//        Validate.notNull(lang);
+//        
+//        List<TText> tTexts = this.tTask.getPresentationElements().getName();
+//        for (TText x : tTexts) {
+//            if (lang.equals(x.getLang())) {
+//                return x.getContent().get(0).toString();
+//            }
+//        }
+//        
+//        return "error";
+//    }
+//
+//    /**
+//     * Returns a task subject in a required language.
+//     * @param lang subject language according ISO, e.g. en-US, pl, de-DE
+//     * @param task The task subject value is evaluated for.
+//     * @return subject
+//     */
+//    public String getSubject(String lang, Task task) {
+//        
+//        Validate.notNull(lang);
+//        Validate.notNull(task);
+//        
+//        String subjectTemplate = null;
+//
+//        List<TText> tTexts = this.tTask.getPresentationElements().getSubject();
+//        for (TText x : tTexts) {
+//            if (lang.equals(x.getLang())) {
+//                subjectTemplate = x.getContent().get(0).toString();
+//                break;
+//            }
+//        }
+//        
+//        if (subjectTemplate == null) {
+//            return "error";
+//        }
+//        
+//        Map<String, Object> presentationParameterValues = task.getPresentationParameterValues();
+//
+//        return this.templateEngine.merge(subjectTemplate, presentationParameterValues).trim();
+//    }
 
     public QName getTaskName() {
-        return new QName(targetNamespace, this.tTask.getName());
+        return DOMUtils.uniqueQName(new QName(targetNamespace, this.tTask.getName()));
     }
 
-    public void setTemplateEngine(TemplateEngine templateEngine) {
-        this.templateEngine = templateEngine;
-    }
-    
     public TTask gettTask() {
         return tTask;
     }
+    
+    public String getOutcomeExpression() {
+        return tTask.getOutcome().getContent().get(0).toString();
+    }
 
     /**
      * Returns namespace URI for namespace registered in HumanInteractionsManager.
@@ -337,5 +301,4 @@
     public String getNamespaceURI(String prefix) {
         return this.xmlNamespaces == null ? null : this.xmlNamespaces.get(prefix);
     }
-
 }

Modified: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/DeadlineController.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/DeadlineController.java?rev=898994&r1=898993&r2=898994&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/DeadlineController.java (original)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/DeadlineController.java Wed Jan 13 23:20:54 2010
@@ -23,10 +23,10 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hise.dao.Task.Status;
 import org.apache.hise.lang.xsd.htd.TDeadline;
 import org.apache.hise.lang.xsd.htd.TDeadlines;
 import org.apache.hise.lang.xsd.htd.TExpression;
-import org.apache.hise.runtime.Task.Status;
 
 public class DeadlineController implements TaskStateListener {
     private static Log __log = LogFactory.getLog(DeadlineController.class);
@@ -53,7 +53,7 @@
     private void computeDeadlines(Task task, List<TDeadline> deadlines, boolean isCompletion) {
         for (TDeadline deadline : deadlines) {
             TExpression expr = deadline.getFor();
-            Object v = task.evaluateExpression(expr);
+            Object v = task.getTaskEvaluator().evaluateExpression(expr);
             __log.debug("deadline " + v);
         }
     }

Added: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/ResponseHandler.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/ResponseHandler.java?rev=898994&view=auto
==============================================================================
--- incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/ResponseHandler.java (added)
+++ incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/ResponseHandler.java Wed Jan 13 23:20:54 2010
@@ -0,0 +1,18 @@
+package org.apache.hise.runtime;
+
+import org.apache.hise.dao.Task.Status;
+
+public class ResponseHandler implements TaskStateListener {
+    
+    public void stateChanged(Task task, Status oldStatus, Status newStatus) {
+        boolean result = false;
+        if (newStatus.equals(Status.COMPLETED)) {
+            result = true;
+        } else if (newStatus.equals(Status.FAILED)) {
+            result = false;
+        } else return;
+        //TODO:impl
+//        task.get
+        
+    }
+}

Propchange: incubator/hise/trunk/hise-services/src/main/java/org/apache/hise/runtime/ResponseHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message