You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by je...@apache.org on 2010/05/02 19:03:00 UTC
svn commit: r940263 [9/16] - in /ode/trunk: ./ axis2-war/
axis2-war/src/main/assembly/
axis2-war/src/main/webapp/WEB-INF/conf.hib-derby/
axis2-war/src/main/webapp/WEB-INF/conf.jpa-derby/
axis2-war/src/main/webapp/WEB-INF/conf/ axis2-war/src/test/java/o...
Added: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/bpel/ql/HibernateInstancesQueryCompiler.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/bpel/ql/HibernateInstancesQueryCompiler.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/bpel/ql/HibernateInstancesQueryCompiler.java (added)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/bpel/ql/HibernateInstancesQueryCompiler.java Sun May 2 17:02:51 2010
@@ -0,0 +1,724 @@
+/*
+ * 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.ode.dao.hib.bpel.ql;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.ode.bpel.common.ProcessState;
+import org.apache.ode.dao.hib.bpel.hobj.HProcessInstance;
+import org.apache.ode.ql.Compiler;
+import org.apache.ode.ql.eval.skel.AbstractConjunction;
+import org.apache.ode.ql.eval.skel.AbstractDisjunction;
+import org.apache.ode.ql.eval.skel.AbstractEqualityEvaluator;
+import org.apache.ode.ql.eval.skel.CommandEvaluator;
+import org.apache.ode.ql.eval.skel.ConjunctionEvaluator;
+import org.apache.ode.ql.eval.skel.DisjunctionEvaluator;
+import org.apache.ode.ql.eval.skel.EqualityEvaluator;
+import org.apache.ode.ql.eval.skel.GEEvaluator;
+import org.apache.ode.ql.eval.skel.GreaterEvaluator;
+import org.apache.ode.ql.eval.skel.INEvaluator;
+import org.apache.ode.ql.eval.skel.LEEvaluator;
+import org.apache.ode.ql.eval.skel.LessEvaluator;
+import org.apache.ode.ql.eval.skel.LikeEvaluator;
+import org.apache.ode.ql.eval.skel.OrderByEvaluator;
+import org.apache.ode.ql.tree.Builder;
+import org.apache.ode.ql.tree.BuilderFactory;
+import org.apache.ode.ql.tree.nodes.*;
+import org.apache.ode.utils.ISO8601DateParser;
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.criterion.Conjunction;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Disjunction;
+import org.hibernate.criterion.Order;
+import org.hibernate.criterion.Restrictions;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+public class HibernateInstancesQueryCompiler extends Compiler<List, Session> {
+ private static class DBFieldValueEq extends FieldValueEquality {
+ protected final Object fieldValue;
+
+ /**
+ * @param identifier
+ */
+ public DBFieldValueEq(String identifier, Object fieldValue) {
+ super(identifier);
+ this.fieldValue = fieldValue;
+ }
+
+ /**
+ * @see org.apache.ode.ql.eval.skel.CommandEvaluator#evaluate(java.lang.Object)
+ */
+ public Criterion evaluate(Object paramValue) {
+ return Restrictions.eq(identifier, fieldValue);
+ }
+ }
+
+ private abstract static class FieldValueEquality extends AbstractEqualityEvaluator<String, Criterion, Object> {
+
+ /**
+ * @param identifier
+ */
+ public FieldValueEquality(String identifier) {
+ super(identifier);
+ }
+
+ }
+
+ //
+ private final static String INSTANCE_ID_FIELD = "iid";
+
+ private final static String PROCESS_ID_FIELD = "pid";
+
+ private final static String PROCESS_NAME_FIELD = "name";
+
+ private final static String PROCESS_NAMESPACE_FIELD = "namespace";
+
+ private final static String INSTANCE_STATUS_FIELD = "status";
+
+ private final static String INSTANCE_STARTED_FIELD = "started";
+
+ private final static String INSTANCE_LAST_ACTIVE_FIELD = "last-active";
+
+ /*
+ * private final static String CORRELATION_NAME_FIELD = "name"; private final static String
+ * CORRELATION_NAMESPACE_FIELD = "namespace"; private final static String CORRELATION_NAMESPACE_FIELD = "namespace";
+ */
+ // DB fields
+ private final static String INSTANCE_ID_DB_FIELD = "id";
+
+ private final static String PROCESS_ID_DB_FIELD = "process.processId";
+
+ private final static String PROCESS_NAME_DB_FIELD = "process.typeName";
+
+ private final static String PROCESS_NAMESPACE_DB_FIELD = "process.typeNamespace";
+
+ private final static String INSTANCE_STATUS_DB_FIELD = "state";
+
+ private final static String PROPERTY_NS_DB_FIELD = "process.typeNamespace";
+
+ private final static String PROPERTY_NAME_DB_FIELD = "property.name";
+
+ private final static String PROPERTY_VALUE_DB_FIELD = "property.value";
+
+ private final static String INSTANCE_STARTED_DB_FIELD = "created";
+
+ private final static String INSTANCE_LAST_ACTIVE_DB_FIELD = "lastActiveTime";
+
+ // status fields
+ private final static String STATUS_ACTIVE = "active";
+
+ private final static String STATUS_SUSPENDED = "suspended";
+
+ private final static String STATUS_ERROR = "error";
+
+ private final static String STATUS_COMPLETED = "completed";
+
+ private final static String STATUS_TERMINATED = "terminated";
+
+ private final static String STATUS_FAULTED = "failed";
+
+ private final static Map<String, String> nodeIdentifierToDBField = new HashMap<String, String>(20);
+ //Whether property is used in query
+ private boolean propertyInQuery;
+ //Whether ordering by status used
+ private boolean orderByStatus;
+ private boolean orderByStatusDesc;
+
+ static {
+ nodeIdentifierToDBField.put(INSTANCE_ID_FIELD, INSTANCE_ID_DB_FIELD);
+ nodeIdentifierToDBField.put(INSTANCE_ID_FIELD, INSTANCE_ID_DB_FIELD);
+ nodeIdentifierToDBField.put(PROCESS_ID_FIELD, PROCESS_ID_DB_FIELD);
+ nodeIdentifierToDBField.put(PROCESS_NAME_FIELD, PROCESS_NAME_DB_FIELD);
+ nodeIdentifierToDBField.put(PROCESS_NAMESPACE_FIELD, PROCESS_NAMESPACE_DB_FIELD);
+ nodeIdentifierToDBField.put(INSTANCE_STARTED_FIELD, INSTANCE_STARTED_DB_FIELD);
+ nodeIdentifierToDBField.put(INSTANCE_LAST_ACTIVE_FIELD, INSTANCE_LAST_ACTIVE_DB_FIELD);
+ nodeIdentifierToDBField.put(INSTANCE_STATUS_FIELD, INSTANCE_STATUS_DB_FIELD);
+ }
+
+ private static String getDBField(String name) {
+ String dbField = nodeIdentifierToDBField.get(name);
+
+ if (dbField == null) {
+ throw new IllegalArgumentException("Unsupported field " + name);
+ }
+ return dbField;
+ }
+
+ private void init() {
+ propertyInQuery = false;
+ orderByStatus = false;
+ orderByStatusDesc = false;
+ }
+
+ @Override
+ public CommandEvaluator<List, Session> compile(final Query node) {
+ init();
+
+ final OrderByEvaluator<Collection<Order>, Object> orderEvaluator = (node.getOrder() != null) ? compileOrderBy(node
+ .getOrder()) : null;
+
+ final CommandEvaluator<Criterion, Object> selectionEvaluator = node.getChilds().size() == 0 ? null
+ : compileEvaluator(node.getChilds().iterator().next());
+
+ final boolean joinCorrelationSet = propertyInQuery;
+ final boolean sortByStatus = orderByStatus;
+ final boolean sortByStatusDesc = orderByStatusDesc;
+ final Limit limit = node.getLimit();
+
+ return new CommandEvaluator<List, Session>() {
+ public List evaluate(Session session) {
+ Criteria criteria = session.createCriteria(HProcessInstance.class).createAlias("process", "process");
+ if(joinCorrelationSet) {
+ criteria = criteria.createAlias("correlationSets", "property");
+ }
+ if(selectionEvaluator!=null) {
+ criteria.add(selectionEvaluator.evaluate(null));
+ }
+ if (orderEvaluator != null) {
+ Collection<Order> orders = orderEvaluator.evaluate(null);
+ for (Order order : orders) {
+ criteria.addOrder(order);
+ }
+ }
+ // setting limit
+ if (limit != null) {
+ criteria.setMaxResults(limit.getNumber());
+ }
+
+ List result = criteria.list();
+ //check whether ordering by status
+ if(sortByStatus) {
+ Collections.sort(result, sortByStatusDesc?StateComparator.DESC:StateComparator.ASC);
+ }
+
+ return result;
+ };
+ };
+ }
+
+ protected ConjunctionEvaluator<Criterion, Object> compileConjunction(Collection<CommandEvaluator> childs) {
+ return new AbstractConjunction<Criterion, Object>(childs) {
+ public Criterion evaluate(Object arg) {
+ Conjunction conj = Restrictions.conjunction();
+ for (CommandEvaluator eval : childs) {
+ conj.add((Criterion) eval.evaluate(null));
+ }
+ return conj;
+ }
+ };
+ }
+
+ protected DisjunctionEvaluator<Criterion, Object> compileDisjunction(Collection<CommandEvaluator> childs) {
+ return new AbstractDisjunction<Criterion, Object>(childs) {
+ public Criterion evaluate(Object arg) {
+ Disjunction conj = Restrictions.disjunction();
+ for (CommandEvaluator eval : childs) {
+ conj.add((Criterion) eval.evaluate(null));
+ }
+ return conj;
+ };
+ };
+ }
+
+ protected EqualityEvaluator<String, Criterion, Object> compileEqual(final Equality eq) {
+ if (eq.getIdentifier() instanceof Property) {
+ propertyInQuery = true;
+ final Property property = (Property) eq.getIdentifier();
+ return new EqualityEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ Conjunction conj = Restrictions.conjunction();
+ if (!StringUtils.isEmpty(property.getNamespace())) {
+ conj.add(Restrictions.eq(PROPERTY_NS_DB_FIELD, property.getNamespace()));
+ }
+ conj.add(Restrictions.eq(PROPERTY_NAME_DB_FIELD, property.getName()));
+ conj.add(Restrictions.eq(PROPERTY_VALUE_DB_FIELD, eq.getValue().getValue()));
+
+ return conj;
+ };
+
+ public String getIdentifier() {
+ return property.toString();
+ };
+ };
+ } else {
+ final String fieldName = eq.getIdentifier().getName();
+ final Object value = eq.getValue().getValue();
+
+ final String dbField = getDBField(fieldName);
+
+ if (INSTANCE_STATUS_FIELD.equals(fieldName)) {
+ return new FieldValueEquality(INSTANCE_STATUS_FIELD) {
+ /**
+ * @see org.apache.ode.ql.eval.skel.CommandEvaluator#evaluate(java.lang.Object)
+ */
+ public Criterion evaluate(Object paramValue) {
+ short noState = 200; // TODO move to constants
+ Disjunction disj = Restrictions.disjunction();
+
+ if (STATUS_ACTIVE.equals(paramValue)) {
+ disj.add(Restrictions.eq(dbField, ProcessState.STATE_NEW));
+ disj.add(Restrictions.eq(dbField, ProcessState.STATE_ACTIVE));
+ disj.add(Restrictions.eq(dbField, ProcessState.STATE_READY));
+ } else if (STATUS_SUSPENDED.equals(paramValue)) {
+ disj.add(Restrictions.eq(dbField, ProcessState.STATE_SUSPENDED));
+ } else if (STATUS_ERROR.equals(value)) {
+ disj.add(Restrictions.eq(dbField, noState)); // Error instance state doesn't exist yet
+ } else if (STATUS_COMPLETED.equals(paramValue)) {
+ disj.add(Restrictions.eq(dbField, ProcessState.STATE_COMPLETED_OK));
+ } else if (STATUS_TERMINATED.equals(paramValue)) {
+ disj.add(Restrictions.eq(dbField, ProcessState.STATE_TERMINATED));
+ } else if (STATUS_FAULTED.equals(paramValue)) {
+ disj.add(Restrictions.eq(dbField, ProcessState.STATE_COMPLETED_WITH_FAULT));
+ } else {
+ disj.add(Restrictions.eq(dbField, noState)); // Non existent state
+ }
+ return disj;
+ }
+ };
+ }
+
+ return new DBFieldValueEq(dbField, value);
+ }
+ }
+
+ public CommandEvaluator compileEvaluator(Object node) {
+ /*
+ *
+ */
+ if (node instanceof In) {
+ return compileIn((In) node);
+ } else if (node instanceof org.apache.ode.ql.tree.nodes.Conjunction) {
+ return compileConjunction(evaluate((LogicExprNode) node));
+ } else if (node instanceof org.apache.ode.ql.tree.nodes.Disjunction) {
+ return compileDisjunction(evaluate((LogicExprNode) node));
+ } else if (node instanceof IdentifierToValueCMP) {
+ return compileIdentifierToValueCMP((IdentifierToValueCMP) node);
+ }
+ throw new IllegalArgumentException("Unsupported node " + node.getClass());
+ }
+
+ protected CommandEvaluator<Criterion, Object> compileIdentifierToValueCMP(IdentifierToValueCMP node) {
+ Identifier id = node.getIdentifier();
+ if (id instanceof Field) {
+ String name = id.getName();
+ Value value = node.getValue();
+ if (INSTANCE_ID_FIELD.equals(name)) {
+ value.setValue(Long.valueOf((String) value.getValue()));
+ } else if (INSTANCE_STARTED_FIELD.equals(name) || INSTANCE_LAST_ACTIVE_FIELD.equals(name)) {
+ try {
+ value.setValue(ISO8601DateParser.parse((String) value.getValue()));
+ } catch (ParseException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ if (node instanceof Equality) {
+ return compileEqual((Equality) node);
+ } else if (node instanceof Less) {
+ return compileLess((Less) node);
+ } else if (node instanceof Greater) {
+ return compileGreater((Greater) node);
+ } else if (node instanceof GE) {
+ return compileGE((GE) node);
+ } else if (node instanceof LE) {
+ return compileLE((LE) node);
+ } else if (node instanceof Like) {
+ return compileLike((Like) node);
+ } else {
+ throw new IllegalArgumentException("Unsupported node " + node.getClass());
+ }
+ }
+
+ protected GEEvaluator<String, Criterion, Object> compileGE(final GE ge) {
+ if (ge.getIdentifier() instanceof Property) {
+ propertyInQuery = true;
+ final Property property = (Property) ge.getIdentifier();
+ return new GEEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ Conjunction conj = Restrictions.conjunction();
+ if (!StringUtils.isEmpty(property.getNamespace())) {
+ conj.add(Restrictions.ge(PROPERTY_NS_DB_FIELD, property.getNamespace()));
+ }
+ conj.add(Restrictions.ge(PROPERTY_NAME_DB_FIELD, property.getName()));
+ conj.add(Restrictions.ge(PROPERTY_VALUE_DB_FIELD, ge.getValue().getValue()));
+
+ return conj;
+ };
+
+ public String getIdentifier() {
+ return property.toString();
+ };
+ };
+ } else {
+ final String fieldName = ge.getIdentifier().getName();
+ final Object objValue = ge.getValue().getValue();
+
+ if (INSTANCE_STATUS_FIELD.equals(fieldName)) {
+ throw new IllegalArgumentException("Field " + INSTANCE_STATUS_FIELD + " is not supported.");
+ }
+
+ final String dbField = getDBField(fieldName);
+
+ return new GEEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ return Restrictions.ge(dbField, objValue);
+ }
+
+ public String getIdentifier() {
+ return fieldName;
+ }
+ };
+ }
+ }
+
+ protected GreaterEvaluator<String, Criterion, Object> compileGreater(final Greater gt) {
+ if (gt.getIdentifier() instanceof Property) {
+ propertyInQuery = true;
+ final Property property = (Property) gt.getIdentifier();
+ return new GreaterEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ Conjunction conj = Restrictions.conjunction();
+ if (!StringUtils.isEmpty(property.getNamespace())) {
+ conj.add(Restrictions.gt(PROPERTY_NS_DB_FIELD, property.getNamespace()));
+ }
+ conj.add(Restrictions.gt(PROPERTY_NAME_DB_FIELD, property.getName()));
+ conj.add(Restrictions.gt(PROPERTY_VALUE_DB_FIELD, gt.getValue().getValue()));
+
+ return conj;
+ };
+
+ public String getIdentifier() {
+ return property.toString();
+ };
+ };
+ } else {
+ final String fieldName = gt.getIdentifier().getName();
+ final Object value = gt.getValue().getValue();
+
+ if (INSTANCE_STATUS_FIELD.equals(fieldName)) {
+ throw new IllegalArgumentException("Field " + INSTANCE_STATUS_FIELD + " is not supported.");
+ }
+
+ final String dbField = getDBField(fieldName);
+
+ return new GreaterEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ return Restrictions.gt(dbField, value);
+ }
+
+ public String getIdentifier() {
+ return fieldName;
+ }
+ };
+ }
+ }
+
+ protected INEvaluator<String, Criterion, Object> compileIn(final In in) {
+ if (in.getIdentifier() instanceof Property) {
+ propertyInQuery = true;
+ final Property property = (Property) in.getIdentifier();
+ return new INEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ Disjunction disj = Restrictions.disjunction();
+
+ String propertyNS = property.getNamespace();
+ String propertyName = property.getName();
+
+ for (Value value : in.getValues()) {
+ Conjunction conj = Restrictions.conjunction();
+ if (!StringUtils.isEmpty(property.getNamespace())) {
+ conj.add(Restrictions.gt(PROPERTY_NS_DB_FIELD, propertyNS));
+ }
+ conj.add(Restrictions.gt(PROPERTY_NAME_DB_FIELD, propertyName));
+ conj.add(Restrictions.gt(PROPERTY_VALUE_DB_FIELD, value.getValue()));
+
+ disj.add(conj);
+ }
+ return disj;
+ };
+
+ public String getIdentifier() {
+ return property.toString();
+ };
+ };
+ } else {
+ final String fieldName = in.getIdentifier().getName();
+
+ if (INSTANCE_STATUS_FIELD.equals(fieldName)) {
+ short noState = 200; // TODO move to constants
+ final Disjunction disj = Restrictions.disjunction();
+
+ final Collection values = ValuesHelper.extract((Collection<Value>) in.getValues());
+
+ if (values.contains(STATUS_ACTIVE)) {
+ disj.add(Restrictions.eq(INSTANCE_STATUS_DB_FIELD, ProcessState.STATE_NEW));
+ disj.add(Restrictions.eq(INSTANCE_STATUS_DB_FIELD, ProcessState.STATE_ACTIVE));
+ disj.add(Restrictions.eq(INSTANCE_STATUS_DB_FIELD, ProcessState.STATE_READY));
+ }
+ if (values.contains(STATUS_SUSPENDED)) {
+ disj.add(Restrictions.eq(INSTANCE_STATUS_DB_FIELD, ProcessState.STATE_SUSPENDED));
+ }
+ if (values.contains(STATUS_ERROR)) {
+ disj.add(Restrictions.eq(INSTANCE_STATUS_DB_FIELD, noState)); // Error instance state doesn't exist yet
+ }
+ if (values.contains(STATUS_COMPLETED)) {
+ disj.add(Restrictions.eq(INSTANCE_STATUS_DB_FIELD, ProcessState.STATE_COMPLETED_OK));
+ }
+ if (values.contains(STATUS_TERMINATED)) {
+ disj.add(Restrictions.eq(INSTANCE_STATUS_DB_FIELD, ProcessState.STATE_TERMINATED));
+ }
+ if (values.contains(STATUS_FAULTED)) {
+ disj.add(Restrictions.eq(INSTANCE_STATUS_DB_FIELD, ProcessState.STATE_COMPLETED_WITH_FAULT));
+ }
+ return new INEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ return disj;
+ };
+
+ public String getIdentifier() {
+ return INSTANCE_STATUS_DB_FIELD;
+ };
+ };
+ } else {
+ final Collection objValues;
+ final Collection<Value> values = in.getValues();
+ if (INSTANCE_ID_FIELD.equals(fieldName)) {
+ objValues = new ArrayList<Long>(values.size());
+ for (Value value : values) {
+ objValues.add(Long.valueOf((String) value.getValue()));
+ }
+ } else if (INSTANCE_STARTED_FIELD.equals(fieldName) || INSTANCE_LAST_ACTIVE_FIELD.equals(fieldName)) {
+ objValues = new ArrayList<Date>(values.size());
+ try {
+ for (Value value : values) {
+ objValues.add(ISO8601DateParser.parse((String) value.getValue()));
+ }
+ } catch (ParseException ex) {
+ throw new RuntimeException(ex);
+ }
+ } else {
+ objValues = ValuesHelper.extract((Collection<Value>) values);
+ }
+ final String dbField = getDBField(fieldName);
+ return new INEvaluator<String, Criterion, Object>() {
+ /**
+ * @see org.apache.ode.ql.eval.skel.CommandEvaluator#evaluate(java.lang.Object)
+ */
+ public Criterion evaluate(Object paramValue) {
+ return Restrictions.in(dbField, objValues);
+ }
+
+ /**
+ * @see org.apache.ode.ql.eval.skel.Identified#getIdentifier()
+ */
+ public String getIdentifier() {
+ return dbField;
+ }
+ };
+ }
+ }
+ }
+
+ protected LEEvaluator<String, Criterion, Object> compileLE(final LE le) {
+ if (le.getIdentifier() instanceof Property) {
+ final Property property = (Property) le.getIdentifier();
+ return new LEEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ Conjunction conj = Restrictions.conjunction();
+ if (!StringUtils.isEmpty(property.getNamespace())) {
+ conj.add(Restrictions.le(PROPERTY_NS_DB_FIELD, property.getNamespace()));
+ }
+ conj.add(Restrictions.le(PROPERTY_NAME_DB_FIELD, property.getName()));
+ conj.add(Restrictions.le(PROPERTY_VALUE_DB_FIELD, le.getValue().getValue()));
+
+ return conj;
+ };
+
+ public String getIdentifier() {
+ return property.toString();
+ };
+ };
+ } else {
+ final String fieldName = le.getIdentifier().getName();
+ final Object value = le.getValue().getValue();
+
+ if (INSTANCE_STATUS_FIELD.equals(fieldName)) {
+ throw new IllegalArgumentException("Field " + INSTANCE_STATUS_FIELD + " is not supported.");
+ }
+
+ final String dbField = getDBField(fieldName);
+
+ return new LEEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ return Restrictions.le(dbField, value);
+ }
+
+ public String getIdentifier() {
+ return fieldName;
+ }
+ };
+ }
+ }
+
+ protected LessEvaluator<String, Criterion, Object> compileLess(final Less less) {
+ if (less.getIdentifier() instanceof Property) {
+ propertyInQuery = true;
+ final Property property = (Property) less.getIdentifier();
+ return new LessEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ Conjunction conj = Restrictions.conjunction();
+ if (!StringUtils.isEmpty(property.getNamespace())) {
+ conj.add(Restrictions.lt(PROPERTY_NS_DB_FIELD, property.getNamespace()));
+ }
+ conj.add(Restrictions.lt(PROPERTY_NAME_DB_FIELD, property.getName()));
+ conj.add(Restrictions.lt(PROPERTY_VALUE_DB_FIELD, less.getValue().getValue()));
+
+ return conj;
+ };
+
+ public String getIdentifier() {
+ return property.toString();
+ };
+ };
+ } else {
+ final String fieldName = less.getIdentifier().getName();
+ final Object value = less.getValue().getValue();
+
+ if (INSTANCE_STATUS_FIELD.equals(fieldName)) {
+ throw new IllegalArgumentException("Field " + INSTANCE_STATUS_FIELD + " is not supported.");
+ }
+
+ final String dbField = getDBField(fieldName);
+
+ return new LessEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ return Restrictions.lt(dbField, value);
+ }
+
+ public String getIdentifier() {
+ return fieldName;
+ }
+ };
+ }
+ }
+
+ protected LikeEvaluator<String, Criterion, Object> compileLike(final Like like) {
+ if (like.getIdentifier() instanceof Property) {
+ propertyInQuery = true;
+ final Property property = (Property) like.getIdentifier();
+ return new LikeEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ Conjunction conj = Restrictions.conjunction();
+ if (!StringUtils.isEmpty(property.getNamespace())) {
+ conj.add(Restrictions.like(PROPERTY_NS_DB_FIELD, property.getNamespace()));
+ }
+ conj.add(Restrictions.like(PROPERTY_NAME_DB_FIELD, property.getName()));
+ conj.add(Restrictions.like(PROPERTY_VALUE_DB_FIELD, like.getValue().getValue()));
+
+ return conj;
+ };
+
+ public String getIdentifier() {
+ return property.toString();
+ };
+ };
+ } else {
+ final String fieldName = like.getIdentifier().getName();
+ if (INSTANCE_STATUS_FIELD.equals(fieldName)) {
+ throw new IllegalArgumentException("Field " + INSTANCE_STATUS_FIELD + " is not supported by like operation.");
+ }
+ if (INSTANCE_ID_FIELD.equals(fieldName)) {
+ throw new IllegalArgumentException("Field " + INSTANCE_ID_FIELD + " is not supported by like operation.");
+ }
+
+ final Object value = like.getValue().getValue();
+ final String dbField = getDBField(fieldName);
+
+ return new LikeEvaluator<String, Criterion, Object>() {
+ public Criterion evaluate(Object paramValue) {
+ return Restrictions.like(dbField, value);
+ };
+
+ public String getIdentifier() {
+ return dbField;
+ }
+ };
+ }
+ }
+
+ protected OrderByEvaluator<Collection<Order>, Object> compileOrderBy(OrderBy orderBy) {
+ final LinkedHashMap<String, Boolean> orders = new LinkedHashMap<String, Boolean>();
+
+ for (OrderByElement idOrder : orderBy.getOrders()) {
+ if (!(idOrder.getIdentifier() instanceof Field)) {
+ throw new IllegalArgumentException("Only field identifier supported by order by operator.");
+ }
+ String idName = idOrder.getIdentifier().getName();
+ if(INSTANCE_STATUS_FIELD.equals(idName)) {
+ if(orderBy.getOrders().size()>1) {
+ //TODO throw appropriate exception
+ throw new RuntimeException("Status field should be used alone in <order by> construction.");
+ }
+ orderByStatus = true;
+ orderByStatusDesc = idOrder.getType()==OrderByType.DESC;
+ return null;
+ }
+ String dbField = getDBField(idName);
+
+ orders.put(dbField, idOrder.getType() == null || idOrder.getType() == OrderByType.ASC);
+ }
+
+ return new OrderByEvaluator<Collection<Order>, Object>() {
+ public Collection<Order> evaluate(Object paramValue) {
+ Collection<Order> hibernateOrders = new ArrayList<Order>(orders.size());
+ for (Map.Entry<String, Boolean> order : orders.entrySet()) {
+ hibernateOrders.add(order.getValue() ? Order.asc(order.getKey()) : Order.desc(order.getKey()));
+ }
+ return hibernateOrders;
+ }
+ };
+ }
+
+ protected List<CommandEvaluator> evaluate(LogicExprNode exprNode) {
+ ArrayList<CommandEvaluator> commandsEv = new ArrayList<CommandEvaluator>(exprNode.getChilds().size());
+ for (LogicNode node : exprNode.getChilds()) {
+ commandsEv.add(compileEvaluator(node));
+ }
+ return commandsEv;
+ }
+
+ public static void main(String[] args) {
+ String queryString = "order by last-active desc limit 1000";
+ Builder<String> builder = BuilderFactory.getInstance().createBuilder();
+ Node queryNode = builder.build(queryString);
+ HibernateInstancesQueryCompiler compiler = new HibernateInstancesQueryCompiler();
+
+ compiler.compile((Query) queryNode);
+ }
+}
Added: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/bpel/ql/StateComparator.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/bpel/ql/StateComparator.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/bpel/ql/StateComparator.java (added)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/bpel/ql/StateComparator.java Sun May 2 17:02:51 2010
@@ -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.ode.dao.hib.bpel.ql;
+
+import java.util.Comparator;
+
+import org.apache.commons.lang.ArrayUtils;
+
+import org.apache.ode.bpel.common.ProcessState;
+import org.apache.ode.dao.hib.bpel.hobj.HProcessInstance;
+
+class StateComparator implements Comparator<HProcessInstance> {
+
+ private static final short[] order = {
+ //"active" status
+ ProcessState.STATE_ACTIVE,
+ ProcessState.STATE_NEW,
+ ProcessState.STATE_READY,
+ //"completed"
+ ProcessState.STATE_COMPLETED_OK,
+ //"error"
+ //TODO Create status for error
+ 200,//noState
+ //"failed"
+ ProcessState.STATE_COMPLETED_WITH_FAULT,
+ //"suspended"
+ ProcessState.STATE_SUSPENDED,
+ //"terminated"
+ ProcessState.STATE_TERMINATED};
+
+ private final int multiplier;
+
+ public final static StateComparator ASC = new StateComparator(true);
+ public final static StateComparator DESC = new StateComparator(false);
+
+ protected StateComparator(boolean asc) {
+ multiplier = asc?1:-1;
+ }
+ /**
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(HProcessInstance o1, HProcessInstance o2) {
+ return multiplier * (ArrayUtils.indexOf(order, o1.getState()) - ArrayUtils.indexOf(order, o2.getState()));
+ }
+
+}
Added: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/package.html
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/package.html?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/package.html (added)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/package.html Sun May 2 17:02:51 2010
@@ -0,0 +1,27 @@
+<!--
+ ~ 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.
+ -->
+
+<html>
+<body>
+<p>
+Supporting classes for the Hibernate/DAO implementation used
+by both the BPEL and SFWK DAO implementations.
+</p>
+</body>
+</html>
Added: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/ConfStoreDAOConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/ConfStoreDAOConnectionFactoryImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/ConfStoreDAOConnectionFactoryImpl.java (added)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/ConfStoreDAOConnectionFactoryImpl.java Sun May 2 17:02:51 2010
@@ -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.ode.dao.hib.store;
+
+import org.apache.ode.dao.hib.store.hobj.VersionTrackerDAOImpl;
+import org.apache.ode.dao.hib.store.hobj.DeploymentUnitDaoImpl;
+import org.apache.ode.dao.hib.store.hobj.ProcessConfDaoImpl;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
+import org.apache.ode.utils.GUID;
+import org.hibernate.MappingException;
+import org.hibernate.cfg.Configuration;
+
+import javax.sql.DataSource;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+import javax.transaction.TransactionManager;
+import org.apache.ode.dao.hib.SessionManager;
+import static org.apache.ode.dao.hib.bpel.BpelDAOConnectionFactoryImpl.setupSessionManager;
+
+public class ConfStoreDAOConnectionFactoryImpl implements ConfStoreDAOConnectionFactory {
+
+ private static final Log __log = LogFactory.getLog(ConfStoreDAOConnectionFactoryImpl.class);
+ private static final String _guid = new GUID().toString();
+ private static final Map<String, DataSource> _dataSources = new ConcurrentHashMap<String, DataSource>();
+ protected SessionManager _sessionManager;
+ private TransactionManager _txm;
+ private DataSource _ds;
+
+ public void init(Properties initialProps, TransactionManager mgr, Object env) {
+ _txm = mgr;
+ _ds = (DataSource) env;
+ _sessionManager = setupSessionManager(initialProps, _txm, _ds);
+
+ }
+
+ public void shutdown() {
+ _sessionManager.shutdown();
+ }
+
+ public ConfStoreDAOConnectionImpl getConnection() {
+ final ThreadLocal<ConfStoreDAOConnectionImpl> currentConnection = ConfStoreDAOConnectionImpl.getThreadLocal();
+ ConfStoreDAOConnectionImpl conn = (ConfStoreDAOConnectionImpl) currentConnection.get();
+ if (conn != null && !conn.isClosed()) {
+ return conn;
+ } else {
+ conn = new ConfStoreDAOConnectionImpl(_sessionManager);
+ currentConnection.set(conn);
+ return conn;
+ }
+ }
+
+ static Configuration getDefaultConfiguration() throws MappingException {
+ return new Configuration().addClass(ProcessConfDaoImpl.class).addClass(DeploymentUnitDaoImpl.class).addClass(VersionTrackerDAOImpl.class);
+ }
+}
Added: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/ConfStoreDAOConnectionImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/ConfStoreDAOConnectionImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/ConfStoreDAOConnectionImpl.java (added)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/ConfStoreDAOConnectionImpl.java Sun May 2 17:02:51 2010
@@ -0,0 +1,122 @@
+/*
+ * 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.ode.dao.hib.store;
+
+import org.apache.ode.dao.hib.store.hobj.VersionTrackerDAOImpl;
+import org.apache.ode.dao.hib.store.hobj.DeploymentUnitDaoImpl;
+import org.apache.ode.dao.hib.store.hobj.ProcessConfDaoImpl;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ode.dao.store.ConfStoreDAOConnection;
+import org.apache.ode.dao.store.DeploymentUnitDAO;
+import org.apache.ode.dao.store.ProcessConfDAO;
+import org.hibernate.Criteria;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.Date;
+import org.apache.ode.dao.hib.SessionManager;
+
+/**
+ * Connection to a Hibernate data store. Essentially a thin wrapper around Hibernate's
+ * {@link org.hibernate.Session} interface.
+ * @author mriou <mriou at apache dot org>
+ */
+public class ConfStoreDAOConnectionImpl implements ConfStoreDAOConnection {
+
+ private static final Log __log = LogFactory.getLog(ConfStoreDAOConnectionImpl.class);
+ SessionManager _sm;
+ static final ThreadLocal<ConfStoreDAOConnectionImpl> _connections = new ThreadLocal<ConfStoreDAOConnectionImpl>();
+
+
+ public ConfStoreDAOConnectionImpl(SessionManager session) {
+ _sm = session;
+ }
+
+ public ProcessConfDAO getProcess(QName pid) {
+ _sm.begin();
+ try {
+ ProcessConfDAO ret = (ProcessConfDaoImpl) _sm.getSession().get(ProcessConfDaoImpl.class, pid.toString());
+ _sm.commit();
+ return ret;
+ } catch (HibernateException e) {
+ __log.error("DbError", e);
+ _sm.rollback();
+ throw e;
+ }
+ }
+
+ public DeploymentUnitDAO createDeploymentUnit(String name) {
+ DeploymentUnitDaoImpl du = new DeploymentUnitDaoImpl();
+ du.setName(name);
+ du.setDeployDate(new Date());
+ _sm.getSession().save(du);
+ return du;
+ }
+
+ public DeploymentUnitDAO getDeploymentUnit(String name) {
+ try {
+ DeploymentUnitDaoImpl du = (DeploymentUnitDaoImpl) _sm.getSession().get(DeploymentUnitDaoImpl.class, name);
+ return du;
+ } catch (HibernateException e) {
+ __log.error("DbError", e);
+ throw e;
+ }
+ }
+
+ public long getNextVersion() {
+ VersionTrackerDAOImpl vt = (VersionTrackerDAOImpl) _sm.getSession().createQuery("from VersionTrackerDAOImpl v ").uniqueResult();
+ if (vt == null) {
+ return 1;
+ } else {
+ return vt.getVersion() + 1;
+ }
+ }
+
+ public void setVersion(long version) {
+ VersionTrackerDAOImpl vt = (VersionTrackerDAOImpl) _sm.getSession().createQuery("from VersionTrackerDAOImpl v ").uniqueResult();
+ if (vt == null) {
+ vt = new VersionTrackerDAOImpl();
+ vt.setId(1);
+ }
+ vt.setVersion(version);
+ _sm.getSession().save(vt);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Collection<DeploymentUnitDAO> getDeploymentUnits() {
+ Criteria c = _sm.getSession().createCriteria(DeploymentUnitDaoImpl.class);
+ return c.list();
+ }
+
+ public void close() {
+
+ }
+
+ public boolean isClosed() {
+ return _sm.isClosed();
+ }
+
+ public static ThreadLocal<ConfStoreDAOConnectionImpl> getThreadLocal() {
+ return _connections;
+ }
+
+}
Added: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/HibernateDao.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/HibernateDao.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/HibernateDao.java (added)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/HibernateDao.java Sun May 2 17:02:51 2010
@@ -0,0 +1,45 @@
+/*
+ * 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.ode.dao.hib.store;
+
+import org.apache.ode.dao.hib.SessionManager;
+import org.hibernate.Session;
+
+
+public class HibernateDao {
+
+ protected Session getSession() {
+ return ConfStoreDAOConnectionImpl.getThreadLocal().get()._sm.getSession();
+ }
+
+ protected void delete() {
+ SessionManager sm =ConfStoreDAOConnectionImpl.getThreadLocal().get()._sm;
+ sm.begin();
+ getSession().delete(this);
+ sm.commit();
+ }
+
+ protected void begin(){
+ ConfStoreDAOConnectionImpl.getThreadLocal().get()._sm.begin();
+ }
+
+ protected void commit(){
+ ConfStoreDAOConnectionImpl.getThreadLocal().get()._sm.commit();
+ }
+}
Added: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/DeploymentUnitDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/DeploymentUnitDaoImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/DeploymentUnitDaoImpl.java (added)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/DeploymentUnitDaoImpl.java Sun May 2 17:02:51 2010
@@ -0,0 +1,150 @@
+/*
+ * 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.ode.dao.hib.store.hobj;
+
+import org.apache.ode.bpel.iapi.ProcessState;
+import org.apache.ode.dao.store.DeploymentUnitDAO;
+import org.apache.ode.dao.store.ProcessConfDAO;
+import org.apache.ode.utils.stl.CollectionsX;
+import org.apache.ode.utils.stl.MemberOfFunction;
+import org.apache.ode.dao.hib.store.HibernateDao;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import org.apache.ode.dao.hib.SessionManager;
+
+
+/**
+ * @author mriou <mriou at apache dot org>
+ * @hibernate.class table="STORE_DU"
+ */
+public class DeploymentUnitDaoImpl extends HibernateDao implements DeploymentUnitDAO {
+
+ private Collection<ProcessConfDaoImpl> _processes = new HashSet<ProcessConfDaoImpl>();
+
+ /** User that deployed the process. */
+ private String _deployer;
+
+ /** Date of last deployment. */
+ private Date _deployDate;
+
+ private String _dir;
+
+ private String _name;
+
+ /**
+ * @hibernate.bag
+ * lazy="false"
+ * inverse="true"
+ * cascade="all"
+ * role="store_processes"
+ * @hibernate.collection-key
+ * column="DU"
+ * @hibernate.collection-one-to-many
+ * class="org.apache.ode.dao.hib.store.hobj.ProcessConfDaoImpl"
+ */
+ public Collection<? extends ProcessConfDAO> getProcesses() {
+ return _processes;
+ }
+
+
+ public void setProcesses(Collection<ProcessConfDaoImpl> processes) {
+ _processes = processes;
+ }
+
+ /**
+ * The user that deployed the process.
+ * @hibernate.property
+ * column="deployer"
+ */
+ public String getDeployer() {
+ return _deployer;
+ }
+
+ public void setDeployer(String deployer) {
+ _deployer = deployer;
+ }
+
+ /**
+ * The date the process was deployed.
+ * @hibernate.property
+ * column="DEPLOYDT"
+ */
+ public Date getDeployDate() {
+ return _deployDate;
+ }
+
+ public void setDeployDate(Date deployDate) {
+ _deployDate = deployDate;
+ }
+
+ /**
+ * @hibernate.id generator-class="assigned"
+ * @hibernate.column name="NAME"
+ */
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ _name = name;
+ }
+
+ /**
+ * @hibernate.property column="DIR"
+ */
+ public String getDeploymentUnitDir() {
+ return _dir;
+ }
+
+ public void setDeploymentUnitDir(String dir) {
+ _dir = dir;
+ }
+
+ public void delete() {
+ super.delete();
+ }
+
+ public ProcessConfDAO createProcess(QName pid, QName type, long version) {
+ ProcessConfDaoImpl p = new ProcessConfDaoImpl();
+ p.setPID(pid);
+ p.setType(type);
+ p.setDeploymentUnit(this);
+ p.setState(ProcessState.ACTIVE);
+ p.setVersion(version);
+ begin();
+ getSession().save(p);
+ commit();
+ _processes.add(p);
+ return p;
+ }
+
+ public ProcessConfDAO getProcess(final QName pid) {
+ return CollectionsX.find_if(_processes,new MemberOfFunction<ProcessConfDAO>() {
+ @Override
+ public boolean isMember(ProcessConfDAO o) {
+ return o.getPID().equals(pid);
+ }
+
+ });
+ }
+ }
+
Added: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/ProcessConfDaoImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/ProcessConfDaoImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/ProcessConfDaoImpl.java (added)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/ProcessConfDaoImpl.java Sun May 2 17:02:51 2010
@@ -0,0 +1,186 @@
+/*
+ * 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.ode.dao.hib.store.hobj;
+
+import org.apache.ode.bpel.iapi.ProcessState;
+import org.apache.ode.dao.store.ProcessConfDAO;
+import org.apache.ode.utils.stl.CollectionsX;
+import org.apache.ode.utils.stl.UnaryFunction;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.ode.dao.hib.SessionManager;
+import org.apache.ode.dao.hib.store.HibernateDao;
+
+/**
+ * @author mriou <mriou at apache dot org>
+ * @hibernate.class table="STORE_PROCESS"
+ */
+public class ProcessConfDaoImpl extends HibernateDao implements ProcessConfDAO {
+
+ private DeploymentUnitDaoImpl _du;
+
+ private Map<String,String> _properties = new HashMap<String,String>();
+
+ /** Simple name of the process. */
+ private String _processId;
+
+ /** Process type. */
+ private String _type;
+
+
+ /** Process version. */
+ private long _version;
+
+ /** Process state.*/
+ private String _state;
+
+
+ /**
+ * @hibernate.many-to-one
+ * @hibernate.column name="DU"
+ */
+ public DeploymentUnitDaoImpl getDeploymentUnit() {
+ return _du;
+ }
+
+ public void setDeploymentUnit(DeploymentUnitDaoImpl du) {
+ _du = du;
+ }
+ /**
+ * @hibernate.map table="STORE_PROCESS_PROP" role="properties_"
+ * @hibernate.collection-key column="propId"
+ * @hibernate.collection-index column="name" type="string"
+ * @hibernate.collection-element column="value" type="string" length="2000"
+ */
+ public Map<String,String> getProperties_() {
+ return _properties;
+ }
+
+ public void setProperties_(Map<String,String> properties) {
+ _properties = properties;
+ }
+
+ /**
+ *
+ * @hibernate.id generator-class="assigned"
+ * @hibernate.column
+ * name="PID"
+ * not-null="true"
+ */
+ public String getPID_() {
+ return _processId;
+ }
+
+ public void setPID_(String processId) {
+ _processId = processId;
+ }
+
+
+ /**
+ * The type of the process (BPEL process definition name).
+ * @hibernate.property
+ * column="TYPE"
+ */
+ public String getType_() {
+ return _type;
+ }
+
+ public void setType_(String type) {
+ _type = type;
+ }
+
+
+ /**
+ * The process version.
+ * @hibernate.property
+ * column="version"
+ */
+ public long getVersion() {
+ return _version;
+ }
+
+ public void setVersion(long version) {
+ _version = version;
+ }
+
+ /**
+ * The process state.
+ * @hibernate.property
+ * column="STATE"
+ */
+ public String getState_() {
+ return _state;
+ }
+
+ public void setState_(String state) {
+ _state = state;
+ }
+
+
+ public QName getPID() {
+ return QName.valueOf(getPID_());
+ }
+
+ public void setPID(QName pid) {
+ setPID_(pid.toString());
+ }
+
+ public void setState(ProcessState state) {
+ setState_(state.toString());
+ }
+
+ public void setProperty(QName name, String content) {
+ _properties.put(name.toString(),content);
+ }
+
+ public void delete() {
+ super.delete();
+ }
+
+ public QName getType() {
+ return QName.valueOf(getType_());
+ }
+
+ public void setType(QName type) {
+ setType_(type.toString());
+ }
+
+ public ProcessState getState() {
+ return ProcessState.valueOf(getState_());
+ }
+
+ public String getProperty(QName name) {
+ return _properties.get(name.toString());
+ }
+
+ public Collection<QName> getPropertyNames() {
+ return CollectionsX.transform(new ArrayList<QName>(), _properties.keySet(),new UnaryFunction<String,QName>() {
+ public QName apply(String x) {
+ return QName.valueOf(x);
+ }
+
+ });
+ }
+
+
+}
Added: ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/VersionTrackerDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/VersionTrackerDAOImpl.java?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/VersionTrackerDAOImpl.java (added)
+++ ode/trunk/dao-hibernate/src/main/java/org/apache/ode/dao/hib/store/hobj/VersionTrackerDAOImpl.java Sun May 2 17:02:51 2010
@@ -0,0 +1,56 @@
+/*
+ * 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.ode.dao.hib.store.hobj;
+
+import org.apache.ode.dao.hib.SessionManager;
+import org.apache.ode.dao.hib.store.HibernateDao;
+
+/**
+ * @author Matthieu Riou <mriou at apache dot org>
+ * @hibernate.class table="STORE_VERSIONS"
+ */
+public class VersionTrackerDAOImpl extends HibernateDao {
+
+ private int _id;
+ private long _version;
+
+ /**
+ * @hibernate.id generator-class="assigned"
+ * @hibernate.column name="ID" not-null="true"
+ */
+ public int getId() {
+ return _id;
+ }
+
+ public void setId(int id) {
+ _id = id;
+ }
+
+ /**
+ * @hibernate.property column="VERSION"
+ */
+ public long getVersion() {
+ return _version;
+ }
+
+ public void setVersion(long version) {
+ _version = version;
+ }
+}
Added: ode/trunk/dao-hibernate/src/test/resources/ode.properties
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate/src/test/resources/ode.properties?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-hibernate/src/test/resources/ode.properties (added)
+++ ode/trunk/dao-hibernate/src/test/resources/ode.properties Sun May 2 17:02:51 2010
@@ -0,0 +1,5 @@
+test.dao.factory=org.apache.ode.dao.hib.bpel.BpelDAOConnectionFactoryImpl
+test.dao.factory.store=org.apache.ode.dao.hib.store.ConfStoreDAOConnectionFactoryImpl
+test.dao.factory.schedule=
+
+
Modified: ode/trunk/dao-jpa-db/build.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-db/build.xml?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/dao-jpa-db/build.xml (original)
+++ ode/trunk/dao-jpa-db/build.xml Sun May 2 17:02:51 2010
@@ -71,9 +71,8 @@
<path refid="classpath"/>
</classpath>
</mappingtool>
- <concat destfile="${db.scripts.dir}/@{db}.sql">
+ <concat destfile="${db.scripts.dir}/scripts/@{db}.sql">
<fileset file="${scripts.dir}/license-header.sql"/>
- <fileset file="${scripts.dir}/simplesched-@{db}.sql"/>
<fileset file="${db.scripts.dir}/partial.@{db}.sql"/>
</concat>
<echo>Done.</echo>
Modified: ode/trunk/dao-jpa-db/pom.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-db/pom.xml?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/dao-jpa-db/pom.xml (original)
+++ ode/trunk/dao-jpa-db/pom.xml Sun May 2 17:02:51 2010
@@ -16,204 +16,201 @@
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
- -->
+-->
<project>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-dao-jpa-db</artifactId>
- <name>ODE :: OpenJPA DDL Generation</name>
- <parent>
+ <modelVersion>4.0.0</modelVersion>
<groupId>org.apache.ode</groupId>
- <artifactId>ode</artifactId>
- <version>2.0-SNAPSHOT</version>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jta_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-dao</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-utils</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-runtimes</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-il-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-dao-jpa</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-store</artifactId>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.serp</groupId>
- <artifactId>serp</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
- <dependency>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-ejb_2.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbytools</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.modules</groupId>
- <artifactId>geronimo-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.components</groupId>
- <artifactId>geronimo-transaction</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.components</groupId>
- <artifactId>geronimo-connector</artifactId>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-pool</groupId>
- <artifactId>commons-pool</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>create-db-schemas</id>
- <phase>process-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="maven.runtime.classpath" refid="maven.compile.classpath"/>
- <ant antfile="build.xml" target="create-schema" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>sql-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>create-derby-db</id>
- <phase>process-resources</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
- <url>jdbc:derby:${basedir}/target/derby/jpadb;create=true</url>
- <username>sa</username>
- <password />
- <autocommit>true</autocommit>
- <onError>continue</onError>
- <srcFiles>
- <srcFile>target/derby.sql</srcFile>
- </srcFiles>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>zip-derby-db</id>
- <phase>package</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="ode.version" value="${project.version}"/>
- <ant antfile="build.xml" target="zip-derby-db" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
-
+ <artifactId>ode-dao-jpa-db</artifactId>
+ <name>ODE :: OpenJPA DDL Generation</name>
+ <packaging>pom</packaging>
+ <parent>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-dao</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-utils</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-runtimes</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-il-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-dao-jpa</artifactId>
+ <classifier>openjpa</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ode</groupId>
+ <artifactId>ode-bpel-store</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.serp</groupId>
+ <artifactId>serp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_2.1_spec</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbytools</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.modules</groupId>
+ <artifactId>geronimo-kernel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.components</groupId>
+ <artifactId>geronimo-transaction</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.components</groupId>
+ <artifactId>geronimo-connector</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-pool</groupId>
+ <artifactId>commons-pool</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-db-schemas</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.compile.classpath"/>
+ <ant antfile="build.xml" target="create-schema" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>sql-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-derby-db</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:${basedir}/target/ode-db;create=true</url>
+ <username>sa</username>
+ <password />
+ <autocommit>true</autocommit>
+ <onError>continue</onError>
+ <srcFiles>
+ <srcFile>target/scripts/derby.sql</srcFile>
+ </srcFiles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <finalName>ode-db-derby-ojpa-${project.version}</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
Added: ode/trunk/dao-jpa-db/src/main/assembly/bin.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-db/src/main/assembly/bin.xml?rev=940263&view=auto
==============================================================================
--- ode/trunk/dao-jpa-db/src/main/assembly/bin.xml (added)
+++ ode/trunk/dao-jpa-db/src/main/assembly/bin.xml Sun May 2 17:02:51 2010
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <outputDirectory>/</outputDirectory>
+ <directory>target</directory>
+ <includes>
+ <include>scripts/*.sql</include>
+ <include>ode-db/**</include>
+ </includes>
+ <excludes>
+ <exclude>partial.*.sql</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+
+</assembly>
Modified: ode/trunk/dao-jpa-db/src/main/descriptors/persistence.derby.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-db/src/main/descriptors/persistence.derby.xml?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/dao-jpa-db/src/main/descriptors/persistence.derby.xml (original)
+++ ode/trunk/dao-jpa-db/src/main/descriptors/persistence.derby.xml Sun May 2 17:02:51 2010
@@ -16,42 +16,47 @@
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
- -->
+-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
- <persistence-unit name="ode-unit-test-embedded">
- <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
- <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
- <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
- <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
- <class>org.apache.ode.dao.jpa.EventDAOImpl</class>
- <class>org.apache.ode.dao.jpa.FaultDAOImpl</class>
- <class>org.apache.ode.dao.jpa.MessageDAOImpl</class>
- <class>org.apache.ode.dao.jpa.MessageExchangeDAOImpl</class>
- <class>org.apache.ode.dao.jpa.MessageRouteDAOImpl</class>
- <class>org.apache.ode.dao.jpa.PartnerLinkDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ProcessDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ProcessInstanceDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ResourceRouteDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
- <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
-
- <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
- <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
- <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
- <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
-
- <properties>
- <!-- Properties for an embedded Derby connection -->
- <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
- <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.DerbyDictionary"/>
- <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
- <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ <persistence-unit name="ode-unit-test-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.bpel.EventDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.FaultDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageExchangeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MexProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ProcessDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ContextValueDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrSetProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.ProcessInstanceDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.XmlDataProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.PartnerLinkDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageDAOImpl</class>
- <property name="openjpa.ConnectionProperties"
- value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
+ <class>org.apache.ode.dao.jpa.store.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.VersionTrackerDAOImpl</class>
- </properties>
- </persistence-unit>
+ <class>org.apache.ode.dao.jpa.scheduler.JobDAOImpl</class>
+
+ <properties>
+ <!-- Properties for an embedded Derby connection -->
+ <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.DerbyDictionary"/>
+ <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+
+ <property name="openjpa.ConnectionProperties"
+ value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
+
+ </properties>
+ </persistence-unit>
</persistence>
Modified: ode/trunk/dao-jpa-db/src/main/descriptors/persistence.mysql.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-db/src/main/descriptors/persistence.mysql.xml?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/dao-jpa-db/src/main/descriptors/persistence.mysql.xml (original)
+++ ode/trunk/dao-jpa-db/src/main/descriptors/persistence.mysql.xml Sun May 2 17:02:51 2010
@@ -16,42 +16,48 @@
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
- -->
+-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
- <persistence-unit name="ode-unit-test-embedded">
- <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
- <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
- <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
- <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
- <class>org.apache.ode.dao.jpa.EventDAOImpl</class>
- <class>org.apache.ode.dao.jpa.FaultDAOImpl</class>
- <class>org.apache.ode.dao.jpa.MessageDAOImpl</class>
- <class>org.apache.ode.dao.jpa.MessageExchangeDAOImpl</class>
- <class>org.apache.ode.dao.jpa.MessageRouteDAOImpl</class>
- <class>org.apache.ode.dao.jpa.PartnerLinkDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ProcessDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ProcessInstanceDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ResourceRouteDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
- <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
-
- <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
- <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
- <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
- <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
-
- <properties>
- <!-- Properties for an embedded Derby connection -->
- <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
- <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.MySQLDictionary"/>
- <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
- <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ <persistence-unit name="ode-unit-test-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.bpel.EventDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.FaultDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageExchangeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MexProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ProcessDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ContextValueDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrSetProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.ProcessInstanceDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.XmlDataProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.PartnerLinkDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageDAOImpl</class>
- <property name="openjpa.ConnectionProperties"
- value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
+ <class>org.apache.ode.dao.jpa.store.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.VersionTrackerDAOImpl</class>
- </properties>
- </persistence-unit>
+ <class>org.apache.ode.dao.jpa.scheduler.JobDAOImpl</class>
+
+
+ <properties>
+ <!-- Properties for an embedded Derby connection -->
+ <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.MySQLDictionary"/>
+ <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+
+ <property name="openjpa.ConnectionProperties"
+ value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
+
+ </properties>
+ </persistence-unit>
</persistence>
Modified: ode/trunk/dao-jpa-db/src/main/descriptors/persistence.oracle.xml
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-db/src/main/descriptors/persistence.oracle.xml?rev=940263&r1=940262&r2=940263&view=diff
==============================================================================
--- ode/trunk/dao-jpa-db/src/main/descriptors/persistence.oracle.xml (original)
+++ ode/trunk/dao-jpa-db/src/main/descriptors/persistence.oracle.xml Sun May 2 17:02:51 2010
@@ -16,42 +16,48 @@
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
- -->
+-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
- <persistence-unit name="ode-unit-test-embedded">
- <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
- <class>org.apache.ode.dao.jpa.ActivityRecoveryDAOImpl</class>
- <class>org.apache.ode.dao.jpa.CorrelationSetDAOImpl</class>
- <class>org.apache.ode.dao.jpa.CorrelatorDAOImpl</class>
- <class>org.apache.ode.dao.jpa.EventDAOImpl</class>
- <class>org.apache.ode.dao.jpa.FaultDAOImpl</class>
- <class>org.apache.ode.dao.jpa.MessageDAOImpl</class>
- <class>org.apache.ode.dao.jpa.MessageExchangeDAOImpl</class>
- <class>org.apache.ode.dao.jpa.MessageRouteDAOImpl</class>
- <class>org.apache.ode.dao.jpa.PartnerLinkDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ProcessDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ProcessInstanceDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ResourceRouteDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ScopeDAOImpl</class>
- <class>org.apache.ode.dao.jpa.XmlDataDAOImpl</class>
- <class>org.apache.ode.dao.jpa.ContextValueDAOImpl</class>
-
- <class>org.apache.ode.store.jpa.ProcessConfDaoImpl</class>
- <class>org.apache.ode.store.jpa.ProcessConfPropertyDaoImpl</class>
- <class>org.apache.ode.store.jpa.DeploymentUnitDaoImpl</class>
- <class>org.apache.ode.store.jpa.VersionTrackerDAOImpl</class>
-
- <properties>
- <!-- Properties for an embedded Derby connection -->
- <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
- <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.OracleDictionary"/>
- <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
- <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+ <persistence-unit name="ode-unit-test-embedded">
+ <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
+ <class>org.apache.ode.dao.jpa.bpel.EventDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.FaultDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ResourceRouteDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageExchangeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MexProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.ActivityRecoveryDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ProcessDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ContextValueDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrelatorDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrSetProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.ProcessInstanceDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.XmlDataDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.XmlDataProperty</class>
+ <class>org.apache.ode.dao.jpa.bpel.PartnerLinkDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.CorrelationSetDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.ScopeDAOImpl</class>
+ <class>org.apache.ode.dao.jpa.bpel.MessageDAOImpl</class>
- <property name="openjpa.ConnectionProperties"
- value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
+ <class>org.apache.ode.dao.jpa.store.ProcessConfDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.ProcessConfPropertyDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.DeploymentUnitDaoImpl</class>
+ <class>org.apache.ode.dao.jpa.store.VersionTrackerDAOImpl</class>
- </properties>
- </persistence-unit>
+ <class>org.apache.ode.dao.jpa.scheduler.JobDAOImpl</class>
+
+
+ <properties>
+ <!-- Properties for an embedded Derby connection -->
+ <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
+ <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.OracleDictionary"/>
+ <!-- To validate DBSchema and create DDL at runtime - use this property. Currently the DDL is created at build time -->
+ <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
+
+ <property name="openjpa.ConnectionProperties"
+ value="DriverClassName=org.apache.derby.jdbc.EmbeddedDriver,Url=jdbc:derby:target/database/openjpa-test-database;create=true,MaxActive=100,MaxWait=10000,TestOnBorrow=true"/>
+
+ </properties>
+ </persistence-unit>
</persistence>