You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2009/01/24 00:53:21 UTC
svn commit: r737256 [12/12] - in /ode/branches/APACHE_ODE_1.X:
bpel-test/src/test/resources/
bpel-test/src/test/resources/bpel/2.0/TestAlarm/
bpel-test/src/test/resources/bpel/2.0/TestAssignComplex/
bpel-test/src/test/resources/bpel/2.0/TestAssignDate/...
Modified: ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/ScopeDAOImpl.java Fri Jan 23 23:53:17 2009
@@ -1,200 +1,200 @@
-/*
- * 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.jpa;
-
-import org.apache.ode.bpel.dao.CorrelationSetDAO;
-import org.apache.ode.bpel.dao.PartnerLinkDAO;
-import org.apache.ode.bpel.dao.ProcessInstanceDAO;
-import org.apache.ode.bpel.dao.ScopeDAO;
-import org.apache.ode.bpel.dao.ScopeStateEnum;
-import org.apache.ode.bpel.dao.XmlDataDAO;
-import org.apache.ode.bpel.evt.BpelEvent;
-
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.OneToMany;
-import javax.persistence.Query;
-import javax.persistence.Table;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-@Entity
-@Table(name="ODE_SCOPE")
-@NamedQueries({
- @NamedQuery(name="ScopeEvents", query="SELECT se FROM EventDAOImpl as se WHERE se._scopeId = :sid"),
- @NamedQuery(name=ScopeDAOImpl.SELECT_SCOPE_IDS_BY_PROCESS, query="select s._scopeInstanceId from ScopeDAOImpl as s where s._processInstance._process = :process"),
- @NamedQuery(name=ScopeDAOImpl.SELECT_SCOPE_IDS_BY_INSTANCE, query="select s._scopeInstanceId from ScopeDAOImpl as s where s._processInstance = :instance"),
- @NamedQuery(name=ScopeDAOImpl.DELETE_SCOPES_BY_SCOPE_IDS, query="delete from ScopeDAOImpl as s where s._scopeInstanceId in(:ids)")
-})
-public class ScopeDAOImpl extends OpenJPADAO implements ScopeDAO {
- public final static String SELECT_SCOPE_IDS_BY_PROCESS = "SELECT_SCOPE_IDS_BY_PROCESS";
- public final static String SELECT_SCOPE_IDS_BY_INSTANCE = "SELECT_SCOPE_IDS_BY_INSTANCE";
- public final static String DELETE_SCOPES_BY_SCOPE_IDS = "DELETE_SCOPES_BY_SCOPE_IDS";
-
- @Id @Column(name="SCOPE_ID")
- @GeneratedValue(strategy= GenerationType.AUTO)
- private Long _scopeInstanceId;
-
- @Basic @Column(name="MODEL_ID")
- private int _modelId;
- @Basic @Column(name="SCOPE_NAME")
- private String _name;
- @Basic @Column(name="SCOPE_STATE")
- private String _scopeState;
-
- @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
- @Column(name="PARENT_SCOPE_ID")
- private ScopeDAOImpl _parentScope;
-
- @OneToMany(targetEntity=ScopeDAOImpl.class,mappedBy="_parentScope",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
- private Collection<ScopeDAO> _childScopes = new ArrayList<ScopeDAO>();
- @OneToMany(targetEntity=CorrelationSetDAOImpl.class,mappedBy="_scope",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
- private Collection<CorrelationSetDAO> _correlationSets = new ArrayList<CorrelationSetDAO>();
- @OneToMany(targetEntity=PartnerLinkDAOImpl.class,mappedBy="_scope",fetch= FetchType.LAZY,cascade={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.PERSIST})
- private Collection<PartnerLinkDAO> _partnerLinks = new ArrayList<PartnerLinkDAO>();
- @OneToMany(targetEntity=XmlDataDAOImpl.class,mappedBy="_scope",fetch=FetchType.LAZY,cascade={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.PERSIST})
- private Collection<XmlDataDAO> _variables = new ArrayList<XmlDataDAO>();
- @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST}) @Column(name="PROCESS_INSTANCE_ID")
- private ProcessInstanceDAOImpl _processInstance;
-
- public ScopeDAOImpl() {}
- public ScopeDAOImpl(ScopeDAOImpl parentScope, String name, int scopeModelId, ProcessInstanceDAOImpl pi) {
- _parentScope = parentScope;
- _name = name;
- _modelId = scopeModelId;
- _processInstance = pi;
- }
-
- public PartnerLinkDAO createPartnerLink(int plinkModelId, String pLinkName,
- String myRole, String partnerRole) {
- PartnerLinkDAOImpl pl = new PartnerLinkDAOImpl(plinkModelId, pLinkName, myRole, partnerRole);
- pl.setScope(this);
- _partnerLinks.add(pl);
- return pl;
- }
-
- public Collection<ScopeDAO> getChildScopes() {
- return _childScopes;
- }
-
- public CorrelationSetDAO getCorrelationSet(String corrSetName) {
- CorrelationSetDAO ret = null;
- for (CorrelationSetDAO csElement : _correlationSets) {
- if ( csElement.getName().equals(corrSetName)) ret = csElement;
- }
-
- if ( ret == null ) {
- // Apparently the caller knows there should be a correlation set
- // in here. Create a new set if one does not exist.
- // Not sure I understand this implied object creation and why
- // an explicit create pattern isn't used ( i.e. similar to
- // PartnerLink creation )
- ret = new CorrelationSetDAOImpl(this,corrSetName);
- // Persist the new correlation set to generate an ID
- getEM().persist(ret);
- _correlationSets.add(ret);
- }
-
- return ret;
- }
-
- public Collection<CorrelationSetDAO> getCorrelationSets() {
- return _correlationSets;
- }
-
- public int getModelId() {
- return _modelId;
- }
-
- public String getName() {
- return _name;
- }
-
- public ScopeDAO getParentScope() {
- return _parentScope;
- }
-
- public PartnerLinkDAO getPartnerLink(int plinkModelId) {
- for (PartnerLinkDAO pLink : getPartnerLinks()) {
- if (pLink.getPartnerLinkModelId() == plinkModelId) {
- return pLink;
- }
- }
- return null;
- }
-
- public Collection<PartnerLinkDAO> getPartnerLinks() {
- return _partnerLinks;
- }
-
- public ProcessInstanceDAO getProcessInstance() {
- return _processInstance;
- }
-
- public Long getScopeInstanceId() {
- return _scopeInstanceId;
- }
-
- public ScopeStateEnum getState() {
- return new ScopeStateEnum(_scopeState);
- }
-
- public XmlDataDAO getVariable(String varName) {
- XmlDataDAO ret = null;
-
- for (XmlDataDAO xmlElement : _variables) {
- if ( xmlElement.getName().equals(varName)) return xmlElement;
- }
-
- ret = new XmlDataDAOImpl(this,varName);
- _variables.add(ret);
-
- return ret;
- }
-
- public Collection<XmlDataDAO> getVariables() {
- return _variables;
- }
-
- public List<BpelEvent> listEvents() {
- List<BpelEvent> result = new ArrayList<BpelEvent>();
- Query qry = getEM().createNamedQuery("ScopeEvents");
- qry.setParameter("sid", _scopeInstanceId);
- for (Object eventDao : qry.getResultList()) {
- result.add(((EventDAOImpl)eventDao).getEvent());
- }
- return result;
- }
-
- public void setState(ScopeStateEnum state) {
- _scopeState = state.toString();
- }
-
-}
+/*
+ * 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.jpa;
+
+import org.apache.ode.bpel.dao.CorrelationSetDAO;
+import org.apache.ode.bpel.dao.PartnerLinkDAO;
+import org.apache.ode.bpel.dao.ProcessInstanceDAO;
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.ScopeStateEnum;
+import org.apache.ode.bpel.dao.XmlDataDAO;
+import org.apache.ode.bpel.evt.BpelEvent;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Query;
+import javax.persistence.Table;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+@Entity
+@Table(name="ODE_SCOPE")
+@NamedQueries({
+ @NamedQuery(name="ScopeEvents", query="SELECT se FROM EventDAOImpl as se WHERE se._scopeId = :sid"),
+ @NamedQuery(name=ScopeDAOImpl.SELECT_SCOPE_IDS_BY_PROCESS, query="select s._scopeInstanceId from ScopeDAOImpl as s where s._processInstance._process = :process"),
+ @NamedQuery(name=ScopeDAOImpl.SELECT_SCOPE_IDS_BY_INSTANCE, query="select s._scopeInstanceId from ScopeDAOImpl as s where s._processInstance = :instance"),
+ @NamedQuery(name=ScopeDAOImpl.DELETE_SCOPES_BY_SCOPE_IDS, query="delete from ScopeDAOImpl as s where s._scopeInstanceId in(:ids)")
+})
+public class ScopeDAOImpl extends OpenJPADAO implements ScopeDAO {
+ public final static String SELECT_SCOPE_IDS_BY_PROCESS = "SELECT_SCOPE_IDS_BY_PROCESS";
+ public final static String SELECT_SCOPE_IDS_BY_INSTANCE = "SELECT_SCOPE_IDS_BY_INSTANCE";
+ public final static String DELETE_SCOPES_BY_SCOPE_IDS = "DELETE_SCOPES_BY_SCOPE_IDS";
+
+ @Id @Column(name="SCOPE_ID")
+ @GeneratedValue(strategy= GenerationType.AUTO)
+ private Long _scopeInstanceId;
+
+ @Basic @Column(name="MODEL_ID")
+ private int _modelId;
+ @Basic @Column(name="SCOPE_NAME")
+ private String _name;
+ @Basic @Column(name="SCOPE_STATE")
+ private String _scopeState;
+
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST})
+ @Column(name="PARENT_SCOPE_ID")
+ private ScopeDAOImpl _parentScope;
+
+ @OneToMany(targetEntity=ScopeDAOImpl.class,mappedBy="_parentScope",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<ScopeDAO> _childScopes = new ArrayList<ScopeDAO>();
+ @OneToMany(targetEntity=CorrelationSetDAOImpl.class,mappedBy="_scope",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
+ private Collection<CorrelationSetDAO> _correlationSets = new ArrayList<CorrelationSetDAO>();
+ @OneToMany(targetEntity=PartnerLinkDAOImpl.class,mappedBy="_scope",fetch= FetchType.LAZY,cascade={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.PERSIST})
+ private Collection<PartnerLinkDAO> _partnerLinks = new ArrayList<PartnerLinkDAO>();
+ @OneToMany(targetEntity=XmlDataDAOImpl.class,mappedBy="_scope",fetch=FetchType.LAZY,cascade={CascadeType.MERGE, CascadeType.REFRESH, CascadeType.PERSIST})
+ private Collection<XmlDataDAO> _variables = new ArrayList<XmlDataDAO>();
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST}) @Column(name="PROCESS_INSTANCE_ID")
+ private ProcessInstanceDAOImpl _processInstance;
+
+ public ScopeDAOImpl() {}
+ public ScopeDAOImpl(ScopeDAOImpl parentScope, String name, int scopeModelId, ProcessInstanceDAOImpl pi) {
+ _parentScope = parentScope;
+ _name = name;
+ _modelId = scopeModelId;
+ _processInstance = pi;
+ }
+
+ public PartnerLinkDAO createPartnerLink(int plinkModelId, String pLinkName,
+ String myRole, String partnerRole) {
+ PartnerLinkDAOImpl pl = new PartnerLinkDAOImpl(plinkModelId, pLinkName, myRole, partnerRole);
+ pl.setScope(this);
+ _partnerLinks.add(pl);
+ return pl;
+ }
+
+ public Collection<ScopeDAO> getChildScopes() {
+ return _childScopes;
+ }
+
+ public CorrelationSetDAO getCorrelationSet(String corrSetName) {
+ CorrelationSetDAO ret = null;
+ for (CorrelationSetDAO csElement : _correlationSets) {
+ if ( csElement.getName().equals(corrSetName)) ret = csElement;
+ }
+
+ if ( ret == null ) {
+ // Apparently the caller knows there should be a correlation set
+ // in here. Create a new set if one does not exist.
+ // Not sure I understand this implied object creation and why
+ // an explicit create pattern isn't used ( i.e. similar to
+ // PartnerLink creation )
+ ret = new CorrelationSetDAOImpl(this,corrSetName);
+ // Persist the new correlation set to generate an ID
+ getEM().persist(ret);
+ _correlationSets.add(ret);
+ }
+
+ return ret;
+ }
+
+ public Collection<CorrelationSetDAO> getCorrelationSets() {
+ return _correlationSets;
+ }
+
+ public int getModelId() {
+ return _modelId;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public ScopeDAO getParentScope() {
+ return _parentScope;
+ }
+
+ public PartnerLinkDAO getPartnerLink(int plinkModelId) {
+ for (PartnerLinkDAO pLink : getPartnerLinks()) {
+ if (pLink.getPartnerLinkModelId() == plinkModelId) {
+ return pLink;
+ }
+ }
+ return null;
+ }
+
+ public Collection<PartnerLinkDAO> getPartnerLinks() {
+ return _partnerLinks;
+ }
+
+ public ProcessInstanceDAO getProcessInstance() {
+ return _processInstance;
+ }
+
+ public Long getScopeInstanceId() {
+ return _scopeInstanceId;
+ }
+
+ public ScopeStateEnum getState() {
+ return new ScopeStateEnum(_scopeState);
+ }
+
+ public XmlDataDAO getVariable(String varName) {
+ XmlDataDAO ret = null;
+
+ for (XmlDataDAO xmlElement : _variables) {
+ if ( xmlElement.getName().equals(varName)) return xmlElement;
+ }
+
+ ret = new XmlDataDAOImpl(this,varName);
+ _variables.add(ret);
+
+ return ret;
+ }
+
+ public Collection<XmlDataDAO> getVariables() {
+ return _variables;
+ }
+
+ public List<BpelEvent> listEvents() {
+ List<BpelEvent> result = new ArrayList<BpelEvent>();
+ Query qry = getEM().createNamedQuery("ScopeEvents");
+ qry.setParameter("sid", _scopeInstanceId);
+ for (Object eventDao : qry.getResultList()) {
+ result.add(((EventDAOImpl)eventDao).getEvent());
+ }
+ return result;
+ }
+
+ public void setState(ScopeStateEnum state) {
+ _scopeState = state.toString();
+ }
+
+}
Modified: ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/dao-jpa/src/main/java/org/apache/ode/dao/jpa/XmlDataDAOImpl.java Fri Jan 23 23:53:17 2009
@@ -1,153 +1,153 @@
-/*
- * 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.jpa;
-
-import org.apache.ode.bpel.dao.ScopeDAO;
-import org.apache.ode.bpel.dao.XmlDataDAO;
-import org.apache.ode.utils.DOMUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-import javax.persistence.Basic;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQueries;
-import javax.persistence.NamedQuery;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * @author Matthieu Riou <mriou at apache dot org>
- */
-@Entity
-@Table(name="ODE_XML_DATA")
-@NamedQueries({
- @NamedQuery(name=XmlDataDAOImpl.SELECT_XMLDATA_IDS_BY_PROCESS, query="select distinct x._id from XmlDataDAOImpl as x where x._scope._processInstance._process = :process"),
- @NamedQuery(name=XmlDataDAOImpl.SELECT_XMLDATA_IDS_BY_INSTANCE, query="select distinct x._id from XmlDataDAOImpl as x where x._scope._processInstance = :instance"),
- @NamedQuery(name=XmlDataDAOImpl.DELETE_XMLDATA_BY_SCOPE_IDS, query="delete from XmlDataDAOImpl as x where x._scopeId in(:scopeIds)")
-})
-public class XmlDataDAOImpl implements XmlDataDAO {
- public final static String SELECT_XMLDATA_IDS_BY_PROCESS = "SELECT_XMLDATA_IDS_BY_PROCESS";
- public final static String SELECT_XMLDATA_IDS_BY_INSTANCE = "SELECT_XMLDATA_IDS_BY_INSTANCE";
- public final static String DELETE_XMLDATA_BY_SCOPE_IDS = "DELETE_XMLDATA_BY_SCOPE_IDS";
-
- @Id @Column(name="XML_DATA_ID")
- @GeneratedValue(strategy=GenerationType.AUTO)
- @SuppressWarnings("unused")
- private Long _id;
- @Lob @Column(name="DATA")
- private String _data;
- @Transient
- private Node _node;
- @Basic @Column(name="IS_SIMPLE_TYPE")
- private boolean _isSimpleType;
- @Basic @Column(name="NAME")
- private String _name;
-
- @OneToMany(targetEntity=XmlDataProperty.class,mappedBy="_xmlData",fetch=FetchType.EAGER,cascade={CascadeType.ALL})
- private Collection<XmlDataProperty> _props = new ArrayList<XmlDataProperty>();
-
- @SuppressWarnings("unused")
- @Basic @Column(name="SCOPE_ID", nullable=true, insertable=false, updatable=false)
- private Long _scopeId;
- @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST}) @Column(name="SCOPE_ID")
- private ScopeDAOImpl _scope;
-
- public XmlDataDAOImpl() {}
- public XmlDataDAOImpl(ScopeDAOImpl scope, String name){
- _scope = scope;
- _name = name;
- }
-
- public Node get() {
- if ( _node == null && _data != null ) {
- if(_isSimpleType){
- Document d = DOMUtils.newDocument();
- // we create a dummy wrapper element
- // prevents some apps from complaining
- // when text node is not actual child of document
- Element e = d.createElement("text-node-wrapper");
- Text tnode = d.createTextNode(_data);
- d.appendChild(e);
- e.appendChild(tnode);
- _node = tnode;
- }else{
- try{
- _node = DOMUtils.stringToDOM(_data);
- }catch(Exception e){
- throw new RuntimeException(e);
- }
- }
- }
-
- return _node;
- }
-
- public String getName() {
- return _name;
- }
-
- public String getProperty(String propertyName) {
- for (XmlDataProperty prop : _props) {
- if (prop.getPropertyKey().equals(propertyName)) return prop.getPropertyValue();
- }
- return null;
- }
-
- public ScopeDAO getScopeDAO() {
- return _scope;
- }
-
- public boolean isNull() {
- return _data == null;
- }
-
- public void remove() {
-
- }
-
- public void set(Node val) {
- _node = val;
- if ( val instanceof Element ) {
- _isSimpleType = false;
- _data = DOMUtils.domToString(val);
- } else if (_node != null) {
- _isSimpleType = true;
- _data = _node.getNodeValue();
- }
- }
-
- public void setProperty(String pname, String pvalue) {
- _props.add(new XmlDataProperty(pname, pvalue, this));
- }
-
-}
+/*
+ * 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.jpa;
+
+import org.apache.ode.bpel.dao.ScopeDAO;
+import org.apache.ode.bpel.dao.XmlDataDAO;
+import org.apache.ode.utils.DOMUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author Matthieu Riou <mriou at apache dot org>
+ */
+@Entity
+@Table(name="ODE_XML_DATA")
+@NamedQueries({
+ @NamedQuery(name=XmlDataDAOImpl.SELECT_XMLDATA_IDS_BY_PROCESS, query="select distinct x._id from XmlDataDAOImpl as x where x._scope._processInstance._process = :process"),
+ @NamedQuery(name=XmlDataDAOImpl.SELECT_XMLDATA_IDS_BY_INSTANCE, query="select distinct x._id from XmlDataDAOImpl as x where x._scope._processInstance = :instance"),
+ @NamedQuery(name=XmlDataDAOImpl.DELETE_XMLDATA_BY_SCOPE_IDS, query="delete from XmlDataDAOImpl as x where x._scopeId in(:scopeIds)")
+})
+public class XmlDataDAOImpl implements XmlDataDAO {
+ public final static String SELECT_XMLDATA_IDS_BY_PROCESS = "SELECT_XMLDATA_IDS_BY_PROCESS";
+ public final static String SELECT_XMLDATA_IDS_BY_INSTANCE = "SELECT_XMLDATA_IDS_BY_INSTANCE";
+ public final static String DELETE_XMLDATA_BY_SCOPE_IDS = "DELETE_XMLDATA_BY_SCOPE_IDS";
+
+ @Id @Column(name="XML_DATA_ID")
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ @SuppressWarnings("unused")
+ private Long _id;
+ @Lob @Column(name="DATA")
+ private String _data;
+ @Transient
+ private Node _node;
+ @Basic @Column(name="IS_SIMPLE_TYPE")
+ private boolean _isSimpleType;
+ @Basic @Column(name="NAME")
+ private String _name;
+
+ @OneToMany(targetEntity=XmlDataProperty.class,mappedBy="_xmlData",fetch=FetchType.EAGER,cascade={CascadeType.ALL})
+ private Collection<XmlDataProperty> _props = new ArrayList<XmlDataProperty>();
+
+ @SuppressWarnings("unused")
+ @Basic @Column(name="SCOPE_ID", nullable=true, insertable=false, updatable=false)
+ private Long _scopeId;
+ @ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.PERSIST}) @Column(name="SCOPE_ID")
+ private ScopeDAOImpl _scope;
+
+ public XmlDataDAOImpl() {}
+ public XmlDataDAOImpl(ScopeDAOImpl scope, String name){
+ _scope = scope;
+ _name = name;
+ }
+
+ public Node get() {
+ if ( _node == null && _data != null ) {
+ if(_isSimpleType){
+ Document d = DOMUtils.newDocument();
+ // we create a dummy wrapper element
+ // prevents some apps from complaining
+ // when text node is not actual child of document
+ Element e = d.createElement("text-node-wrapper");
+ Text tnode = d.createTextNode(_data);
+ d.appendChild(e);
+ e.appendChild(tnode);
+ _node = tnode;
+ }else{
+ try{
+ _node = DOMUtils.stringToDOM(_data);
+ }catch(Exception e){
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ return _node;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public String getProperty(String propertyName) {
+ for (XmlDataProperty prop : _props) {
+ if (prop.getPropertyKey().equals(propertyName)) return prop.getPropertyValue();
+ }
+ return null;
+ }
+
+ public ScopeDAO getScopeDAO() {
+ return _scope;
+ }
+
+ public boolean isNull() {
+ return _data == null;
+ }
+
+ public void remove() {
+
+ }
+
+ public void set(Node val) {
+ _node = val;
+ if ( val instanceof Element ) {
+ _isSimpleType = false;
+ _data = DOMUtils.domToString(val);
+ } else if (_node != null) {
+ _isSimpleType = true;
+ _data = _node.getNodeValue();
+ }
+ }
+
+ public void setProperty(String pname, String pvalue) {
+ _props.add(new XmlDataProperty(pname, pvalue, this));
+ }
+
+}
Modified: ode/branches/APACHE_ODE_1.X/distro/src/bin/bpelc.bat
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/bin/bpelc.bat?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/distro/src/bin/bpelc.bat (original)
+++ ode/branches/APACHE_ODE_1.X/distro/src/bin/bpelc.bat Fri Jan 23 23:53:17 2009
@@ -1,67 +1,67 @@
-@echo off
-rem
-rem Licensed to the Apache Software Foundation (ASF) under one or more
-rem contributor license agreements. See the NOTICE file distributed with
-rem this work for additional information regarding copyright ownership.
-rem The ASF licenses this file to You under the Apache License, Version 2.0
-rem (the "License"); you may not use this file except in compliance with
-rem the License. You may obtain a copy of the License at
-rem
-rem http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS,
-rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-rem See the License for the specific language governing permissions and
-rem limitations under the License.
-rem
-
-if not "%OS%"=="Windows_NT" goto wrongOS
-
-@setlocal
-
-set command=%0
-set progname=%~n0
-
-set ODE_HOME=%~dp0..
-set ODE_BIN=%~dp0..\bin
-set ODE_LIB=%~dp0..\lib
-set ODE_ETC=%~dp0..\etc
-
-if "%JAVA_HOME%"=="" goto noJavaHome
-if not exist "%JAVA_HOME%"\bin\java.exe goto noJava
-
-set JAVACMD="%JAVA_HOME%\bin\java.exe"
-
-set LOCALCLASSPATH=%ODE_CLASSPATH%;%ODE_LIB%
-FOR %%c in (%ODE_LIB%\*.jar) DO (call :append_cp %%c)
-
-%JAVACMD% %ODE_JAVAOPTS% -cp "%LOCALCLASSPATH%" org.apache.ode.tools.bpelc.cline.BpelC %*
-goto end
-
-:append_cp
-set LOCALCLASSPATH=%LOCALCLASSPATH%;%1
-goto end
-
-=====================================================================
- ERRORS
-=====================================================================
-
-
-:wrongOS
-echo ERROR: ODE requires WindowsNT/XP. Aborting.
-goto end
-
-:noJavaHome
-echo ERROR: JAVA_HOME not set! Aborting.
-goto end
-
-:noJava
-echo ERROR: The Java VM (java.exe) was not found in %JAVA_HOME%\bin! Aborting
-goto end
-
-REM ================================================================
-REM END
-REM ================================================================
-:end
-@endlocal
+@echo off
+rem
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+rem
+
+if not "%OS%"=="Windows_NT" goto wrongOS
+
+@setlocal
+
+set command=%0
+set progname=%~n0
+
+set ODE_HOME=%~dp0..
+set ODE_BIN=%~dp0..\bin
+set ODE_LIB=%~dp0..\lib
+set ODE_ETC=%~dp0..\etc
+
+if "%JAVA_HOME%"=="" goto noJavaHome
+if not exist "%JAVA_HOME%"\bin\java.exe goto noJava
+
+set JAVACMD="%JAVA_HOME%\bin\java.exe"
+
+set LOCALCLASSPATH=%ODE_CLASSPATH%;%ODE_LIB%
+FOR %%c in (%ODE_LIB%\*.jar) DO (call :append_cp %%c)
+
+%JAVACMD% %ODE_JAVAOPTS% -cp "%LOCALCLASSPATH%" org.apache.ode.tools.bpelc.cline.BpelC %*
+goto end
+
+:append_cp
+set LOCALCLASSPATH=%LOCALCLASSPATH%;%1
+goto end
+
+=====================================================================
+ ERRORS
+=====================================================================
+
+
+:wrongOS
+echo ERROR: ODE requires WindowsNT/XP. Aborting.
+goto end
+
+:noJavaHome
+echo ERROR: JAVA_HOME not set! Aborting.
+goto end
+
+:noJava
+echo ERROR: The Java VM (java.exe) was not found in %JAVA_HOME%\bin! Aborting
+goto end
+
+REM ================================================================
+REM END
+REM ================================================================
+:end
+@endlocal
Modified: ode/branches/APACHE_ODE_1.X/distro/src/bin/sendsoap.bat
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/bin/sendsoap.bat?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/distro/src/bin/sendsoap.bat (original)
+++ ode/branches/APACHE_ODE_1.X/distro/src/bin/sendsoap.bat Fri Jan 23 23:53:17 2009
@@ -1,67 +1,67 @@
-@echo off
-rem
-rem Licensed to the Apache Software Foundation (ASF) under one or more
-rem contributor license agreements. See the NOTICE file distributed with
-rem this work for additional information regarding copyright ownership.
-rem The ASF licenses this file to You under the Apache License, Version 2.0
-rem (the "License"); you may not use this file except in compliance with
-rem the License. You may obtain a copy of the License at
-rem
-rem http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS,
-rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-rem See the License for the specific language governing permissions and
-rem limitations under the License.
-rem
-
-if not "%OS%"=="Windows_NT" goto wrongOS
-
-@setlocal
-
-set command=%0
-set progname=%~n0
-
-set ODE_HOME=%~dp0..
-set ODE_BIN=%~dp0..\bin
-set ODE_LIB=%~dp0..\lib
-set ODE_ETC=%~dp0..\etc
-
-if "%JAVA_HOME%"=="" goto noJavaHome
-if not exist "%JAVA_HOME%"\bin\java.exe goto noJava
-
-set JAVACMD="%JAVA_HOME%\bin\java.exe"
-
-set LOCALCLASSPATH=%ODE_CLASSPATH%;%ODE_LIB%
-FOR %%c in (%ODE_LIB%\*.jar) DO (call :append_cp %%c)
-
-%JAVACMD% %ODE_JAVAOPTS% -cp "%LOCALCLASSPATH%" org.apache.ode.tools.sendsoap.cline.HttpSoapSender %*
-goto end
-
-:append_cp
-set LOCALCLASSPATH=%LOCALCLASSPATH%;%1
-goto end
-
-=====================================================================
- ERRORS
-=====================================================================
-
-
-:wrongOS
-echo ERROR: ODE requires WindowsNT/XP. Aborting.
-goto end
-
-:noJavaHome
-echo ERROR: JAVA_HOME not set! Aborting.
-goto end
-
-:noJava
-echo ERROR: The Java VM (java.exe) was not found in %JAVA_HOME%\bin! Aborting
-goto end
-
-REM ================================================================
-REM END
-REM ================================================================
-:end
-@endlocal
+@echo off
+rem
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements. See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+rem
+
+if not "%OS%"=="Windows_NT" goto wrongOS
+
+@setlocal
+
+set command=%0
+set progname=%~n0
+
+set ODE_HOME=%~dp0..
+set ODE_BIN=%~dp0..\bin
+set ODE_LIB=%~dp0..\lib
+set ODE_ETC=%~dp0..\etc
+
+if "%JAVA_HOME%"=="" goto noJavaHome
+if not exist "%JAVA_HOME%"\bin\java.exe goto noJava
+
+set JAVACMD="%JAVA_HOME%\bin\java.exe"
+
+set LOCALCLASSPATH=%ODE_CLASSPATH%;%ODE_LIB%
+FOR %%c in (%ODE_LIB%\*.jar) DO (call :append_cp %%c)
+
+%JAVACMD% %ODE_JAVAOPTS% -cp "%LOCALCLASSPATH%" org.apache.ode.tools.sendsoap.cline.HttpSoapSender %*
+goto end
+
+:append_cp
+set LOCALCLASSPATH=%LOCALCLASSPATH%;%1
+goto end
+
+=====================================================================
+ ERRORS
+=====================================================================
+
+
+:wrongOS
+echo ERROR: ODE requires WindowsNT/XP. Aborting.
+goto end
+
+:noJavaHome
+echo ERROR: JAVA_HOME not set! Aborting.
+goto end
+
+:noJava
+echo ERROR: The Java VM (java.exe) was not found in %JAVA_HOME%\bin! Aborting
+goto end
+
+REM ================================================================
+REM END
+REM ================================================================
+:end
+@endlocal
Modified: ode/branches/APACHE_ODE_1.X/distro/src/examples-war/HelloWorld2/HelloWorld2.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-war/HelloWorld2/HelloWorld2.bpel?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/distro/src/examples-war/HelloWorld2/HelloWorld2.bpel (original)
+++ ode/branches/APACHE_ODE_1.X/distro/src/examples-war/HelloWorld2/HelloWorld2.bpel Fri Jan 23 23:53:17 2009
@@ -18,7 +18,7 @@
-->
<process name="HelloWorld2"
targetNamespace="http://ode/bpel/unit-test"
- xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
+ xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:tns="http://ode/bpel/unit-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:test="http://ode/bpel/unit-test.wsdl"
Modified: ode/branches/APACHE_ODE_1.X/distro/src/examples-war/HelloWorld2/HelloWorld2.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/distro/src/examples-war/HelloWorld2/HelloWorld2.wsdl?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/distro/src/examples-war/HelloWorld2/HelloWorld2.wsdl (original)
+++ ode/branches/APACHE_ODE_1.X/distro/src/examples-war/HelloWorld2/HelloWorld2.wsdl Fri Jan 23 23:53:17 2009
@@ -25,7 +25,7 @@
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
+ xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
<wsdl:message name="HelloMessage">
<wsdl:part name="TestPart" type="xsd:string"/>
Modified: ode/branches/APACHE_ODE_1.X/tools/src/main/java/org/apache/ode/tools/ToolMessages.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/tools/src/main/java/org/apache/ode/tools/ToolMessages.java?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/tools/src/main/java/org/apache/ode/tools/ToolMessages.java (original)
+++ ode/branches/APACHE_ODE_1.X/tools/src/main/java/org/apache/ode/tools/ToolMessages.java Fri Jan 23 23:53:17 2009
@@ -1,38 +1,38 @@
-/*
- * 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.tools;
-
-import org.apache.ode.utils.msg.MessageBundle;
-
-public class ToolMessages extends MessageBundle {
-
- public String msgBadUrl(String url, String message) {
- return this.format("{0} does not appear to be a valid URL: {1}", url, message);
- }
-
- public String msgSoapErrorOnSend(String msg) {
- return this.format("Unable to send message due to SOAP-related error: {0}", msg);
- }
-
- public String msgIoErrorOnSend(String msg) {
- return this.format("Unable to send message due to I/O-related error: {0}", msg);
- }
-
-}
+/*
+ * 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.tools;
+
+import org.apache.ode.utils.msg.MessageBundle;
+
+public class ToolMessages extends MessageBundle {
+
+ public String msgBadUrl(String url, String message) {
+ return this.format("{0} does not appear to be a valid URL: {1}", url, message);
+ }
+
+ public String msgSoapErrorOnSend(String msg) {
+ return this.format("Unable to send message due to SOAP-related error: {0}", msg);
+ }
+
+ public String msgIoErrorOnSend(String msg) {
+ return this.format("Unable to send message due to I/O-related error: {0}", msg);
+ }
+
+}
Modified: ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/LoggingInterceptor.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/LoggingInterceptor.java?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/LoggingInterceptor.java (original)
+++ ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/LoggingInterceptor.java Fri Jan 23 23:53:17 2009
@@ -1,161 +1,161 @@
-package org.apache.ode.utils;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.sql.Connection;
-import java.sql.Statement;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import javax.sql.DataSource;
-
-import org.apache.commons.logging.Log;
-
-public class LoggingInterceptor<T> implements InvocationHandler {
-
- private static final Set<String> PARAMSTYPES = new HashSet<String>();
- static {
- PARAMSTYPES.add("setArray");
- PARAMSTYPES.add("setBigDecimal");
- PARAMSTYPES.add("setBoolean");
- PARAMSTYPES.add("setByte");
- PARAMSTYPES.add("setBytes");
- PARAMSTYPES.add("setDate");
- PARAMSTYPES.add("setDouble");
- PARAMSTYPES.add("setFloat");
- PARAMSTYPES.add("setInt");
- PARAMSTYPES.add("setLong");
- PARAMSTYPES.add("setObject");
- PARAMSTYPES.add("setRef");
- PARAMSTYPES.add("setShort");
- PARAMSTYPES.add("setString");
- PARAMSTYPES.add("setTime");
- PARAMSTYPES.add("setTimestamp");
- PARAMSTYPES.add("setURL");
- }
-
- private Log _log;
- private T _delegate;
- private Map<String, Object> _paramsByName = new TreeMap<String, Object>();
- private Map<Integer, Object> _paramsByIdx = new TreeMap<Integer, Object>();
-
-
- public LoggingInterceptor(T delegate, Log log) {
- _log = log;
- _delegate = delegate;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args)
- throws Throwable {
- try {
- if (method.getDeclaringClass() == DataSource.class
- && "getConnection".equals(method.getName())) {
- Connection conn = (Connection)method.invoke(_delegate, args);
- print("getConnection (tx=" + conn.getTransactionIsolation() + ")");
- return Proxy.newProxyInstance(_delegate.getClass().getClassLoader(),
- new Class[] {Connection.class}, new LoggingInterceptor<Connection>(conn, _log));
- } else if (method.getDeclaringClass() == Connection.class
- && Statement.class.isAssignableFrom(method.getReturnType())) {
- Statement stmt = (Statement)method.invoke(_delegate, args);
- print(method, args);
- return Proxy.newProxyInstance(_delegate.getClass().getClassLoader(),
- new Class[] {method.getReturnType()}, new LoggingInterceptor<Statement>(stmt, _log));
- } else {
- print(method, args);
- return method.invoke(_delegate, args);
- }
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- }
-
- private void print(Method method, Object[] args) {
- if (shouldPrint()) {
- // JDBC Connection
- if ("prepareStmt".equals(method.getName())) {
- print("prepareStmt: " + args[0]);
- if (((String)args[0]).indexOf("ODE_SCOPE") > 0) {
- for (StackTraceElement traceElement : Thread.currentThread().getStackTrace()) {
- print(traceElement.toString());
- }
- }
- } else if ("prepareCall".equals(method.getName())) {
- print("prepareCall: " + args[0]);
- } else if ("close".equals(method.getName())) {
- print("close()");
- } else if ("commit".equals(method.getName())) {
- print("commit()");
- } else if ("rollback".equals(method.getName())) {
- print("rollback()");
- } else if ("setTransactionIsolation".equals(method.getName())) {
- print("Set isolation level to " + args[0]);
- }
- // JDBC Statement
- else if (method.getName().startsWith("execute")) {
- print(method.getName() + ", " + getParams());
- } else if ("clearParameters".equals(method.getName())) {
- _paramsByIdx.clear();
- _paramsByName.clear();
- } else if ("setNull".equals(method.getName())) {
- if (String.class.isAssignableFrom(args[0].getClass())) {
- _paramsByName.put((String)args[0], null);
- } else if (Integer.class.isAssignableFrom(args[0].getClass())) {
- _paramsByIdx.put((Integer)args[0], null);
- }
- } else if (PARAMSTYPES.contains(method.getName())){
- if (String.class.isAssignableFrom(args[0].getClass())) {
- _paramsByName.put((String)args[0], args[1]);
- } else if (Integer.class.isAssignableFrom(args[0].getClass())) {
- _paramsByIdx.put((Integer)args[0], args[1]);
- }
- }
- }
- }
-
- private String getParams() {
- if (_paramsByIdx.size() > 0 || _paramsByName.size() > 0) {
- StringBuffer buf = new StringBuffer();
- buf.append("bound ");
- for (Map.Entry<Integer, Object> entry : _paramsByIdx.entrySet()) {
- try {
- buf.append("(").append(entry.getKey()).append(",").append(entry.getValue()).append(") ");
- } catch (Throwable e) {
- // We don't want to mess with the connection just for logging
- return "[e]";
- }
- }
- for (Map.Entry<String, Object> entry : _paramsByName.entrySet()) {
- try {
- buf.append("(").append(entry.getKey()).append(",").append(entry.getValue()).append(") ");
- } catch (Throwable e) {
- // We don't want to mess with the connection just for logging
- return "[e]";
- }
- }
- return buf.toString();
- }
- return "w/o params";
- }
-
- private boolean shouldPrint() {
- if (_log != null)
- return _log.isDebugEnabled();
- else return true;
- }
-
- private void print(String str) {
- if (_log != null)
- _log.debug(str);
- else System.out.println(str);
- }
-
- public static DataSource createLoggingDS(DataSource ds, Log log) {
- return (DataSource)Proxy.newProxyInstance(ds.getClass().getClassLoader(),
- new Class[] {DataSource.class}, new LoggingInterceptor<DataSource>(ds,log));
- }
-}
+package org.apache.ode.utils;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.sql.DataSource;
+
+import org.apache.commons.logging.Log;
+
+public class LoggingInterceptor<T> implements InvocationHandler {
+
+ private static final Set<String> PARAMSTYPES = new HashSet<String>();
+ static {
+ PARAMSTYPES.add("setArray");
+ PARAMSTYPES.add("setBigDecimal");
+ PARAMSTYPES.add("setBoolean");
+ PARAMSTYPES.add("setByte");
+ PARAMSTYPES.add("setBytes");
+ PARAMSTYPES.add("setDate");
+ PARAMSTYPES.add("setDouble");
+ PARAMSTYPES.add("setFloat");
+ PARAMSTYPES.add("setInt");
+ PARAMSTYPES.add("setLong");
+ PARAMSTYPES.add("setObject");
+ PARAMSTYPES.add("setRef");
+ PARAMSTYPES.add("setShort");
+ PARAMSTYPES.add("setString");
+ PARAMSTYPES.add("setTime");
+ PARAMSTYPES.add("setTimestamp");
+ PARAMSTYPES.add("setURL");
+ }
+
+ private Log _log;
+ private T _delegate;
+ private Map<String, Object> _paramsByName = new TreeMap<String, Object>();
+ private Map<Integer, Object> _paramsByIdx = new TreeMap<Integer, Object>();
+
+
+ public LoggingInterceptor(T delegate, Log log) {
+ _log = log;
+ _delegate = delegate;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args)
+ throws Throwable {
+ try {
+ if (method.getDeclaringClass() == DataSource.class
+ && "getConnection".equals(method.getName())) {
+ Connection conn = (Connection)method.invoke(_delegate, args);
+ print("getConnection (tx=" + conn.getTransactionIsolation() + ")");
+ return Proxy.newProxyInstance(_delegate.getClass().getClassLoader(),
+ new Class[] {Connection.class}, new LoggingInterceptor<Connection>(conn, _log));
+ } else if (method.getDeclaringClass() == Connection.class
+ && Statement.class.isAssignableFrom(method.getReturnType())) {
+ Statement stmt = (Statement)method.invoke(_delegate, args);
+ print(method, args);
+ return Proxy.newProxyInstance(_delegate.getClass().getClassLoader(),
+ new Class[] {method.getReturnType()}, new LoggingInterceptor<Statement>(stmt, _log));
+ } else {
+ print(method, args);
+ return method.invoke(_delegate, args);
+ }
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ }
+ }
+
+ private void print(Method method, Object[] args) {
+ if (shouldPrint()) {
+ // JDBC Connection
+ if ("prepareStmt".equals(method.getName())) {
+ print("prepareStmt: " + args[0]);
+ if (((String)args[0]).indexOf("ODE_SCOPE") > 0) {
+ for (StackTraceElement traceElement : Thread.currentThread().getStackTrace()) {
+ print(traceElement.toString());
+ }
+ }
+ } else if ("prepareCall".equals(method.getName())) {
+ print("prepareCall: " + args[0]);
+ } else if ("close".equals(method.getName())) {
+ print("close()");
+ } else if ("commit".equals(method.getName())) {
+ print("commit()");
+ } else if ("rollback".equals(method.getName())) {
+ print("rollback()");
+ } else if ("setTransactionIsolation".equals(method.getName())) {
+ print("Set isolation level to " + args[0]);
+ }
+ // JDBC Statement
+ else if (method.getName().startsWith("execute")) {
+ print(method.getName() + ", " + getParams());
+ } else if ("clearParameters".equals(method.getName())) {
+ _paramsByIdx.clear();
+ _paramsByName.clear();
+ } else if ("setNull".equals(method.getName())) {
+ if (String.class.isAssignableFrom(args[0].getClass())) {
+ _paramsByName.put((String)args[0], null);
+ } else if (Integer.class.isAssignableFrom(args[0].getClass())) {
+ _paramsByIdx.put((Integer)args[0], null);
+ }
+ } else if (PARAMSTYPES.contains(method.getName())){
+ if (String.class.isAssignableFrom(args[0].getClass())) {
+ _paramsByName.put((String)args[0], args[1]);
+ } else if (Integer.class.isAssignableFrom(args[0].getClass())) {
+ _paramsByIdx.put((Integer)args[0], args[1]);
+ }
+ }
+ }
+ }
+
+ private String getParams() {
+ if (_paramsByIdx.size() > 0 || _paramsByName.size() > 0) {
+ StringBuffer buf = new StringBuffer();
+ buf.append("bound ");
+ for (Map.Entry<Integer, Object> entry : _paramsByIdx.entrySet()) {
+ try {
+ buf.append("(").append(entry.getKey()).append(",").append(entry.getValue()).append(") ");
+ } catch (Throwable e) {
+ // We don't want to mess with the connection just for logging
+ return "[e]";
+ }
+ }
+ for (Map.Entry<String, Object> entry : _paramsByName.entrySet()) {
+ try {
+ buf.append("(").append(entry.getKey()).append(",").append(entry.getValue()).append(") ");
+ } catch (Throwable e) {
+ // We don't want to mess with the connection just for logging
+ return "[e]";
+ }
+ }
+ return buf.toString();
+ }
+ return "w/o params";
+ }
+
+ private boolean shouldPrint() {
+ if (_log != null)
+ return _log.isDebugEnabled();
+ else return true;
+ }
+
+ private void print(String str) {
+ if (_log != null)
+ _log.debug(str);
+ else System.out.println(str);
+ }
+
+ public static DataSource createLoggingDS(DataSource ds, Log log) {
+ return (DataSource)Proxy.newProxyInstance(ds.getClass().getClassLoader(),
+ new Class[] {DataSource.class}, new LoggingInterceptor<DataSource>(ds,log));
+ }
+}
Modified: ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/msg/CommonMessages.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/msg/CommonMessages.java?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/msg/CommonMessages.java (original)
+++ ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/msg/CommonMessages.java Fri Jan 23 23:53:17 2009
@@ -1,59 +1,59 @@
-/*
- * 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.utils.msg;
-
-public class CommonMessages extends MessageBundle {
-
- public String strError() {
- return this.format("Error");
- }
-
- public String strFatal() {
- return this.format("Fatal");
- }
-
- public String strInfo() {
- return this.format("Info");
- }
-
- public String strWarning() {
- return this.format("Warning");
- }
-
- public String msgFileNotFound(String string) {
- return this.format("File not found: {0}", string);
- }
-
- public String msgCannotWriteToFile(String string) {
- return this.format("Unable to write to file \"{0}\";"
- + " it may be a directory or otherwise unwritable.", string);
- }
-
- public String msgCannotReadFromFile(String string) {
- return this.format("Unable to read from file \"{0}\";"
- + " it may be missing, a directory, or otherwise unreadable.", string);
- }
-
- public String msgBadPort(String string) {
- return this.format("The string you specified for proxy port \"{0}\" doesn't appear to be "
- + " correct, it must be a number.", string);
- }
-
-}
+/*
+ * 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.utils.msg;
+
+public class CommonMessages extends MessageBundle {
+
+ public String strError() {
+ return this.format("Error");
+ }
+
+ public String strFatal() {
+ return this.format("Fatal");
+ }
+
+ public String strInfo() {
+ return this.format("Info");
+ }
+
+ public String strWarning() {
+ return this.format("Warning");
+ }
+
+ public String msgFileNotFound(String string) {
+ return this.format("File not found: {0}", string);
+ }
+
+ public String msgCannotWriteToFile(String string) {
+ return this.format("Unable to write to file \"{0}\";"
+ + " it may be a directory or otherwise unwritable.", string);
+ }
+
+ public String msgCannotReadFromFile(String string) {
+ return this.format("Unable to read from file \"{0}\";"
+ + " it may be missing, a directory, or otherwise unreadable.", string);
+ }
+
+ public String msgBadPort(String string) {
+ return this.format("The string you specified for proxy port \"{0}\" doesn't appear to be "
+ + " correct, it must be a number.", string);
+ }
+
+}
Modified: ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/rmi/RMIConstants.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/rmi/RMIConstants.java?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/rmi/RMIConstants.java (original)
+++ ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/rmi/RMIConstants.java Fri Jan 23 23:53:17 2009
@@ -1,58 +1,58 @@
-/*
- * 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.utils.rmi;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Constant related to naming of ODE objects in JMX.
- * @deprecated DO NO USE: Find your own way to get this URL.
- */
-public final class RMIConstants {
- private static final Log __log = LogFactory.getLog(RMIConstants.class);
-
-
- /**
- * same constant defined in BootLoader but we cannot have dependencies on it
- * @deprecated DO NOT USE, will soon be eliminated.
- */
- public static final String DEFAULT_RMI_CONNECTION_URL =
- "rmi://localhost:2099/ode";
-
- /**
- * same constant defined in BootLoader but we cannot have dependencies on it
- */
- public static final String PROP_RMIURL = "ode.url";
-
-
- /**
- * @deprecated DO NOT USE, will soon be eliminated.
- */
- public static String getConnectionURL() {
- String url = System.getProperty(PROP_RMIURL);
- if(null == url) {
- url = DEFAULT_RMI_CONNECTION_URL;
- __log.warn("Cannot find value system property " + PROP_RMIURL + " so returning " +
- "default value for url " + DEFAULT_RMI_CONNECTION_URL);
- }
- return url;
- }
-}
+/*
+ * 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.utils.rmi;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Constant related to naming of ODE objects in JMX.
+ * @deprecated DO NO USE: Find your own way to get this URL.
+ */
+public final class RMIConstants {
+ private static final Log __log = LogFactory.getLog(RMIConstants.class);
+
+
+ /**
+ * same constant defined in BootLoader but we cannot have dependencies on it
+ * @deprecated DO NOT USE, will soon be eliminated.
+ */
+ public static final String DEFAULT_RMI_CONNECTION_URL =
+ "rmi://localhost:2099/ode";
+
+ /**
+ * same constant defined in BootLoader but we cannot have dependencies on it
+ */
+ public static final String PROP_RMIURL = "ode.url";
+
+
+ /**
+ * @deprecated DO NOT USE, will soon be eliminated.
+ */
+ public static String getConnectionURL() {
+ String url = System.getProperty(PROP_RMIURL);
+ if(null == url) {
+ url = DEFAULT_RMI_CONNECTION_URL;
+ __log.warn("Cannot find value system property " + PROP_RMIURL + " so returning " +
+ "default value for url " + DEFAULT_RMI_CONNECTION_URL);
+ }
+ return url;
+ }
+}
Modified: ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/ISO8601DateParserTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/ISO8601DateParserTest.java?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/ISO8601DateParserTest.java (original)
+++ ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/ISO8601DateParserTest.java Fri Jan 23 23:53:17 2009
@@ -1,95 +1,95 @@
-/*
- * 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.utils;
-
-import java.text.ParseException;
-import java.util.Date;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import junit.framework.TestCase;
-
-public class ISO8601DateParserTest extends TestCase {
-
- public void test1() throws ParseException {
- String in = "2004-05-31T09:19:31-05:00";
-
- Date d = ISO8601DateParser.parse(in);
- assertDate(d, 2004, 5, 31, 9, 19, 31, 0, "GMT-5");
- }
-
- public void test2() throws ParseException {
- String in = "2004-06-23T17:25:31-00:00";
- Date d = ISO8601DateParser.parse(in);
- assertDate(d, 2004, 6, 23, 17, 25, 31, 0, "GMT");
- }
-
- public void test3() throws ParseException {
- String in = "2004-06-23T17:25-00:00";
- Date d = ISO8601DateParser.parse(in);
- assertDate(d, 2004, 6, 23, 17, 25, 0, 0, "GMT");
- }
-
- public void test4() throws ParseException {
- String in = "2002-10-02T10:00:00-05:00";
- Date d = ISO8601DateParser.parse(in);
- assertDate(d, 2002, 10, 2, 10, 0, 0, 0, "GMT-5");
- }
-
- public void test5() throws ParseException {
- String in = "2008-02-15T18:44:54.9-08:00";
- Date d = ISO8601DateParser.parse(in);
- assertDate(d, 2008, 2, 15, 18, 44, 54, 9, "GMT-8");
- }
-
- public void test6() throws ParseException {
- String in = "2008-02-15T18:44:54.109-08:00";
- Date d = ISO8601DateParser.parse(in);
- assertDate(d, 2008, 2, 15, 18, 44, 54, 109, "GMT-8");
- }
-
- public void test7() throws ParseException {
- String in = "2004-06-23T17:25:31.6";
- Date d = ISO8601DateParser.parse(in);
- assertDate(d, 2004, 6, 23, 17, 25, 31, 6, null);
- }
-
- public void test8() throws ParseException {
- String in = "2004-06-23T17:25:10.826";
- Date d = ISO8601DateParser.parse(in);
- assertDate(d, 2004, 6, 23, 17, 25, 10, 826, null);
- }
-
- private void assertDate(Date d, int year, int month, int day,
- int hour, int minute, int second, int ms, String tz) {
- Calendar cal = Calendar.getInstance();
- cal.setTime(d);
- if (tz != null) cal.setTimeZone(TimeZone.getTimeZone(tz));
-
- assertEquals(year, cal.get(Calendar.YEAR));
- assertEquals(month - 1, cal.get(Calendar.MONTH));
- assertEquals(day, cal.get(Calendar.DAY_OF_MONTH));
- assertEquals(hour, cal.get(Calendar.HOUR_OF_DAY));
- assertEquals(minute, cal.get(Calendar.MINUTE));
- assertEquals(second, cal.get(Calendar.SECOND));
- assertEquals(ms, cal.get(Calendar.MILLISECOND));
- }
-
-}
+/*
+ * 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.utils;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import junit.framework.TestCase;
+
+public class ISO8601DateParserTest extends TestCase {
+
+ public void test1() throws ParseException {
+ String in = "2004-05-31T09:19:31-05:00";
+
+ Date d = ISO8601DateParser.parse(in);
+ assertDate(d, 2004, 5, 31, 9, 19, 31, 0, "GMT-5");
+ }
+
+ public void test2() throws ParseException {
+ String in = "2004-06-23T17:25:31-00:00";
+ Date d = ISO8601DateParser.parse(in);
+ assertDate(d, 2004, 6, 23, 17, 25, 31, 0, "GMT");
+ }
+
+ public void test3() throws ParseException {
+ String in = "2004-06-23T17:25-00:00";
+ Date d = ISO8601DateParser.parse(in);
+ assertDate(d, 2004, 6, 23, 17, 25, 0, 0, "GMT");
+ }
+
+ public void test4() throws ParseException {
+ String in = "2002-10-02T10:00:00-05:00";
+ Date d = ISO8601DateParser.parse(in);
+ assertDate(d, 2002, 10, 2, 10, 0, 0, 0, "GMT-5");
+ }
+
+ public void test5() throws ParseException {
+ String in = "2008-02-15T18:44:54.9-08:00";
+ Date d = ISO8601DateParser.parse(in);
+ assertDate(d, 2008, 2, 15, 18, 44, 54, 9, "GMT-8");
+ }
+
+ public void test6() throws ParseException {
+ String in = "2008-02-15T18:44:54.109-08:00";
+ Date d = ISO8601DateParser.parse(in);
+ assertDate(d, 2008, 2, 15, 18, 44, 54, 109, "GMT-8");
+ }
+
+ public void test7() throws ParseException {
+ String in = "2004-06-23T17:25:31.6";
+ Date d = ISO8601DateParser.parse(in);
+ assertDate(d, 2004, 6, 23, 17, 25, 31, 6, null);
+ }
+
+ public void test8() throws ParseException {
+ String in = "2004-06-23T17:25:10.826";
+ Date d = ISO8601DateParser.parse(in);
+ assertDate(d, 2004, 6, 23, 17, 25, 10, 826, null);
+ }
+
+ private void assertDate(Date d, int year, int month, int day,
+ int hour, int minute, int second, int ms, String tz) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(d);
+ if (tz != null) cal.setTimeZone(TimeZone.getTimeZone(tz));
+
+ assertEquals(year, cal.get(Calendar.YEAR));
+ assertEquals(month - 1, cal.get(Calendar.MONTH));
+ assertEquals(day, cal.get(Calendar.DAY_OF_MONTH));
+ assertEquals(hour, cal.get(Calendar.HOUR_OF_DAY));
+ assertEquals(minute, cal.get(Calendar.MINUTE));
+ assertEquals(second, cal.get(Calendar.SECOND));
+ assertEquals(ms, cal.get(Calendar.MILLISECOND));
+ }
+
+}
Modified: ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTest.java?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTest.java (original)
+++ ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTest.java Fri Jan 23 23:53:17 2009
@@ -1,64 +1,64 @@
-/*
- * 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.utils.msg;
-
-import java.util.Locale;
-
-import junit.framework.TestCase;
-
-public class MessageBundleTest extends TestCase {
-
- private static String NO_PARAMETER = "No parameter!";
- private static String NO_PARAMETER_DE = "Kein Parameter!";
- private static String WRONG_PARAMETER = "Wrong parameter :-)";
-
- private MessageBundleTestMessages _bundle;
- private Locale oldLocale;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- oldLocale = Locale.getDefault();
- Locale.setDefault(Locale.ENGLISH);
- _bundle = MessageBundle.getMessages(MessageBundleTestMessages.class);
- }
-
- @Override
- protected void tearDown() throws Exception {
- _bundle = null;
- Locale.setDefault(oldLocale);
- super.tearDown();
- }
-
- public void testNoParameter() {
- assertEquals(NO_PARAMETER, _bundle.msgNoParameter());
- }
-
- public void testNoParameterLocalized() {
- MessageBundleTestMessages bundle = MessageBundle.getMessages(
- MessageBundleTestMessages.class, Locale.GERMAN);
- assertEquals(NO_PARAMETER_DE, bundle.msgNoParameter());
- }
-
- public void testWrongParameter() {
- assertEquals(WRONG_PARAMETER, _bundle.msgWrongParameter(":-)"));
- }
-
-}
+/*
+ * 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.utils.msg;
+
+import java.util.Locale;
+
+import junit.framework.TestCase;
+
+public class MessageBundleTest extends TestCase {
+
+ private static String NO_PARAMETER = "No parameter!";
+ private static String NO_PARAMETER_DE = "Kein Parameter!";
+ private static String WRONG_PARAMETER = "Wrong parameter :-)";
+
+ private MessageBundleTestMessages _bundle;
+ private Locale oldLocale;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ oldLocale = Locale.getDefault();
+ Locale.setDefault(Locale.ENGLISH);
+ _bundle = MessageBundle.getMessages(MessageBundleTestMessages.class);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ _bundle = null;
+ Locale.setDefault(oldLocale);
+ super.tearDown();
+ }
+
+ public void testNoParameter() {
+ assertEquals(NO_PARAMETER, _bundle.msgNoParameter());
+ }
+
+ public void testNoParameterLocalized() {
+ MessageBundleTestMessages bundle = MessageBundle.getMessages(
+ MessageBundleTestMessages.class, Locale.GERMAN);
+ assertEquals(NO_PARAMETER_DE, bundle.msgNoParameter());
+ }
+
+ public void testWrongParameter() {
+ assertEquals(WRONG_PARAMETER, _bundle.msgWrongParameter(":-)"));
+ }
+
+}
Modified: ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTestMessages.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTestMessages.java?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTestMessages.java (original)
+++ ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTestMessages.java Fri Jan 23 23:53:17 2009
@@ -1,32 +1,32 @@
-/*
- * 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.utils.msg;
-
-public class MessageBundleTestMessages extends MessageBundle {
-
- public String msgNoParameter() {
- return this.format("No parameter!");
- }
-
- public String msgWrongParameter(String param) {
- return this.format("Wrong parameter {0}", param);
- }
-
-}
+/*
+ * 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.utils.msg;
+
+public class MessageBundleTestMessages extends MessageBundle {
+
+ public String msgNoParameter() {
+ return this.format("No parameter!");
+ }
+
+ public String msgWrongParameter(String param) {
+ return this.format("Wrong parameter {0}", param);
+ }
+
+}
Modified: ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTestMessages_de.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTestMessages_de.java?rev=737256&r1=737255&r2=737256&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTestMessages_de.java (original)
+++ ode/branches/APACHE_ODE_1.X/utils/src/test/java/org/apache/ode/utils/msg/MessageBundleTestMessages_de.java Fri Jan 23 23:53:17 2009
@@ -1,29 +1,29 @@
-/*
- * 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.utils.msg;
-
-public class MessageBundleTestMessages_de extends MessageBundleTestMessages {
-
- public String msgNoParameter() {
- return this.format("Kein Parameter!");
- }
-
-}
+/*
+ * 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.utils.msg;
+
+public class MessageBundleTestMessages_de extends MessageBundleTestMessages {
+
+ public String msgNoParameter() {
+ return this.format("Kein Parameter!");
+ }
+
+}
\ No newline at end of file