You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by vi...@apache.org on 2013/09/08 04:29:33 UTC

svn commit: r1520828 [3/5] - in /oozie/trunk: ./ core/src/main/java/org/apache/oozie/ core/src/main/java/org/apache/oozie/command/ core/src/main/java/org/apache/oozie/command/bundle/ core/src/main/java/org/apache/oozie/command/coord/ core/src/main/java...

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForInputCheckJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForInputCheckJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForInputCheckJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForInputCheckJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -0,0 +1,75 @@
+/**
+ * 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.oozie.executor.jpa;
+
+import java.util.Date;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Updates the action status, pending status, last modified time, actionXml and missingDependencies of CoordinatorAction and persists it.
+ * It executes SQL update query and return type is Void.
+ */
+public class CoordActionUpdateForInputCheckJPAExecutor implements JPAExecutor<Void> {
+
+    private CoordinatorActionBean coordAction = null;
+
+    public CoordActionUpdateForInputCheckJPAExecutor(CoordinatorActionBean coordAction) {
+        ParamChecker.notNull(coordAction, "coordAction");
+        this.coordAction = coordAction;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
+     * EntityManager)
+     */
+    @Override
+    public Void execute(EntityManager em) throws JPAExecutorException {
+        try {
+            Query q = em.createNamedQuery("UPDATE_COORD_ACTION_FOR_INPUTCHECK");
+            q.setParameter("id", coordAction.getId());
+            q.setParameter("status", coordAction.getStatus().toString());
+            q.setParameter("lastModifiedTime", new Date());
+            q.setParameter("actionXml", coordAction.getActionXml());
+            q.setParameter("missingDependencies", coordAction.getMissingDependencies());
+            q.executeUpdate();
+            // Since the return type is Void, we have to return null
+            return null;
+        }
+        catch (Exception e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+     */
+    @Override
+    public String getName() {
+        return "CoordActionUpdateForInputCheckJPAExecutor";
+    }
+}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForModifiedTimeJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForModifiedTimeJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForModifiedTimeJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForModifiedTimeJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -0,0 +1,72 @@
+/**
+ * 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.oozie.executor.jpa;
+
+import java.util.Date;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Updates the last modified time of CoordinatorAction and persists it.
+ * It executes SQL update query and return type is Void.
+ */
+public class CoordActionUpdateForModifiedTimeJPAExecutor implements JPAExecutor<Void> {
+
+    private CoordinatorActionBean coordAction = null;
+
+    public CoordActionUpdateForModifiedTimeJPAExecutor(CoordinatorActionBean coordAction) {
+        ParamChecker.notNull(coordAction, "coordAction");
+        this.coordAction = coordAction;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
+     * EntityManager)
+     */
+    @Override
+    public Void execute(EntityManager em) throws JPAExecutorException {
+        try {
+            Query q = em.createNamedQuery("UPDATE_COORD_ACTION_FOR_MODIFIED_DATE");
+            q.setParameter("id", coordAction.getId());
+            q.setParameter("lastModifiedTime", new Date());
+            q.executeUpdate();
+            // Since the return type is Void, we have to return null
+            return null;
+        }
+        catch (Exception e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+     */
+    @Override
+    public String getName() {
+        return "CoordActionUpdateForModifiedTimeJPAExecutor";
+    }
+}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -0,0 +1,67 @@
+/**
+ * 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.oozie.executor.jpa;
+
+import java.util.Date;
+
+import javax.persistence.EntityManager;
+
+import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Update the CoordinatorAction into a Bean and persist it
+ */
+public class CoordActionUpdateJPAExecutor implements JPAExecutor<Void> {
+
+    private CoordinatorActionBean coordAction = null;
+
+    /**
+     * Create the object for CoordActionUpdateJPAExecutor to update the CoordinatorAction into a Bean and persist it
+     * 
+     * @param coordAction
+     */
+    public CoordActionUpdateJPAExecutor(CoordinatorActionBean coordAction) {
+        ParamChecker.notNull(coordAction, "coordAction");
+        this.coordAction = coordAction;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.EntityManager)
+     */
+    @Override
+    public Void execute(EntityManager em) throws JPAExecutorException {
+        try {
+            coordAction.setLastModifiedTime(new Date());
+            em.merge(coordAction);
+            return null;
+        }
+        catch (Exception e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+     */
+    @Override
+    public String getName() {
+        return "CoordActionUpdateJPAExecutor";
+    }
+}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdatePushInputCheckJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdatePushInputCheckJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdatePushInputCheckJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdatePushInputCheckJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -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.oozie.executor.jpa;
+
+import java.util.Date;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Updates the action status, pending status, last modified time, push
+ * missingDependencies of CoordinatorAction and persists it. It executes SQL
+ * update query and return type is Void.
+ */
+public class CoordActionUpdatePushInputCheckJPAExecutor implements JPAExecutor<Void> {
+
+    private CoordinatorActionBean coordAction = null;
+
+    public CoordActionUpdatePushInputCheckJPAExecutor(CoordinatorActionBean coordAction) {
+        ParamChecker.notNull(coordAction, "coordAction");
+        this.coordAction = coordAction;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
+     * EntityManager)
+     */
+    @Override
+    public Void execute(EntityManager em) throws JPAExecutorException {
+        try {
+            Query q = em.createNamedQuery("UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK");
+            q.setParameter("id", coordAction.getId());
+            q.setParameter("status", coordAction.getStatus().toString());
+            q.setParameter("lastModifiedTime", new Date());
+            q.setParameter("actionXml", coordAction.getActionXml());
+            q.setParameter("pushMissingDependencies", coordAction.getPushMissingDependencies());
+            q.executeUpdate();
+            // Since the return type is Void, we have to return null
+            return null;
+        }
+        catch (Exception e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+     */
+    @Override
+    public String getName() {
+        return "CoordActionUpdatePushInputCheckJPAExecutor";
+    }
+}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -0,0 +1,74 @@
+/**
+ * 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.oozie.executor.jpa;
+
+import java.util.Date;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.CoordinatorActionBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Updates the action status, pending status and last modified time of CoordinatorAction and persists it.
+ * It executes SQL update query and return type is Void.
+ */
+public class CoordActionUpdateStatusJPAExecutor implements JPAExecutor<Void> {
+
+    private CoordinatorActionBean coordAction = null;
+
+    public CoordActionUpdateStatusJPAExecutor(CoordinatorActionBean coordAction) {
+        ParamChecker.notNull(coordAction, "coordAction");
+        this.coordAction = coordAction;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
+     * EntityManager)
+     */
+    @Override
+    public Void execute(EntityManager em) throws JPAExecutorException {
+        try {
+            Query q = em.createNamedQuery("UPDATE_COORD_ACTION_STATUS_PENDING_TIME");
+            q.setParameter("id", coordAction.getId());
+            q.setParameter("status", coordAction.getStatus().toString());
+            q.setParameter("pending", coordAction.getPending());
+            q.setParameter("lastModifiedTime", new Date());
+            q.executeUpdate();
+            // Since the return type is Void, we have to return null
+            return null;
+        }
+        catch (Exception e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+     */
+    @Override
+    public String getName() {
+        return "CoordActionUpdateStatusJPAExecutor";
+    }
+}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobUpdateJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobUpdateJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobUpdateJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobUpdateJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -0,0 +1,67 @@
+/**
+ * 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.oozie.executor.jpa;
+
+import javax.persistence.EntityManager;
+import org.apache.oozie.CoordinatorJobBean;
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Update the CoordinatorJob into a Bean and persist it.
+ */
+public class CoordJobUpdateJPAExecutor implements JPAExecutor<Void> {
+
+    private CoordinatorJobBean coordJob = null;
+
+    /**
+     * @param coordJob
+     */
+    public CoordJobUpdateJPAExecutor(CoordinatorJobBean coordJob) {
+        ParamChecker.notNull(coordJob, "CoordinatorJobBean");
+        this.coordJob = coordJob;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
+     * EntityManager)
+     */
+    @Override
+    public Void execute(EntityManager em) throws JPAExecutorException {
+        try {
+            em.merge(coordJob);
+            return null;
+        }
+        catch (Exception e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+     */
+    @Override
+    public String getName() {
+        return "CoordinatorUpdateJobJPAExecutor";
+    }
+
+}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -94,7 +94,7 @@ public class WorkflowActionGetJPAExecuto
             action.setExecutionPath(a.getExecutionPath());
             action.setLastCheckTime(a.getLastCheckTime());
             action.setLogToken(a.getLogToken());
-            if (a.isPending() == true) {
+            if (a.getPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(a.getPendingAge());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -109,7 +109,7 @@ public class WorkflowActionSubsetGetJPAE
             action.setExecutionPath(a.getExecutionPath());
             action.setLastCheckTime(a.getLastCheckTime());
             action.setLogToken(a.getLogToken());
-            if (a.isPending() == true) {
+            if (a.getPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(a.getPendingAge());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionUpdateJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionUpdateJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionUpdateJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionUpdateJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -0,0 +1,55 @@
+/**
+ * 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.oozie.executor.jpa;
+
+import javax.persistence.EntityManager;
+
+import org.apache.oozie.WorkflowActionBean;
+import org.apache.oozie.util.ParamChecker;
+import org.apache.oozie.ErrorCode;
+
+/**
+* Persist the WorkflowAction bean.
+*/
+public class WorkflowActionUpdateJPAExecutor implements JPAExecutor<String> {
+
+    private WorkflowActionBean wfAction = null;
+
+    public WorkflowActionUpdateJPAExecutor(WorkflowActionBean wfAction) {
+        ParamChecker.notNull(wfAction, "wfAction");
+        this.wfAction = wfAction;
+    }
+
+    @Override
+    public String getName() {
+        return "WorkflowActionUpdateJPAExecutor";
+    }
+
+    @Override
+    public String execute(EntityManager em) throws JPAExecutorException {
+
+        try {
+            em.merge(wfAction);
+            return null;
+        }
+        catch (Exception e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
+        }
+    }
+
+}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -93,7 +93,7 @@ public class WorkflowActionsGetForJobJPA
             action.setExecutionPath(a.getExecutionPath());
             action.setLastCheckTime(a.getLastCheckTime());
             action.setLogToken(a.getLogToken());
-            if (a.isPending() == true) {
+            if (a.getPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(a.getPendingAge());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -98,7 +98,7 @@ public class WorkflowActionsRunningGetJP
             action.setExecutionPath(bean.getExecutionPath());
             action.setLastCheckTime(bean.getLastCheckTime());
             action.setLogToken(bean.getLogToken());
-            if (bean.isPending() == true) {
+            if (bean.getPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(bean.getPendingAge());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -87,7 +87,7 @@ public class WorkflowJobGetActionsJPAExe
             action.setExecutionPath(a.getExecutionPath());
             action.setLastCheckTime(a.getLastCheckTime());
             action.setLogToken(a.getLogToken());
-            if (a.isPending() == true) {
+            if (a.getPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(a.getPendingAge());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobUpdateJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobUpdateJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobUpdateJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobUpdateJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -0,0 +1,63 @@
+/**
+ * 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.oozie.executor.jpa;
+
+import java.util.Date;
+
+import javax.persistence.EntityManager;
+
+import org.apache.oozie.WorkflowJobBean;
+import org.apache.oozie.util.ParamChecker;
+import org.apache.oozie.ErrorCode;
+
+/**
+* Persist the WorkflowJob bean.
+*/
+public class WorkflowJobUpdateJPAExecutor implements JPAExecutor<Void> {
+
+    private WorkflowJobBean wfJob = null;
+
+    public WorkflowJobUpdateJPAExecutor(WorkflowJobBean wfJob) {
+        ParamChecker.notNull(wfJob, "wfJob");
+        this.wfJob = wfJob;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+     */
+    @Override
+    public String getName() {
+        return "WorkflowJobUpdateJPAExecutor";
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.EntityManager)
+     */
+    @Override
+    public Void execute(EntityManager em) throws JPAExecutorException {
+        try {
+            wfJob.setLastModifiedTime(new Date());
+            em.merge(wfJob);
+            return null;
+        }
+        catch (Exception e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
+        }
+    }
+
+}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLACalculationInsertUpdateJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLACalculationInsertUpdateJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLACalculationInsertUpdateJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLACalculationInsertUpdateJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -0,0 +1,105 @@
+/**
+ * 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.oozie.executor.jpa.sla;
+
+import java.util.Collection;
+
+import javax.persistence.EntityManager;
+
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.FaultInjection;
+import org.apache.oozie.client.rest.JsonBean;
+import org.apache.oozie.executor.jpa.JPAExecutor;
+import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Persist the SLA beans to tables SLA_CALCULATOR and SLA_SUMMARY.
+ */
+public class SLACalculationInsertUpdateJPAExecutor implements JPAExecutor<String> {
+
+    private Collection<JsonBean> insertList;
+    private Collection<JsonBean> updateList;
+
+    public SLACalculationInsertUpdateJPAExecutor(Collection<JsonBean> insertList, Collection<JsonBean> updateList) {
+        setInsertList(insertList);
+        setUpdateList(updateList);
+    }
+
+    public SLACalculationInsertUpdateJPAExecutor() {
+    }
+
+    /**
+     * Sets the list of beans to insert
+     *
+     * @param insert
+     */
+    public void setInsertList(Collection<JsonBean> insertList) {
+        this.insertList = insertList;
+    }
+
+    /**
+     * Sets the list of beans to update
+     *
+     * @param update
+     */
+    public void setUpdateList(Collection<JsonBean> updateList) {
+        this.updateList = updateList;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+     */
+    @Override
+    public String getName() {
+        return "SLACalculationInsertUpdateJPAExecutor";
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
+     * EntityManager)
+     */
+    @Override
+    public String execute(EntityManager em) throws JPAExecutorException {
+        try {
+            if (insertList != null) {
+                for (JsonBean entity : insertList) {
+                    ParamChecker.notNull(entity, "JsonBean");
+                    em.persist(entity);
+                }
+            }
+            // Only used by test cases to check for rollback of transaction
+            FaultInjection.activate("org.apache.oozie.command.SkipCommitFaultInjection");
+            if (updateList != null) {
+                for (JsonBean entity : updateList) {
+                    ParamChecker.notNull(entity, "JsonBean");
+                    em.merge(entity);
+                }
+            }
+            return null;
+        }
+        catch (Exception e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
+        }
+    }
+
+}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryUpdateForSLAStatusActualTimesJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryUpdateForSLAStatusActualTimesJPAExecutor.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryUpdateForSLAStatusActualTimesJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryUpdateForSLAStatusActualTimesJPAExecutor.java Sun Sep  8 02:29:31 2013
@@ -0,0 +1,80 @@
+/**
+ * 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.oozie.executor.jpa.sla;
+
+import java.util.Date;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+import org.apache.oozie.ErrorCode;
+import org.apache.oozie.executor.jpa.JPAExecutor;
+import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.sla.SLASummaryBean;
+import org.apache.oozie.util.ParamChecker;
+
+/**
+ * Update the slaStatus, eventStatus, eventProcessed, jobStatus, actualStart,
+ * actualEnd, actualDuration and lastModifiedTime of SLAsummaryBean
+ */
+public class SLASummaryUpdateForSLAStatusActualTimesJPAExecutor implements JPAExecutor<Void> {
+
+    private SLASummaryBean slaSummaryBean = null;
+
+    public SLASummaryUpdateForSLAStatusActualTimesJPAExecutor(SLASummaryBean slaSummaryBean) {
+        ParamChecker.notNull(slaSummaryBean, "slaSummaryBean");
+        this.slaSummaryBean = slaSummaryBean;
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
+     * EntityManager)
+     */
+    @Override
+    public Void execute(EntityManager em) throws JPAExecutorException {
+        try {
+            Query q = em.createNamedQuery("UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES");
+            q.setParameter("jobId", slaSummaryBean.getId());
+            q.setParameter("slaStatus", slaSummaryBean.getSLAStatusString());
+            q.setParameter("lastModifiedTS", new Date());
+            q.setParameter("eventStatus", slaSummaryBean.getEventStatusString());
+            q.setParameter("jobStatus", slaSummaryBean.getJobStatus());
+            q.setParameter("eventProcessed", slaSummaryBean.getEventProcessed());
+            q.setParameter("actualStartTS", slaSummaryBean.getActualStart());
+            q.setParameter("actualEndTS", slaSummaryBean.getActualEnd());
+            q.setParameter("actualDuration", slaSummaryBean.getActualDuration());
+            q.executeUpdate();
+            return null;
+        }
+        catch (Exception e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     *
+     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
+     */
+    @Override
+    public String getName() {
+        return "SLASummaryUpdateForSLAStatusActualTimesJPAExecutor";
+    }
+}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/service/CoordMaterializeTriggerService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/CoordMaterializeTriggerService.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/service/CoordMaterializeTriggerService.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/service/CoordMaterializeTriggerService.java Sun Sep  8 02:29:31 2013
@@ -25,7 +25,8 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.oozie.CoordinatorJobBean;
 import org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand;
 import org.apache.oozie.executor.jpa.CoordActionsActiveCountJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
+import org.apache.oozie.executor.jpa.CoordJobGetRunningActionsCountJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordJobUpdateJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobsToBeMaterializedJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.util.XCallable;
@@ -132,9 +133,7 @@ public class CoordMaterializeTriggerServ
                                 + " MatThrottle : " + coordJob.getMatThrottling());
                         // update lastModifiedTime so next time others might have higher chance to get pick up
                         coordJob.setLastModifiedTime(new Date());
-                        CoordJobQueryExecutor.getInstance().executeUpdate(
-                                CoordJobQueryExecutor.CoordJobQuery.UPDATE_COORD_JOB_LAST_MODIFIED_TIME,
-                                coordJob);
+                        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
                         if (numWaitingActions >= coordJob.getMatThrottling()) {
                             LOG.info("info for JobID [" + coordJob.getId() + " already waiting "
                                     + numWaitingActions + " actions. MatThrottle is : " + coordJob.getMatThrottling());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java Sun Sep  8 02:29:31 2013
@@ -19,16 +19,12 @@ package org.apache.oozie.service;
 
 import java.io.IOException;
 import java.text.MessageFormat;
-import java.util.Collection;
-import java.util.List;
 import java.util.Properties;
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
-import javax.persistence.NoResultException;
 import javax.persistence.Persistence;
 import javax.persistence.PersistenceException;
-import javax.persistence.Query;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.oozie.BundleActionBean;
@@ -40,7 +36,6 @@ import org.apache.oozie.FaultInjection;
 import org.apache.oozie.SLAEventBean;
 import org.apache.oozie.WorkflowActionBean;
 import org.apache.oozie.WorkflowJobBean;
-import org.apache.oozie.client.rest.JsonBean;
 import org.apache.oozie.client.rest.JsonSLAEvent;
 import org.apache.oozie.executor.jpa.JPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
@@ -57,7 +52,7 @@ import org.apache.openjpa.persistence.Op
  */
 @SuppressWarnings("deprecation")
 public class JPAService implements Service, Instrumentable {
-    private static final String INSTRUMENTATION_GROUP_JPA = "jpa";
+    private static final String INSTRUMENTATION_GROUP = "jpa";
 
     public static final String CONF_DB_SCHEMA = "oozie.db.schema.name";
 
@@ -205,7 +200,7 @@ public class JPAService implements Servi
         try {
             LOG.trace("Executing JPAExecutor [{0}]", executor.getName());
             if (instr != null) {
-                instr.incr(INSTRUMENTATION_GROUP_JPA, executor.getName(), 1);
+                instr.incr(INSTRUMENTATION_GROUP, executor.getName(), 1);
             }
             cron.start();
             em.getTransaction().begin();
@@ -225,7 +220,7 @@ public class JPAService implements Servi
         finally {
             cron.stop();
             if (instr != null) {
-                instr.addCron(INSTRUMENTATION_GROUP_JPA, executor.getName(), cron);
+                instr.addCron(INSTRUMENTATION_GROUP, executor.getName(), cron);
             }
             try {
                 if (em.getTransaction().isActive()) {
@@ -253,225 +248,11 @@ public class JPAService implements Servi
     }
 
     /**
-     * Execute an UPDATE query
-     * @param namedQueryName the name of query to be executed
-     * @param query query instance to be executed
-     * @param em Entity Manager
-     * @return Integer that query returns, which corresponds to the number of rows updated
-     * @throws JPAExecutorException
-     */
-    public int executeUpdate(String namedQueryName, Query query, EntityManager em) throws JPAExecutorException {
-        Instrumentation.Cron cron = new Instrumentation.Cron();
-        try {
-
-            LOG.trace("Executing Update/Delete Query [{0}]", namedQueryName);
-            if (instr != null) {
-                instr.incr(INSTRUMENTATION_GROUP_JPA, namedQueryName, 1);
-            }
-            cron.start();
-            em.getTransaction().begin();
-            int ret = query.executeUpdate();
-            if (em.getTransaction().isActive()) {
-                if (FaultInjection.isActive("org.apache.oozie.command.SkipCommitFaultInjection")) {
-                    throw new RuntimeException("Skipping Commit for Failover Testing");
-                }
-                em.getTransaction().commit();
-            }
-            return ret;
-        }
-        catch (PersistenceException e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e);
-        }
-        finally {
-            processFinally(em, cron, namedQueryName);
-        }
-    }
-
-    public static class QueryEntry<E extends Enum<E>> {
-        E namedQuery;
-        Query query;
-
-        public QueryEntry(E namedQuery, Query query) {
-            this.namedQuery = namedQuery;
-            this.query = query;
-        }
-
-        public Query getQuery() {
-            return this.query;
-        }
-
-        public E getQueryName() {
-            return this.namedQuery;
-        }
-    }
-
-    private void processFinally(EntityManager em, Instrumentation.Cron cron, String name){
-        cron.stop();
-        if (instr != null) {
-            instr.addCron(INSTRUMENTATION_GROUP_JPA, name, cron);
-        }
-        try {
-            if (em.getTransaction().isActive()) {
-                LOG.warn("[{0}] ended with an active transaction, rolling back", name);
-                em.getTransaction().rollback();
-            }
-        }
-        catch (Exception ex) {
-            LOG.warn("Could not check/rollback transaction after [{0}], {1}", name,
-                    ex.getMessage(), ex);
-        }
-        try {
-            if (em.isOpen()) {
-                em.close();
-            }
-            else {
-                LOG.warn("[{0}] closed the EntityManager, it should not!", name);
-            }
-        }
-        catch (Exception ex) {
-            LOG.warn("Could not close EntityManager after [{0}], {1}", name, ex.getMessage(), ex);
-        }
-    }
-
-    /**
-     * Execute multiple update/insert queries in one transaction
-     * @param insertBeans list of beans to be inserted
-     * @param updateQueryList list of update queries
-     * @param deleteBeans list of beans to be deleted
-     * @param em Entity Manager
-     * @throws JPAExecutorException
-     */
-    public void executeBatchInsertUpdateDelete(Collection<JsonBean> insertBeans, List<QueryEntry> updateQueryList,
-            Collection<JsonBean> deleteBeans, EntityManager em) throws JPAExecutorException {
-        Instrumentation.Cron cron = new Instrumentation.Cron();
-        try {
-
-            LOG.trace("Executing Queries in Batch");
-            cron.start();
-            em.getTransaction().begin();
-            if (updateQueryList != null && updateQueryList.size() > 0) {
-                for (QueryEntry q : updateQueryList) {
-                    if (instr != null) {
-                        instr.incr(INSTRUMENTATION_GROUP_JPA, q.getQueryName().name(), 1);
-                    }
-                    q.getQuery().executeUpdate();
-                }
-            }
-            if (insertBeans != null && insertBeans.size() > 0) {
-                for (JsonBean bean : insertBeans) {
-                    em.persist(bean);
-                }
-            }
-            if (deleteBeans != null && deleteBeans.size() > 0) {
-                for (JsonBean bean : deleteBeans) {
-                    em.remove(em.merge(bean));
-                }
-            }
-            if (em.getTransaction().isActive()) {
-                if (FaultInjection.isActive("org.apache.oozie.command.SkipCommitFaultInjection")) {
-                    throw new RuntimeException("Skipping Commit for Failover Testing");
-                }
-                em.getTransaction().commit();
-            }
-        }
-        catch (PersistenceException e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e);
-        }
-        finally {
-            processFinally(em, cron, "batchqueryexecutor");
-        }
-    }
-
-    /**
-     * Execute a SELECT query
-     * @param namedQueryName the name of query to be executed
-     * @param query query instance to be executed
-     * @param em Entity Manager
-     * @return object that matches the query
-     * @throws JPAExecutorException
-     */
-    public Object executeGet(String namedQueryName, Query query, EntityManager em) throws JPAExecutorException {
-        Instrumentation.Cron cron = new Instrumentation.Cron();
-        try {
-
-            LOG.trace("Executing Select Query to Get a Single row  [{0}]", namedQueryName);
-            if (instr != null) {
-                instr.incr(INSTRUMENTATION_GROUP_JPA, namedQueryName, 1);
-            }
-
-            cron.start();
-            em.getTransaction().begin();
-            Object obj = null;
-            try {
-                obj = query.getSingleResult();
-            }
-            catch (NoResultException e) {
-                // return null when no matched result
-            }
-            if (em.getTransaction().isActive()) {
-                if (FaultInjection.isActive("org.apache.oozie.command.SkipCommitFaultInjection")) {
-                    throw new RuntimeException("Skipping Commit for Failover Testing");
-                }
-                em.getTransaction().commit();
-            }
-            return obj;
-        }
-        catch (PersistenceException e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e);
-        }
-        finally {
-            processFinally(em, cron, namedQueryName);
-        }
-    }
-
-    /**
-     * Execute a SELECT query to get list of results
-     * @param namedQueryName the name of query to be executed
-     * @param query query instance to be executed
-     * @param em Entity Manager
-     * @return list containing results that match the query
-     * @throws JPAExecutorException
-     */
-    public List executeGetList(String namedQueryName, Query query, EntityManager em) throws JPAExecutorException {
-        Instrumentation.Cron cron = new Instrumentation.Cron();
-        try {
-
-            LOG.trace("Executing Select Query to Get Multiple Rows [{0}]", namedQueryName);
-            if (instr != null) {
-                instr.incr(INSTRUMENTATION_GROUP_JPA, namedQueryName, 1);
-            }
-
-            cron.start();
-            em.getTransaction().begin();
-            List resultList = null;
-            try {
-                resultList = query.getResultList();
-            }
-            catch (NoResultException e) {
-                // return null when no matched result
-            }
-            if (em.getTransaction().isActive()) {
-                if (FaultInjection.isActive("org.apache.oozie.command.SkipCommitFaultInjection")) {
-                    throw new RuntimeException("Skipping Commit for Failover Testing");
-                }
-                em.getTransaction().commit();
-            }
-            return resultList;
-        }
-        catch (PersistenceException e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e);
-        }
-        finally {
-            processFinally(em, cron, namedQueryName);
-        }
-    }
-
-    /**
      * Return an EntityManager. Used by the StoreService. Once the StoreService is removed this method must be removed.
      *
      * @return an entity manager
      */
-    public EntityManager getEntityManager() {
+    EntityManager getEntityManager() {
         return factory.createEntityManager();
     }
 

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java Sun Sep  8 02:29:31 2013
@@ -39,15 +39,13 @@ import org.apache.oozie.command.bundle.B
 import org.apache.oozie.executor.jpa.BundleActionsGetByLastModifiedTimeJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleActionsGetStatusPendingJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
-import org.apache.oozie.executor.jpa.BundleJobQueryExecutor;
-import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
+import org.apache.oozie.executor.jpa.BundleJobUpdateJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleJobsGetRunningOrPendingJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordActionsGetByLastModifiedTimeJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetActionsStatusJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetPendingActionsCountJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
-import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
+import org.apache.oozie.executor.jpa.CoordJobUpdateJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobsGetPendingJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.util.DateUtils;
@@ -639,7 +637,7 @@ public class StatusTransitService implem
                 bundleJob.resetPending();
                 LOG.info("Bundle job [" + jobId + "] Pending set to FALSE");
             }
-            BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME, bundleJob);
+            jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
         }
 
         private void updateCoordJob(boolean isPending, CoordinatorJobBean coordJob, Job.Status coordStatus)
@@ -664,7 +662,7 @@ public class StatusTransitService implem
             if (coordJob.getStatus() != prevStatus || isPendingStateChanged) {
                 LOG.debug("Updating coord job " + coordJob.getId());
                 coordJob.setLastModifiedTime(new Date());
-                CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_STATUS_PENDING_MODTIME, coordJob);
+                jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
             }
             // update bundle action only when status changes in coord job
             if (coordJob.getBundleId() != null) {
@@ -689,7 +687,7 @@ public class StatusTransitService implem
             }
             boolean hasChange = prevPending != coordJob.isPending();
             if (saveToDB && hasChange) {
-                CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_STATUS_PENDING_MODTIME, coordJob);
+                jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
             }
             return hasChange;
 

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java Sun Sep  8 02:29:31 2013
@@ -40,18 +40,16 @@ import org.apache.oozie.client.event.Job
 import org.apache.oozie.client.event.SLAEvent.EventStatus;
 import org.apache.oozie.client.event.SLAEvent.SLAStatus;
 import org.apache.oozie.client.rest.JsonBean;
-import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordActionGetForSLAJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
-import org.apache.oozie.executor.jpa.SLARegistrationQueryExecutor.SLARegQuery;
-import org.apache.oozie.executor.jpa.SLASummaryQueryExecutor;
 import org.apache.oozie.executor.jpa.WorkflowActionGetForSLAJPAExecutor;
 import org.apache.oozie.executor.jpa.WorkflowJobGetForSLAJPAExecutor;
+
+import org.apache.oozie.executor.jpa.sla.SLACalculationInsertUpdateJPAExecutor;
 import org.apache.oozie.executor.jpa.sla.SLARegistrationGetOnRestartJPAExecutor;
 import org.apache.oozie.executor.jpa.sla.SLASummaryGetJPAExecutor;
 import org.apache.oozie.executor.jpa.sla.SLASummaryGetRecordsOnRestartJPAExecutor;
-import org.apache.oozie.executor.jpa.SLASummaryQueryExecutor.SLASummaryQuery;
-import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
+import org.apache.oozie.executor.jpa.sla.SLASummaryUpdateForSLAStatusActualTimesJPAExecutor;
 import org.apache.oozie.service.EventHandlerService;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.ServiceException;
@@ -114,9 +112,7 @@ public class SLACalculatorMemory impleme
                             break;
                     }
                     if (isJobModified) {
-                        summaryBean.setLastModifiedTime(new Date());
-                        SLASummaryQueryExecutor.getInstance().executeUpdate(
-                                SLASummaryQuery.UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES, summaryBean);
+                        jpaService.execute(new SLASummaryUpdateForSLAStatusActualTimesJPAExecutor(summaryBean));
                     }
                 }
                 catch (Exception e) {
@@ -356,9 +352,7 @@ public class SLACalculatorMemory impleme
                 slaSummaryBean.setActualStart(slaCalc.getActualStart());
                 slaSummaryBean.setActualDuration(slaCalc.getActualDuration());
                 slaSummaryBean.setJobStatus(slaCalc.getJobStatus());
-                slaSummaryBean.setLastModifiedTime(new Date());
-                SLASummaryQueryExecutor.getInstance().executeUpdate(
-                        SLASummaryQuery.UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES, slaSummaryBean);
+                jpaService.execute(new SLASummaryUpdateForSLAStatusActualTimesJPAExecutor(slaSummaryBean));
                 if (eventProc == 7) {
                     historySet.add(jobId);
                     slaMap.remove(jobId);
@@ -403,7 +397,7 @@ public class SLACalculatorMemory impleme
                 List<JsonBean> insertList = new ArrayList<JsonBean>();
                 insertList.add(reg);
                 insertList.add(new SLASummaryBean(slaCalc));
-                BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, null, null);
+                jpaService.execute(new SLACalculationInsertUpdateJPAExecutor(insertList, null));
                 LOG.trace("SLA Registration Event - Job:" + jobId);
                 return true;
             }
@@ -448,11 +442,10 @@ public class SLACalculatorMemory impleme
                 slaCalc.setSLAStatus(SLAStatus.NOT_STARTED);
                 slaCalc.setJobStatus(getJobStatus(reg.getAppType()));
                 slaMap.put(jobId, slaCalc);
-                List<UpdateEntry> updateList = new ArrayList<UpdateEntry>();
-                updateList.add(new UpdateEntry<SLARegQuery>(SLARegQuery.UPDATE_SLA_REG_ALL, reg));
-                updateList.add(new UpdateEntry<SLASummaryQuery>(SLASummaryQuery.UPDATE_SLA_SUMMARY_ALL,
-                        new SLASummaryBean(slaCalc)));
-                BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(null, updateList, null);
+                List<JsonBean> updateList = new ArrayList<JsonBean>();
+                updateList.add(reg);
+                updateList.add(new SLASummaryBean(slaCalc));
+                jpaService.execute(new SLACalculationInsertUpdateJPAExecutor(null, updateList));
                 LOG.trace("SLA Registration Event - Job:" + jobId);
                 return true;
             }
@@ -531,9 +524,7 @@ public class SLACalculatorMemory impleme
         }
 
         if (hasSla) {
-            slaInfo.setLastModifiedTime(new Date());
-            SLASummaryQueryExecutor.getInstance().executeUpdate(
-                    SLASummaryQuery.UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES, slaInfo);
+            jpaService.execute(new SLASummaryUpdateForSLAStatusActualTimesJPAExecutor(slaInfo));
         }
         return hasSla;
     }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java Sun Sep  8 02:29:31 2013
@@ -17,7 +17,6 @@
  */
 package org.apache.oozie.sla;
 
-import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -47,8 +46,6 @@ import org.json.simple.JSONObject;
 @Table(name = "SLA_REGISTRATION")
 @NamedQueries({
 
- @NamedQuery(name = "UPDATE_SLA_REG_ALL", query = "update SLARegistrationBean w set w.jobId = :jobId, w.nominalTimeTS = :nominalTime, w.expectedStartTS = :expectedStartTime, w.expectedEndTS = :expectedEndTime, w.expectedDuration = :expectedDuration, w.slaConfig = :slaConfig, w.notificationMsg = :notificationMsg, w.upstreamApps = :upstreamApps, w.appType = :appType, w.appName = :appName, w.user = :user, w.parentId = :parentId, w.jobData = :jobData where w.jobId = :jobId"),
-
  @NamedQuery(name = "GET_SLA_REG_ON_RESTART", query = "select w.notificationMsg, w.upstreamApps, w.slaConfig, w.jobData from SLARegistrationBean w where w.jobId = :id"),
 
  @NamedQuery(name = "GET_SLA_REG_ALL", query = "select OBJECT(w) from SLARegistrationBean w where w.jobId = :id") })
@@ -163,10 +160,6 @@ public class SLARegistrationBean impleme
         return DateUtils.toDate(nominalTimeTS);
     }
 
-    public Timestamp getNominalTimestamp() {
-        return this.nominalTimeTS;
-    }
-
     public void setNominalTime(Date nominalTime) {
         this.nominalTimeTS = DateUtils.convertDateToTimestamp(nominalTime);
     }
@@ -175,10 +168,6 @@ public class SLARegistrationBean impleme
         return DateUtils.toDate(expectedStartTS);
     }
 
-    public Timestamp getExpectedStartTimestamp() {
-        return this.expectedStartTS;
-    }
-
     public void setExpectedStart(Date expectedStart) {
         this.expectedStartTS = DateUtils.convertDateToTimestamp(expectedStart);
     }
@@ -187,10 +176,6 @@ public class SLARegistrationBean impleme
         return DateUtils.toDate(expectedEndTS);
     }
 
-    public Timestamp getExpectedEndTimestamp() {
-        return this.expectedEndTS;
-    }
-
     public void setExpectedEnd(Date expectedEnd) {
         this.expectedEndTS = DateUtils.convertDateToTimestamp(expectedEnd);
     }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLASummaryBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLASummaryBean.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLASummaryBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLASummaryBean.java Sun Sep  8 02:29:31 2013
@@ -47,8 +47,6 @@ import org.json.simple.JSONObject;
 
  @NamedQuery(name = "UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES", query = "update SLASummaryBean w set w.slaStatus = :slaStatus, w.eventStatus = :eventStatus, w.eventProcessed = :eventProcessed, w.jobStatus = :jobStatus, w.lastModifiedTS = :lastModifiedTS, w.actualStartTS = :actualStartTS, w.actualEndTS = :actualEndTS, w.actualDuration = :actualDuration where w.jobId = :jobId"),
 
- @NamedQuery(name = "UPDATE_SLA_SUMMARY_ALL", query = "update SLASummaryBean w set w.jobId = :jobId, w.appName = :appName, w.appType = :appType, w.nominalTimeTS = :nominalTime, w.expectedStartTS = :expectedStartTime, w.expectedEndTS = :expectedEndTime, w.expectedDuration = :expectedDuration, w.jobStatus = :jobStatus, w.slaStatus = :slaStatus, w.eventStatus = :eventStatus, w.lastModifiedTS = :lastModTime, w.user = :user, w.parentId = :parentId, w.eventProcessed = :eventProcessed, w.actualDuration = :actualDuration, w.actualEndTS = :actualEndTS, w.actualStartTS = :actualStartTS where w.jobId = :jobId"),
-
  @NamedQuery(name = "GET_SLA_SUMMARY", query = "select OBJECT(w) from SLASummaryBean w where w.jobId = :id"),
 
  @NamedQuery(name = "GET_SLA_SUMMARY_RECORDS_RESTART", query = "select OBJECT(w) from SLASummaryBean w where w.eventProcessed <= 7 AND w.lastModifiedTS >= :lastModifiedTime") })
@@ -176,10 +174,6 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(nominalTimeTS);
     }
 
-    public Timestamp getNominalTimestamp() {
-        return this.nominalTimeTS;
-    }
-
     public void setNominalTime(Date nominalTime) {
         this.nominalTimeTS = DateUtils.convertDateToTimestamp(nominalTime);
     }
@@ -189,10 +183,6 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(expectedStartTS);
     }
 
-    public Timestamp getExpectedStartTimestamp() {
-        return this.expectedStartTS;
-    }
-
     public void setExpectedStart(Date expectedStart) {
         this.expectedStartTS = DateUtils.convertDateToTimestamp(expectedStart);
     }
@@ -201,9 +191,6 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(expectedEndTS);
     }
 
-    public Timestamp getExpectedEndTimestamp() {
-        return this.expectedEndTS;
-    }
     public void setExpectedEnd(Date expectedEnd) {
         this.expectedEndTS = DateUtils.convertDateToTimestamp(expectedEnd);
     }
@@ -220,10 +207,6 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(actualStartTS);
     }
 
-    public Timestamp getActualStartTimestamp() {
-        return this.actualStartTS;
-    }
-
     public void setActualStart(Date actualStart) {
         this.actualStartTS = DateUtils.convertDateToTimestamp(actualStart);
     }
@@ -232,10 +215,6 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(actualEndTS);
     }
 
-    public Timestamp getActualEndTimestamp() {
-        return this.actualEndTS;
-    }
-
     public void setActualEnd(Date actualEnd) {
         this.actualEndTS = DateUtils.convertDateToTimestamp(actualEnd);
     }
@@ -316,10 +295,6 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(lastModifiedTS);
     }
 
-    public Timestamp getLastModifiedTimestamp() {
-        return this.lastModifiedTS;
-    }
-
     public void setLastModifiedTime(Date lastModified) {
         this.lastModifiedTS = DateUtils.convertDateToTimestamp(lastModified);
     }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java Sun Sep  8 02:29:31 2013
@@ -34,10 +34,6 @@ import org.apache.oozie.CoordinatorJobIn
 import org.apache.oozie.ErrorCode;
 import org.apache.oozie.client.Job.Status;
 import org.apache.oozie.client.CoordinatorJob.Timeunit;
-import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
-import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
-import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
-import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.InstrumentationService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.DateUtils;
@@ -355,12 +351,14 @@ public class CoordinatorStore extends St
      * @param action Action Bean
      * @throws StoreException if action doesn't exist
      */
-    public void updateCoordinatorAction(final CoordinatorActionBean action) throws StoreException, JPAExecutorException {
+    public void updateCoordinatorAction(final CoordinatorActionBean action) throws StoreException {
         ParamChecker.notNull(action, "CoordinatorActionBean");
         doOperation("updateCoordinatorAction", new Callable<Void>() {
-            public Void call() throws StoreException, JPAExecutorException {
-                CoordActionQueryExecutor.getInstance().executeUpdate(
-                        CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION, action);
+            public Void call() throws StoreException {
+                Query q = entityManager.createNamedQuery("UPDATE_COORD_ACTION");
+                q.setParameter("id", action.getId());
+                setActionQueryParameters(action, q);
+                q.executeUpdate();
                 return null;
             }
         });
@@ -372,12 +370,17 @@ public class CoordinatorStore extends St
      * @param action Action Bean
      * @throws StoreException if action doesn't exist
      */
-    public void updateCoordActionMin(final CoordinatorActionBean action) throws StoreException, JPAExecutorException {
+    public void updateCoordActionMin(final CoordinatorActionBean action) throws StoreException {
         ParamChecker.notNull(action, "CoordinatorActionBean");
         doOperation("updateCoordinatorAction", new Callable<Void>() {
-            public Void call() throws StoreException, JPAExecutorException {
-                CoordActionQueryExecutor.getInstance().executeUpdate(
-                        CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK, action);
+            public Void call() throws StoreException {
+                Query q = entityManager.createNamedQuery("UPDATE_COORD_ACTION_MIN");
+                q.setParameter("id", action.getId());
+                q.setParameter("missingDependencies", action.getMissingDependencies());
+                q.setParameter("lastModifiedTime", new Date());
+                q.setParameter("status", action.getStatus().toString());
+                q.setParameter("actionXml", action.getActionXml());
+                q.executeUpdate();
                 return null;
             }
         });
@@ -392,8 +395,11 @@ public class CoordinatorStore extends St
     public void updateCoordinatorJob(final CoordinatorJobBean job) throws StoreException {
         ParamChecker.notNull(job, "CoordinatorJobBean");
         doOperation("updateJob", new Callable<Void>() {
-            public Void call() throws StoreException, JPAExecutorException {
-                CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, job);
+            public Void call() throws StoreException {
+                Query q = entityManager.createNamedQuery("UPDATE_COORD_JOB");
+                q.setParameter("id", job.getId());
+                setJobQueryParameters(job, q);
+                q.executeUpdate();
                 return null;
             }
         });
@@ -402,8 +408,12 @@ public class CoordinatorStore extends St
     public void updateCoordinatorJobStatus(final CoordinatorJobBean job) throws StoreException {
         ParamChecker.notNull(job, "CoordinatorJobBean");
         doOperation("updateJobStatus", new Callable<Void>() {
-            public Void call() throws StoreException, JPAExecutorException {
-                CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_STATUS_MODTIME, job);
+            public Void call() throws StoreException {
+                Query q = entityManager.createNamedQuery("UPDATE_COORD_JOB_STATUS");
+                q.setParameter("id", job.getId());
+                q.setParameter("status", job.getStatus().toString());
+                q.setParameter("lastModifiedTime", new Date());
+                q.executeUpdate();
                 return null;
             }
         });

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java Sun Sep  8 02:29:31 2013
@@ -35,9 +35,6 @@ import org.apache.oozie.WorkflowJobBean;
 import org.apache.oozie.WorkflowsInfo;
 import org.apache.oozie.client.OozieClient;
 import org.apache.oozie.client.WorkflowJob.Status;
-import org.apache.oozie.executor.jpa.JPAExecutorException;
-import org.apache.oozie.executor.jpa.WorkflowActionQueryExecutor;
-import org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor;
 import org.apache.oozie.service.InstrumentationService;
 import org.apache.oozie.service.SchemaService;
 import org.apache.oozie.service.Services;
@@ -201,9 +198,11 @@ public class WorkflowStore extends Store
     public void updateWorkflow(final WorkflowJobBean wfBean) throws StoreException {
         ParamChecker.notNull(wfBean, "WorkflowJobBean");
         doOperation("updateWorkflow", new Callable<Void>() {
-            public Void call() throws SQLException, StoreException, WorkflowException, JPAExecutorException {
-                WorkflowJobQueryExecutor.getInstance().executeUpdate(
-                        WorkflowJobQueryExecutor.WorkflowJobQuery.UPDATE_WORKFLOW, wfBean);
+            public Void call() throws SQLException, StoreException, WorkflowException {
+                Query q = entityManager.createNamedQuery("UPDATE_WORKFLOW");
+                q.setParameter("id", wfBean.getId());
+                setWFQueryParameters(wfBean, q);
+                q.executeUpdate();
                 return null;
             }
         });
@@ -275,9 +274,11 @@ public class WorkflowStore extends Store
     public void updateAction(final WorkflowActionBean action) throws StoreException {
         ParamChecker.notNull(action, "WorkflowActionBean");
         doOperation("updateAction", new Callable<Void>() {
-            public Void call() throws SQLException, StoreException, WorkflowException, JPAExecutorException {
-                WorkflowActionQueryExecutor.getInstance().executeUpdate(
-                        WorkflowActionQueryExecutor.WorkflowActionQuery.UPDATE_ACTION, action);
+            public Void call() throws SQLException, StoreException, WorkflowException {
+                Query q = entityManager.createNamedQuery("UPDATE_ACTION");
+                q.setParameter("id", action.getId());
+                setActionQueryParameters(action, q);
+                q.executeUpdate();
                 return null;
             }
         });
@@ -934,7 +935,7 @@ public class WorkflowStore extends Store
             action.setExecutionPath(a.getExecutionPath());
             action.setLastCheckTime(a.getLastCheckTime());
             action.setLogToken(a.getLogToken());
-            if (a.isPending() == true) {
+            if (a.getPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(a.getPendingAge());

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/TestPurgeXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/TestPurgeXCommand.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/TestPurgeXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/TestPurgeXCommand.java Sun Sep  8 02:29:31 2013
@@ -18,6 +18,9 @@
 package org.apache.oozie.command;
 
 import java.util.Date;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.fail;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
@@ -40,14 +43,12 @@ import org.apache.oozie.executor.jpa.Bun
 import org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
-import org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor;
-import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
+import org.apache.oozie.executor.jpa.CoordJobUpdateJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor;
 import org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.WorkflowJobInsertJPAExecutor;
-import org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor.WorkflowJobQuery;
+import org.apache.oozie.executor.jpa.WorkflowJobUpdateJPAExecutor;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.LiteWorkflowStoreService;
 import org.apache.oozie.service.Services;
@@ -1392,16 +1393,16 @@ public class TestPurgeXCommand extends X
         CoordinatorJobBean coordJob1 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         CoordinatorJobBean coordJob2 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob2.setAppName("coord2");
-        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob2);
+        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob2));
         CoordinatorJobBean coordJob3 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob3.setAppName("coord3");
-        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob3);
+        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob3));
         CoordinatorJobBean coordJob4 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob4.setAppName("coord4");
-        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob4);
+        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob4));
         CoordinatorJobBean coordJob5 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob5.setAppName("coord5");
-        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob5);
+        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob5));
         WorkflowJobBean wfJob1 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
         WorkflowJobBean wfJob2 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
         WorkflowJobBean wfJob3 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
@@ -1802,16 +1803,16 @@ public class TestPurgeXCommand extends X
         CoordinatorJobBean coordJob1 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         CoordinatorJobBean coordJob2 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob2.setAppName("coord2");
-        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob2);
+        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob2));
         CoordinatorJobBean coordJob3 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob3.setAppName("coord3");
-        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob3);
+        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob3));
         CoordinatorJobBean coordJob4 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob4.setAppName("coord4");
-        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob4);
+        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob4));
         CoordinatorJobBean coordJob5 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob5.setAppName("coord5");
-        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob5);
+        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob5));
         WorkflowJobBean wfJob1 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
         WorkflowJobBean wfJob2 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
         WorkflowJobBean wfJob3 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
@@ -3821,7 +3822,7 @@ public class TestPurgeXCommand extends X
         try {
             JPAService jpaService = Services.get().get(JPAService.class);
             assertNotNull(jpaService);
-            CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_LAST_MODIFIED_TIME, job);
+            jpaService.execute(new CoordJobUpdateJPAExecutor(job));
         }
         catch (JPAExecutorException je) {
             je.printStackTrace();
@@ -3836,7 +3837,7 @@ public class TestPurgeXCommand extends X
         try {
             JPAService jpaService = Services.get().get(JPAService.class);
             assertNotNull(jpaService);
-            WorkflowJobQueryExecutor.getInstance().executeUpdate(WorkflowJobQuery.UPDATE_WORKFLOW_STATUS_INSTANCE_MOD_END, job);
+            jpaService.execute(new WorkflowJobUpdateJPAExecutor(job));
         }
         catch (JPAExecutorException je) {
             je.printStackTrace();

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java Sun Sep  8 02:29:31 2013
@@ -27,8 +27,7 @@ import org.apache.oozie.client.Job;
 import org.apache.oozie.executor.jpa.BundleActionInsertJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
-import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
+import org.apache.oozie.executor.jpa.CoordJobUpdateJPAExecutor;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.test.XDataTestCase;
@@ -85,7 +84,7 @@ public class TestBundleChangeXCommand ex
         coordJob.setBundleId(bundleJob.getId());
         final JPAService jpaService = Services.get().get(JPAService.class);
         assertNotNull(jpaService);
-        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_BUNDLEID, coordJob);
+        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
 
         BundleActionBean bundleAction = new BundleActionBean();
         bundleAction.setBundleActionId("11111");

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java Sun Sep  8 02:29:31 2013
@@ -267,7 +267,6 @@ public class TestBundleStartXCommand ext
         assertEquals(Job.Status.FAILED, actions.get(0).getStatus());
         Runnable runnable = new StatusTransitRunnable();
         runnable.run();
-        sleep(2000);
         job = jpaService.execute(bundleJobGetExecutor);
         assertEquals(job.getStatus(), Job.Status.KILLED);
     }

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java?rev=1520828&r1=1520827&r2=1520828&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java Sun Sep  8 02:29:31 2013
@@ -36,8 +36,8 @@ import org.apache.oozie.coord.CoordELFun
 import org.apache.oozie.executor.jpa.CoordActionGetForInputCheckJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordActionInsertJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
-import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
+import org.apache.oozie.executor.jpa.CoordActionUpdateForInputCheckJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordActionUpdatePushInputCheckJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.CallableQueueService;
@@ -235,9 +235,7 @@ public class TestCoordActionInputCheckXC
                 + "\">");
         action.setActionXml(actionXML);
         action.setCreatedTime(DateUtils.parseDateOozieTZ(actionCreationTime));
-        CoordActionQueryExecutor.getInstance().executeUpdate(
-                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK,
-                action);
+        jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(action));
         action = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         assertTrue(action.getActionXml().contains("action-actual-time=\"2009-02-15T01:00")) ;
 
@@ -282,9 +280,7 @@ public class TestCoordActionInputCheckXC
                 .execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         final String pushMissingDependency = "file://" + getTestCaseDir() + "/2009/02/05";
         action.setPushMissingDependencies(pushMissingDependency);
-        CoordActionQueryExecutor.getInstance().executeUpdate(
-                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK,
-                action);
+        jpaService.execute(new CoordActionUpdatePushInputCheckJPAExecutor(action));
 
         // Update action creation time
         String actionXML = action.getActionXml();
@@ -293,9 +289,7 @@ public class TestCoordActionInputCheckXC
                 + "\">");
         action.setActionXml(actionXML);
         action.setCreatedTime(DateUtils.parseDateOozieTZ(actionCreationTime));
-        CoordActionQueryExecutor.getInstance().executeUpdate(
-                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK,
-                action);
+        jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(action));
         action = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         assertTrue(action.getActionXml().contains("action-actual-time=\"2009-02-15T01:00")) ;
 
@@ -368,9 +362,7 @@ public class TestCoordActionInputCheckXC
                 + "\">");
         action.setActionXml(actionXML);
         action.setCreatedTime(DateUtils.parseDateOozieTZ(actionCreationTime));
-        CoordActionQueryExecutor.getInstance().executeUpdate(
-                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK,
-                action);
+        jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(action));
         action = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         assertTrue(action.getActionXml().contains("action-actual-time=\"2009-02-15T01:00")) ;
 
@@ -414,9 +406,7 @@ public class TestCoordActionInputCheckXC
                 .execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         final String pushMissingDependency = "file://" + getTestCaseDir() + "/2009/02/05";
         action.setPushMissingDependencies(pushMissingDependency);
-        CoordActionQueryExecutor.getInstance().executeUpdate(
-                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK,
-                action);
+        jpaService.execute(new CoordActionUpdatePushInputCheckJPAExecutor(action));
 
         // Update action creation time
         String actionXML = action.getActionXml();
@@ -425,9 +415,7 @@ public class TestCoordActionInputCheckXC
                 + "\">");
         action.setActionXml(actionXML);
         action.setCreatedTime(DateUtils.parseDateOozieTZ(actionCreationTime));
-        CoordActionQueryExecutor.getInstance().executeUpdate(
-                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK,
-                action);
+        jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(action));
         action = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         assertTrue(action.getActionXml().contains("action-actual-time=\"2009-02-15T01:00")) ;
 
@@ -712,7 +700,7 @@ public class TestCoordActionInputCheckXC
         action.setStatus(CoordinatorAction.Status.WAITING);
         try {
             jpaService = Services.get().get(JPAService.class);
-            CoordActionQueryExecutor.getInstance().executeUpdate(CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK, action);
+            jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(action));
         }
         catch (JPAExecutorException se) {
             fail("Action ID " + coordJob.getId() + "@1" + " was not stored properly in db");