Projects >> ode >>45848089289e10fa9809afed4fa6ab828260b405

Chunk
Conflicting content
    }

    private void undeploy(String pakage) throws Exception {
<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/DeploymentTest.java
        // Prepare undeploy message
=======
    	// Prepare undeploy message
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/DeploymentTest.java
        OMNamespace depns = _factory.createOMNamespace(Namespaces.ODE_DEPLOYAPI_NS, "deployapi");
        OMElement root = _factory.createOMElement("undeploy", depns);
        OMElement part = _factory.createOMElement("packageName", null);
Solution content
    }

    private void undeploy(String pakage) throws Exception {
    	// Prepare undeploy message
        OMNamespace depns = _factory.createOMNamespace(Namespaces.ODE_DEPLOYAPI_NS, "deployapi");
        OMElement root = _factory.createOMElement("undeploy", depns);
        OMElement part = _factory.createOMElement("packageName", null);
File
DeploymentTest.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
    }

    private OMElement sendToPM(OMElement msg) throws AxisFault {
<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/DeploymentTest.java
        return _client.send(msg, "http://localhost:8888/processes/ProcessManagement");
    }

    private OMElement sendToDeployment(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:8888/processes/DeploymentService");
=======
        return _client.send(msg, "http://localhost:"+getTestPort(0)+"/processes/ProcessManagement");
    }

    private OMElement sendToDeployment(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:"+getTestPort(0)+"/processes/DeploymentService");
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/DeploymentTest.java
    }

}
Solution content
    }

    private OMElement sendToPM(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:"+getTestPort(0)+"/processes/ProcessManagement");
    }

    private OMElement sendToDeployment(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:"+getTestPort(0)+"/processes/DeploymentService");
    }

}
File
DeploymentTest.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Method signature
Return statement
Chunk
Conflicting content
import org.apache.ode.tools.sendsoap.cline.HttpSoapSender;
import org.apache.ode.utils.Namespaces;
import org.apache.ode.il.OMUtils;
<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
=======
import org.apache.ode.axis2.ODEConfigDirAware;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.IteratorUtils;
import org.testng.annotations.AfterMethod;
Solution content
import org.apache.ode.tools.sendsoap.cline.HttpSoapSender;
import org.apache.ode.utils.Namespaces;
import org.apache.ode.il.OMUtils;
import org.apache.ode.axis2.ODEConfigDirAware;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.IteratorUtils;
import org.testng.annotations.AfterMethod;
File
InstanceManagementTest.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import static org.testng.AssertJUnit.assertTrue;

<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
public class InstanceManagementTest extends Axis2TestBase {
=======
public class InstanceManagementTest extends Axis2TestBase implements ODEConfigDirAware {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java

    private OMFactory _factory;
    private DateFormat xsdDF = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
Solution content
import static org.testng.AssertJUnit.assertTrue;

public class InstanceManagementTest extends Axis2TestBase implements ODEConfigDirAware {

    private OMFactory _factory;
    private DateFormat xsdDF = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
File
InstanceManagementTest.java
Developer's decision
Version 2
Kind of conflict
Class signature
Chunk
Conflicting content
        assertTrue(instanceNb(result) == 0);
    }

<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
/*  @Test
    public void testListAllInstances() throws Exception {
        OMElement root = _client.buildMessage("listAllInstancesWithLimit", new String[] {"limit"}, new String[] {"1"});
        OMElement result = sendToIM(root);
        // We shold have only one instance (so 2 opening/closing elmts)
        assert(result.toString().split("instance-info").length == 5);
=======
    @Test
    public void testListAllInstances() throws Exception {
        OMElement root = _client.buildMessage("listAllInstancesWithLimit", new String[] {"limit"}, new String[] {"1"});
        OMElement result = sendToIM(root);

        // We should have only one instance (so 2 opening/closing elmts)
        assertTrue("Must contain exactly 1 instance-info element", instanceNb(result) == 1);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
        // And one of our executed instances are there
        assertTrue(result.toString().indexOf("DynPartnerMain") >= 0 ||
                result.toString().indexOf("DynPartnerResponder") >= 0);
Solution content
        assertTrue(instanceNb(result) == 0);
    }

    @Test
    public void testListAllInstances() throws Exception {
        OMElement root = _client.buildMessage("listAllInstancesWithLimit", new String[] {"limit"}, new String[] {"1"});
        OMElement result = sendToIM(root);

        // We should have only one instance (so 2 opening/closing elmts)
        assertTrue("Must contain exactly 1 instance-info element", instanceNb(result) == 1);
        // And one of our executed instances are there
        assertTrue(result.toString().indexOf("DynPartnerMain") >= 0 ||
                result.toString().indexOf("DynPartnerResponder") >= 0);
File
InstanceManagementTest.java
Developer's decision
Version 2
Kind of conflict
Annotation
Comment
Method invocation
Method signature
Variable
Chunk
Conflicting content
                result.toString().indexOf("DynPartnerResponder") >= 0);
    }*/

<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
  @Test
=======
  @Test(dataProvider="configs")
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
    public void testInstanceSummaryListProcess() throws Exception {
        OMElement listRoot = _client.buildMessage("listProcesses", new String[] {"filter", "orderKeys"},
                new String[] {"name=DynPartnerMain", ""});
Solution content
                result.toString().indexOf("DynPartnerResponder") >= 0);
    }

  @Test(dataProvider="configs")
    public void testInstanceSummaryListProcess() throws Exception {
        OMElement listRoot = _client.buildMessage("listProcesses", new String[] {"filter", "orderKeys"},
                new String[] {"name=DynPartnerMain", ""});
File
InstanceManagementTest.java
Developer's decision
Version 2
Kind of conflict
Annotation
Chunk
Conflicting content
        assertTrue(count == 1);
    }

<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
  @Test
    public void testGetInstanceInfo() throws Exception {
        OMElement root = _client.buildMessage("listAllInstances", new String[] {}, new String[] {});
        OMElement result = sendToIM(root);
        String iid = result.getFirstElement().getFirstChildWithName(new QName(Namespaces.ODE_PMAPI_TYPES_NS, "instance-info"))
                .getFirstChildWithName(new QName(Namespaces.ODE_PMAPI_TYPES_NS, "iid")).getText();
=======
    @Test
    public void testGetInstanceInfo() throws Exception {
        OMElement root = _client.buildMessage("listAllInstances", new String[] {}, new String[] {});
        OMElement result = sendToIM(root);
        String iid = instances(result).get(0).getFirstChildWithName(new QName(Namespaces.ODE_PMAPI_TYPES_NS, "iid")).getText();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
        root = _client.buildMessage("getInstanceInfo", new String[] {"iid"}, new String[] {iid});
        result = sendToIM(root);
        assertTrue("Must return one  element", instance(result)!=null);
Solution content
        assertTrue(count == 1);
    }

    @Test
    public void testGetInstanceInfo() throws Exception {
        OMElement root = _client.buildMessage("listAllInstances", new String[] {}, new String[] {});
        OMElement result = sendToIM(root);
        String iid = instances(result).get(0).getFirstChildWithName(new QName(Namespaces.ODE_PMAPI_TYPES_NS, "iid")).getText();
        root = _client.buildMessage("getInstanceInfo", new String[] {"iid"}, new String[] {iid});
        result = sendToIM(root);
        assertTrue("Must return one  element", instance(result)!=null);
File
InstanceManagementTest.java
Developer's decision
Version 2
Kind of conflict
Annotation
Method invocation
Method signature
Variable
Chunk
Conflicting content
            @SuppressWarnings("unused")
            OMElement result = sendToIM(root);
        } catch (AxisFault axisFault) {
<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
            assert(axisFault.getMessage().indexOf("InstanceNotFoundException") > 0);
        }
    }

  @Test
    public void testGetScopeInfo() throws Exception {
      OMElement root = _client.buildMessage("listInstances", new String[] {"filter", "order", "limit"},
              new String[] {"name=DynPartnerMain", "", "10"});
        OMElement result = sendToIM(root);
        String siid = result.getFirstElement().getFirstChildWithName(new QName(Namespaces.ODE_PMAPI_TYPES_NS, "instance-info"))
=======
            assertTrue("Should contain InstanceNotFoundException", axisFault.getMessage().contains("InstanceNotFoundException"));
        }
    }

    @Test
    public void testGetScopeInfo() throws Exception {
        OMElement root = _client.buildMessage("listInstances", new String[] {"filter", "order", "limit"},
                new String[] {"name=DynPartnerMain", "", "10"});
        OMElement result = sendToIM(root);
        String siid = instances(result).get(0)
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
                .getFirstChildWithName(new QName(Namespaces.ODE_PMAPI_TYPES_NS, "root-scope"))
                .getAttributeValue(new QName(null, "siid"));
        root = _client.buildMessage("getScopeInfoWithActivity", new String[] {"siid", "activityInfo"},
Solution content
            @SuppressWarnings("unused")
            OMElement result = sendToIM(root);
        } catch (AxisFault axisFault) {
            assertTrue("Should contain InstanceNotFoundException", axisFault.getMessage().contains("InstanceNotFoundException"));
        }
    }

    @Test
    public void testGetScopeInfo() throws Exception {
        OMElement root = _client.buildMessage("listInstances", new String[] {"filter", "order", "limit"},
                new String[] {"name=DynPartnerMain", "", "10"});
        OMElement result = sendToIM(root);
        String siid = instances(result).get(0)
                .getFirstChildWithName(new QName(Namespaces.ODE_PMAPI_TYPES_NS, "root-scope"))
                .getAttributeValue(new QName(null, "siid"));
        root = _client.buildMessage("getScopeInfoWithActivity", new String[] {"siid", "activityInfo"},
File
InstanceManagementTest.java
Developer's decision
Version 2
Kind of conflict
Annotation
Assert statement
Method invocation
Method signature
Variable
Chunk
Conflicting content
        OMElement root = _client.buildMessage("listInstances", new String[] {"filter", "order", "limit"},
                new String[] {"name=DynPartnerMain", "", "10"});
        OMElement result = sendToIM(root);
<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
        String siid = result.getFirstElement().getFirstChildWithName(new QName(Namespaces.ODE_PMAPI_TYPES_NS, "instance-info"))
=======
        String siid = instances(result).get(0)
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
                .getFirstChildWithName(new QName(Namespaces.ODE_PMAPI_TYPES_NS, "root-scope"))
                .getAttributeValue(new QName(null, "siid"));
        root = _client.buildMessage("getVariableInfo", new String[] {"sid", "varName"}, new String[] {siid, "dummy"});
Solution content
        OMElement root = _client.buildMessage("listInstances", new String[] {"filter", "order", "limit"},
                new String[] {"name=DynPartnerMain", "", "10"});
        OMElement result = sendToIM(root);
        String siid = instances(result).get(0)
                .getFirstChildWithName(new QName(Namespaces.ODE_PMAPI_TYPES_NS, "root-scope"))
                .getAttributeValue(new QName(null, "siid"));
        root = _client.buildMessage("getVariableInfo", new String[] {"sid", "varName"}, new String[] {siid, "dummy"});
File
InstanceManagementTest.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
        assertTrue(result.toString().indexOf("fire!") >= 0);
    }

<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java

//    TODO uncomment when events querying is fixes on OpenJPA
    
//    public void testListEvents() throws Exception {
//        OMElement root = _client.buildMessage("listEvents", new String[] {"instanceFilter", "eventFilter", "maxCount"},
//                new String[] {"", "", "0"});
//        OMElement result = sendToIM(root);
//        assert(result.toString().split("event-info").length > 10);
//    }
//
//    public void testGetEventTimeline() throws Exception {
//        OMElement root = _client.buildMessage("getEventTimeline", new String[] {"instanceFilter", "eventFilter"},
//                new String[] {"", ""});
//        OMElement result = sendToIM(root);
//        assert(result.toString().split("element").length > 10);
//    }

  @Test
=======

    //    TODO uncomment when events querying is fixes on OpenJPA
    @Test(enabled = false)
    public void testListEvents() throws Exception {
        OMElement root = _client.buildMessage("listEvents", new String[]{"instanceFilter", "eventFilter", "maxCount"},
                new String[]{"", "", "0"});
        OMElement result = sendToIM(root);
        assertTrue(result.toString().split("event-info").length > 10);
    }

    @Test(enabled = false)
    public void testGetEventTimeline() throws Exception {
        OMElement root = _client.buildMessage("getEventTimeline", new String[]{"instanceFilter", "eventFilter"},
                new String[]{"", ""});
        OMElement result = sendToIM(root);
        assertTrue(result.toString().split("element").length > 10);
    }

    @Test
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
    public void testDeleteInstances() throws Exception {
        OMElement root = _client.buildMessage("listAllInstancesWithLimit", new String[] {"limit"}, new String[] {"1"});
        OMElement result = sendToIM(root);
Solution content
        assertTrue(result.toString().indexOf("fire!") >= 0);
    }


    //    TODO uncomment when events querying is fixes on OpenJPA
    @Test(enabled = false)
    public void testListEvents() throws Exception {
        OMElement root = _client.buildMessage("listEvents", new String[]{"instanceFilter", "eventFilter", "maxCount"},
                new String[]{"", "", "0"});
        OMElement result = sendToIM(root);
        assertTrue(result.toString().split("event-info").length > 10);
    }

    @Test(enabled = false)
    public void testGetEventTimeline() throws Exception {
        OMElement root = _client.buildMessage("getEventTimeline", new String[]{"instanceFilter", "eventFilter"},
                new String[]{"", ""});
        OMElement result = sendToIM(root);
        assertTrue(result.toString().split("element").length > 10);
    }

    @Test
    public void testDeleteInstances() throws Exception {
        OMElement root = _client.buildMessage("listAllInstancesWithLimit", new String[] {"limit"}, new String[] {"1"});
        OMElement result = sendToIM(root);
File
InstanceManagementTest.java
Developer's decision
Version 2
Kind of conflict
Annotation
Comment
Method declaration
Chunk
Conflicting content
        _deployedName = res.getFirstChildWithName(new QName(null, "response")).getFirstChildWithName(new QName("http://www.apache.org/ode/deployapi", "name")).getText();

        // Execute
<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
        URL svcUrl = new URL("http://localhost:8888/processes/DynMainService");
        InputStream sis = this.getClass().getClassLoader().getResourceAsStream("testDynPartnerRequest.soap");
        System.out.println(HttpSoapSender.doSend(svcUrl, sis, null, 0, null, null, null));
=======
      System.out.println(server.sendRequestFile("http://localhost:8888/processes/DynMainService", "testDynPartnerRequest.soap"));
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
        // Just making sure the instance starts
        Thread.sleep(1000);
    }
Solution content
        _deployedName = res.getFirstChildWithName(new QName(null, "response")).getFirstChildWithName(new QName("http://www.apache.org/ode/deployapi", "name")).getText();

        // Execute
      System.out.println(server.sendRequestFile("http://localhost:8888/processes/DynMainService", "testDynPartnerRequest.soap"));
        // Just making sure the instance starts
        Thread.sleep(1000);
    }
File
InstanceManagementTest.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
    }

    private OMElement sendToPM(OMElement msg) throws AxisFault {
<<<<<<< HEAD:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
        return _client.send(msg, "http://localhost:8888/processes/ProcessManagement");
    }

    private OMElement sendToIM(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:8888/processes/InstanceManagement");
    }

    private OMElement sendToDeployment(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:8888/processes/DeploymentService");
=======
        return _client.send(msg, "http://localhost:"+getTestPort(0)+"/processes/ProcessManagement");
    }

    private OMElement sendToIM(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:"+getTestPort(0)+"/processes/InstanceManagement");
    }

    private OMElement sendToDeployment(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:"+getTestPort(0)+"/processes/DeploymentService");
    }

    public String getODEConfigDir() {
        return HIB_DERBY_CONF_DIR;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a:axis2-war/src/test/java/org/apache/ode/axis2/management/InstanceManagementTest.java
    }
}
Solution content
    }

    private OMElement sendToPM(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:"+getTestPort(0)+"/processes/ProcessManagement");
    }

    private OMElement sendToIM(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:"+getTestPort(0)+"/processes/InstanceManagement");
    }

    private OMElement sendToDeployment(OMElement msg) throws AxisFault {
        return _client.send(msg, "http://localhost:"+getTestPort(0)+"/processes/DeploymentService");
    }

    public String getODEConfigDir() {
        return HIB_DERBY_CONF_DIR;
    }
}
File
InstanceManagementTest.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Method invocation
Method signature
Return statement
Chunk
Conflicting content
import org.apache.commons.collections.map.MultiKeyMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
<<<<<<< HEAD
import org.apache.ode.axis2.hooks.ODEAxisService;
import org.apache.ode.axis2.hooks.ODEMessageReceiver;
import org.apache.ode.axis2.httpbinding.HttpExternalService;
import org.apache.ode.axis2.soapbinding.SoapExternalService;
import org.apache.ode.bpel.iapi.*;
import org.apache.ode.utils.wsdl.WsdlUtils;

import javax.wsdl.Definition;
import javax.wsdl.PortType;
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Iterator;
=======
import org.apache.ode.agents.memory.SizingAgent;
import org.apache.ode.axis2.hooks.ODEAxisService;
import org.apache.ode.axis2.hooks.ODEMessageReceiver;
import org.apache.ode.axis2.httpbinding.HttpExternalService;
import org.apache.ode.bpel.iapi.BindingContext;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.Endpoint;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.PartnerRoleChannel;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.utils.wsdl.WsdlUtils;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

/**
 * AXIS2 implementation of the {@link org.apache.ode.bpel.iapi.BindingContext}
Solution content
import org.apache.commons.collections.map.MultiKeyMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.agents.memory.SizingAgent;
import org.apache.ode.axis2.hooks.ODEAxisService;
import org.apache.ode.axis2.hooks.ODEMessageReceiver;
import org.apache.ode.axis2.httpbinding.HttpExternalService;
import org.apache.ode.bpel.iapi.BindingContext;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.Endpoint;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.PartnerRoleChannel;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.utils.wsdl.WsdlUtils;

/**
 * AXIS2 implementation of the {@link org.apache.ode.bpel.iapi.BindingContext}
File
BindingContextImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
    private ODEServer _server;
    private MultiKeyMap _services = new MultiKeyMap();
<<<<<<< HEAD
=======
    private Map _serviceEprMap = new HashMap();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    public BindingContextImpl(ODEServer server) {
        _server = server;
Solution content
    private ODEServer _server;
    private MultiKeyMap _services = new MultiKeyMap();
    private Map _serviceEprMap = new HashMap();

    public BindingContextImpl(ODEServer server) {
        _server = server;
File
BindingContextImpl.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
                throw new ContextException("Unable to access WSDL definition to activate MyRole endpoint for service " + myRoleEndpoint.serviceName
                        + " and port " + myRoleEndpoint.portName);
            ODEService svc = createService(pconf, myRoleEndpoint.serviceName, myRoleEndpoint.portName);
<<<<<<< HEAD
            return svc.getMyServiceRef();
=======
            EndpointReference epr = svc.getMyServiceRef();
            _serviceEprMap.put(svc, epr);
            return epr;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        } catch (AxisFault axisFault) {
            throw new ContextException("Could not activate endpoint for service " + myRoleEndpoint.serviceName
                    + " and port " + myRoleEndpoint.portName, axisFault);
Solution content
                throw new ContextException("Unable to access WSDL definition to activate MyRole endpoint for service " + myRoleEndpoint.serviceName
                        + " and port " + myRoleEndpoint.portName);
            ODEService svc = createService(pconf, myRoleEndpoint.serviceName, myRoleEndpoint.portName);
            EndpointReference epr = svc.getMyServiceRef();
            _serviceEprMap.put(svc, epr);
            return epr;
        } catch (AxisFault axisFault) {
            throw new ContextException("Could not activate endpoint for service " + myRoleEndpoint.serviceName
                    + " and port " + myRoleEndpoint.portName, axisFault);
File
BindingContextImpl.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Return statement
Variable
Chunk
Conflicting content
    }

    public void deactivateMyRoleEndpoint(Endpoint myRoleEndpoint) {
<<<<<<< HEAD
        destroyService(myRoleEndpoint.serviceName, myRoleEndpoint.portName);
=======
        ODEService service = destroyService(myRoleEndpoint.serviceName, myRoleEndpoint.portName);
        if (service != null) {
	        _serviceEprMap.remove(service);
        }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    public PartnerRoleChannel createPartnerRoleChannel(QName processId, PortType portType,
Solution content
    }

    public void deactivateMyRoleEndpoint(Endpoint myRoleEndpoint) {
        ODEService service = destroyService(myRoleEndpoint.serviceName, myRoleEndpoint.portName);
        if (service != null) {
	        _serviceEprMap.remove(service);
        }
    }

    public PartnerRoleChannel createPartnerRoleChannel(QName processId, PortType portType,
File
BindingContextImpl.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Variable
Chunk
Conflicting content
        } else {
            __log.debug("Couldn't find service " + serviceName + " port " + portName + " to destroy.");
        }
<<<<<<< HEAD
=======
        return createExternalService(pconf, initialPartnerEndpoint.serviceName, initialPartnerEndpoint.portName);
    }

	public long calculateSizeofService(EndpointReference epr) {
		if (_server._odeConfig.isProcessSizeThrottled()) {
			for (ODEService service : _serviceEprMap.keySet()) {
				if (epr.equals(_serviceEprMap.get(epr))) {
					return SizingAgent.deepSizeOf(service);
				}
			}
		}
		return 0;
	}
	
    protected ODEService createService(ProcessConf pconf, QName serviceName, String portName) throws AxisFault {
        AxisService axisService = ODEAxisService.createService(_server._axisConfig, pconf, serviceName, portName);
        ODEService odeService = new ODEService(axisService, pconf, serviceName, portName, _server._bpelServer, _server._txMgr);

        destroyService(serviceName, portName);
        _services.put(serviceName, portName, odeService);

        // Setting our new service on the ODE receiver
        }
    }
        Iterator operationIterator = axisService.getOperations();
        while (operationIterator.hasNext()) {
            AxisOperation op = (AxisOperation) operationIterator.next();
            if (op.getMessageReceiver() instanceof ODEMessageReceiver) {
                ((ODEMessageReceiver) op.getMessageReceiver()).setService(odeService);
                break;
            }
        }

        // We're public!
        _server._axisConfig.addService(axisService);
        __log.debug("Created Axis2 service " + serviceName);
        return odeService;
    }

    protected ODEService destroyService(QName serviceName, String portName) {
        __log.debug("Destroying service " + serviceName + " port " + portName);
        ODEService service = (ODEService) _services.remove(serviceName, portName);
        if (service != null) {
            // try to clean up the service after itself
            try {
                String axisServiceName = service.getAxisService().getName();
                AxisService axisService = _server._axisConfig.getService(axisServiceName);
                // first, de-allocate its schemas
                axisService.releaseSchemaList();
                // then, de-allocate its parameters
                // the service's wsdl object model is stored as one of its parameters!
                // can't stress strongly enough how important it is to clean this up.
                ArrayList parameters = (ArrayList) axisService.getParameters();
                for (Parameter parameter : parameters) {
                    axisService.removeParameter(parameter);
                }
                // now, stop the service
                _server._axisConfig.stopService(axisServiceName);
                // if only this method did a good job of cleaning up after itself
                _server._axisConfig.removeService(service.getName());
                completeCleanup(axisService);
                _server._axisConfig.cleanup();
            } catch (AxisFault axisFault) {
                __log.error("Couldn't destroy service " + serviceName);
            }
        } else {
            __log.debug("Couldn't find service " + serviceName + " port " + portName + " to destroy.");
        }
        return service;
    }

    /**
     * /!\ Monkey patching to remove references to the service:
     * Manually & externally & really really horribly fix for ODE-580/AXIS2-3870
     * The exception handling is for locked down environment where reflection would not be allowed...
     *
     * This patch is needed for Axis2 1.3 and 1.4.1
     * @param service
     * @throws AxisFault
     */
    private void completeCleanup(AxisService service) {
        try {
            Field field= _server._axisConfig.getClass().getDeclaredField("allEndpoints");
            field.setAccessible(true);
            synchronized (_server._axisConfig) {
                //removes the endpoints to this service
                Map allEndpoints = (Map) field.get(_server._axisConfig);

                //removes the service endpoints
                for (Iterator iter = service.getEndpoints().keySet().iterator(); iter.hasNext();) {
                    allEndpoints.remove(service.getName() + "." + iter.next());
                }
            }
        } catch(Exception e) {
            __log.error("Workaround for ODE-580/AXIS2-3870 failed. AxisConfig clean up might be incomplete.",  e);

    protected ExternalService createExternalService(ProcessConf pconf, QName serviceName, String portName) throws ContextException {
        ExternalService extService = null;

        Definition def = pconf.getDefinitionForService(serviceName);
        try {
            if (WsdlUtils.useHTTPBinding(def, serviceName, portName)) {
                if (__log.isDebugEnabled()) __log.debug("Creating HTTP-bound external service " + serviceName);
                extService = new HttpExternalService(pconf, serviceName, portName, _server._executorService, _server._scheduler, _server._bpelServer, _server.httpConnectionManager, _server._clusterUrlTransformer);
            } else if (WsdlUtils.useSOAPBinding(def, serviceName, portName)) {
                if (__log.isDebugEnabled()) __log.debug("Creating SOAP-bound external service " + serviceName);
                extService = new SoapExternalService(pconf, serviceName, portName, _server._executorService, _server._axisConfig, _server._scheduler, _server._bpelServer, _server.httpConnectionManager, _server._clusterUrlTransformer);
            }
        } catch (Exception ex) {
            __log.error("Could not create external service.", ex);
            throw new ContextException("Error creating external service! name:" + serviceName + ", port:" + portName, ex);
        }

        // if not SOAP nor HTTP binding
        if (extService == null) {
            throw new ContextException("Only SOAP and HTTP binding supported!");
        }

        __log.debug("Created external service " + serviceName);
        return extService;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    protected ExternalService createExternalService(ProcessConf pconf, QName serviceName, String portName) throws ContextException {
Solution content
}
        }
        return createExternalService(pconf, initialPartnerEndpoint.serviceName, initialPartnerEndpoint.portName);
    }

	public long calculateSizeofService(EndpointReference epr) {
		if (_server._odeConfig.isProcessSizeThrottled()) {
			for (ODEService service : _serviceEprMap.keySet()) {
				if (epr.equals(_serviceEprMap.get(epr))) {
					return SizingAgent.deepSizeOf(service);
				}
			}
		}
		return 0;
	}
	
    protected ODEService createService(ProcessConf pconf, QName serviceName, String portName) throws AxisFault {
        AxisService axisService = ODEAxisService.createService(_server._axisConfig, pconf, serviceName, portName);
        ODEService odeService = new ODEService(axisService, pconf, serviceName, portName, _server._bpelServer, _server._txMgr);

        destroyService(serviceName, portName);
        _services.put(serviceName, portName, odeService);

        // Setting our new service on the ODE receiver
        Iterator operationIterator = axisService.getOperations();
        while (operationIterator.hasNext()) {
            AxisOperation op = (AxisOperation) operationIterator.next();
            if (op.getMessageReceiver() instanceof ODEMessageReceiver) {
                ((ODEMessageReceiver) op.getMessageReceiver()).setService(odeService);
                break;
            }
        }

        // We're public!
        _server._axisConfig.addService(axisService);
        __log.debug("Created Axis2 service " + serviceName);
        return odeService;
    }

    protected ODEService destroyService(QName serviceName, String portName) {
        __log.debug("Destroying service " + serviceName + " port " + portName);
        ODEService service = (ODEService) _services.remove(serviceName, portName);
        if (service != null) {
            // try to clean up the service after itself
            try {
                String axisServiceName = service.getAxisService().getName();
                AxisService axisService = _server._axisConfig.getService(axisServiceName);
                // first, de-allocate its schemas
                axisService.releaseSchemaList();
                // then, de-allocate its parameters
                // the service's wsdl object model is stored as one of its parameters!
                // can't stress strongly enough how important it is to clean this up.
                ArrayList parameters = (ArrayList) axisService.getParameters();
                for (Parameter parameter : parameters) {
                    axisService.removeParameter(parameter);
                }
                // now, stop the service
                _server._axisConfig.stopService(axisServiceName);
                // if only this method did a good job of cleaning up after itself
                _server._axisConfig.removeService(service.getName());
                completeCleanup(axisService);
                _server._axisConfig.cleanup();
            } catch (AxisFault axisFault) {
                __log.error("Couldn't destroy service " + serviceName);
            }
        } else {
            __log.debug("Couldn't find service " + serviceName + " port " + portName + " to destroy.");
        }
        return service;
    }

    /**
     * /!\ Monkey patching to remove references to the service:
     * Manually & externally & really really horribly fix for ODE-580/AXIS2-3870
     * The exception handling is for locked down environment where reflection would not be allowed...
     *
     * This patch is needed for Axis2 1.3 and 1.4.1
     * @param service
     * @throws AxisFault
     */
    private void completeCleanup(AxisService service) {
        try {
            Field field= _server._axisConfig.getClass().getDeclaredField("allEndpoints");
            field.setAccessible(true);
            synchronized (_server._axisConfig) {
                //removes the endpoints to this service
                Map allEndpoints = (Map) field.get(_server._axisConfig);

                //removes the service endpoints
                for (Iterator iter = service.getEndpoints().keySet().iterator(); iter.hasNext();) {
                    allEndpoints.remove(service.getName() + "." + iter.next());
                }
            }
        } catch(Exception e) {
            __log.error("Workaround for ODE-580/AXIS2-3870 failed. AxisConfig clean up might be incomplete.",  e);
        }
    }

    protected ExternalService createExternalService(ProcessConf pconf, QName serviceName, String portName) throws ContextException {
        ExternalService extService = null;

        Definition def = pconf.getDefinitionForService(serviceName);
        try {
            if (WsdlUtils.useHTTPBinding(def, serviceName, portName)) {
                if (__log.isDebugEnabled()) __log.debug("Creating HTTP-bound external service " + serviceName);
                extService = new HttpExternalService(pconf, serviceName, portName, _server._executorService, _server._scheduler, _server._bpelServer, _server.httpConnectionManager, _server._clusterUrlTransformer);
            } else if (WsdlUtils.useSOAPBinding(def, serviceName, portName)) {
                if (__log.isDebugEnabled()) __log.debug("Creating SOAP-bound external service " + serviceName);
                extService = new SoapExternalService(pconf, serviceName, portName, _server._executorService, _server._axisConfig, _server._scheduler, _server._bpelServer, _server.httpConnectionManager, _server._clusterUrlTransformer);
            }
        } catch (Exception ex) {
            __log.error("Could not create external service.", ex);
            throw new ContextException("Error creating external service! name:" + serviceName + ", port:" + portName, ex);
        }

        // if not SOAP nor HTTP binding
        if (extService == null) {
            throw new ContextException("Only SOAP and HTTP binding supported!");
        }

        __log.debug("Created external service " + serviceName);
        return extService;
    }
File
BindingContextImpl.java
Developer's decision
Combination
Kind of conflict
Comment
If statement
Method declaration
Method invocation
Method signature
Return statement
Try statement
Variable
Chunk
Conflicting content
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
<<<<<<< HEAD
import org.apache.ode.il.epr.EndpointFactory;
import org.apache.ode.il.epr.MutableEndpoint;
=======
import org.apache.ode.bpel.epr.EndpointFactory;
import org.apache.ode.bpel.epr.MutableEndpoint;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
import org.apache.ode.utils.DOMUtils;
Solution content
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.epr.EndpointFactory;
import org.apache.ode.bpel.epr.MutableEndpoint;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
import org.apache.ode.utils.DOMUtils;
File
EndpointReferenceContextImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.w3c.dom.Element;

import java.util.Map;
<<<<<<< HEAD
=======
import java.util.HashMap;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

public class EndpointReferenceContextImpl implements EndpointReferenceContext {
Solution content
import org.w3c.dom.Element;

import java.util.Map;
import java.util.HashMap;

public class EndpointReferenceContextImpl implements EndpointReferenceContext {
File
EndpointReferenceContextImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.ode.bpel.iapi.PartnerRoleChannel;
import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
<<<<<<< HEAD
import javax.xml.namespace.QName;

/**
 +  * @author Alexis Midon
=======

import javax.xml.namespace.QName;

/**
 * @author Alexis Midon
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
 */
public interface ExternalService extends PartnerRoleChannel {
    void invoke(PartnerRoleMessageExchange odeMex);
Solution content
import org.apache.ode.bpel.iapi.PartnerRoleChannel;
import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;

import javax.xml.namespace.QName;

/**
 * @author Alexis Midon
 */
public interface ExternalService extends PartnerRoleChannel {
    void invoke(PartnerRoleMessageExchange odeMex);
File
ExternalService.java
Developer's decision
Version 2
Kind of conflict
Comment
Import
Chunk
Conflicting content
        return format("Registered message exchange interceptor: {0}", interceptorCN);
    }

<<<<<<< HEAD
    public String msgContextInterceptorRegistered(String interceptorCN) {
        return format("Registered context interceptor: {0}", interceptorCN);
    }

=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public String msgOdeShutdownCompleted() {
        return "Shutdown completed. ";
    }
Solution content
        return format("Registered message exchange interceptor: {0}", interceptorCN);
    }

    public String msgOdeShutdownCompleted() {
        return "Shutdown completed. ";
    }
File
Messages.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
        return "Shutdown completed. ";
    }

<<<<<<< HEAD
    public String msgOdeUsingBpelDAOImpl(String className) {
        return format("Using Bpel DAO Connection Factory class {0}.", className);
    }

    public String msgOdeUsingStoreDAOImpl(String className) {
        return format("Using Conf Store DAO Connection Factory class {0}.", className);
    }

    public String msgOdeUsingSchedDAOImpl(String className) {
        return format("Using Scheduler DAO Connection Factory class {0}.", className);
=======
    public String msgOdeUsingDAOImpl(String className) {
        return format("Using DAO Connection Factory class {0}.", className);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    public String msgDAOInstantiationFailed(String className) {
Solution content
        return "Shutdown completed. ";
    }

    public String msgOdeUsingDAOImpl(String className) {
        return format("Using DAO Connection Factory class {0}.", className);
    }

    public String msgDAOInstantiationFailed(String className) {
File
Messages.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Method invocation
Method signature
Return statement
Chunk
Conflicting content
<<<<<<< HEAD

import java.io.File;
import java.io.FileNotFoundException;
import java.util.HashMap;
import java.util.Map;
import java.util.Iterator;
=======
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import java.util.StringTokenizer;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Solution content
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;
<<<<<<< HEAD
import javax.wsdl.Definition;
import javax.xml.namespace.QName;
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

import org.apache.axis2.AxisFault;
import org.apache.axis2.engine.AxisConfiguration;
Solution content
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;

import org.apache.axis2.AxisFault;
import org.apache.axis2.engine.AxisConfiguration;
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.commons.httpclient.util.IdleConnectionTimeoutThread;
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
import org.apache.ode.axis2.deploy.DeploymentPoller;
<<<<<<< HEAD
import org.apache.ode.axis2.hooks.ODEAxisService;
import org.apache.ode.axis2.hooks.ODEMessageReceiver;
import org.apache.ode.axis2.httpbinding.HttpExternalService;
import org.apache.ode.axis2.service.DeploymentWebService;
import org.apache.ode.axis2.service.ManagementService;
import org.apache.ode.axis2.soapbinding.SoapExternalService;
import org.apache.ode.bpel.extension.ExtensionValidator;
import org.apache.ode.bpel.extension.ExtensionBundleRuntime;
import org.apache.ode.bpel.extension.ExtensionBundleValidation;
=======
import org.apache.ode.axis2.service.DeploymentWebService;
import org.apache.ode.axis2.service.ManagementService;
import org.apache.ode.axis2.util.ClusterUrlTransformer;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.bpel.connector.BpelServerConnector;
import org.apache.ode.bpel.context.ContextInterceptor;
import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
Solution content
import org.apache.ode.axis2.deploy.DeploymentPoller;
import org.apache.ode.axis2.service.DeploymentWebService;
import org.apache.ode.axis2.service.ManagementService;
import org.apache.ode.axis2.util.ClusterUrlTransformer;
import org.apache.ode.bpel.connector.BpelServerConnector;
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
import org.apache.ode.bpel.engine.cron.CronScheduler;
<<<<<<< HEAD
import org.apache.ode.bpel.evtproc.DebugBpelEventListener;
import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;
import org.apache.ode.bpel.iapi.BpelEventListener;
import org.apache.ode.bpel.iapi.ContextException;
=======
import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;
import org.apache.ode.bpel.iapi.BpelEventListener;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.bpel.iapi.ProcessStoreEvent;
Solution content
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
import org.apache.ode.bpel.engine.cron.CronScheduler;
import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;
import org.apache.ode.bpel.iapi.BpelEventListener;
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.bpel.iapi.ProcessStoreEvent;
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.ode.bpel.iapi.ProcessStoreListener;
import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
<<<<<<< HEAD
import org.apache.ode.bpel.pmapi.InstanceManagement;
import org.apache.ode.bpel.pmapi.ProcessManagement;
import org.apache.ode.dao.scheduler.SchedulerDAOConnectionFactory;
import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
=======
import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
import org.apache.ode.bpel.pmapi.InstanceManagement;
import org.apache.ode.bpel.pmapi.ProcessManagement;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.il.txutil.TxManager;
import org.apache.ode.scheduler.simple.SimpleScheduler;
Solution content
import org.apache.ode.bpel.iapi.ProcessStoreListener;
import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
import org.apache.ode.bpel.pmapi.InstanceManagement;
import org.apache.ode.bpel.pmapi.ProcessManagement;
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.scheduler.simple.JdbcDelegate;
import org.apache.ode.scheduler.simple.SimpleScheduler;
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.ode.store.ProcessStoreImpl;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.fs.TempFileManager;
<<<<<<< HEAD
import org.apache.ode.utils.wsdl.WsdlUtils;
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

/**
 * Server class called by our Axis hooks to handle all ODE lifecycle management.
Solution content
import org.apache.ode.store.ProcessStoreImpl;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.fs.TempFileManager;

/**
 * Server class called by our Axis hooks to handle all ODE lifecycle management.
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
    protected File _appRoot;
    protected File _configRoot;
    protected File _workRoot;
<<<<<<< HEAD
    protected BpelServerImpl _bpelServer;
=======

    protected File _configRoot;

    protected BpelServerImpl _bpelServer;

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    protected ProcessStoreImpl _store;
    protected ODEConfigProperties _odeConfig;
    protected AxisConfiguration _axisConfig;
Solution content
    protected File _appRoot;

    protected File _workRoot;

    protected File _configRoot;

    protected BpelServerImpl _bpelServer;

    protected ProcessStoreImpl _store;

    protected ODEConfigProperties _odeConfig;

    protected AxisConfiguration _axisConfig;
File
ODEServer.java
Developer's decision
Manual
Kind of conflict
Attribute
Chunk
Conflicting content
    protected ProcessStoreImpl _store;
    protected ODEConfigProperties _odeConfig;
    protected AxisConfiguration _axisConfig;
<<<<<<< HEAD
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    protected TransactionManager _txMgr;
    protected BpelDAOConnectionFactory _bpelDaoCF;
    protected ConfStoreDAOConnectionFactory _storeDaoCF;
Solution content
    protected ProcessStoreImpl _store;

    protected ODEConfigProperties _odeConfig;

    protected AxisConfiguration _axisConfig;

    protected TransactionManager _txMgr;
File
ODEServer.java
Developer's decision
Concatenation
Kind of conflict
Blank
Chunk
Conflicting content
    protected Scheduler _scheduler;

    protected ExecutorService _executorService;
<<<<<<< HEAD
=======

    protected Scheduler _scheduler;
    
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    protected CronScheduler _cronScheduler;

    protected Database _db;
Solution content
    protected ExecutorService _executorService;

    protected Scheduler _scheduler;
    
    protected CronScheduler _cronScheduler;

    protected Database _db;
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
    protected Database _db;
    private DeploymentPoller _poller;
<<<<<<< HEAD
    private MultiKeyMap _services = new MultiKeyMap();
    private BpelServerConnector _connector;
    private ManagementService _mgtService;
    protected MultiThreadedHttpConnectionManager httpConnectionManager;
    protected IdleConnectionTimeoutThread idleConnectionTimeoutThread;
=======

    private BpelServerConnector _connector;

    private ManagementService _mgtService;
    
    protected ClusterUrlTransformer _clusterUrlTransformer;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    protected MultiThreadedHttpConnectionManager httpConnectionManager;
    protected IdleConnectionTimeoutThread idleConnectionTimeoutThread;
Solution content
    protected Database _db;

    private DeploymentPoller _poller;

    private BpelServerConnector _connector;

    private ManagementService _mgtService;
    
    protected ClusterUrlTransformer _clusterUrlTransformer;

    protected MultiThreadedHttpConnectionManager httpConnectionManager;
    protected IdleConnectionTimeoutThread idleConnectionTimeoutThread;
File
ODEServer.java
Developer's decision
Manual
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    public void init(ServletConfig config, AxisConfiguration axisConf) throws ServletException {
        init(config.getServletContext().getRealPath("/WEB-INF"), axisConf);
    }
<<<<<<< HEAD

    public void init(String contextPath, AxisConfiguration axisConf) throws ServletException {
        boolean success = false;
        try {
            _axisConfig = axisConf;
            String rootDir = System.getProperty("org.apache.ode.rootDir");
            if (rootDir != null) _appRoot = new File(rootDir);
            else _appRoot = new File(contextPath);

            if(!_appRoot.isDirectory()) throw new IllegalArgumentException(_appRoot+" does not exist or is not a directory");
            TempFileManager.setWorkingDirectory(_appRoot);

            __log.debug("Loading properties");
            String confDir = System.getProperty("org.apache.ode.configDir");
            _configRoot = confDir == null ? new File(_appRoot, "conf") : new File(confDir);
            if(!_configRoot.isDirectory()) throw new IllegalArgumentException(_configRoot+" does not exist or is not a directory");

            _odeConfig = new ODEConfigProperties(_configRoot);
=======

    public void init(String contextPath, AxisConfiguration axisConf) throws ServletException {
        _axisConfig = axisConf;
        String rootDir = System.getProperty("org.apache.ode.rootDir");
        if (rootDir != null) _appRoot = new File(rootDir);
        else _appRoot = new File(contextPath);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

        if (!_appRoot.isDirectory())
            throw new IllegalArgumentException(_appRoot + " does not exist or is not a directory");
Solution content
    public void init(ServletConfig config, AxisConfiguration axisConf) throws ServletException {
        init(config.getServletContext().getRealPath("/WEB-INF"), axisConf);
    }

    public void init(String contextPath, AxisConfiguration axisConf) throws ServletException {
        _axisConfig = axisConf;
        String rootDir = System.getProperty("org.apache.ode.rootDir");
        if (rootDir != null) _appRoot = new File(rootDir);
        else _appRoot = new File(contextPath);

        if (!_appRoot.isDirectory())
            throw new IllegalArgumentException(_appRoot + " does not exist or is not a directory");
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Attribute
If statement
Method invocation
Method signature
Try statement
Variable
Chunk
Conflicting content
            String wdir = _odeConfig.getWorkingDir();
            if (wdir == null) _workRoot = _appRoot;
            else _workRoot = new File(wdir.trim());
<<<<<<< HEAD
            if(!_workRoot.isDirectory()) throw new IllegalArgumentException(_workRoot+" does not exist or is not a directory");

            __log.debug("Initializing transaction manager");
            initTxMgr();
            __log.debug("Creating data source.");
            initDataSource();
            __log.debug("Starting DAO.");
            initDAO();
            EndpointReferenceContextImpl eprContext = new EndpointReferenceContextImpl(this);            
            __log.debug("Initializing BPEL process store.");
            initProcessStore(eprContext);
            __log.debug("Initializing BPEL server.");
            initBpelServer(eprContext);
            __log.debug("Initializing HTTP connection manager");
            initHttpConnectionManager();

            // Register BPEL event listeners configured in axis2.properties file.
            registerEventListeners();
            registerMexInterceptors();
            registerContextInterceptors();

            registerExtensionActivityBundles();

            registerExternalVariableModules();

            try {
                _bpelServer.start();
            } catch (Exception ex) {
                String errmsg = __msgs.msgOdeBpelServerStartFailure();
                __log.error(errmsg, ex);
                throw new ServletException(errmsg, ex);
            }
=======
        if (!_workRoot.isDirectory())
            throw new IllegalArgumentException(_workRoot + " does not exist or is not a directory");

        __log.debug("Initializing transaction manager");
        initTxMgr();
        __log.debug("Creating data source.");
        initDataSource();
        __log.debug("Starting DAO.");
        initDAO();
        EndpointReferenceContextImpl eprContext = new EndpointReferenceContextImpl(this);            
        __log.debug("Initializing BPEL process store.");
        initProcessStore(eprContext);
        __log.debug("Initializing BPEL server.");
        initBpelServer(eprContext);
        __log.debug("Initializing HTTP connection manager");
        initHttpConnectionManager();

        // Register BPEL event listeners configured in axis2.properties file.
        registerEventListeners();
        registerMexInterceptors();
        registerExternalVariableModules();

        _store.loadAll();

        try {
            _bpelServer.start();
        } catch (Exception ex) {
            String errmsg = __msgs.msgOdeBpelServerStartFailure();
            __log.error(errmsg, ex);
            throw new ServletException(errmsg, ex);
        }

        _poller = getDeploymentPollerExt();
        if( _poller == null ) {
            _poller = new DeploymentPoller(_store.getDeployDir(), this);
        }

        _mgtService = new ManagementService();
        _mgtService.enableService(_axisConfig, _bpelServer, _store, _appRoot.getAbsolutePath());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

        try {
            __log.debug("Initializing Deployment Web Service");
Solution content
            String wdir = _odeConfig.getWorkingDir();
            if (wdir == null) _workRoot = _appRoot;
            else _workRoot = new File(wdir.trim());
        if (!_workRoot.isDirectory())
            throw new IllegalArgumentException(_workRoot + " does not exist or is not a directory");

        __log.debug("Initializing transaction manager");
        initTxMgr();
        __log.debug("Creating data source.");
        initDataSource();
        __log.debug("Starting DAO.");
        initDAO();
        EndpointReferenceContextImpl eprContext = new EndpointReferenceContextImpl(this);            
        __log.debug("Initializing BPEL process store.");
        initProcessStore(eprContext);
        __log.debug("Initializing BPEL server.");
        initBpelServer(eprContext);
        __log.debug("Initializing HTTP connection manager");
        initHttpConnectionManager();

        // Register BPEL event listeners configured in axis2.properties file.
        registerEventListeners();
        registerMexInterceptors();
        registerExternalVariableModules();

        _store.loadAll();

        try {
            _bpelServer.start();
        } catch (Exception ex) {
            String errmsg = __msgs.msgOdeBpelServerStartFailure();
            __log.error(errmsg, ex);
            throw new ServletException(errmsg, ex);
        }

        _poller = getDeploymentPollerExt();
        if( _poller == null ) {
            _poller = new DeploymentPoller(_store.getDeployDir(), this);
        }

        _mgtService = new ManagementService();
        _mgtService.enableService(_axisConfig, _bpelServer, _store, _appRoot.getAbsolutePath());

        try {
            __log.debug("Initializing Deployment Web Service");
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
If statement
Method invocation
Try statement
Variable
Chunk
Conflicting content
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            throw new ServletException(e);
        }

<<<<<<< HEAD
            _mgtService = new ManagementService();
            _mgtService.enableService(_axisConfig, _bpelServer, _store, _appRoot.getAbsolutePath());

            try {
                __log.debug("Initializing Deployment Web Service");
                new DeploymentWebService().enableService(_axisConfig, _store, _poller, _appRoot.getAbsolutePath(), _workRoot
                        .getAbsolutePath());
            } catch (Exception e) {
                throw new ServletException(e);
            }
            _store.loadAll();
=======
        __log.debug("Starting scheduler");
        _scheduler.start();

        __log.debug("Initializing JCA adapter.");
        initConnector();

        _poller.start();
        __log.info(__msgs.msgPollingStarted(_store.getDeployDir().getAbsolutePath()));
Solution content
            throw new ServletException(e);
        }

        __log.debug("Starting scheduler");
        _scheduler.start();

        __log.debug("Initializing JCA adapter.");
        initConnector();

        _poller.start();
        __log.info(__msgs.msgPollingStarted(_store.getDeployDir().getAbsolutePath()));
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Try statement
Chunk
Conflicting content
        __log.info(__msgs.msgOdeStarted());
    }

<<<<<<< HEAD
            _poller.start();
            __log.info(__msgs.msgPollingStarted(deploymentDir.getAbsolutePath()));
            __log.info(__msgs.msgOdeStarted());
            success = true;
        } catch (RuntimeException re) {
            __log.error("ODE server could not be started.", re);
            throw re;
        } finally {
            if (!success)
=======
    @SuppressWarnings("unchecked")
    private DeploymentPoller getDeploymentPollerExt() {
        DeploymentPoller poller = null;
        
        InputStream is = null;
        try {
            is = ODEServer.class.getResourceAsStream("/deploy-ext.properties");
            if( is != null ) {
                __log.info("A deploy-ext.properties found; will use the provided class if applicable.");
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                try {
                    Properties props = new Properties();
                    props.load(is);
Solution content
    @SuppressWarnings("unchecked")
        __log.info(__msgs.msgOdeStarted());
    }
    private DeploymentPoller getDeploymentPollerExt() {
        DeploymentPoller poller = null;
        
        InputStream is = null;
        try {
            is = ODEServer.class.getResourceAsStream("/deploy-ext.properties");
            if( is != null ) {
                __log.info("A deploy-ext.properties found; will use the provided class if applicable.");
                try {
                    Properties props = new Properties();
                    props.load(is);
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Annotation
Catch clause
If statement
Method invocation
Method signature
Try statement
Variable
Chunk
Conflicting content
        } catch (Exception ex) {
        }
            __log.error("Could not create external service.", ex);
        return null;
    }

    @SuppressWarnings("unchecked")
<<<<<<< HEAD
    public ODEService createService(ProcessConf pconf, QName serviceName, String portName) throws AxisFault {
        AxisService axisService = ODEAxisService.createService(_axisConfig, pconf, serviceName, portName);
        ODEService odeService = new ODEService(axisService, pconf, serviceName, portName, _bpelServer);

        destroyService(serviceName, portName);

        _services.put(serviceName, portName, odeService);

        // Setting our new service on the ODE receiver
        Iterator operationIterator = axisService.getOperations();
        while(operationIterator.hasNext()){
            AxisOperation op = (AxisOperation) operationIterator.next();
            if(op.getMessageReceiver() instanceof ODEMessageReceiver){
                ((ODEMessageReceiver) op.getMessageReceiver()).setService(odeService);
                break;
            }
        }

        // We're public!
        _axisConfig.addService(axisService);
        __log.debug("Created Axis2 service " + serviceName);
        return odeService;
    }

    public ExternalService createExternalService(ProcessConf pconf, QName serviceName, String portName) throws ContextException {
        ExternalService extService = null; 
    Definition def = pconf.getDefinitionForService(serviceName);
        try {
             if (WsdlUtils.useHTTPBinding(def, serviceName, portName)) {
                 if(__log.isDebugEnabled())__log.debug("Creating HTTP-bound external service " + serviceName);
                 extService = new HttpExternalService(pconf, serviceName, portName, _bpelServer, httpConnectionManager);
             } else if (WsdlUtils.useSOAPBinding(def, serviceName, portName)) {
                 if(__log.isDebugEnabled())__log.debug("Creating SOAP-bound external service " + serviceName);
                 extService = new SoapExternalService(def, serviceName, portName, _axisConfig, pconf, httpConnectionManager);
             }
            throw new ContextException("Error creating external service! name:"+serviceName+", port:"+portName, ex);
        }

         // if not SOAP nor HTTP binding
         if (extService == null) throw new ContextException("Only SOAP and HTTP binding supported!");

        __log.debug("Created external service " + serviceName);
        return extService;
    }

    public void destroyService(QName serviceName, String portName) {
        __log.debug("Destroying service " + serviceName + " port " + portName);
        ODEService service = (ODEService) _services.remove(serviceName, portName);
        if (service != null) {
            try {
                _axisConfig.removeService(service.getAxisService().getName());
                _axisConfig.removeServiceGroup(service.getAxisService().getAxisServiceGroup().getServiceGroupName());
            } catch (AxisFault axisFault) {
                __log.error("Couldn't destroy service " + serviceName);
            }
        } else {
    }

            __log.debug("Couldn't find service " + serviceName + " port " + portName + " to destroy.");
        }
    }

    public ODEService getService(QName serviceName, String portName) {
        return (ODEService) _services.get(serviceName, portName);
    }

    public ODEService getService(QName serviceName, QName portTypeName) {
    @SuppressWarnings("unchecked")
    private void initTxMgr() throws ServletException {
        try {
            TxManager mgr = new TxManager(_odeConfig);
        // TODO Normally this lookup should't exist as there could be more one
        // than port
        // TODO for a portType. See MessageExchangeContextImpl.
        for (Object o : _services.values()) {
            ODEService service = (ODEService) o;
            if (service.respondsTo(serviceName, portTypeName))
                return service;
            _txMgr = mgr.createTransactionManager();
            _axisConfig.addParameter("ode.transaction.manager", _txMgr);
=======
     private void initTxMgr() throws ServletException {
        String txFactoryName = _odeConfig.getTxFactoryClass();
        __log.debug("Initializing transaction manager using " + txFactoryName);
        try {
            Class txFactClass = this.getClass().getClassLoader().loadClass(txFactoryName);
            Object txFact = txFactClass.newInstance();
            _txMgr = (TransactionManager) txFactClass.getMethod("getTransactionManager", (Class[]) null).invoke(txFact);
            if (__logTx.isDebugEnabled() && System.getProperty("ode.debug.tx") != null)
                _txMgr = new DebugTxMgr(_txMgr);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        } catch (Exception e) {
            __log.fatal("Couldn't initialize a transaction manager", e);
            throw new ServletException("Couldn't initialize a transaction manager", e);
Solution content
    }

    @SuppressWarnings("unchecked")
     private void initTxMgr() throws ServletException {
        String txFactoryName = _odeConfig.getTxFactoryClass();
        __log.debug("Initializing transaction manager using " + txFactoryName);
        try {
            Class txFactClass = this.getClass().getClassLoader().loadClass(txFactoryName);
            Object txFact = txFactClass.newInstance();
            _txMgr = (TransactionManager) txFactClass.getMethod("getTransactionManager", (Class[]) null).invoke(txFact);
            if (__logTx.isDebugEnabled() && System.getProperty("ode.debug.tx") != null)
                _txMgr = new DebugTxMgr(_txMgr);
        } catch (Exception e) {
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Annotation
Attribute
Cast expression
If statement
Method declaration
Method invocation
Method signature
Try statement
Variable
Chunk
Conflicting content
    protected void initProcessStore(EndpointReferenceContext eprContext) {
        _store = createProcessStore(eprContext, _db.getDataSource());
        _store.registerListener(new ProcessStoreListenerImpl());
<<<<<<< HEAD
        _store.setDeployDir(new File(_workRoot, "processes"));
=======
        _store.setDeployDir(
        		_odeConfig.getDeployDir() != null ?
	        		new File(_odeConfig.getDeployDir()) :
	        		new File(_workRoot, "processes"));
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        _store.setConfigDir(_configRoot);
    }
Solution content
    protected void initProcessStore(EndpointReferenceContext eprContext) {
        _store = createProcessStore(eprContext, _db.getDataSource());
        _store.registerListener(new ProcessStoreListenerImpl());
        _store.setDeployDir(
        		_odeConfig.getDeployDir() != null ?
	        		new File(_odeConfig.getDeployDir()) :
	        		new File(_workRoot, "processes"));
        _store.setConfigDir(_configRoot);
    }
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
    private void initBpelServer(EndpointReferenceContextImpl eprContext) {
        if (__log.isDebugEnabled()) {
            __log.debug("ODE initializing");
        }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        ThreadFactory threadFactory = new ThreadFactory() {
            int threadNumber = 0;
            public Thread newThread(Runnable r) {
        return scheduler;
    }

    }

    protected ProcessStoreImpl createProcessStore(EndpointReferenceContext eprContext, DataSource ds) {
<<<<<<< HEAD
        return new ProcessStoreImpl(eprContext,_txMgr,_storeDaoCF);
    }

    protected Scheduler createScheduler() {
         return new SimpleScheduler(new GUID().toString(),_schedDaoCF,_txMgr, _odeConfig.getProperties());
    }

    protected void initBpelServer(EndpointReferenceContextImpl eprContext) {
        if (__log.isDebugEnabled()) {
            __log.debug("ODE initializing");
        }

=======
        return new ProcessStoreImpl(eprContext, ds, _odeConfig.getDAOConnectionFactory(), _odeConfig, false);
    }

    protected Scheduler createScheduler() {
        SimpleScheduler scheduler = new SimpleScheduler(new GUID().toString(), 
                new JdbcDelegate(_db.getDataSource()), _odeConfig.getProperties());
        scheduler.setExecutorService(_executorService);
        scheduler.setTransactionManager(_txMgr);
Solution content
    }

    protected ProcessStoreImpl createProcessStore(EndpointReferenceContext eprContext, DataSource ds) {
        return new ProcessStoreImpl(eprContext, ds, _odeConfig.getDAOConnectionFactory(), _odeConfig, false);
    }

    protected Scheduler createScheduler() {
        SimpleScheduler scheduler = new SimpleScheduler(new GUID().toString(), 
                new JdbcDelegate(_db.getDataSource()), _odeConfig.getProperties());
        scheduler.setExecutorService(_executorService);
        scheduler.setTransactionManager(_txMgr);
        return scheduler;
    }

    private void initBpelServer(EndpointReferenceContextImpl eprContext) {
        if (__log.isDebugEnabled()) {
            __log.debug("ODE initializing");
        }
        ThreadFactory threadFactory = new ThreadFactory() {
            int threadNumber = 0;
            public Thread newThread(Runnable r) {
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
If statement
Method declaration
Method invocation
Method signature
Return statement
Chunk
Conflicting content
            int threadNumber = 0;
            public Thread newThread(Runnable r) {
                threadNumber += 1;
<<<<<<< HEAD
                Thread t = new Thread(r, "BULK-"+threadNumber);
=======
                Thread t = new Thread(r, "ODEServer-"+threadNumber);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                t.setDaemon(true);
                return t;
            }
Solution content
            int threadNumber = 0;
            public Thread newThread(Runnable r) {
                threadNumber += 1;
                Thread t = new Thread(r, "ODEServer-"+threadNumber);
                t.setDaemon(true);
                return t;
            }
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
        _bpelServer = new BpelServerImpl();
        _scheduler = createScheduler();
            _executorService = Executors.newCachedThreadPool(threadFactory);
        else
            _executorService = Executors.newFixedThreadPool(_odeConfig.getThreadPoolMaxSize(), threadFactory);
<<<<<<< HEAD

        _bpelServer = new BpelServerImpl();
        _scheduler = createScheduler();
        _scheduler.setJobProcessor(_bpelServer);

        _cronScheduler = new CronScheduler();
        _cronScheduler.setScheduledTaskExec(_executorService);
        _cronScheduler.setContexts(_bpelServer.getContexts());
        _bpelServer.setCronScheduler(_cronScheduler);
=======
        _scheduler.setJobProcessor(_bpelServer);
        
        
        {
            List targets = new ArrayList();
            Collections.addAll(targets, _odeConfig.getProperty("cluster.localRoute.targets", "").split(","));
            _clusterUrlTransformer = new ClusterUrlTransformer(targets, _odeConfig.getProperty("cluster.localRoute.base", "http://localhost:8080/ode/processes/"));
        }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        BpelServerImpl.PolledRunnableProcessor polledRunnableProcessor = new BpelServerImpl.PolledRunnableProcessor();
        polledRunnableProcessor.setPolledRunnableExecutorService(_executorService);
        polledRunnableProcessor.setContexts(_bpelServer.getContexts());
Solution content
            _executorService = Executors.newCachedThreadPool(threadFactory);
        else
            _executorService = Executors.newFixedThreadPool(_odeConfig.getThreadPoolMaxSize(), threadFactory);
        
        {
            List targets = new ArrayList();
            Collections.addAll(targets, _odeConfig.getProperty("cluster.localRoute.targets", "").split(","));
            _clusterUrlTransformer = new ClusterUrlTransformer(targets, _odeConfig.getProperty("cluster.localRoute.base", "http://localhost:8080/ode/processes/"));
        }
        _bpelServer = new BpelServerImpl();
        _scheduler = createScheduler();
        _scheduler.setJobProcessor(_bpelServer);
        
        BpelServerImpl.PolledRunnableProcessor polledRunnableProcessor = new BpelServerImpl.PolledRunnableProcessor();
        polledRunnableProcessor.setPolledRunnableExecutorService(_executorService);
        polledRunnableProcessor.setContexts(_bpelServer.getContexts());
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Variable
Chunk
Conflicting content
        polledRunnableProcessor.setContexts(_bpelServer.getContexts());
        _scheduler.setPolledRunnableProcesser(polledRunnableProcessor);
        
<<<<<<< HEAD
        _bpelServer.setDaoConnectionFactory(_bpelDaoCF);
=======
        _cronScheduler = new CronScheduler();
        _cronScheduler.setScheduledTaskExec(_executorService);
        _cronScheduler.setContexts(_bpelServer.getContexts());
        _bpelServer.setCronScheduler(_cronScheduler);

        _bpelServer.setDaoConnectionFactory(_daoCF);
        _bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler, _odeConfig.getInMemMexTtl()));
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        _bpelServer.setEndpointReferenceContext(eprContext);
        _bpelServer.setMessageExchangeContext(new MessageExchangeContextImpl(this));
        _bpelServer.setBindingContext(new BindingContextImpl(this));
Solution content
        _bpelServer.setEndpointReferenceContext(eprContext);
        polledRunnableProcessor.setContexts(_bpelServer.getContexts());
        _scheduler.setPolledRunnableProcesser(polledRunnableProcessor);
        
        _cronScheduler = new CronScheduler();
        _cronScheduler.setScheduledTaskExec(_executorService);
        _cronScheduler.setContexts(_bpelServer.getContexts());
        _bpelServer.setMessageExchangeContext(new MessageExchangeContextImpl(this));
        _bpelServer.setBindingContext(new BindingContextImpl(this));
        _bpelServer.setCronScheduler(_cronScheduler);

        _bpelServer.setDaoConnectionFactory(_daoCF);
        _bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler, _odeConfig.getInMemMexTtl()));
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
        _bpelServer.setConfigProperties(_odeConfig.getProperties());
        _bpelServer.init();
        _bpelServer.setMessageExchangeContext(new MessageExchangeContextImpl(this));
        _bpelServer.setBindingContext(new BindingContextImpl(this));
        _bpelServer.setScheduler(_scheduler);
<<<<<<< HEAD
        _bpelServer.setTransactionManager(_txMgr);
        if (_odeConfig.isDehydrationEnabled()) {
            CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy();
            // dehy.setProcessMaxAge(10000);
            _bpelServer.setDehydrationPolicy(dehy);
        }
        _bpelServer.setConfigProperties(_odeConfig);
        _bpelServer.init();
    }

    private void initHttpConnectionManager() throws ServletException {
        httpConnectionManager = new MultiThreadedHttpConnectionManager();
        // settings may be overridden from ode-axis2.properties using the same properties as HttpClient 
        int max_per_host = Integer.parseInt(_odeConfig.getProperty(HttpConnectionManagerParams.MAX_HOST_CONNECTIONS, "2"));
        int max_total = Integer.parseInt(_odeConfig.getProperty(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, "20"));
        if(__log.isDebugEnabled()) {
            __log.debug(HttpConnectionManagerParams.MAX_HOST_CONNECTIONS+"="+max_per_host);
            __log.debug(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS+"="+max_total);
        }
        if(max_per_host<1 || max_total <1){
            String errmsg = HttpConnectionManagerParams.MAX_HOST_CONNECTIONS+" and "+ HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS+" must be positive integers!";
            __log.error(errmsg);
            throw new ServletException(errmsg);
        }
=======
        if (_odeConfig.isDehydrationEnabled()) {
            CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy();
            dehy.setProcessMaxAge(_odeConfig.getDehydrationMaximumAge());
            dehy.setProcessMaxCount(_odeConfig.getDehydrationMaximumCount());
            _bpelServer.setDehydrationPolicy(dehy);
        }
        _bpelServer.setMigrationTransactionTimeout(_odeConfig.getMigrationTransactionTimeout());
        _bpelServer.setInstanceThrottledMaximumCount(_odeConfig.getInstanceThrottledMaximumCount());
        _bpelServer.setProcessThrottledMaximumCount(_odeConfig.getProcessThrottledMaximumCount());
        _bpelServer.setProcessThrottledMaximumSize(_odeConfig.getProcessThrottledMaximumSize());
        _bpelServer.setHydrationLazy(_odeConfig.isHydrationLazy());
        _bpelServer.setHydrationLazyMinimumSize(_odeConfig.getHydrationLazyMinimumSize());
    }

    private void initHttpConnectionManager() throws ServletException {
        httpConnectionManager = new MultiThreadedHttpConnectionManager();
        // settings may be overridden from ode-axis2.properties using the same properties as HttpClient
        // /!\ If the size of the conn pool is smaller than the size of the thread pool, the thread pool might get starved.
        int max_per_host = Integer.parseInt(_odeConfig.getProperty(HttpConnectionManagerParams.MAX_HOST_CONNECTIONS, ""+_odeConfig.getPoolMaxSize()));
        int max_total = Integer.parseInt(_odeConfig.getProperty(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, ""+_odeConfig.getPoolMaxSize()));
        if(__log.isDebugEnabled()) {
            __log.debug(HttpConnectionManagerParams.MAX_HOST_CONNECTIONS+"="+max_per_host);
        httpConnectionManager.getParams().setMaxTotalConnections(max_total);
            __log.debug(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS+"="+max_total);
        }
        if(max_per_host<1 || max_total <1){
            String errmsg = HttpConnectionManagerParams.MAX_HOST_CONNECTIONS+" and "+ HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS+" must be positive integers!";

            __log.error(errmsg);
            throw new ServletException(errmsg);
        }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(max_per_host);
Solution content
            _bpelServer.setDehydrationPolicy(dehy);
        }
        _bpelServer.setMessageExchangeContext(new MessageExchangeContextImpl(this));
        _bpelServer.setBindingContext(new BindingContextImpl(this));
        _bpelServer.setScheduler(_scheduler);
        if (_odeConfig.isDehydrationEnabled()) {
            CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy();
            dehy.setProcessMaxAge(_odeConfig.getDehydrationMaximumAge());
            dehy.setProcessMaxCount(_odeConfig.getDehydrationMaximumCount());
        _bpelServer.setMigrationTransactionTimeout(_odeConfig.getMigrationTransactionTimeout());
        _bpelServer.setConfigProperties(_odeConfig.getProperties());
        _bpelServer.init();
        _bpelServer.setInstanceThrottledMaximumCount(_odeConfig.getInstanceThrottledMaximumCount());
        _bpelServer.setProcessThrottledMaximumCount(_odeConfig.getProcessThrottledMaximumCount());
        _bpelServer.setProcessThrottledMaximumSize(_odeConfig.getProcessThrottledMaximumSize());
        _bpelServer.setHydrationLazy(_odeConfig.isHydrationLazy());
        _bpelServer.setHydrationLazyMinimumSize(_odeConfig.getHydrationLazyMinimumSize());
    }

    private void initHttpConnectionManager() throws ServletException {
        httpConnectionManager = new MultiThreadedHttpConnectionManager();
        // settings may be overridden from ode-axis2.properties using the same properties as HttpClient
        // /!\ If the size of the conn pool is smaller than the size of the thread pool, the thread pool might get starved.
        int max_per_host = Integer.parseInt(_odeConfig.getProperty(HttpConnectionManagerParams.MAX_HOST_CONNECTIONS, ""+_odeConfig.getPoolMaxSize()));
        int max_total = Integer.parseInt(_odeConfig.getProperty(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, ""+_odeConfig.getPoolMaxSize()));
        if(__log.isDebugEnabled()) {
            __log.debug(HttpConnectionManagerParams.MAX_HOST_CONNECTIONS+"="+max_per_host);
            __log.debug(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS+"="+max_total);
        }
        if(max_per_host<1 || max_total <1){
            String errmsg = HttpConnectionManagerParams.MAX_HOST_CONNECTIONS+" and "+ HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS+" must be positive integers!";
            __log.error(errmsg);
            throw new ServletException(errmsg);
        }
        httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(max_per_host);
        httpConnectionManager.getParams().setMaxTotalConnections(max_total);
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
If statement
Method invocation
Method signature
Variable
Chunk
Conflicting content
    }
<<<<<<< HEAD

    /**
    public File getConfigRoot() {
        return _configRoot;
     * Register event listeners configured in the configuration.
     *
     */
=======
    
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    private void registerEventListeners() {

        // let's always register the debugging listener....
Solution content
    public File getConfigRoot() {
        return _configRoot;
    }
    
    private void registerEventListeners() {
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
    private void registerExtensionActivityBundles() {
        String extensionsRTStr = _odeConfig.getExtensionActivityBundlesRT();
        String extensionsValStr = _odeConfig.getExtensionActivityBundlesValidation();
        if (extensionsRTStr != null) {
            // TODO replace StringTokenizer by regex
            for (StringTokenizer tokenizer = new StringTokenizer(extensionsRTStr, ",;"); tokenizer.hasMoreTokens();) {
                String bundleCN = tokenizer.nextToken();
                try {
                    // instantiate bundle
                    ExtensionBundleRuntime bundleRT = (ExtensionBundleRuntime) Class.forName(bundleCN).newInstance();
                    // register extension bundle (BPEL server)
                    _bpelServer.registerExtensionBundle(bundleRT);
                } catch (Exception e) {
                    __log.warn("Couldn't register the extension bundle runtime " + bundleCN + ", the class couldn't be " +
                            "loaded properly.");
                }
            }
        }
        if (extensionsValStr != null) {
            Map validators = new HashMap();
            for (StringTokenizer tokenizer = new StringTokenizer(extensionsValStr, ",;"); tokenizer.hasMoreTokens();) {
                String bundleCN = tokenizer.nextToken();
                try {
                    // instantiate bundle
                    ExtensionBundleValidation bundleVal = (ExtensionBundleValidation) Class.forName(bundleCN).newInstance();
                    //add validators
                    validators.putAll(bundleVal.getExtensionValidators());
                } catch (Exception e) {
                    __log.warn("Couldn't register the extension bundle validator " + bundleCN + ", the class couldn't be " +
                            "loaded properly.");
                }
            }
            // register extension bundle (BPEL store)
            _store.setExtensionValidators(validators);
        }
    }

=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    private void registerExternalVariableModules() {
        JdbcExternalVariableModule jdbcext;
        jdbcext = new JdbcExternalVariableModule();
Solution content
     */
                }
    protected void initDAO() throws ServletException {
            }
import org.apache.commons.httpclient.util.IdleConnectionTimeoutThread;
/*
 * 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.axis2;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.sql.DataSource;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
import javax.transaction.InvalidTransactionException;
import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.xa.XAResource;

import org.apache.axis2.AxisFault;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
        String confDir = System.getProperty("org.apache.ode.configDir");
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.axis2.deploy.DeploymentPoller;
import org.apache.ode.axis2.service.DeploymentWebService;
import org.apache.ode.axis2.service.ManagementService;
import org.apache.ode.axis2.util.ClusterUrlTransformer;
import org.apache.ode.bpel.connector.BpelServerConnector;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
import org.apache.ode.bpel.engine.cron.CronScheduler;
import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;
import org.apache.ode.bpel.iapi.BpelEventListener;
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.bpel.iapi.ProcessStoreEvent;
import org.apache.ode.bpel.iapi.ProcessStoreListener;
import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
import org.apache.ode.bpel.pmapi.InstanceManagement;
import org.apache.ode.bpel.pmapi.ProcessManagement;
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.scheduler.simple.JdbcDelegate;
import org.apache.ode.scheduler.simple.SimpleScheduler;
import org.apache.ode.store.ProcessStoreImpl;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.fs.TempFileManager;

/**
 * Server class called by our Axis hooks to handle all ODE lifecycle management.
 *
 * @author Matthieu Riou 
 */
public class ODEServer {

    protected final Log __log = LogFactory.getLog(getClass());
    protected final Log __logTx = LogFactory.getLog("org.apache.ode.tx");

    private static final Messages __msgs = Messages.getMessages(Messages.class);

    protected File _appRoot;

    protected File _workRoot;

    protected File _configRoot;

    protected BpelServerImpl _bpelServer;

    protected ProcessStoreImpl _store;

    protected ODEConfigProperties _odeConfig;

    protected AxisConfiguration _axisConfig;

    protected TransactionManager _txMgr;

    protected BpelDAOConnectionFactory _daoCF;

    protected ExecutorService _executorService;

    protected Scheduler _scheduler;
    
    protected CronScheduler _cronScheduler;

    protected Database _db;

    private DeploymentPoller _poller;

    private BpelServerConnector _connector;

    private ManagementService _mgtService;
    
    protected ClusterUrlTransformer _clusterUrlTransformer;

    protected MultiThreadedHttpConnectionManager httpConnectionManager;
    protected IdleConnectionTimeoutThread idleConnectionTimeoutThread;
    
    public void init(ServletConfig config, AxisConfiguration axisConf) throws ServletException {
        init(config.getServletContext().getRealPath("/WEB-INF"), axisConf);
    }

    public void init(String contextPath, AxisConfiguration axisConf) throws ServletException {
        _axisConfig = axisConf;
        String rootDir = System.getProperty("org.apache.ode.rootDir");
        if (rootDir != null) _appRoot = new File(rootDir);
        else _appRoot = new File(contextPath);

        if (!_appRoot.isDirectory())
            throw new IllegalArgumentException(_appRoot + " does not exist or is not a directory");
        TempFileManager.setWorkingDirectory(_appRoot);

        __log.debug("Loading properties");
                    } else {
                        __log.warn("deploy-ext.properties found in the class path; however, the file does not have 'deploymentPoller.class' as one of the properties!!");

        _configRoot = confDir == null ? new File(_appRoot, "conf") : new File(confDir);
        if (!_configRoot.isDirectory())
            throw new IllegalArgumentException(_configRoot + " does not exist or is not a directory");

        _odeConfig = new ODEConfigProperties(_configRoot);

        try {
            _odeConfig.load();
        } catch (FileNotFoundException fnf) {
            String errmsg = __msgs.msgOdeInstallErrorCfgNotFound(_odeConfig.getFile());
            __log.warn(errmsg);
        } catch (Exception ex) {
            String errmsg = __msgs.msgOdeInstallErrorCfgReadError(_odeConfig.getFile());
                __log.error(errmsg, ex);
                throw new ServletException(errmsg, ex);
            }

            String wdir = _odeConfig.getWorkingDir();
            if (wdir == null) _workRoot = _appRoot;
            else _workRoot = new File(wdir.trim());
        if (!_workRoot.isDirectory())
            throw new IllegalArgumentException(_workRoot + " does not exist or is not a directory");

        __log.debug("Initializing transaction manager");
        initTxMgr();
        __log.debug("Creating data source.");
        initDataSource();
        __log.debug("Starting DAO.");
        initDAO();
        EndpointReferenceContextImpl eprContext = new EndpointReferenceContextImpl(this);            
        __log.debug("Initializing BPEL process store.");
        initProcessStore(eprContext);
        __log.debug("Initializing BPEL server.");
        initBpelServer(eprContext);
        __log.debug("Initializing HTTP connection manager");
        initHttpConnectionManager();

        // Register BPEL event listeners configured in axis2.properties file.
        registerEventListeners();
        registerMexInterceptors();
        registerExternalVariableModules();

        _store.loadAll();

        try {
            _bpelServer.start();
        } catch (Exception ex) {
            String errmsg = __msgs.msgOdeBpelServerStartFailure();
            __log.error(errmsg, ex);
            throw new ServletException(errmsg, ex);
        }

        _poller = getDeploymentPollerExt();
        if( _poller == null ) {
            _poller = new DeploymentPoller(_store.getDeployDir(), this);
        }

        _mgtService = new ManagementService();
        _mgtService.enableService(_axisConfig, _bpelServer, _store, _appRoot.getAbsolutePath());

        try {
            __log.debug("Initializing Deployment Web Service");
            new DeploymentWebService().enableService(_axisConfig, _store, _poller, _appRoot.getAbsolutePath(), _workRoot.getAbsolutePath());
        } catch (Exception e) {
            throw new ServletException(e);
        }

        __log.debug("Starting scheduler");
        _scheduler.start();

        __log.debug("Initializing JCA adapter.");
        initConnector();

        _poller.start();
        __log.info(__msgs.msgPollingStarted(_store.getDeployDir().getAbsolutePath()));
        __log.info(__msgs.msgOdeStarted());
    }

    @SuppressWarnings("unchecked")
    private DeploymentPoller getDeploymentPollerExt() {
        DeploymentPoller poller = null;
        
        InputStream is = null;
        try {
            is = ODEServer.class.getResourceAsStream("/deploy-ext.properties");
            if( is != null ) {
                __log.info("A deploy-ext.properties found; will use the provided class if applicable.");
                try {
                    Properties props = new Properties();
                    props.load(is);
                    String deploymentPollerClass = props.getProperty("deploymentPoller.class");
                    if( deploymentPollerClass == null ) {
                        Class pollerClass = Class.forName(deploymentPollerClass);
                        poller = (DeploymentPoller)pollerClass.getConstructor(File.class, ODEServer.class).newInstance(_store.getDeployDir(), this);
                        __log.info("A custom deployment poller: " + deploymentPollerClass + " has been plugged in.");
                    }
                } catch( Exception e ) {
                    __log.warn("Deployment poller extension class is not loadable, falling back to the default DeploymentPoller.", e);
                }
            } else if( __log.isDebugEnabled() ) __log.debug("No deploy-ext.properties found.");
        } finally {
            try {
                if(is != null) is.close();
            } catch( IOException ie ) {
                // ignore
            }
        }

        return poller;
    }
    
    private void initDataSource() throws ServletException {
        _db = new Database(_odeConfig);
        _db.setTransactionManager(_txMgr);
        _db.setWorkRoot(_workRoot);

        try {
            _db.start();
        } catch (Exception ex) {
            String errmsg = __msgs.msgOdeDbConfigError();
            __log.error(errmsg, ex);
            throw new ServletException(errmsg, ex);
        }

    }

    /**
     * Shutdown the service engine. This performs cleanup before the BPE is terminated. Once this method has been called, init()
     * must be called before the transformation engine can be started again with a call to start().
     *
     * @throws AxisFault if the engine is unable to shut down.
     */
    public void shutDown() throws AxisFault {

        ClassLoader old = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        try {
            if (_poller != null)
                try {
                    __log.debug("shutting down poller");
                    _poller.stop();
                    _poller = null;
                } catch (Throwable t) {
                    __log.debug("Error stopping poller.", t);
                }

            if (_bpelServer != null)
                try {
                    __log.debug("shutting down ODE server.");
                    _bpelServer.shutdown();
                    _bpelServer = null;
                } catch (Throwable ex) {
                    __log.debug("Error stopping services.", ex);
                }

            if( _cronScheduler != null ) {
                try {
                    __log.debug("shutting down cron scheduler.");
                    _cronScheduler.shutdown();
                    _cronScheduler = null;
                } catch (Exception ex) {
                    __log.debug("Cron scheduler couldn't be shutdown.", ex);
                }
            }
            
            if (_scheduler != null)
                try {
                    __log.debug("shutting down scheduler.");
                    _scheduler.shutdown();
                    _scheduler = null;
                } catch (Exception ex) {
                    __log.debug("Scheduler couldn't be shutdown.", ex);
                }

            if (_store != null)
                try {
                    _store.shutdown();
                    _store = null;
                } catch (Throwable t) {
                    __log.debug("Store could not be shutdown.", t);
                }

            if (_daoCF != null)
                try {
                    _daoCF.shutdown();
                } catch (Throwable ex) {
     * @throws ServletException
                    __log.debug("DOA shutdown failed.", ex);
                } finally {
                    _daoCF = null;
                }

            if (_db != null)
                try {
                    _db.shutdown();

                } catch (Throwable ex) {
                    __log.debug("DB shutdown failed.", ex);
                } finally {
                    _db = null;
                }

            if (_txMgr != null) {
                __log.debug("shutting down transaction manager.");
                _txMgr = null;
            }

            if (_connector != null) {
                try {
                    __log.debug("shutdown BpelConnector");
                    _connector.shutdown();
                } catch (Throwable t) {
                    __log.error("Unable to cleanup temp files.", t);
                }
            }
            if(httpConnectionManager!=null){
                __log.debug("shutting down HTTP connection manager.");
                try {
                    httpConnectionManager.shutdown();
                } catch(Throwable t) {
                    __log.error("Unable to shut down HTTP connection manager.", t);
                }
            }
            if(idleConnectionTimeoutThread!=null){
                __log.debug("shutting down Idle Connection Timeout Thread.");
                try {
                    idleConnectionTimeoutThread.shutdown();
                } catch(Throwable t) {
                    __log.error("Unable to shut down Idle Connection Timeout Thread.", t);
                }
            }
            try {
                __log.debug("cleaning up temporary files.");
                TempFileManager.cleanup();
            } catch (Throwable t) {
                __log.error("Unable to cleanup temp files.", t);
            }


            __log.info(__msgs.msgOdeShutdownCompleted());
        } finally {
            Thread.currentThread().setContextClassLoader(old);
        }
    }

    @SuppressWarnings("unchecked")
     private void initTxMgr() throws ServletException {
        String txFactoryName = _odeConfig.getTxFactoryClass();
        __log.debug("Initializing transaction manager using " + txFactoryName);
        try {
            Class txFactClass = this.getClass().getClassLoader().loadClass(txFactoryName);
            Object txFact = txFactClass.newInstance();
            _txMgr = (TransactionManager) txFactClass.getMethod("getTransactionManager", (Class[]) null).invoke(txFact);
            if (__logTx.isDebugEnabled() && System.getProperty("ode.debug.tx") != null)
                _txMgr = new DebugTxMgr(_txMgr);
        } catch (Exception e) {
            __log.fatal("Couldn't initialize a transaction manager with factory: " + txFactoryName, e);
            throw new ServletException("Couldn't initialize a transaction manager with factory: " + txFactoryName, e);
        }
    }

    private void initConnector() throws ServletException {
        int port = _odeConfig.getConnectorPort();
        if (port == 0) {
            __log.info("Skipping connector initialization.");
        } else {
            _connector = new BpelServerConnector();
            _connector.setBpelServer(_bpelServer);
            _connector.setProcessStore(_store);
            _connector.setPort(_odeConfig.getConnectorPort());
            _connector.setId("jcaServer");
            try {
                _connector.start();
            } catch (Exception e) {
                __log.error("Failed to initialize JCA connector.", e);
            }
        }
    }

    /**
     * Initialize the DAO.
     *
        __log.info(__msgs.msgOdeUsingDAOImpl(_odeConfig.getDAOConnectionFactory()));
        try {
            _daoCF = _db.createDaoCF();
        } catch (Exception ex) {
            String errmsg = __msgs.msgDAOInstantiationFailed(_odeConfig.getDAOConnectionFactory());
            __log.error(errmsg, ex);
            throw new ServletException(errmsg, ex);

        }
    }

    protected void initProcessStore(EndpointReferenceContext eprContext) {
        _store = createProcessStore(eprContext, _db.getDataSource());
        _store.registerListener(new ProcessStoreListenerImpl());
        _store.setDeployDir(
        		_odeConfig.getDeployDir() != null ?
	        		new File(_odeConfig.getDeployDir()) :
	        		new File(_workRoot, "processes"));
        _store.setConfigDir(_configRoot);
    }

    protected ProcessStoreImpl createProcessStore(EndpointReferenceContext eprContext, DataSource ds) {
        return new ProcessStoreImpl(eprContext, ds, _odeConfig.getDAOConnectionFactory(), _odeConfig, false);
    }

    protected Scheduler createScheduler() {
        SimpleScheduler scheduler = new SimpleScheduler(new GUID().toString(), 
                new JdbcDelegate(_db.getDataSource()), _odeConfig.getProperties());
        scheduler.setExecutorService(_executorService);
        scheduler.setTransactionManager(_txMgr);
        return scheduler;
    }

    private void initBpelServer(EndpointReferenceContextImpl eprContext) {
        if (__log.isDebugEnabled()) {
            __log.debug("ODE initializing");
        }
        ThreadFactory threadFactory = new ThreadFactory() {
            int threadNumber = 0;
            public Thread newThread(Runnable r) {
                threadNumber += 1;
                Thread t = new Thread(r, "ODEServer-"+threadNumber);
                t.setDaemon(true);
                return t;
            }
        };

        if (_odeConfig.getThreadPoolMaxSize() == 0)
            _executorService = Executors.newCachedThreadPool(threadFactory);
        else
            _executorService = Executors.newFixedThreadPool(_odeConfig.getThreadPoolMaxSize(), threadFactory);
        
        {
            List targets = new ArrayList();
            Collections.addAll(targets, _odeConfig.getProperty("cluster.localRoute.targets", "").split(","));
            _clusterUrlTransformer = new ClusterUrlTransformer(targets, _odeConfig.getProperty("cluster.localRoute.base", "http://localhost:8080/ode/processes/"));
        }
        _bpelServer = new BpelServerImpl();
        _scheduler = createScheduler();
        _scheduler.setJobProcessor(_bpelServer);
        
        BpelServerImpl.PolledRunnableProcessor polledRunnableProcessor = new BpelServerImpl.PolledRunnableProcessor();
        polledRunnableProcessor.setPolledRunnableExecutorService(_executorService);
        polledRunnableProcessor.setContexts(_bpelServer.getContexts());
        _scheduler.setPolledRunnableProcesser(polledRunnableProcessor);
        
        _cronScheduler = new CronScheduler();
        _cronScheduler.setScheduledTaskExec(_executorService);
        _cronScheduler.setContexts(_bpelServer.getContexts());
        _bpelServer.setCronScheduler(_cronScheduler);

        _bpelServer.setDaoConnectionFactory(_daoCF);
        _bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler, _odeConfig.getInMemMexTtl()));
        _bpelServer.setEndpointReferenceContext(eprContext);
        _bpelServer.setMessageExchangeContext(new MessageExchangeContextImpl(this));
        _bpelServer.setBindingContext(new BindingContextImpl(this));
        _bpelServer.setScheduler(_scheduler);
        if (_odeConfig.isDehydrationEnabled()) {
            CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy();
            dehy.setProcessMaxAge(_odeConfig.getDehydrationMaximumAge());
            dehy.setProcessMaxCount(_odeConfig.getDehydrationMaximumCount());
            _bpelServer.setDehydrationPolicy(dehy);
        }
        }
    }

        _bpelServer.setMigrationTransactionTimeout(_odeConfig.getMigrationTransactionTimeout());
        _bpelServer.setConfigProperties(_odeConfig.getProperties());
        _bpelServer.init();
        _bpelServer.setInstanceThrottledMaximumCount(_odeConfig.getInstanceThrottledMaximumCount());
        _bpelServer.setProcessThrottledMaximumCount(_odeConfig.getProcessThrottledMaximumCount());
        _bpelServer.setProcessThrottledMaximumSize(_odeConfig.getProcessThrottledMaximumSize());
        _bpelServer.setHydrationLazy(_odeConfig.isHydrationLazy());
        _bpelServer.setHydrationLazyMinimumSize(_odeConfig.getHydrationLazyMinimumSize());
    }

    private void initHttpConnectionManager() throws ServletException {
        httpConnectionManager = new MultiThreadedHttpConnectionManager();
        // settings may be overridden from ode-axis2.properties using the same properties as HttpClient
        // /!\ If the size of the conn pool is smaller than the size of the thread pool, the thread pool might get starved.
        int max_per_host = Integer.parseInt(_odeConfig.getProperty(HttpConnectionManagerParams.MAX_HOST_CONNECTIONS, ""+_odeConfig.getPoolMaxSize()));
        int max_total = Integer.parseInt(_odeConfig.getProperty(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS, ""+_odeConfig.getPoolMaxSize()));
        if(__log.isDebugEnabled()) {
            __log.debug(HttpConnectionManagerParams.MAX_HOST_CONNECTIONS+"="+max_per_host);
            __log.debug(HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS+"="+max_total);
        }
        if(max_per_host<1 || max_total <1){
            String errmsg = HttpConnectionManagerParams.MAX_HOST_CONNECTIONS+" and "+ HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS+" must be positive integers!";
            __log.error(errmsg);
            throw new ServletException(errmsg);
        }
        httpConnectionManager.getParams().setDefaultMaxConnectionsPerHost(max_per_host);
        httpConnectionManager.getParams().setMaxTotalConnections(max_total);

        // Register the connection manager to a idle check thread
        idleConnectionTimeoutThread = new IdleConnectionTimeoutThread();
        idleConnectionTimeoutThread.setName("Http_Idle_Connection_Timeout_Thread");
        long idleConnectionTimeout = Long.parseLong(_odeConfig.getProperty("http.idle.connection.timeout", "30000"));
        long idleConnectionCheckInterval = Long.parseLong(_odeConfig.getProperty("http.idle.connection.check.interval", "30000"));

        if(__log.isDebugEnabled()){
            __log.debug("http.idle.connection.timeout="+idleConnectionTimeout);
            __log.debug("http.idle.connection.check.interval="+idleConnectionCheckInterval);
        }
        idleConnectionTimeoutThread.setConnectionTimeout(idleConnectionTimeout);
        idleConnectionTimeoutThread.setTimeoutInterval(idleConnectionCheckInterval);

        idleConnectionTimeoutThread.addConnectionManager(httpConnectionManager);
        idleConnectionTimeoutThread.start();
    }

    public ProcessStoreImpl getProcessStore() {
        return _store;
    }

    public BpelServerImpl getBpelServer() {
        return _bpelServer;
    }

    public InstanceManagement getInstanceManagement() {
        return _mgtService.getInstanceMgmt();
    }

    public ProcessManagement getProcessManagement() {
        return _mgtService.getProcessMgmt();
    }

    public File getAppRoot() {
        return _appRoot;
    }

    public File getConfigRoot() {
        return _configRoot;
    }
    
    private void registerEventListeners() {
        String listenersStr = _odeConfig.getEventListeners();
        if (listenersStr != null) {
            for (StringTokenizer tokenizer = new StringTokenizer(listenersStr, ",;"); tokenizer.hasMoreTokens();) {
                String listenerCN = tokenizer.nextToken();
                try {
                    _bpelServer.registerBpelEventListener((BpelEventListener) Class.forName(listenerCN).newInstance());
                    __log.info(__msgs.msgBpelEventListenerRegistered(listenerCN));
                } catch (Exception e) {
                    __log.warn("Couldn't register the event listener " + listenerCN + ", the class couldn't be "
                            + "loaded properly: " + e);
    private void registerMexInterceptors() {
        String listenersStr = _odeConfig.getMessageExchangeInterceptors();
        if (listenersStr != null) {
            for (StringTokenizer tokenizer = new StringTokenizer(listenersStr, ",;"); tokenizer.hasMoreTokens();) {
                String interceptorCN = tokenizer.nextToken();
                try {
                    _bpelServer.registerMessageExchangeInterceptor((MessageExchangeInterceptor) Class.forName(interceptorCN).newInstance());
                    __log.info(__msgs.msgMessageExchangeInterceptorRegistered(interceptorCN));
                } catch (Exception e) {
                    __log.warn("Couldn't register the event listener " + interceptorCN + ", the class couldn't be "
                            + "loaded properly: " + e);
                }
            }
        }
    }

    private void registerExternalVariableModules() {
        JdbcExternalVariableModule jdbcext;
        jdbcext = new JdbcExternalVariableModule();
File
ODEServer.java
Developer's decision
Manual
Kind of conflict
Method declaration
Chunk
Conflicting content
                }
                break;
                ProcessConf pconf = _store.getProcessConfiguration(pse.pid);
        __log.debug("Process store event: " + pse);
        ProcessConf pconf = _store.getProcessConfiguration(pse.pid);
        switch (pse.type) {
<<<<<<< HEAD
            case ACTIVATED:
            case RETIRED:
                // bounce the process
                _bpelServer.unregister(pse.pid);
                if (pconf != null) _bpelServer.register(pconf);
                else __log.debug("slighly odd: recevied event " + pse + " for process not in store!");
=======
            case DEPLOYED:
                if (pconf != null) {
                    /*
                     * If and only if an old process exists with the same pid, the old process is cleaned up.
                     * The following line is IMPORTANT and used for the case when the deployment and store 
                     * do not have the process while the process itself exists in the BPEL_PROCESS table.
                     * Notice that the new process is actually created on the 'ACTIVATED' event.
                     */
                    _bpelServer.cleanupProcess(pconf);
                }
                break;
            case ACTVIATED:
                // bounce the process
                _bpelServer.unregister(pse.pid);
                if (pconf != null) {
                    _bpelServer.register(pconf);
                } else {
                    __log.debug("slighly odd: recevied event " + 
                            pse + " for process not in store!");
            case RETIRED:
                // are there are instances of this process running? 
                boolean instantiated = _bpelServer.hasActiveInstances(pse.pid);
                // remove the process
                _bpelServer.unregister(pse.pid);
                // bounce the process if necessary  
                if (instantiated) {
                    if (pconf != null) {
                        _bpelServer.register(pconf);
                    } else {
                        __log.debug("slighly odd: recevied event " + 
                                pse + " for process not in store!");
                    }
                } else {
                    // we may have potentially created a lot of garbage, so,
                    // let's hope the garbage collector is configured properly.
                    if (pconf != null) {
                        _bpelServer.cleanupProcess(pconf);
                    }
                }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                break;
            case DISABLED:
            case UNDEPLOYED:
Solution content
        __log.debug("Process store event: " + pse);
        ProcessConf pconf = _store.getProcessConfiguration(pse.pid);
        switch (pse.type) {
            case DEPLOYED:
                if (pconf != null) {
                    /*
                     * If and only if an old process exists with the same pid, the old process is cleaned up.
                     * The following line is IMPORTANT and used for the case when the deployment and store 
                     * do not have the process while the process itself exists in the BPEL_PROCESS table.
                     * Notice that the new process is actually created on the 'ACTIVATED' event.
                     */
                    _bpelServer.cleanupProcess(pconf);
                }
                break;
            case ACTVIATED:
                // bounce the process
                _bpelServer.unregister(pse.pid);
                if (pconf != null) {
                    _bpelServer.register(pconf);
                } else {
                    __log.debug("slighly odd: recevied event " + 
                            pse + " for process not in store!");
                }
                break;
            case RETIRED:
                // are there are instances of this process running? 
                boolean instantiated = _bpelServer.hasActiveInstances(pse.pid);
                // remove the process
                _bpelServer.unregister(pse.pid);
                // bounce the process if necessary  
                if (instantiated) {
                    if (pconf != null) {
                        _bpelServer.register(pconf);
                    } else {
                        __log.debug("slighly odd: recevied event " + 
                                pse + " for process not in store!");
                    }
                } else {
                    // we may have potentially created a lot of garbage, so,
                    // let's hope the garbage collector is configured properly.
                    if (pconf != null) {
                        _bpelServer.cleanupProcess(pconf);
                    }
                }
                break;
            case DISABLED:
            case UNDEPLOYED:
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Break statement
Case statement
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
            case DISABLED:
            case UNDEPLOYED:
                _bpelServer.unregister(pse.pid);
<<<<<<< HEAD
                _bpelServer.cleanupProcess(pse.pid);
=======
                if (pconf != null) {
                    _bpelServer.cleanupProcess(pconf);
                }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                break;
            default:
                __log.debug("Ignoring store event: " + pse);
Solution content
            case DISABLED:
            case UNDEPLOYED:
                _bpelServer.unregister(pse.pid);
                if (pconf != null) {
                    _bpelServer.cleanupProcess(pconf);
                }
                break;
            default:
                __log.debug("Ignoring store event: " + pse);
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Chunk
Conflicting content
            default:
                __log.debug("Ignoring store event: " + pse);
        }
<<<<<<< HEAD

        ProcessConf pconf = _store.getProcessConfiguration(pse.pid);
=======
        
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        if( pconf != null ) {
            if( pse.type == ProcessStoreEvent.Type.UNDEPLOYED) {
                __log.debug("Cancelling all cron scheduled jobs on store event: " + pse);
Solution content
            default:
                __log.debug("Ignoring store event: " + pse);
        }
        
        if( pconf != null ) {
            if( pse.type == ProcessStoreEvent.Type.UNDEPLOYED) {
                __log.debug("Cancelling all cron scheduled jobs on store event: " + pse);
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
            _tx.rollback();
        }

            // Except for undeploy event, we need to re-schedule process dependent jobs
            __log.debug("(Re)scheduling cron scheduled jobs on store event: " + pse);
        public int getStatus() throws SystemException {
            if( pse.type == ProcessStoreEvent.Type.UNDEPLOYED) {
                __log.debug("Cancelling all cron scheduled jobs on store event: " + pse);
                _bpelServer.getContexts().cronScheduler.cancelProcessCronJobs(pse.pid, true);
<<<<<<< HEAD
            }

            // Except for undeploy event, we need to re-schedule process dependent jobs
            __log.debug("(Re)scheduling cron scheduled jobs on store event: " + pse);
            if( pse.type != ProcessStoreEvent.Type.UNDEPLOYED) {
                _bpelServer.getContexts().cronScheduler.scheduleProcessCronJobs(pse.pid, pconf);
            }
=======
            }

            if( pse.type != ProcessStoreEvent.Type.UNDEPLOYED) {
                _bpelServer.getContexts().cronScheduler.scheduleProcessCronJobs(pse.pid, pconf);
            }
        }
    }
    
    // Transactional debugging stuff, to track down all these little annoying bugs.
    private class DebugTxMgr implements TransactionManager {
        private TransactionManager _tm;

        public DebugTxMgr(TransactionManager tm) {
            _tm = tm;
        }

        public void begin() throws NotSupportedException, SystemException {
            __logTx.debug("Txm begin");
            _tm.begin();
        }

        public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {
            __logTx.debug("Txm commit");
            for (StackTraceElement traceElement : Thread.currentThread().getStackTrace()) {
                __logTx.debug(traceElement.toString());
            }
            _tm.commit();
        }

            __logTx.debug("Txm status");
        public void rollback() throws IllegalStateException, SystemException {
            __logTx.debug("Tx rollback");
            return _tm.getStatus();
        }

        public Transaction getTransaction() throws SystemException {
            Transaction tx = _tm.getTransaction();
            __logTx.debug("Txm get tx " + tx);
            return tx == null ? null : new DebugTx(tx);
        }

        public void resume(Transaction transaction) throws IllegalStateException, InvalidTransactionException, SystemException {
            __logTx.debug("Txm resume");
            _tm.resume(transaction);
        }

        public void rollback() throws IllegalStateException, SecurityException, SystemException {
            __logTx.debug("Txm rollback");
            _tm.rollback();
        }

        public void setRollbackOnly() throws IllegalStateException, SystemException {
            __logTx.debug("Txm set rollback");
            _tm.setRollbackOnly();
        }

        public void setTransactionTimeout(int i) throws SystemException {
            __logTx.debug("Txm set tiemout " + i);
            _tm.setTransactionTimeout(i);
        }

        public Transaction suspend() throws SystemException {
            __logTx.debug("Txm suspend");
            return _tm.suspend();
        }
    }

    private class DebugTx implements Transaction {
        private Transaction _tx;

        public DebugTx(Transaction tx) {
            _tx = tx;
        }

        public void commit() throws HeuristicMixedException, HeuristicRollbackException, RollbackException, SecurityException, SystemException {
            __logTx.debug("Tx commit");
            _tx.commit();
        }

        public boolean delistResource(XAResource xaResource, int i) throws IllegalStateException, SystemException {
            return _tx.delistResource(xaResource, i);
        }

        public boolean enlistResource(XAResource xaResource) throws IllegalStateException, RollbackException, SystemException {
            return _tx.enlistResource(xaResource);
        }

        public int getStatus() throws SystemException {
            return _tx.getStatus();
        }

        public void registerSynchronization(Synchronization synchronization) throws IllegalStateException, RollbackException, SystemException {
            __logTx.debug("Synchronization registration on " + synchronization.getClass().getName());
            _tx.registerSynchronization(synchronization);
        }

        public void setRollbackOnly() throws IllegalStateException, SystemException {
            __logTx.debug("Tx set rollback");
            _tx.setRollbackOnly();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }
    }
Solution content
            if( pse.type == ProcessStoreEvent.Type.UNDEPLOYED) {
                __log.debug("Cancelling all cron scheduled jobs on store event: " + pse);
                _bpelServer.getContexts().cronScheduler.cancelProcessCronJobs(pse.pid, true);
            }

            // Except for undeploy event, we need to re-schedule process dependent jobs
            __log.debug("(Re)scheduling cron scheduled jobs on store event: " + pse);
            if( pse.type != ProcessStoreEvent.Type.UNDEPLOYED) {
                _bpelServer.getContexts().cronScheduler.scheduleProcessCronJobs(pse.pid, pconf);
            }
        }
    }
    
    // Transactional debugging stuff, to track down all these little annoying bugs.
    private class DebugTxMgr implements TransactionManager {
        private TransactionManager _tm;

        public DebugTxMgr(TransactionManager tm) {
            _tm = tm;
        }

        public void begin() throws NotSupportedException, SystemException {
            __logTx.debug("Txm begin");
            _tm.begin();
        }

        public void commit() throws HeuristicMixedException, HeuristicRollbackException, IllegalStateException, RollbackException, SecurityException, SystemException {
            __logTx.debug("Txm commit");
            for (StackTraceElement traceElement : Thread.currentThread().getStackTrace()) {
                __logTx.debug(traceElement.toString());
            }
            _tm.commit();
        }

        public int getStatus() throws SystemException {
            __logTx.debug("Txm status");
            return _tm.getStatus();
        }

        public Transaction getTransaction() throws SystemException {
            Transaction tx = _tm.getTransaction();
            __logTx.debug("Txm get tx " + tx);
            return tx == null ? null : new DebugTx(tx);
        }

        public void resume(Transaction transaction) throws IllegalStateException, InvalidTransactionException, SystemException {
            __logTx.debug("Txm resume");
            _tm.resume(transaction);
        }

        public void rollback() throws IllegalStateException, SecurityException, SystemException {
            __logTx.debug("Txm rollback");
            _tm.rollback();
        }

        public void setRollbackOnly() throws IllegalStateException, SystemException {
            __logTx.debug("Txm set rollback");
            _tm.setRollbackOnly();
        }

        public void setTransactionTimeout(int i) throws SystemException {
            __logTx.debug("Txm set tiemout " + i);
            _tm.setTransactionTimeout(i);
        }

        public Transaction suspend() throws SystemException {
            __logTx.debug("Txm suspend");
            return _tm.suspend();
        }
    }

    private class DebugTx implements Transaction {
        private Transaction _tx;

        public DebugTx(Transaction tx) {
            _tx = tx;
        }

        public void commit() throws HeuristicMixedException, HeuristicRollbackException, RollbackException, SecurityException, SystemException {
            __logTx.debug("Tx commit");
            _tx.commit();
        }

        public boolean delistResource(XAResource xaResource, int i) throws IllegalStateException, SystemException {
            return _tx.delistResource(xaResource, i);
        }

        public boolean enlistResource(XAResource xaResource) throws IllegalStateException, RollbackException, SystemException {
            return _tx.enlistResource(xaResource);
        }

        public int getStatus() throws SystemException {
            return _tx.getStatus();
        }

        public void registerSynchronization(Synchronization synchronization) throws IllegalStateException, RollbackException, SystemException {
            __logTx.debug("Synchronization registration on " + synchronization.getClass().getName());
            _tx.registerSynchronization(synchronization);
        }

        public void rollback() throws IllegalStateException, SystemException {
            __logTx.debug("Tx rollback");
            _tx.rollback();
        }

        public void setRollbackOnly() throws IllegalStateException, SystemException {
            __logTx.debug("Tx set rollback");
            _tx.setRollbackOnly();
        }
    }
File
ODEServer.java
Developer's decision
Version 2
Kind of conflict
Attribute
Class declaration
Class signature
Comment
If statement
Method declaration
Method invocation
Method signature
Chunk
Conflicting content
package org.apache.ode.axis2;

<<<<<<< HEAD
=======
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.Map;

import javax.transaction.TransactionManager;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import javax.wsdl.Definition;
import javax.wsdl.Port;
import javax.wsdl.Service;
Solution content
package org.apache.ode.axis2;

import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.Map;

import javax.transaction.TransactionManager;
import javax.wsdl.Definition;
import javax.wsdl.Port;
import javax.wsdl.Service;
File
ODEService.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.ode.il.epr.WSAEndpoint;
import org.apache.axis2.transport.jms.JMSConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
<<<<<<< HEAD
import org.apache.ode.axis2.soapbinding.SoapMessageConverter;
import org.apache.ode.il.epr.EndpointFactory;
import org.apache.ode.il.epr.MutableEndpoint;
import org.apache.ode.utils.*;
import org.apache.ode.bpel.iapi.*;
import org.apache.ode.bpel.iapi.MessageExchange.AckType;
import org.apache.ode.bpel.iapi.ProcessConf.CLEANUP_CATEGORY;
=======
import org.apache.ode.axis2.util.SoapMessageConverter;
import org.apache.ode.bpel.epr.EndpointFactory;
import org.apache.ode.bpel.epr.MutableEndpoint;
import org.apache.ode.bpel.epr.WSAEndpoint;
import org.apache.ode.bpel.iapi.BpelServer;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchange;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
import org.apache.ode.bpel.iapi.ProcessConf;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.Namespaces;
Solution content
import org.apache.axis2.transport.jms.JMSConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.axis2.util.SoapMessageConverter;
import org.apache.ode.bpel.epr.EndpointFactory;
import org.apache.ode.bpel.epr.MutableEndpoint;
import org.apache.ode.bpel.epr.WSAEndpoint;
import org.apache.ode.bpel.iapi.BpelServer;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchange;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.Namespaces;
File
ODEService.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.w3c.dom.Element;

/**
<<<<<<< HEAD
 * A running service, encapsulates the Axis service, its receivers and our receivers as well.
 * 
 * @author Matthieu Riou 
=======
 * A running service, encapsulates the Axis service, its receivers and our
 * receivers as well.
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
 */
public class ODEService {
    private static final Log __log = LogFactory.getLog(ODEService.class);
Solution content
import org.w3c.dom.Element;

/**
 * A running service, encapsulates the Axis service, its receivers and our
 * receivers as well.
 */
public class ODEService {
File
ODEService.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
 */
public class ODEService {
    private static final Log __log = LogFactory.getLog(ODEService.class);
<<<<<<< HEAD

    public static final String TARGET_SESSION_ENDPOINT = "targetSessionEndpoint";
    public static final String CALLBACK_SESSION_ENDPOINT = "callbackSessionEndpoint";

    private AxisService _axisService;
    private BpelServer _server;
=======

    private AxisService _axisService;
    private BpelServer _server;
    private TransactionManager _txManager;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    private ProcessConf _pconf;
    private Definition _wsdlDef;
    private QName _serviceName;
Solution content
 */
public class ODEService {

    private static final Log __log = LogFactory.getLog(ODEService.class);

    private AxisService _axisService;
    private BpelServer _server;
    private TransactionManager _txManager;
    private ProcessConf _pconf;
    private Definition _wsdlDef;
    private QName _serviceName;
File
ODEService.java
Developer's decision
Manual
Kind of conflict
Attribute
Chunk
Conflicting content
    _pconf = pconf;
    private WSAEndpoint _serviceRef;
    private SoapMessageConverter _converter;

<<<<<<< HEAD
    public ODEService(AxisService axisService, ProcessConf pconf, QName serviceName, String portName, BpelServer server) throws AxisFault {
        _axisService = axisService;
        _server = server;
=======
    public ODEService(AxisService axisService, ProcessConf pconf, QName serviceName, String portName, BpelServer server,
                      TransactionManager txManager) throws AxisFault {
        _axisService = axisService;
        _server = server;
        _txManager = txManager;
        _pconf = pconf;
        _wsdlDef = pconf.getDefinitionForService(serviceName);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        _serviceName = serviceName;
    _wsdlDef = pconf.getDefinitionForService(serviceName);
Solution content
    private WSAEndpoint _serviceRef;
    private SoapMessageConverter _converter;

    public ODEService(AxisService axisService, ProcessConf pconf, QName serviceName, String portName, BpelServer server,
                      TransactionManager txManager) throws AxisFault {
        _axisService = axisService;
        _server = server;
        _txManager = txManager;
        _pconf = pconf;
        _wsdlDef = pconf.getDefinitionForService(serviceName);
        _serviceName = serviceName;
File
ODEService.java
Developer's decision
Combination
Kind of conflict
Attribute
Method invocation
Method signature
Variable
Chunk
Conflicting content
        _portName = portName;
        _serviceRef = EndpointFactory.convertToWSA(createServiceRef(genEPRfromWSDL(_wsdlDef, serviceName, portName)));
        _converter = new SoapMessageConverter(_wsdlDef, serviceName, portName);
<<<<<<< HEAD
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }
    
    public String getName() {
Solution content
        _portName = portName;
        _serviceRef = EndpointFactory.convertToWSA(createServiceRef(genEPRfromWSDL(_wsdlDef, serviceName, portName)));
        _converter = new SoapMessageConverter(_wsdlDef, serviceName, portName);

    }
    
    public String getName() {
File
ODEService.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
            throws AxisFault {
        MyRoleMessageExchange odeMex = null;
        try {
<<<<<<< HEAD
            // Creating mesage exchange
=======
            _txManager.begin();
            if (__log.isDebugEnabled()) __log.debug("Starting transaction.");

            // Creating message exchange
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            String messageId = new GUID().toString();
            odeMex = _server.createMessageExchange(InvocationStyle.UNRELIABLE, _serviceName,
                    msgContext.getAxisOperation().getName().getLocalPart(), "" + messageId);
Solution content
            throws AxisFault {
        boolean success = true;
        MyRoleMessageExchange odeMex = null;
        Future responseFuture = null;
        try {
            _txManager.begin();
            if (__log.isDebugEnabled()) __log.debug("Starting transaction.");

            // Creating message exchange
            String messageId = new GUID().toString();
File
ODEService.java
Developer's decision
Manual
Kind of conflict
Comment
If statement
Method invocation
Chunk
Conflicting content
                    msgContext.getAxisOperation().getName().getLocalPart(), "" + messageId);
            
            __log.debug("ODE routed to operation " + odeMex.getOperation() + " from service " + _serviceName);
<<<<<<< HEAD

            if (odeMex.getOperation() == null) {
                String errmsg = "Call to " + _serviceName + "." + odeMex.getOperationName() + " was not routable.";
                __log.error(errmsg);
                throw new OdeFault(errmsg);
            }

            // Preparing message to send to ODE
            Message odeRequest = odeMex.createMessage(odeMex.getOperation().getInput().getMessage().getQName());
            _converter.parseSoapRequest(odeRequest, msgContext.getEnvelope(), odeMex.getOperation());
            readHeader(msgContext, odeMex);

            if (__log.isDebugEnabled()) {
                __log.debug("Invoking ODE using MEX " + odeMex);
                __log.debug("Message content:  " + DOMUtils.domToString(odeRequest.getMessage()));
=======
            odeMex.setProperty("isTwoWay", Boolean.toString(msgContext.getAxisOperation() instanceof TwoChannelAxisOperation));
            if (odeMex.getOperation() != null) {
                // Preparing message to send to ODE
                Message odeRequest = odeMex.createMessage(odeMex.getOperation().getInput().getMessage().getQName());
                _converter.parseSoapRequest(odeRequest, msgContext.getEnvelope(), odeMex.getOperation());
                readHeader(msgContext, odeMex);

                if (__log.isDebugEnabled()) {
                    __log.debug("Invoking ODE using MEX " + odeMex);
                    __log.debug("Message content:  " + DOMUtils.domToString(odeRequest.getMessage()));
                }

                // Invoke ODE
                responseFuture = odeMex.invoke(odeRequest);

                __log.debug("Commiting ODE MEX " + odeMex);
                try {
                    if (__log.isDebugEnabled()) __log.debug("Commiting transaction.");
                    _txManager.commit();
                } catch (Exception e) {
                    __log.error("Commit failed", e);
                    success = false;
                }
            } else {
                success = false;
            }
        } catch (Exception e) {
            __log.error("Exception occured while invoking ODE", e);
            success = false;
            String message = e.getMessage();
            if (message == null) {
            	message = "An exception occured while invoking ODE.";
            }
            throw new OdeFault(message, e);
        } finally {
            if (!success) {
                if (odeMex != null) odeMex.release(success);
                try {
                    _txManager.rollback();
                } catch (Exception e) {
                    throw new OdeFault("Rollback failed", e);
                }
            }
        }
        if (odeMex.getOperation().getOutput() != null) {
            // Waits for the response to arrive
            try {
                responseFuture.get(getTimeout(), TimeUnit.MILLISECONDS);
            } catch (Exception e) {
                String errorMsg = "Timeout or execution error when waiting for response to MEX "
                        + odeMex + " " + e.toString();
                __log.error(errorMsg, e);
                throw new OdeFault(errorMsg);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            }

            odeMex.setRequest(odeRequest);
Solution content
                readHeader(msgContext, odeMex);

                if (__log.isDebugEnabled()) {
            __log.debug("ODE routed to operation " + odeMex.getOperation() + " from service " + _serviceName);
            odeMex.setProperty("isTwoWay", Boolean.toString(msgContext.getAxisOperation() instanceof TwoChannelAxisOperation));
            if (odeMex.getOperation() != null) {
                // Preparing message to send to ODE
                Message odeRequest = odeMex.createMessage(odeMex.getOperation().getInput().getMessage().getQName());
                _converter.parseSoapRequest(odeRequest, msgContext.getEnvelope(), odeMex.getOperation());
                    __log.debug("Invoking ODE using MEX " + odeMex);
                    __log.debug("Message content:  " + DOMUtils.domToString(odeRequest.getMessage()));
                }

                // Invoke ODE
                responseFuture = odeMex.invoke(odeRequest);

                __log.debug("Commiting ODE MEX " + odeMex);
                try {
                    if (__log.isDebugEnabled()) __log.debug("Commiting transaction.");
                    _txManager.commit();
                } catch (Exception e) {
                    __log.error("Commit failed", e);
                    success = false;
                }
            } else {
                success = false;
            }
        } catch (Exception e) {
            __log.error("Exception occured while invoking ODE", e);
            success = false;
            String message = e.getMessage();
            if (message == null) {
            	message = "An exception occured while invoking ODE.";
            }
            throw new OdeFault(message, e);
        } finally {
            if (!success) {
                if (odeMex != null) odeMex.release(success);
                try {
                    _txManager.rollback();
                } catch (Exception e) {
                    throw new OdeFault("Rollback failed", e);
                }
            }
        }

        if (odeMex.getOperation().getOutput() != null) {
            // Waits for the response to arrive
            try {
                responseFuture.get(getTimeout(), TimeUnit.MILLISECONDS);
            } catch (Exception e) {
                String errorMsg = "Timeout or execution error when waiting for response to MEX "
                        + odeMex + " " + e.toString();
                __log.error(errorMsg, e);
                throw new OdeFault(errorMsg);
            }
File
ODEService.java
Developer's decision
Version 2
Kind of conflict
Catch clause
Comment
If statement
Method invocation
Throw statement
Try statement
Variable
Chunk
Conflicting content
                    // Hopefully we have a response
                    __log.debug("Handling response for MEX " + odeMex);
                    onResponse(odeMex, outMsgContext);
<<<<<<< HEAD
                } finally {
                    boolean instanceSucceeded = odeMex.getAckType() == AckType.ONEWAY || odeMex.getAckType() == AckType.RESPONSE;
                    odeMex.release(_pconf.isCleanupCategoryEnabled(instanceSucceeded, CLEANUP_CATEGORY.MESSAGES));
                }
            }
        } catch (java.util.concurrent.TimeoutException te) {
            String errmsg = "Call to " + _serviceName + "." + odeMex.getOperationName() + " timed out(" + resolveTimeout() + " ms).";
            __log.error(errmsg, te);
            throw new OdeFault(errmsg);
        } catch (Exception e) {
            String errmsg = "Call to " + _serviceName + "." + odeMex.getOperationName() + " caused an exception.";
            __log.error(errmsg, e);
            throw new OdeFault(errmsg, e);         
        } finally {
            // we cannot release ode mex here since it's outside of the transaction
=======
                    commit = true;
                } catch (AxisFault af) {
                    __log.warn("MEX produced a fault " + odeMex, af);
                    commit = true;
                    throw af;
                } catch (Exception e) {
                    __log.error("Error processing response for MEX " + odeMex, e);
                    throw new OdeFault("An exception occured when invoking ODE.", e);
                } finally {
                    odeMex.release(commit);
                    if (commit) {
                        try {
                            if (__log.isDebugEnabled()) __log.debug("Comitting transaction.");
                            _txManager.commit();
                        } catch (Exception e) {
                            throw new OdeFault("Commit failed!", e);
                        }
                    } else {
                        try {
                            _txManager.rollback();
                        } catch (Exception ex) {
                            throw new OdeFault("Rollback failed!", ex);
                        }
                    }
                }
            }
            if (!success) {
                throw new OdeFault("Message was either unroutable or timed out!");
            }
        } else {
            // One ways cleanup
            odeMex.release(true);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }
    }
Solution content
                }
                try {
                    // Refreshing the message exchange
                    odeMex = (MyRoleMessageExchange) _server.getEngine().getMessageExchange(odeMex.getMessageExchangeId());
                    onResponse(odeMex, outMsgContext);
                    commit = true;
                } catch (AxisFault af) {
                    __log.warn("MEX produced a fault " + odeMex, af);
                    commit = true;
                    throw af;
                } catch (Exception e) {
                    __log.error("Error processing response for MEX " + odeMex, e);
                    throw new OdeFault("An exception occured when invoking ODE.", e);
                } finally {
                    odeMex.release(commit);
                    if (commit) {
                        try {
                            if (__log.isDebugEnabled()) __log.debug("Comitting transaction.");
                            _txManager.commit();
                        } catch (Exception e) {
                            throw new OdeFault("Commit failed!", e);
                        }
                    } else {
                        try {
                            _txManager.rollback();
                        } catch (Exception ex) {
                            throw new OdeFault("Rollback failed!", ex);
                        }
                    }
                }
            }
            if (!success) {
                throw new OdeFault("Message was either unroutable or timed out!");
            }
        } else {
            // One ways cleanup
            odeMex.release(true);
        }
    }
File
ODEService.java
Developer's decision
Manual
Kind of conflict
Catch clause
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
    /**
     * do not store the value so it can be dynamically updated
     */
<<<<<<< HEAD
    private long resolveTimeout() {
=======
    private long getTimeout() {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        String timeout = _pconf.getEndpointProperties(_serviceRef).get(Properties.PROP_MEX_TIMEOUT);
        if (timeout != null) {
            try {
Solution content
        if (timeout != null) {
    /**
     * do not store the value so it can be dynamically updated
     */
    private long getTimeout() {
        String timeout = _pconf.getEndpointProperties(_serviceRef).get(Properties.PROP_MEX_TIMEOUT);
            try {
File
ODEService.java
Developer's decision
Version 2
Kind of conflict
Method signature
Chunk
Conflicting content
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        return Properties.DEFAULT_MEX_TIMEOUT;
    }

<<<<<<< HEAD
=======
    /**
     *
     * @return an Option instance containing the properties for this endpoint
     * @see org.apache.ode.bpel.iapi.ProcessConf#getEndpointProperties(org.apache.ode.bpel.iapi.EndpointReference)
     */
    public Options getOptions(){
        return Properties.Axis2.translate(_pconf.getEndpointProperties(_serviceRef));
    }

    private void onResponse(MyRoleMessageExchange mex, MessageContext msgContext) throws AxisFault {
        switch (mex.getAckType()) {
            case FAULT:
Solution content
    }

        return Properties.DEFAULT_MEX_TIMEOUT;
    /**
     *
     * @return an Option instance containing the properties for this endpoint
     * @see org.apache.ode.bpel.iapi.ProcessConf#getEndpointProperties(org.apache.ode.bpel.iapi.EndpointReference)
     */
    public Options getOptions(){
        return Properties.Axis2.translate(_pconf.getEndpointProperties(_serviceRef));
    }

    private void onResponse(MyRoleMessageExchange mex, MessageContext msgContext) throws AxisFault {
        switch (mex.getStatus()) {
            case FAULT:
File
ODEService.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
                if (__log.isDebugEnabled())
                    __log.debug("Returning fault: " + msgContext.getEnvelope().toString());
                break;
<<<<<<< HEAD
            case ONEWAY:
=======
            case ASYNC:
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            case RESPONSE:
                _converter.createSoapResponse(msgContext, mex.getResponse(), mex.getOperation());
                if (__log.isDebugEnabled())
Solution content
                if (__log.isDebugEnabled())
                    __log.debug("Returning fault: " + msgContext.getEnvelope().toString());
                break;
            case ASYNC:
            case RESPONSE:
                _converter.createSoapResponse(msgContext, mex.getResponse(), mex.getOperation());
                if (__log.isDebugEnabled())
File
ODEService.java
Developer's decision
Version 2
Kind of conflict
Case statement
Chunk
Conflicting content
     * Extracts endpoint information from Axis MessageContext (taken from WSA headers) to stuff them into ODE mesage exchange.
     */
    private void readHeader(MessageContext msgContext, MyRoleMessageExchange odeMex) {
<<<<<<< HEAD
        Object otse = msgContext.getProperty(TARGET_SESSION_ENDPOINT);
        Object ocse = msgContext.getProperty(CALLBACK_SESSION_ENDPOINT);
        if (otse != null) {
            Element serviceEpr = (Element) otse;
            WSAEndpoint endpoint = new WSAEndpoint();
            endpoint.set(serviceEpr);
            // Extract the session ID for the local process.
            odeMex.setProperty(WSMessageExchange.PROPERTY_SEP_MYROLE_SESSIONID, endpoint.getSessionId());
=======
        String correlationId = (String) msgContext.getProperty(JMSConstants.JMS_COORELATION_ID);
        if (correlationId != null) {
            odeMex.setProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID, correlationId);
        } else {
            Object otse = msgContext.getProperty("targetSessionEndpoint");
            if (otse != null) {
                Element serviceEpr = (Element) otse;
                WSAEndpoint endpoint = new WSAEndpoint();
                endpoint.set(serviceEpr);
                // Extract the session ID for the local process.
                odeMex.setProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID, endpoint.getSessionId());
            }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }
        
        Object ocse = msgContext.getProperty("callbackSessionEndpoint");
Solution content
     */
    private void readHeader(MessageContext msgContext, MyRoleMessageExchange odeMex) {
        String correlationId = (String) msgContext.getProperty(JMSConstants.JMS_COORELATION_ID);
        if (correlationId != null) {
            odeMex.setProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID, correlationId);
        } else {
            Object otse = msgContext.getProperty("targetSessionEndpoint");
            if (otse != null) {
                Element serviceEpr = (Element) otse;
                WSAEndpoint endpoint = new WSAEndpoint();
                endpoint.set(serviceEpr);
                // Extract the session ID for the local process.
                odeMex.setProperty(MessageExchange.PROPERTY_SEP_MYROLE_SESSIONID, endpoint.getSessionId());
            }
        }
        
        Object ocse = msgContext.getProperty("callbackSessionEndpoint");
File
ODEService.java
Developer's decision
Version 2
Kind of conflict
Cast expression
Comment
If statement
Method invocation
Variable
Chunk
Conflicting content
    }

    /**
<<<<<<< HEAD
     * Return the service-ref element that will be used to represent this endpoint.
     * 
=======
     * Return the service-ref element that will be used to represent this
     * endpoint.
     *
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
     * @return my service endpoint
     */
    public EndpointReference getMyServiceRef() {
Solution content
    }

    /**
     * Return the service-ref element that will be used to represent this
     * endpoint.
     *
     * @return my service endpoint
     */
    public EndpointReference getMyServiceRef() {
File
ODEService.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
    /**
     * Get the EPR of this service from the WSDL.
<<<<<<< HEAD
     * 
     * @param name
     *            service name
     * @param portName
     *            port name
=======
     *
     * @param name     service name
     * @param portName port name
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
     * @return XML representation of the EPR
     */
    public static Element genEPRfromWSDL(Definition wsdlDef, QName name, String portName) {
Solution content
    /**
     * Get the EPR of this service from the WSDL.
     *
     * @param name     service name
     * @param portName port name
     * @return XML representation of the EPR
     */
    public static Element genEPRfromWSDL(Definition wsdlDef, QName name, String portName) {
File
ODEService.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
    private static final FileFilter _fileFilter = new FileFilter() {
        public boolean accept(File path) {
            return new File(path, "deploy.xml").exists();
    @SuppressWarnings("unchecked")
    private WatchDog _systemCronConfigWatchDog;

<<<<<<< HEAD
    private SystemSchedulesConfig _systemSchedulesConf;

    @SuppressWarnings("unchecked")
    private Map dDWatchDogsByPath = new HashMap();
    @SuppressWarnings("unchecked")
    private WatchDog _systemCronConfigWatchDog;

    /** Filter accepting directories containing a .odedd file. */
=======
    /** Filter accepting directories containing a ode dd file. */
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
Solution content
    @SuppressWarnings("unchecked")
    private WatchDog _systemCronConfigWatchDog;

    /** Filter accepting directories containing a ode dd file. */
    private static final FileFilter _fileFilter = new FileFilter() {
        public boolean accept(File path) {
            return new File(path, "deploy.xml").exists();
File
DeploymentPoller.java
Developer's decision
Version 2
Kind of conflict
Annotation
Attribute
Comment
Method invocation
Chunk
Conflicting content
            }
        File[] files = _deployDir.listFiles(_fileFilter);

        // Checking for new deployment directories
<<<<<<< HEAD
        for (File file : files) {
            File deployXml = new File(file, "deploy.xml");
            File deployedMarker = new File(_deployDir, file.getName() + ".deployed");

            if (!deployXml.exists()) {
                // Skip if deploy.xml is abset
                __log.debug("Not deploying " + file + " (missing deploy.xml)");
            }

            WatchDog ddWatchDog = ensureDeployXmlWatchDog(file, deployXml);

            if (deployedMarker.exists()) {
                checkDeployXmlWatchDog(ddWatchDog);
                continue;

            try {
                deployedMarker.createNewFile();
            } catch (IOException e1) {
                __log.error("Error creating deployed marker file, " + file + " will not be deployed");
                continue;
            }
=======
        if (isDeploymentFromODEFileSystemAllowed() && files != null) {
            for (File file : files) {
                File deployXml = new File(file, "deploy.xml");
                File deployedMarker = new File(_deployDir, file.getName() + ".deployed");
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

                if (!deployXml.exists()) {
                    // Skip if deploy.xml is abset
Solution content
        File[] files = _deployDir.listFiles(_fileFilter);

        // Checking for new deployment directories
        if (isDeploymentFromODEFileSystemAllowed() && files != null) {
            for (File file : files) {
                File deployXml = new File(file, "deploy.xml");
                File deployedMarker = new File(_deployDir, file.getName() + ".deployed");

                if (!deployXml.exists()) {
                    // Skip if deploy.xml is abset
File
DeploymentPoller.java
Developer's decision
Version 2
Kind of conflict
For statement
If statement
Method invocation
Try statement
Variable
Chunk
Conflicting content
                    __log.info("Successfully undeployed " + pkg);
            }
        }
<<<<<<< HEAD

=======
        
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        checkSystemCronConfigWatchDog(_systemCronConfigWatchDog);
    }
Solution content
                    __log.info("Successfully undeployed " + pkg);
            }
        }
        
        checkSystemCronConfigWatchDog(_systemCronConfigWatchDog);
    }
File
DeploymentPoller.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
import org.apache.ode.axis2.util.Axis2WSDLLocator;
import org.apache.ode.axis2.util.AxisUtils;
import org.apache.ode.bpel.iapi.ProcessConf;
<<<<<<< HEAD
import org.apache.ode.utils.Properties;
import org.apache.ode.il.epr.WSDL11Endpoint;
=======
import org.apache.ode.bpel.epr.WSDL11Endpoint;
import org.apache.ode.utils.Properties;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.w3c.dom.Element;
Solution content
import org.apache.ode.axis2.util.Axis2WSDLLocator;
import org.apache.ode.axis2.util.AxisUtils;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.bpel.epr.WSDL11Endpoint;
import org.apache.ode.utils.Properties;
import org.apache.ws.commons.schema.XmlSchema;
import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.w3c.dom.Element;
File
ODEAxisService.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
        InputStream is = null;
        try {
            URI baseUri = pconf.getBaseURI().resolve(wsdlDefinition.getDocumentBaseURI());
<<<<<<< HEAD
            InputStream is = baseUri.toURL().openStream();
=======
            is = baseUri.toURL().openStream();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisPatchedBuilder(is, wsdlServiceName, portName);
            serviceBuilder.setBaseUri(baseUri.toString());
            serviceBuilder.setCustomResolver(new Axis2UriResolver());
Solution content
            serviceBuilder.setBaseUri(baseUri.toString());
        InputStream is = null;
        try {
            URI baseUri = pconf.getBaseURI().resolve(wsdlDefinition.getDocumentBaseURI());
            WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisPatchedBuilder(is, wsdlServiceName, portName);
            serviceBuilder.setCustomResolver(new Axis2UriResolver());
            is = baseUri.toURL().openStream();
File
ODEAxisService.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
            axisService.setWsdlFound(true);
            axisService.setCustomWsdl(true);
            axisService.setClassLoader(axisConfig.getServiceClassLoader());
<<<<<<< HEAD

            URL wsdlUrl = null;
            for (File file : pconf.getFiles()) {
                if (file.getAbsolutePath().indexOf(wsdlDefinition.getDocumentBaseURI()) > 0)
                    wsdlUrl = file.toURI().toURL();
            }
            if (wsdlUrl != null) axisService.setFileName(wsdlUrl);

=======
        
            URL wsdlUrl = null;
            for (File file : pconf.getFiles()) {
                if (file.getAbsolutePath().indexOf(wsdlDefinition.getDocumentBaseURI()) > 0)
                    wsdlUrl = file.toURI().toURL();
            }
            if (wsdlUrl != null) axisService.setFileName(wsdlUrl);

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            // axis2 service configuration  
            URL service_file = pconf.getBaseURI().resolve(wsdlServiceName.getLocalPart()+".axis2").toURL();
            LOG.debug("Looking for Axis2 service configuration file: "+service_file);
Solution content
            axisService.setWsdlFound(true);
            axisService.setCustomWsdl(true);
            axisService.setClassLoader(axisConfig.getServiceClassLoader());
        
            URL wsdlUrl = null;
            for (File file : pconf.getFiles()) {
                if (file.getAbsolutePath().indexOf(wsdlDefinition.getDocumentBaseURI()) > 0)
                    wsdlUrl = file.toURI().toURL();
            }
            if (wsdlUrl != null) axisService.setFileName(wsdlUrl);

            // axis2 service configuration  
            URL service_file = pconf.getBaseURI().resolve(wsdlServiceName.getLocalPart()+".axis2").toURL();
            LOG.debug("Looking for Axis2 service configuration file: "+service_file);
File
ODEAxisService.java
Developer's decision
Version 1
Kind of conflict
For statement
If statement
Variable
Chunk
Conflicting content
              AxisUtils.applySecurityPolicy(axisService, properties.get(Properties.PROP_SECURITY_POLICY));
=======
            final WSDL11Endpoint endpoint = new WSDL11Endpoint(wsdlServiceName, portName);
            final Map properties = pconf.getEndpointProperties(endpoint);
            if(properties.get(Properties.PROP_SECURITY_POLICY)!=null){
<<<<<<< HEAD
                AxisUtils.applySecurityPolicy(axisService, properties.get(Properties.PROP_SECURITY_POLICY));
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            }

            // In doc/lit we need to declare a mapping between operations and message element names
Solution content
            final WSDL11Endpoint endpoint = new WSDL11Endpoint(wsdlServiceName, portName);
            final Map properties = pconf.getEndpointProperties(endpoint);
            if(properties.get(Properties.PROP_SECURITY_POLICY)!=null){
                AxisUtils.applySecurityPolicy(axisService, properties.get(Properties.PROP_SECURITY_POLICY));
            }

            // In doc/lit we need to declare a mapping between operations and message element names
File
ODEAxisService.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
                    operation.setMessageReceiver(msgReceiver);
                }
            }
<<<<<<< HEAD

=======
            
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            // Set the JMS destination name on the Axis Service
            if (isJmsEndpoint(pconf, wsdlServiceName, portName)) {
                axisService.addParameter(new Parameter(JMSConstants.DEST_PARAM, 
Solution content
                    operation.setMessageReceiver(msgReceiver);
                }
            }
            
            // Set the JMS destination name on the Axis Service
            if (isJmsEndpoint(pconf, wsdlServiceName, portName)) {
                axisService.addParameter(new Parameter(JMSConstants.DEST_PARAM, 
File
ODEAxisService.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
         
                axisService.addParameter(new Parameter(JMSConstants.DEST_PARAM, 
                        extractJMSDestinationName(axisServiceName, deriveBaseServiceUri(pconf))));
            }
<<<<<<< HEAD
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            return axisService;
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
Solution content
                axisService.addParameter(new Parameter(JMSConstants.DEST_PARAM, 
                        extractJMSDestinationName(axisServiceName, deriveBaseServiceUri(pconf))));
            }

            return axisService;
        } catch (Exception e) {
            throw AxisFault.makeFault(e);
File
ODEAxisService.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
            destinationPrefix = "dynamicTopics/";
            index = axisServiceName.indexOf(destinationPrefix);
        }
<<<<<<< HEAD
    }

    public static AxisService createService(AxisConfiguration axisConfig, QName serviceQName, String port,
                                            String axisName, Definition wsdlDef, MessageReceiver receiver) throws AxisFault {
=======
        if (index == -1) {
            destinationPrefix = baseUri + "/";
            index = axisServiceName.indexOf(destinationPrefix);
            return (index != -1) ? axisServiceName.substring(destinationPrefix.length()) : axisServiceName;
        } else {
            return axisServiceName.substring(index);
        }
    }

    public static AxisService createService(AxisConfiguration axisConfig, QName serviceQName, String port,
                                            String axisName, Definition wsdlDef, MessageReceiver receiver) throws AxisFault {

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisServiceBuilder(wsdlDef, serviceQName, port);
        AxisService axisService = serviceBuilder.populateService();
        axisService.setName(axisName);
Solution content
            destinationPrefix = "dynamicTopics/";
            index = axisServiceName.indexOf(destinationPrefix);
        }
        if (index == -1) {
            destinationPrefix = baseUri + "/";
            index = axisServiceName.indexOf(destinationPrefix);
            return (index != -1) ? axisServiceName.substring(destinationPrefix.length()) : axisServiceName;
        } else {
            return axisServiceName.substring(index);
        }
    }

    public static AxisService createService(AxisConfiguration axisConfig, QName serviceQName, String port,
                                            String axisName, Definition wsdlDef, MessageReceiver receiver) throws AxisFault {

        WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisServiceBuilder(wsdlDef, serviceQName, port);
        AxisService axisService = serviceBuilder.populateService();
        axisService.setName(axisName);
File
ODEAxisService.java
Developer's decision
Version 2
Kind of conflict
If statement
Method signature
Chunk
Conflicting content
        return axisService;
    }

<<<<<<< HEAD
    /**
     * Extract the JMS destination name that is embedded in the Axis service name.
     * @param axisServiceName the name of the axis service
     * @return the corresponding JMS destination name
     */
    private static String extractJMSDestinationName(String axisServiceName, String baseUri) {
        String destinationPrefix = "dynamicQueues/";
        int index = axisServiceName.indexOf(destinationPrefix);
        if (index == -1) {
            destinationPrefix = "dynamicTopics/";
            index = axisServiceName.indexOf(destinationPrefix);
        }
        if (index == -1) {
            destinationPrefix = baseUri + "/";
            index = axisServiceName.indexOf(destinationPrefix);
            return (index != -1) ? axisServiceName.substring(destinationPrefix.length()) : axisServiceName;
        } else {
            return axisServiceName.substring(index);
        }
    }

    private static String extractEndpointUri(ProcessConf pconf, QName wsdlServiceName, String portName) 
    throws AxisFault {
=======
    private static String extractEndpointUri(ProcessConf pconf, QName wsdlServiceName, String portName) 
            throws AxisFault {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        Definition wsdlDefinition = pconf.getDefinitionForService(wsdlServiceName);
        String url = null;
        Service service = wsdlDefinition.getService(wsdlServiceName);
Solution content
        return axisService;
    }

    private static String extractEndpointUri(ProcessConf pconf, QName wsdlServiceName, String portName) 
            throws AxisFault {
        Definition wsdlDefinition = pconf.getDefinitionForService(wsdlServiceName);
        String url = null;
        Service service = wsdlDefinition.getService(wsdlServiceName);
File
ODEAxisService.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Method signature
Chunk
Conflicting content
    
        String url = extractEndpointUri(pconf, wsdlServiceName, portName);
        return url.startsWith("jms:");
    }
    
    private static boolean isJmsEndpoint(ProcessConf pconf, QName wsdlServiceName, String portName) 
            throws AxisFault {
        if (url == null) {
            throw new OdeFault("Could not extract any soap:address from service WSDL definition " + wsdlServiceName
                    + " (necessary to establish the process target address)!");
<<<<<<< HEAD
        }		
        return url;
}

    private static boolean isJmsEndpoint(ProcessConf pconf, QName wsdlServiceName, String portName) 
        throws AxisFault {
        String url = extractEndpointUri(pconf, wsdlServiceName, portName);
        return url.startsWith("jms:");
    }
    
    private static String extractServiceName(ProcessConf pconf, QName wsdlServiceName, String portName)
        throws AxisFault {
=======
        }       
        return url;
    }
    private static String extractServiceName(ProcessConf pconf, QName wsdlServiceName, String portName)
            throws AxisFault {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        String endpointUri = extractEndpointUri(pconf, wsdlServiceName, portName);
        String derivedUri = deriveBaseServiceUri(pconf);
        String serviceName = parseURLForService(endpointUri, derivedUri);
Solution content
        if (url == null) {
            throw new OdeFault("Could not extract any soap:address from service WSDL definition " + wsdlServiceName
                    + " (necessary to establish the process target address)!");
        }       
        return url;
    }
    
    private static boolean isJmsEndpoint(ProcessConf pconf, QName wsdlServiceName, String portName) 
            throws AxisFault {
        String url = extractEndpointUri(pconf, wsdlServiceName, portName);
        return url.startsWith("jms:");
    }
    
    private static String extractServiceName(ProcessConf pconf, QName wsdlServiceName, String portName)
            throws AxisFault {
        String endpointUri = extractEndpointUri(pconf, wsdlServiceName, portName);
        String derivedUri = deriveBaseServiceUri(pconf);
        String serviceName = parseURLForService(endpointUri, derivedUri);
File
ODEAxisService.java
Developer's decision
Version 1
Kind of conflict
Method declaration
Method signature
Return statement
Variable
Chunk
Conflicting content
    /*
                    + portName + " should be of the form http://hostname:port/ode/processes/myProcessEndpointName");
        }
        return serviceName;
<<<<<<< HEAD
    }
    
    /**
    * Obtain the service name from the request URL. The request URL is expected to use the path "/processes/" under
    * which all processes and their services are listed. Returns null if the path does not contain this part.
    */
    protected static String parseURLForService(String path, String baseUri) {
        // Assume that path is HTTP-based, by default
        String servicePrefix = "/processes/";
        // Don't assume JMS-based paths start the same way 
        if (path.startsWith("jms://")) {
            servicePrefix = "jms://";
        }
        int index = path.indexOf(servicePrefix);
        if (-1 != index) {
            String service;
        
            int serviceStart = index + servicePrefix.length();
            if (path.length() > serviceStart + 1) {
                service = path.substring(serviceStart);
                // Path may contain query string, not interesting for us.
                int queryIndex = service.indexOf('?');
                if (queryIndex > 0) {
                    service = service.substring(0, queryIndex);
                }
                // Qualify shared JMS names with unique baseUri
                // Since multiple processes may provide services at the same (JMS) endpoint, qualify
                // the (JMS) endpoint-specific NCName with a process-relative URI, if necessary.
                if (path.startsWith("jms")) {
                    boolean slashPresent = baseUri.endsWith("/") || service.startsWith("/");
                    service = baseUri + (slashPresent ? "" : "/") + service;		        
                }
                return service;
            }
        }
        return null;
    }
=======
    }

    /**
     * Obtain the service name from the request URL. The request URL is expected to use the path "/processes/" under
     * which all processes and their services are listed. Returns null if the path does not contain this part.
     */
    protected static String parseURLForService(String path, String baseUri) {
        // Assume that path is HTTP-based, by default
        String servicePrefix = "/processes/";
        // Don't assume JMS-based paths start the same way 
        if (path.startsWith("jms:/")) {
            servicePrefix = "jms:/";
        }
        int index = path.indexOf(servicePrefix);
        if (-1 != index) {
            String service;

            int serviceStart = index + servicePrefix.length();
            if (path.length() > serviceStart + 1) {
                service = path.substring(serviceStart);
                // Path may contain query string, not interesting for us.
                int queryIndex = service.indexOf('?');
                if (queryIndex > 0) {
                    service = service.substring(0, queryIndex);
                }
                // Qualify shared JMS names with unique baseUri
                // Since multiple processes may provide services at the same (JMS) endpoint, qualify
                // the (JMS) endpoint-specific NCName with a process-relative URI, if necessary.
                if (path.startsWith("jms:/")) {
                    boolean slashPresent = baseUri.endsWith("/") || service.startsWith("/");
                    // service = baseUri + (slashPresent ? "" : "/") + service; // allow successive slashes ("//") in the URI
                    service = baseUri + "/" + service;
                }
                return service;
            }
        }
        return null;
    }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
     * Generates a URI of the following form:
Solution content
     * Obtain the service name from the request URL. The request URL is expected to use the path "/processes/" under
                    + portName + " should be of the form http://hostname:port/ode/processes/myProcessEndpointName");
        }
        return serviceName;
    }

    /**
     * which all processes and their services are listed. Returns null if the path does not contain this part.
     */
    protected static String parseURLForService(String path, String baseUri) {
        // Assume that path is HTTP-based, by default
        String servicePrefix = "/processes/";
        // Don't assume JMS-based paths start the same way 
        if (path.startsWith("jms:/")) {
            servicePrefix = "jms:/";
        }
        int index = path.indexOf(servicePrefix);
        if (-1 != index) {
            String service;

            int serviceStart = index + servicePrefix.length();
            if (path.length() > serviceStart + 1) {
                service = path.substring(serviceStart);
                // Path may contain query string, not interesting for us.
                int queryIndex = service.indexOf('?');
                if (queryIndex > 0) {
                    service = service.substring(0, queryIndex);
                }
                // Qualify shared JMS names with unique baseUri
                // Since multiple processes may provide services at the same (JMS) endpoint, qualify
                // the (JMS) endpoint-specific NCName with a process-relative URI, if necessary.
                if (path.startsWith("jms:/")) {
                    boolean slashPresent = baseUri.endsWith("/") || service.startsWith("/");
                    // service = baseUri + (slashPresent ? "" : "/") + service; // allow successive slashes ("//") in the URI
                    service = baseUri + "/" + service;
                }
                return service;
            }
        }
        return null;
    }
File
ODEAxisService.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
                    }
                }
                            .getLocalPart());
            }
        }
<<<<<<< HEAD
    }

    // Axis2 monkey patching to force the usage of the read(element,baseUri) method
    // of XmlSchema as the normal read is broken.
    public static class WSDL11ToAxisPatchedBuilder extends WSDL11ToAxisServiceBuilder {
        public WSDL11ToAxisPatchedBuilder(InputStream in, QName serviceName, String portName) {
            super(in, serviceName, portName);
        }
            }
        public WSDL11ToAxisPatchedBuilder(Definition def, QName serviceName, String portName) {
            super(def, serviceName, portName);
        }
        public WSDL11ToAxisPatchedBuilder(Definition def, QName serviceName, String portName, boolean isAllPorts) {
            super(def, serviceName, portName, isAllPorts);
        }
        public WSDL11ToAxisPatchedBuilder(InputStream in, AxisService service) {
            super(in, service);
        }
        public WSDL11ToAxisPatchedBuilder(InputStream in) {
            super(in);
        }

        protected XmlSchema getXMLSchema(Element element, String baseUri) {
            XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
            if (baseUri != null) {
                schemaCollection.setBaseUri(baseUri);
            }
            return schemaCollection.read(element, baseUri);
        }
=======
    }

    // Axis2 monkey patching to force the usage of the read(element,baseUri) method
    // of XmlSchema as the normal read is broken.
    public static class WSDL11ToAxisPatchedBuilder extends WSDL11ToAxisServiceBuilder {
        public WSDL11ToAxisPatchedBuilder(InputStream in, QName serviceName, String portName) {
            super(in, serviceName, portName);
        }
        public WSDL11ToAxisPatchedBuilder(Definition def, QName serviceName, String portName) {
            super(def, serviceName, portName);
        }
        public WSDL11ToAxisPatchedBuilder(Definition def, QName serviceName, String portName, boolean isAllPorts) {
            super(def, serviceName, portName, isAllPorts);
        }
        public WSDL11ToAxisPatchedBuilder(InputStream in, AxisService service) {
            super(in, service);
        }
        public WSDL11ToAxisPatchedBuilder(InputStream in) {
            super(in);
        }

        protected XmlSchema getXMLSchema(Element element, String baseUri) {
            XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
            if (baseUri != null) {
                schemaCollection.setBaseUri(baseUri);
            }
            return schemaCollection.read(element, baseUri);
        }
    }

    /*
     * Generates a URI of the following form:
     *     ${deploy_bundleNcName}/${diagram_relativeURL}/${process_relativeURL}
     * When a service name (local part only) is qualified (prefixed) with the above,
     * it results in a unique identifier that may be used as that service's name.  
     */
    public static String deriveBaseServiceUri(ProcessConf pconf) {
        if (pconf != null) {
            StringBuffer baseServiceUri = new StringBuffer();
            String bundleName = pconf.getPackage();
            if (bundleName != null) {
                baseServiceUri.append(bundleName).append("/");
                if (pconf.getBpelDocument() != null) {
                    String bpelDocumentName = pconf.getBpelDocument();
                    if (bpelDocumentName.indexOf(".") > 0) {
                        bpelDocumentName = bpelDocumentName.substring(0, bpelDocumentName.indexOf("."));
                    }
                    baseServiceUri.append(bpelDocumentName).append("/");
                    String processName = pconf.getType() != null 
                        ? pconf.getType().getLocalPart() : null;
                    if (processName != null) {
                        baseServiceUri.append(processName);
                        return baseServiceUri.toString();
            
        }
        return null;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

}
Solution content
                            .getLocalPart());
            }
        }
    }

    // Axis2 monkey patching to force the usage of the read(element,baseUri) method
    // of XmlSchema as the normal read is broken.
    public static class WSDL11ToAxisPatchedBuilder extends WSDL11ToAxisServiceBuilder {
        public WSDL11ToAxisPatchedBuilder(InputStream in, QName serviceName, String portName) {
            super(in, serviceName, portName);
        }
        public WSDL11ToAxisPatchedBuilder(Definition def, QName serviceName, String portName) {
            super(def, serviceName, portName);
        }
        public WSDL11ToAxisPatchedBuilder(Definition def, QName serviceName, String portName, boolean isAllPorts) {
            super(def, serviceName, portName, isAllPorts);
        }
        public WSDL11ToAxisPatchedBuilder(InputStream in, AxisService service) {
            super(in, service);
        }
        public WSDL11ToAxisPatchedBuilder(InputStream in) {
            super(in);
        }

        protected XmlSchema getXMLSchema(Element element, String baseUri) {
            XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
            if (baseUri != null) {
                schemaCollection.setBaseUri(baseUri);
            }
            return schemaCollection.read(element, baseUri);
        }
    }

    /*
     * Generates a URI of the following form:
     *     ${deploy_bundleNcName}/${diagram_relativeURL}/${process_relativeURL}
     * When a service name (local part only) is qualified (prefixed) with the above,
     * it results in a unique identifier that may be used as that service's name.  
     */
    public static String deriveBaseServiceUri(ProcessConf pconf) {
        if (pconf != null) {
            StringBuffer baseServiceUri = new StringBuffer();
            String bundleName = pconf.getPackage();
            if (bundleName != null) {
                baseServiceUri.append(bundleName).append("/");
                if (pconf.getBpelDocument() != null) {
                    String bpelDocumentName = pconf.getBpelDocument();
                    if (bpelDocumentName.indexOf(".") > 0) {
                        bpelDocumentName = bpelDocumentName.substring(0, bpelDocumentName.indexOf("."));
                    }
                    baseServiceUri.append(bpelDocumentName).append("/");
                    String processName = pconf.getType() != null 
                        ? pconf.getType().getLocalPart() : null;
                    if (processName != null) {
                        baseServiceUri.append(processName);
                        return baseServiceUri.toString();
                    }
                }
            }
            
        }
        return null;
    }

}
File
ODEAxisService.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Class signature
Comment
If statement
Method declaration
Method signature
Return statement
Chunk
Conflicting content
import org.apache.axis2.transport.http.AxisServlet;
import org.apache.ode.axis2.ODEServer;
import org.apache.ode.axis2.service.DeploymentBrowser;
<<<<<<< HEAD
=======

import java.io.*;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

/**
 * Overrides standard AxisServlet to handle our service configurations and
Solution content
import org.apache.axis2.transport.http.AxisServlet;
import org.apache.ode.axis2.ODEServer;
import org.apache.ode.axis2.service.DeploymentBrowser;

import java.io.*;

/**
 * Overrides standard AxisServlet to handle our service configurations and
File
ODEAxisServlet.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
        _odeServer = createODEServer();
        _odeServer.init(config, axisConfiguration);
        _browser = new DeploymentBrowser(_odeServer.getProcessStore(), axisConfiguration, _odeServer.getAppRoot());
<<<<<<< HEAD
=======
    }

    // Prevents a stack overflow on WAS 6.1 due to the axis2 init delegation chain
    public void init() throws ServletException {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Solution content
        _odeServer = createODEServer();
        _odeServer.init(config, axisConfiguration);
        _browser = new DeploymentBrowser(_odeServer.getProcessStore(), axisConfiguration, _odeServer.getAppRoot());
    }

    // Prevents a stack overflow on WAS 6.1 due to the axis2 init delegation chain
    public void init() throws ServletException {
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
File
ODEAxisServlet.java
Developer's decision
Version 2
Kind of conflict
Comment
Method signature
Chunk
Conflicting content
                        + msgContext.getAxisOperation().getName());
            // Client is expecting a response, running in the same thread
            MessageContext outMsgContext = MessageContextBuilder.createOutMessageContext(msgContext);
<<<<<<< HEAD
=======
            // pass on the endpoint properties for output context
            outMsgContext.getOptions().setParent(_service.getOptions());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            outMsgContext.getOperationContext().addMessageContext(outMsgContext);
            invokeBusinessLogic(msgContext, outMsgContext);
            if (__log.isDebugEnabled()) {
Solution content
                        + msgContext.getAxisOperation().getName());
            // Client is expecting a response, running in the same thread
            MessageContext outMsgContext = MessageContextBuilder.createOutMessageContext(msgContext);
            // pass on the endpoint properties for output context
            outMsgContext.getOptions().setParent(_service.getOptions());
            outMsgContext.getOperationContext().addMessageContext(outMsgContext);
            invokeBusinessLogic(msgContext, outMsgContext);
            if (__log.isDebugEnabled()) {
File
ODEMessageReceiver.java
Developer's decision
Version 2
Kind of conflict
Comment
Method invocation
Chunk
Conflicting content

    public InvocationResponse invoke(MessageContext messageContext) throws AxisFault {
<<<<<<< HEAD
        EndpointReference otargetSession = (EndpointReference) messageContext.getProperty(ODEService.TARGET_SESSION_ENDPOINT);
        EndpointReference ocallbackSession = (EndpointReference) messageContext.getProperty(ODEService.CALLBACK_SESSION_ENDPOINT);
=======
        // Skip this handler if ask to do so
        if(messageContext.isPropertyTrue(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES)){
            if(__log.isDebugEnabled()) __log.debug("Skipped WS-Adressing Headers for sessions");
            return InvocationResponse.CONTINUE;
        }

        EndpointReference otargetSession = (EndpointReference) messageContext.getProperty("targetSessionEndpoint");
        EndpointReference ocallbackSession = (EndpointReference) messageContext.getProperty("callbackSessionEndpoint");
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        if (otargetSession == null)
            otargetSession = (EndpointReference) messageContext.getOptions().getProperty(ODEService.TARGET_SESSION_ENDPOINT);
        if (ocallbackSession == null)
Solution content

    public InvocationResponse invoke(MessageContext messageContext) throws AxisFault {
        // Skip this handler if ask to do so
        if(messageContext.isPropertyTrue(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES)){
            if(__log.isDebugEnabled()) __log.debug("Skipped WS-Adressing Headers for sessions");
            return InvocationResponse.CONTINUE;
        }

        EndpointReference otargetSession = (EndpointReference) messageContext.getProperty("targetSessionEndpoint");
        EndpointReference ocallbackSession = (EndpointReference) messageContext.getProperty("callbackSessionEndpoint");
        if (otargetSession == null)
            otargetSession = (EndpointReference) messageContext.getOptions().getProperty("targetSessionEndpoint");
        if (ocallbackSession == null)
File
SessionOutHandler.java
Developer's decision
Version 2
Kind of conflict
Cast expression
Comment
If statement
Variable
Chunk
Conflicting content
        if (otargetSession != null || ocallbackSession != null) {
            SOAPHeader header = messageContext.getEnvelope().getHeader();
            SOAPFactory factory = (SOAPFactory) messageContext.getEnvelope().getOMFactory();
<<<<<<< HEAD
=======
            OMNamespace intalioSessNS = factory.createOMNamespace(Namespaces.INTALIO_SESSION_NS, "intalio");
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            OMNamespace odeSessNS = factory.createOMNamespace(Namespaces.ODE_SESSION_NS, "odesession");
            OMNamespace wsAddrNS = factory.createOMNamespace(Namespaces.WS_ADDRESSING_NS, "addr");
            if (header == null) {
Solution content
        if (otargetSession != null || ocallbackSession != null) {
            SOAPHeader header = messageContext.getEnvelope().getHeader();
            SOAPFactory factory = (SOAPFactory) messageContext.getEnvelope().getOMFactory();
            OMNamespace intalioSessNS = factory.createOMNamespace(Namespaces.INTALIO_SESSION_NS, "intalio");
            OMNamespace odeSessNS = factory.createOMNamespace(Namespaces.ODE_SESSION_NS, "odesession");
            OMNamespace wsAddrNS = factory.createOMNamespace(Namespaces.WS_ADDRESSING_NS, "addr");
            if (header == null) {
File
SessionOutHandler.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
                
                if (targetEpr.getSessionId() != null) {
                    OMElement session = factory.createSOAPHeaderBlock("session", odeSessNS);
<<<<<<< HEAD
=======
                    header.addChild(session);
                    session.setText(targetEpr.getSessionId());
                    // same for intalio
                    session = factory.createSOAPHeaderBlock("session", intalioSessNS);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                    header.addChild(session);
                    session.setText(targetEpr.getSessionId());
                }
Solution content
                
                if (targetEpr.getSessionId() != null) {
                    OMElement session = factory.createSOAPHeaderBlock("session", odeSessNS);
                    header.addChild(session);
                    session.setText(targetEpr.getSessionId());
                    // same for intalio
                    session = factory.createSOAPHeaderBlock("session", intalioSessNS);
                    header.addChild(session);
                    session.setText(targetEpr.getSessionId());
                }
File
SessionOutHandler.java
Developer's decision
Version 2
Kind of conflict
Comment
Method invocation
Variable
Chunk
Conflicting content
            if (ocallbackSession != null && ocallbackSession instanceof MutableEndpoint) {
                WSAEndpoint callbackEpr = EndpointFactory.convertToWSA((MutableEndpoint) ocallbackSession);
<<<<<<< HEAD
                OMElement callback = factory.createSOAPHeaderBlock("callback", odeSessNS);
                header.addChild(callback);
=======
                OMElement odeCallback = factory.createSOAPHeaderBlock("callback", odeSessNS);
                OMElement intCallback = factory.createSOAPHeaderBlock("callback", intalioSessNS);
                header.addChild(odeCallback);
                header.addChild(intCallback);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                OMElement address = factory.createOMElement("Address", wsAddrNS);
                odeCallback.addChild(address);
                intCallback.addChild(address.cloneOMElement());
Solution content
            if (ocallbackSession != null && ocallbackSession instanceof MutableEndpoint) {
                WSAEndpoint callbackEpr = EndpointFactory.convertToWSA((MutableEndpoint) ocallbackSession);
                OMElement odeCallback = factory.createSOAPHeaderBlock("callback", odeSessNS);
                OMElement intCallback = factory.createSOAPHeaderBlock("callback", intalioSessNS);
                header.addChild(odeCallback);
                header.addChild(intCallback);
                OMElement address = factory.createOMElement("Address", wsAddrNS);
                odeCallback.addChild(address);
                intCallback.addChild(address.cloneOMElement());
File
SessionOutHandler.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
                intCallback.addChild(address.cloneOMElement());
                address.setText(callbackEpr.getUrl());
                if (callbackEpr.getSessionId() != null) {
<<<<<<< HEAD
                    OMElement session = factory.createOMElement("session", odeSessNS);
                    session.setText(callbackEpr.getSessionId());
                    callback.addChild(session);
=======
                    OMElement odeSession = factory.createOMElement("session", odeSessNS);
                    OMElement intSession = factory.createOMElement("session", intalioSessNS);
                    odeSession.setText(callbackEpr.getSessionId());
                    intSession.setText(callbackEpr.getSessionId());
                    odeCallback.addChild(odeSession);
                    intCallback.addChild(intSession);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                }
                __log.debug("Sending stateful FROM epr in message header using session " + callbackEpr.getSessionId());
            }
Solution content
                intCallback.addChild(address.cloneOMElement());
                address.setText(callbackEpr.getUrl());
                if (callbackEpr.getSessionId() != null) {
                    OMElement odeSession = factory.createOMElement("session", odeSessNS);
                    OMElement intSession = factory.createOMElement("session", intalioSessNS);
                    odeSession.setText(callbackEpr.getSessionId());
                    intSession.setText(callbackEpr.getSessionId());
                    odeCallback.addChild(odeSession);
                    intCallback.addChild(intSession);
                }
                __log.debug("Sending stateful FROM epr in message header using session " + callbackEpr.getSessionId());
            }
File
SessionOutHandler.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
                if (operation.equals("deploy")) {
                    OMElement deployElement = messageContext.getEnvelope().getBody().getFirstElement();
                    OMElement namePart = deployElement.getFirstChildWithName(new QName(null, "name"));
<<<<<<< HEAD
=======
                    // "be liberal in what you accept from others"
                    if (namePart == null) {
                       namePart = OMUtils.getFirstChildWithName(deployElement, "name");
                       if( namePart == null ) {
                               throw new OdeFault("The name part is missing");
                       } else if (__log.isWarnEnabled()) {
                            __log.warn("Invalid incoming request detected for operation " + messageContext.getAxisOperation().getName() + ". Name part should have no namespace but has " + namePart.getQName().getNamespaceURI());
                        }
                    }

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                    OMElement packagePart = deployElement.getFirstChildWithName(new QName(null, "package"));

                    // "be liberal in what you accept from others"
Solution content
                if (operation.equals("deploy")) {
                    OMElement deployElement = messageContext.getEnvelope().getBody().getFirstElement();
                    OMElement namePart = deployElement.getFirstChildWithName(new QName(null, "name"));
                    // "be liberal in what you accept from others"
                    if (namePart == null) {
                       namePart = OMUtils.getFirstChildWithName(deployElement, "name");
                       if( namePart == null ) {
                               throw new OdeFault("The name part is missing");
                       } else if (__log.isWarnEnabled()) {
                            __log.warn("Invalid incoming request detected for operation " + messageContext.getAxisOperation().getName() + ". Name part should have no namespace but has " + namePart.getQName().getNamespaceURI());
                        }
                    }

                    OMElement packagePart = deployElement.getFirstChildWithName(new QName(null, "package"));

                    // "be liberal in what you accept from others"
File
DeploymentWebService.java
Developer's decision
Version 2
Kind of conflict
Comment
If statement
Chunk
Conflicting content
    public ProcessManagement getProcessMgmt() {
        return _processMgmt;
<<<<<<< HEAD
    }

    public InstanceManagement getInstanceMgmt() {
        return _instanceMgmt;
    }

    static class DynamicMessageReceiver extends AbstractMessageReceiver {
        T _service;

        public DynamicMessageReceiver(T service) {
            _service = service;
        }

        public void invokeBusinessLogic(MessageContext messageContext) throws AxisFault {
            DynamicService service = new DynamicService(_service);
            MessageContext outMsgContext = Utils.createOutMessageContext(messageContext);
            outMsgContext.getOperationContext().addMessageContext(outMsgContext);
            SOAPFactory soapFactory = getSOAPFactory(messageContext);
            SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
            outMsgContext.setEnvelope(envelope);

            OMElement response;
            try {
                response = service.invoke(messageContext.getAxisOperation().getName().getLocalPart(),
                                          messageContext.getEnvelope().getBody().getFirstElement());
                if (response != null) {
                    envelope.getBody().addChild(response);
                }
            } catch (Exception e) {
                // Building a nicely formatted fault
                envelope.getBody().addFault(toSoapFault(e, soapFactory));
            }
            AxisEngine.send(outMsgContext);
        }

        private SOAPFault toSoapFault(Exception e, SOAPFactory soapFactory) {
            SOAPFault fault = soapFactory.createSOAPFault();
            SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault);
            code.setText(new QName(Namespaces.SOAP_ENV_NS, "Server"));
            SOAPFaultReason reason = soapFactory.createSOAPFaultReason(fault);
            reason.setText(e.toString());
    
                OMElement detail = soapFactory
                        .createOMElement(new QName(Namespaces.ODE_PMAPI_NS, e.getClass().getSimpleName()));
            StringWriter stack = new StringWriter();
            e.printStackTrace(new PrintWriter(stack));
            detail.setText(stack.toString());
            SOAPFaultDetail soapDetail = soapFactory.createSOAPFaultDetail(fault);
            soapDetail.addDetailEntry(detail);
            return fault;
        }
=======
    }

    public InstanceManagement getInstanceMgmt() {
        return _instanceMgmt;
    }

    class DynamicMessageReceiver extends AbstractMessageReceiver {
        T _service;

        public DynamicMessageReceiver(T service) {
            _service = service;
        }

        public void invokeBusinessLogic(MessageContext messageContext) throws AxisFault {
            DynamicService service = new DynamicService(_service);
            MessageContext outMsgContext = Utils.createOutMessageContext(messageContext);
            outMsgContext.getOperationContext().addMessageContext(outMsgContext);
            SOAPFactory soapFactory = getSOAPFactory(messageContext);
            SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
            outMsgContext.setEnvelope(envelope);

            OMElement response;
            try {
                response = service.invoke(messageContext.getAxisOperation().getName().getLocalPart(),
                                          messageContext.getEnvelope().getBody().getFirstElement());
                if (response != null) {
                    envelope.getBody().addChild(response);
                }
            } catch (Exception e) {
                // Building a nicely formatted fault
                envelope.getBody().addFault(toSoapFault(e, soapFactory));
            }
            AxisEngine.send(outMsgContext);
    }

        private SOAPFault toSoapFault(Exception e, SOAPFactory soapFactory) {
        SOAPFault fault = soapFactory.createSOAPFault();
        SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault);
        code.setText(new QName(Namespaces.SOAP_ENV_NS, "Server"));
        SOAPFaultReason reason = soapFactory.createSOAPFaultReason(fault);
        reason.setText(e.toString());

            OMElement detail = soapFactory
                    .createOMElement(new QName(Namespaces.ODE_PMAPI_NS, e.getClass().getSimpleName()));
        StringWriter stack = new StringWriter();
        e.printStackTrace(new PrintWriter(stack));
        detail.setText(stack.toString());
        SOAPFaultDetail soapDetail = soapFactory.createSOAPFaultDetail(fault);
        soapDetail.addDetailEntry(detail);
        return fault;
    }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

}
Solution content
    }

    public ProcessManagement getProcessMgmt() {
        return _processMgmt;
    }

    public InstanceManagement getInstanceMgmt() {
        return _instanceMgmt;
    }

    class DynamicMessageReceiver extends AbstractMessageReceiver {
        T _service;

        public DynamicMessageReceiver(T service) {
            _service = service;
        }

        public void invokeBusinessLogic(MessageContext messageContext) throws AxisFault {
            DynamicService service = new DynamicService(_service);
            MessageContext outMsgContext = Utils.createOutMessageContext(messageContext);
            outMsgContext.getOperationContext().addMessageContext(outMsgContext);
            SOAPFactory soapFactory = getSOAPFactory(messageContext);
            SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
            outMsgContext.setEnvelope(envelope);

            OMElement response;
            try {
                response = service.invoke(messageContext.getAxisOperation().getName().getLocalPart(),
                                          messageContext.getEnvelope().getBody().getFirstElement());
                if (response != null) {
                    envelope.getBody().addChild(response);
                }
            } catch (Exception e) {
                // Building a nicely formatted fault
                envelope.getBody().addFault(toSoapFault(e, soapFactory));
            }
            AxisEngine.send(outMsgContext);
    }

        private SOAPFault toSoapFault(Exception e, SOAPFactory soapFactory) {
        SOAPFault fault = soapFactory.createSOAPFault();
        SOAPFaultCode code = soapFactory.createSOAPFaultCode(fault);
        code.setText(new QName(Namespaces.SOAP_ENV_NS, "Server"));
        SOAPFaultReason reason = soapFactory.createSOAPFaultReason(fault);
        reason.setText(e.toString());

            OMElement detail = soapFactory
                    .createOMElement(new QName(Namespaces.ODE_PMAPI_NS, e.getClass().getSimpleName()));
        StringWriter stack = new StringWriter();
        e.printStackTrace(new PrintWriter(stack));
        detail.setText(stack.toString());
        SOAPFaultDetail soapDetail = soapFactory.createSOAPFaultDetail(fault);
        soapDetail.addDetailEntry(detail);
        return fault;
    }

}
File
ManagementService.java
Developer's decision
Version 2
Kind of conflict
Attribute
Class signature
Method declaration
Chunk
Conflicting content
package org.apache.ode.axis2.util;

<<<<<<< HEAD
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.gbean.AbstractNameQuery;
import org.apache.geronimo.kernel.GBeanNotFoundException;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.KernelRegistry;
import org.apache.geronimo.kernel.config.MultiParentClassLoader;
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.repository.Repository;

import javax.transaction.TransactionManager;
import java.io.File;
import java.net.MalformedURLException;
import java.util.Collections;
import java.util.Iterator;
import java.util.Set;
import org.apache.geronimo.transaction.context.TransactionContextManager;
import org.apache.geronimo.transaction.context.GeronimoTransactionManager;
=======
import javax.transaction.TransactionManager;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

public class GeronimoFactory {
Solution content
package org.apache.ode.axis2.util;

import javax.transaction.TransactionManager;

public class GeronimoFactory {
File
GeronimoFactory.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.axis2.context.MessageContext;
import org.apache.ode.axis2.soapbinding.SoapMessageConverter;
import org.apache.ode.utils.DOMUtils;
<<<<<<< HEAD
import org.apache.ode.bpel.engine.MemBackedMessageImpl;
=======
import org.apache.ode.bpel.engine.MessageImpl;
import org.apache.ode.bpel.memdao.MessageDAOImpl;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Solution content
import org.apache.axis2.context.MessageContext;
import org.apache.ode.axis2.util.SoapMessageConverter;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.bpel.engine.MessageImpl;
import org.apache.ode.bpel.memdao.MessageDAOImpl;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
File
SoapMessageConverterTest.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
    public void testCreateSOAPRequest() throws Exception {
        MessageContext msgCtx = new MessageContext();
<<<<<<< HEAD
        MemBackedMessageImpl odeMsg = new MemBackedMessageImpl(null, req1.getDocumentElement(), null, false);
=======
        MessageImpl odeMsg = new MessageImpl(new MessageDAOImpl(null));
        odeMsg.setMessage(req1.getDocumentElement());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        portmapper.createSoapRequest(msgCtx, odeMsg, portType.getOperation("getObjectId", null, null));
        SOAPEnvelope env = msgCtx.getEnvelope();
        System.out.println("testCreateSOAPRequest: " + env);
Solution content
    public void testCreateSOAPRequest() throws Exception {
        MessageContext msgCtx = new MessageContext();
        MessageImpl odeMsg = new MessageImpl(new MessageDAOImpl(null));
        odeMsg.setMessage(req1.getDocumentElement());
        portmapper.createSoapRequest(msgCtx, odeMsg, portType.getOperation("getObjectId", null, null));
        SOAPEnvelope env = msgCtx.getEnvelope();
        System.out.println("testCreateSOAPRequest: " + env);
File
SoapMessageConverterTest.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
    public void testCreateSOAPRequestFail() throws Exception {
        MessageContext msgCtx = new MessageContext();
<<<<<<< HEAD
        MemBackedMessageImpl odeMsg = new MemBackedMessageImpl(null, req1bad.getDocumentElement(), null, false);
=======
        MessageImpl odeMsg = new MessageImpl(new MessageDAOImpl(null));
        odeMsg.setMessage(req1bad.getDocumentElement());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        try {
            portmapper.createSoapRequest(msgCtx, odeMsg, portType.getOperation("getObjectId", null, null));
            fail("Should have caused an ex");
Solution content
    public void testCreateSOAPRequestFail() throws Exception {
        MessageContext msgCtx = new MessageContext();
        MessageImpl odeMsg = new MessageImpl(new MessageDAOImpl(null));
        odeMsg.setMessage(req1bad.getDocumentElement());
        try {
            portmapper.createSoapRequest(msgCtx, odeMsg, portType.getOperation("getObjectId", null, null));
            fail("Should have caused an ex");
File
SoapMessageConverterTest.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
    public void testParseRequest() throws Exception {
        MessageContext msgCtx = new MessageContext();
<<<<<<< HEAD
        MemBackedMessageImpl odeMsg1 = new MemBackedMessageImpl(null, req1.getDocumentElement(), null, false);
=======
        MessageImpl odeMsg1 = new MessageImpl(new MessageDAOImpl(null));
        odeMsg1.setMessage(req1.getDocumentElement());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        odeMsg1.setHeaderPart("DocumentumRequestHeader", DOMUtils.findChildByName(req1.getDocumentElement(),
                new QName("http://documentum.com/ws/2005/services", "DocumentumSecurityToken")));
        portmapper.createSoapRequest(msgCtx, odeMsg1, op1);
Solution content
    public void testParseRequest() throws Exception {
        MessageContext msgCtx = new MessageContext();
        MessageImpl odeMsg1 = new MessageImpl(new MessageDAOImpl(null));
        odeMsg1.setMessage(req1.getDocumentElement());
        odeMsg1.setHeaderPart("DocumentumRequestHeader", DOMUtils.findChildByName(req1.getDocumentElement(),
                new QName("http://documentum.com/ws/2005/services", "DocumentumSecurityToken")));
        portmapper.createSoapRequest(msgCtx, odeMsg1, op1);
File
SoapMessageConverterTest.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
        SOAPEnvelope env = msgCtx.getEnvelope();
        System.out.println("testParseRequest: " + env);
        Element odeMsgElmt = DOMUtils.stringToDOM("");
<<<<<<< HEAD
        MemBackedMessageImpl odeMsg2 = new MemBackedMessageImpl(null, odeMsgElmt, null, false);
=======
        MessageImpl odeMsg2 = new MessageImpl(new MessageDAOImpl(null));
        odeMsg1.setMessage(odeMsgElmt);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        portmapper.parseSoapRequest(odeMsg2, env, op1);

        System.out.println(DOMUtils.domToString(odeMsg2.getMessage()));
Solution content
        SOAPEnvelope env = msgCtx.getEnvelope();
        System.out.println("testParseRequest: " + env);
        Element odeMsgElmt = DOMUtils.stringToDOM("");
        MessageImpl odeMsg2 = new MessageImpl(new MessageDAOImpl(null));
        odeMsg1.setMessage(odeMsgElmt);
        portmapper.parseSoapRequest(odeMsg2, env, op1);

        System.out.println(DOMUtils.domToString(odeMsg2.getMessage()));
File
SoapMessageConverterTest.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
        SOAPEnvelope se = builder.getSOAPEnvelope();

        Element msg = DOMUtils.stringToDOM("");
<<<<<<< HEAD
        MemBackedMessageImpl odeMsg = new MemBackedMessageImpl(null, msg, null, false);
=======
        MessageImpl odeMsg = new MessageImpl(new MessageDAOImpl(null));
        odeMsg.setMessage(msg);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        portmaper1.parseSoapRequest(odeMsg, se, opHello);
        System.out.println(DOMUtils.domToString(msg));
    }
Solution content
        SOAPEnvelope se = builder.getSOAPEnvelope();

        Element msg = DOMUtils.stringToDOM("");
        MessageImpl odeMsg = new MessageImpl(new MessageDAOImpl(null));
        odeMsg.setMessage(msg);
        portmaper1.parseSoapRequest(odeMsg, se, opHello);
        System.out.println(DOMUtils.domToString(msg));
    }
File
SoapMessageConverterTest.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
    private static final long serialVersionUID = 1L;

<<<<<<< HEAD
    /** CorrelationSet identifier. */
    private int _csetId;
    /** Key values. */
    private final String _keyValues[];
    /** System-Wide Unique? */
    private boolean unique = false;
=======
    /** CorrelationSet name. */
    private String _csetName;
    /** Key values. */
    private String _keyValues[];
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    /**
     * Constructor.
Solution content
    private static final long serialVersionUID = 1L;

    /** CorrelationSet name. */
    private String _csetName;
    /** Key values. */
    private String _keyValues[];

    /**
     * Constructor.
File
CorrelationKey.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
Chunk
Conflicting content
    }

    public CorrelationKey(String canonicalForm) {
<<<<<<< HEAD
        int firstTilde = -1;
        if (canonicalForm != null) {
            firstTilde = canonicalForm.indexOf('~') ;
            _csetId = Integer.parseInt(canonicalForm.substring(0, firstTilde == -1 ? canonicalForm.length() : firstTilde));
        }
=======
        int firstTilde = canonicalForm.indexOf('~');
        _csetName = canonicalForm.substring(0, firstTilde == -1 ? canonicalForm.length() : firstTilde);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

        if (firstTilde != -1) {
            List keys = new ArrayList();
Solution content
    }

    public CorrelationKey(String canonicalForm) {
        int firstTilde = canonicalForm.indexOf('~');
        _csetName = canonicalForm.substring(0, firstTilde == -1 ? canonicalForm.length() : firstTilde);

        if (firstTilde != -1) {
            List keys = new ArrayList();
File
CorrelationKey.java
Developer's decision
Version 2
Kind of conflict
Attribute
If statement
Method invocation
Variable
Chunk
Conflicting content
 * 

As per BPEL specification, appendix A.

*/ public class FaultException extends Exception { <<<<<<< HEAD private static final long serialVersionUID = 389190682205802035L; private final QName _qname; public FaultException(QName qname, String message, Throwable cause) { super(qname.toString() + ": " + message, cause); _qname = qname; } /** * Create a new instance. * @param qname the QName of the fault * @param message a descriptive message for the exception */ public FaultException(QName qname, String message) { this(qname, message, null); } public FaultException(QName qname) { this(qname, null, null); } public FaultException(QName qname, Throwable cause) { this(qname, null, cause); } /** * Get the (official) QName of this fault. * @return the QName of the fault */ public QName getQName() { return _qname; ======= private static final long serialVersionUID = 389190682205802035L; private QName _qname; /** * Create a new instance. * * @param qname the QName of the fault * @param message a descriptive message for the exception */ public FaultException(QName qname, String message) { super(message); _qname = qname; } public FaultException(QName qname) { super(qname.toString()); _qname = qname; } public FaultException(QName qname, String message, Throwable cause) { super(message, cause); this._qname = qname; } public FaultException(QName qname, Throwable cause) { super(cause); this._qname = qname; } /** * Get the (official) QName of this fault. * * @return the QName of the fault */ public QName getQName() { return _qname; >>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a } }
Solution content
 * 

As per BPEL specification, appendix A.

*/ public class FaultException extends Exception { private static final long serialVersionUID = 389190682205802035L; private QName _qname; /** * Create a new instance. * * @param qname the QName of the fault * @param message a descriptive message for the exception */ public FaultException(QName qname, String message) { super(message); _qname = qname; } public FaultException(QName qname) { super(qname.toString()); _qname = qname; } public FaultException(QName qname, String message, Throwable cause) { super(message, cause); this._qname = qname; } public FaultException(QName qname, Throwable cause) { super(cause); this._qname = qname; } /** * Get the (official) QName of this fault. * * @return the QName of the fault */ public QName getQName() { return _qname; } }
File
FaultException.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
Method declaration
Method signature
Return statement
Chunk
Conflicting content
    /** If set, will filter on the process id (PID) and select all matching process definitions */
    private List pids;
<<<<<<< HEAD
=======

    /** If set, the PID filter will work negatively */
    private boolean arePidsNegative;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    /** If set, will filter on the process name (accepts ending with wildcard) */
    private String nameFilter;
Solution content
    /** If set, will filter on the process id (PID) and select all matching process definitions */
    private List pids;

    /** If set, the PID filter will work negatively */
    private boolean arePidsNegative;

    /** If set, will filter on the process name (accepts ending with wildcard) */
    private String nameFilter;
File
InstanceFilter.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
Chunk
Conflicting content
        PID {
            void process(InstanceFilter filter, String key, String op, String value) {
                filter.pids = parse(value);
<<<<<<< HEAD
=======
                filter.arePidsNegative = "<>".equals(op);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            }
        },
        NAME {
Solution content
        PID {
            void process(InstanceFilter filter, String key, String op, String value) {
                filter.pids = parse(value);
                filter.arePidsNegative = "<>".equals(op);
            }
        },
        NAME {
File
InstanceFilter.java
Developer's decision
Version 2
Kind of conflict
Attribute
Enum value
Method invocation
Variable
Chunk
Conflicting content
        return pids;
    }

<<<<<<< HEAD
=======
    public boolean arePidsNegative() {
        return arePidsNegative;
    }

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public List getIidFilter() {
        return iids;
    }
Solution content
        return pids;
    }

    public boolean arePidsNegative() {
        return arePidsNegative;
    }

    public List getIidFilter() {
        return iids;
    }
File
InstanceFilter.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
        StringBuffer buf = new StringBuffer();
        buf.append("InstanceFilter {");
        buf.append("iids="+iids);
<<<<<<< HEAD
        buf.append(",pids="+pids);
=======
        if( !arePidsNegative ) {
            buf.append(",pids="+pids);
        } else {
            buf.append(",-pids="+pids);
        }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        buf.append(",name="+nameFilter);
        buf.append(",namespace="+namespaceFilter);
        buf.append(",status="+statusFilter);
Solution content
        StringBuffer buf = new StringBuffer();
        buf.append("InstanceFilter {");
        buf.append("iids="+iids);
        if( !arePidsNegative ) {
            buf.append(",pids="+pids);
        } else {
            buf.append(",-pids="+pids);
        }
        buf.append(",name="+nameFilter);
        buf.append(",namespace="+namespaceFilter);
        buf.append(",status="+statusFilter);
File
InstanceFilter.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Chunk
Conflicting content
 * Correlation matched a process instance on inbound message.
 */
public class CorrelationMatchEvent extends ProcessMessageExchangeEvent {
<<<<<<< HEAD
  private static final long serialVersionUID = 1L;
  private CorrelationKey _correlationKey;

  public CorrelationMatchEvent(
    QName processName, QName processId, Long processInstanceId, CorrelationKey correlationKey) {
    super(PROCESS_INPUT, processName,processId,processInstanceId);
    _correlationKey = correlationKey;
  }

    public CorrelationKey getCorrelationKey() {
    return _correlationKey;
  }

  public void setCorrelationKey(CorrelationKey correlationKey) {
    _correlationKey = correlationKey;
  }

  public TYPE getType() {
    return TYPE.correlation;
  }

}
=======
    private static final long serialVersionUID = 1L;

    // left out for backward-compatibility
    private CorrelationKey _correlationKey;
    private CorrelationKeySet _correlationKeySet;

    public CorrelationMatchEvent(QName processName, QName processId, Long processInstanceId, CorrelationKeySet correlationKeySet) {
        super(PROCESS_INPUT, processName, processId, processInstanceId);
        _correlationKeySet = correlationKeySet;
    }

    public CorrelationKeySet getCorrelationKeySet() {
        // backward compatibility; add up
        if (_correlationKey != null) {
            if( _correlationKeySet == null ) {
                _correlationKeySet = new CorrelationKeySet();
            }
            if(!_correlationKeySet.contains(_correlationKey)) {
                _correlationKeySet.add(_correlationKey);
            }
        }
        
        return _correlationKeySet;
    }

    public void setCorrelationKey(CorrelationKeySet correlationKeySet) {
        _correlationKeySet = correlationKeySet;
    }

    public TYPE getType() {
        return TYPE.correlation;
    }
}
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
Solution content
 * Correlation matched a process instance on inbound message.
 */
public class CorrelationMatchEvent extends ProcessMessageExchangeEvent {
    private static final long serialVersionUID = 1L;

    // left out for backward-compatibility
    private CorrelationKey _correlationKey;
    private CorrelationKeySet _correlationKeySet;

    public CorrelationMatchEvent(QName processName, QName processId, Long processInstanceId, CorrelationKeySet correlationKeySet) {
        super(PROCESS_INPUT, processName, processId, processInstanceId);
        _correlationKeySet = correlationKeySet;
    }

    public CorrelationKeySet getCorrelationKeySet() {
        // backward compatibility; add up
        if (_correlationKey != null) {
            if( _correlationKeySet == null ) {
                _correlationKeySet = new CorrelationKeySet();
            }
            if(!_correlationKeySet.contains(_correlationKey)) {
                _correlationKeySet.add(_correlationKey);
            }
        }
        
        return _correlationKeySet;
    }

    public void setCorrelationKey(CorrelationKeySet correlationKeySet) {
        _correlationKeySet = correlationKeySet;
    }

    public TYPE getType() {
        return TYPE.correlation;
    }
}
File
CorrelationMatchEvent.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
Method declaration
Chunk
Conflicting content
    
    private QName _portType;
    private String _operation;
<<<<<<< HEAD
    private String _resource;
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    private String _mexId;
    private short _aspect;
Solution content
    
    private QName _portType;
    private String _operation;
    private String _mexId;
    private short _aspect;
File
ProcessMessageExchangeEvent.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
    public void setPortType(QName portType) {
        _portType = portType;
    }
<<<<<<< HEAD

    public String getResource() {
        return _resource;
    }

    public void setResource(String resource) {
        this._resource = resource;
    }
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
    public void setPortType(QName portType) {
        _portType = portType;
    }
}
File
ProcessMessageExchangeEvent.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
  public ScopeCompletionEvent() {
  }
<<<<<<< HEAD

    /**
     * @param fault The fault to set.
     */
    public void setFault(QName fault) {
        _fault = fault;
    }

    /**
     * @return Returns the fault.
     */
    public QName getFault() {
        return _fault;
    }
  
    public boolean isSuccess() {
        return _success;
    }
    public void setSuccess(boolean success) {
        _success = success;
    }
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
  public ScopeCompletionEvent() {
  }
}
File
ScopeCompletionEvent.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
 */
package org.apache.ode.bpel.evt;

<<<<<<< HEAD
=======
import org.w3c.dom.Element;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.w3c.dom.Node;

public class VariableModificationEvent extends VariableEvent {
Solution content
 */
package org.apache.ode.bpel.evt;

import org.w3c.dom.Element;
import org.w3c.dom.Node;

public class VariableModificationEvent extends VariableEvent {
File
VariableModificationEvent.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
public class VariableModificationEvent extends VariableEvent {
    private static final long serialVersionUID = 1L;

<<<<<<< HEAD
    private Node newValue;
=======
    private transient Node newValue;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    public VariableModificationEvent() {
        super();
Solution content
public class VariableModificationEvent extends VariableEvent {
    private static final long serialVersionUID = 1L;

    private transient Node newValue;

    public VariableModificationEvent() {
        super();
File
VariableModificationEvent.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
     */
    void unregister(QName pid) throws BpelEngineException;

<<<<<<< HEAD
    
    /**
     * Inquire of the engine the invocation styles that are supported for a given service. 
     * @param serviceId service identifier 
     * @return set of supported {@link InvocationStyle}s
     */
    Set getSupportedInvocationStyle(QName serviceId);
    
    /**
     * Create a "my role" message exchange for invoking a BPEL process.
     * 
     * @param serviceId
     *            the service id of the process being called, if known
     * @param operation
     *            name of the operation
     * 
     * @return {@link MyRoleMessageExchange} the newly created message exchange
     */
    MyRoleMessageExchange createMessageExchange(InvocationStyle istyle, QName serviceId, String operation,
                                                String foreignKey) throws BpelEngineException;

    RESTInMessageExchange createMessageExchange(Resource resource, String foreignKey) throws BpelEngineException;

    /**
     * Retrieve a message identified by the given identifer.
     * 
     * @param mexId
     *            message exhcange identifier
     * @return associated message exchange
     */
    MessageExchange getMessageExchange(String mexId) 
        throws BpelEngineException;

    MessageExchange getMessageExchangeByForeignKey(String foreignKey) 
        throws BpelEngineException;
=======
    void cleanupProcess(ProcessConf conf) throws BpelEngineException;
    
    /**
     * @param pid The process definition QName
     * @return The debugger support.
     * @throws BpelEngineException if we could not find the process
     */
    DebuggerContext getDebugger(QName pid) throws BpelEngineException;

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
     */
    void unregister(QName pid) throws BpelEngineException;

    void cleanupProcess(ProcessConf conf) throws BpelEngineException;
    
    /**
     * @param pid The process definition QName
     * @return The debugger support.
     * @throws BpelEngineException if we could not find the process
     */
    DebuggerContext getDebugger(QName pid) throws BpelEngineException;

}
File
BpelServer.java
Developer's decision
Version 2
Kind of conflict
Comment
Method interface
Chunk
Conflicting content
     */
    @Override 
    public boolean equals(Object other) {
<<<<<<< HEAD
    	if (other == null) {
    		return false;
    	}
=======
        if (!(other instanceof Endpoint)) {
            return false;
        }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        Endpoint o = (Endpoint) other;
        return o.serviceName.equals(serviceName) && o.portName.equals(portName);
    }
Solution content
     */
    @Override 
    public boolean equals(Object other) {
        if (!(other instanceof Endpoint)) {
            return false;
        }
        Endpoint o = (Endpoint) other;
        return o.serviceName.equals(serviceName) && o.portName.equals(portName);
    }
File
Endpoint.java
Developer's decision
Version 2
Kind of conflict
If statement
Chunk
Conflicting content
    EndpointReference convertEndpoint(QName targetType, Element sourceEndpoint);

    /**
<<<<<<< HEAD
     * Convert an endpoint reference into a set of key/value pairs that may be necessary to look up config information.
     * This implies a contract between the implementation and the caller.
     * 

For instance a WSDL endpoint reference may be converted into {service => foo, port => bar}. * @param epr * @return a map containing the relevant information for config lookup ======= * * @param epr * @return >>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a */ Map getConfigLookup(EndpointReference epr); }

Solution content
    EndpointReference convertEndpoint(QName targetType, Element sourceEndpoint);

    /**
     * 
     * @param epr
     * @return
     */
    Map getConfigLookup(EndpointReference epr);
}
File
EndpointReferenceContext.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
     * @return the final status of the operation
     * 
     */
<<<<<<< HEAD
    MessageExchange.Status invokeBlocking() throws BpelEngineException, TimeoutException;
=======
    @SuppressWarnings("unchecked")
    Future invoke(Message request);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    /**
     * Invoke a transactional process: this method must be invoked in a transaction. The invoking thread
Solution content
     */
    @SuppressWarnings("unchecked")
    Future invoke(Message request);

    /**
File
MyRoleMessageExchange.java
Developer's decision
Version 2
Kind of conflict
Method interface
Chunk
Conflicting content
    void release(boolean instanceSucceeded);
     * @return service name
     */
    QName getServiceName();
<<<<<<< HEAD

=======
    
    /**
     * Should be called by the external partner when it's done with the
     * message exchange. Ncessary for a better resource management and
     * proper mex cleanup.
     */
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
     * @return service name
     */
    QName getServiceName();
    
    /**
     * Should be called by the external partner when it's done with the
     * message exchange. Ncessary for a better resource management and
     * proper mex cleanup.
     */
    void release(boolean instanceSucceeded);
}
File
MyRoleMessageExchange.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
import javax.xml.namespace.QName;

import org.apache.ode.bpel.evt.BpelEvent;
<<<<<<< HEAD
import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
import org.apache.ode.bpel.rapi.ProcessModel;
=======
import org.apache.ode.bpel.o.OFailureHandling;
import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.utils.CronExpression;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Solution content
import javax.xml.namespace.QName;

import org.apache.ode.bpel.evt.BpelEvent;
import org.apache.ode.bpel.o.OFailureHandling;
import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
import org.apache.ode.utils.CronExpression;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
File
ProcessConf.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
    boolean isEventEnabled(List scopeNames, BpelEvent.TYPE type);

<<<<<<< HEAD
    /**
     * Returns a list of properties associtated to this endpoint.
     * @param epr
     * @return map of property/value pairs
     */
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public Map getEndpointProperties(EndpointReference epr);

    boolean isCleanupCategoryEnabled(boolean instanceSucceeded, CLEANUP_CATEGORY category);
Solution content
    boolean isEventEnabled(List scopeNames, BpelEvent.TYPE type);

    public Map getEndpointProperties(EndpointReference epr);

    boolean isCleanupCategoryEnabled(boolean instanceSucceeded, CLEANUP_CATEGORY category);
File
ProcessConf.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
    Set getCleanupCategories(boolean instanceSucceeded);

    List getCronJobs();
<<<<<<< HEAD

=======
    
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public enum CLEANUP_CATEGORY {
        INSTANCE,
        VARIABLES,
Solution content
    Set getCleanupCategories(boolean instanceSucceeded);

    List getCronJobs();
    
    public enum CLEANUP_CATEGORY {
        INSTANCE,
        VARIABLES,
File
ProcessConf.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
            return valueOf(CLEANUP_CATEGORY.class, lowerCase.toUpperCase());
        }
    }
<<<<<<< HEAD

=======
    
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public class CronJob {
        private CronExpression _cronExpression;
        
Solution content
            return valueOf(CLEANUP_CATEGORY.class, lowerCase.toUpperCase());
        }
    }
    
    public class CronJob {
        private CronExpression _cronExpression;
        
File
ProcessConf.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
        }
    }
    
<<<<<<< HEAD
    public class CleanupInfo implements Serializable {
=======
    public class CleanupInfo implements java.io.Serializable {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        private List _filters = new ArrayList();
        
        private final Set _categories = EnumSet.noneOf(CLEANUP_CATEGORY.class);
Solution content
        }
    }
    
    public class CleanupInfo implements java.io.Serializable {
        private List _filters = new ArrayList();
        
        private final Set _categories = EnumSet.noneOf(CLEANUP_CATEGORY.class);
File
ProcessConf.java
Developer's decision
Version 2
Kind of conflict
Class signature
Chunk
Conflicting content
            return buf.toString();
        }
    }
<<<<<<< HEAD
    
    public class PropagationRule implements Serializable {
        private static final long serialVersionUID = 5496856170262204149L;

        private String fromPL;
        private String toPL;
        private List contexts = new ArrayList();
        public String getFromPL() {
            return fromPL;
        }
        public void setFromPL(String fromPL) {
            this.fromPL = fromPL;
        }
        public String getToPL() {
            return toPL;
        }
        public void setToPL(String toPL) {
            this.toPL = toPL;
        }
        public List getContexts() {
            return contexts;
        }
        public void setContexts(List contexts) {
            this.contexts = contexts;
        }
    }
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
            return buf.toString();
        }
    }
}
File
ProcessConf.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Chunk
Conflicting content
        
        /** A process property was changed. */
        PROPERTY_CHANGED,
<<<<<<< HEAD

=======
        
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        /** Cron schedule settings have been changed for the process */
        SCHEDULE_SETTINGS_CHANGED
    }
Solution content
        
        /** A process property was changed. */
        PROPERTY_CHANGED,
        
        /** Cron schedule settings have been changed for the process */
        SCHEDULE_SETTINGS_CHANGED
    }
File
ProcessStoreEvent.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
 */
public interface Scheduler {
    void setJobProcessor(JobProcessor processor) throws ContextException;
<<<<<<< HEAD

    void setPolledRunnableProcesser(JobProcessor polledRunnableProcessor);

=======
    
    void setPolledRunnableProcesser(JobProcessor polledRunnableProcessor);
    
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    /**
     * Schedule a persisted job. Persisted jobs MUST survive system failure.
     * They also must not be scheduled unless the transaction associated with
Solution content
 */
public interface Scheduler {
    void setJobProcessor(JobProcessor processor) throws ContextException;
    
    void setPolledRunnableProcesser(JobProcessor polledRunnableProcessor);
    
    /**
     * Schedule a persisted job. Persisted jobs MUST survive system failure.
     * They also must not be scheduled unless the transaction associated with
File
Scheduler.java
Developer's decision
Version 1
Kind of conflict
Method interface
Chunk
Conflicting content
     * @return
     * @param when
     * @throws ContextException
<<<<<<< HEAD
     */
    String scheduleMapSerializableRunnable(MapSerializableRunnable runnable, Date when) throws ContextException;

    void jobCompleted(String jobId);
=======
     */
    String scheduleMapSerializableRunnable(MapSerializableRunnable runnable, Date when) throws ContextException;

    /**
     * Schedule a volatile (non-persisted) job. Volatile jobs should not be
     * saved in the database and should not survive system crash. Volatile
     * jobs scheduled from a transactional context should be scheduled
     * regardless of whether the transaction commits.
     *
     * @param transacted should the job be executed in a transaction?
     * @param jobDetail information about the job
     * @param when does the job should be executed?
     * @return unique (as far as the scheduler is concerned) job identifier
     */
    String scheduleVolatileJob(boolean transacted, JobDetails jobDetail, Date when) throws ContextException;

    /**
     * Schedule a volatile job for right now
     * @see #scheduleVolatileJob(boolean, java.util.Map, java.util.Date)
     */
    String scheduleVolatileJob(boolean transacted, JobDetails jobDetail) throws ContextException;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    /**
     * Make a good effort to cancel the job. If its already running no big
Solution content
     * @param when
     * @return
     * @throws ContextException
     */
    String scheduleMapSerializableRunnable(MapSerializableRunnable runnable, Date when) throws ContextException;

    /**
     * Schedule a volatile (non-persisted) job. Volatile jobs should not be
     * saved in the database and should not survive system crash. Volatile
     * jobs scheduled from a transactional context should be scheduled
     * regardless of whether the transaction commits.
     *
     * @param transacted should the job be executed in a transaction?
     * @param jobDetail information about the job
     * @param when does the job should be executed?
     * @return unique (as far as the scheduler is concerned) job identifier
     */
    String scheduleVolatileJob(boolean transacted, JobDetails jobDetail, Date when) throws ContextException;

    /**
     * Schedule a volatile job for right now
     * @see #scheduleVolatileJob(boolean, java.util.Map, java.util.Date)
     */
    String scheduleVolatileJob(boolean transacted, JobDetails jobDetail) throws ContextException;

    /**
     * Make a good effort to cancel the job. If its already running no big
File
Scheduler.java
Developer's decision
Version 2
Kind of conflict
Comment
Method interface
Chunk
Conflicting content
     */
    void cancelJob(String jobId) throws ContextException;

<<<<<<< HEAD
=======
    /**
     * Execute a {@link Callable} in a transactional context. If the callable
     * throws an exception, then the transaction will be rolled back, otherwise
     * the transaction will commit.
     *
     * @param  return type
     * @param transaction transaction to execute
     * @return result
     * @throws Exception
     */
     T execTransaction(Callable transaction)
            throws Exception, ContextException;

    /**
     * Execute a {@link Callable} in a transactional context. If the callable
     * throws an exception, then the transaction will be rolled back, otherwise
     * the transaction will commit. Also, modify the value of the timeout value 
     * that is associated with the transactions started by the current thread. 
     *
     * @param  return type
     * @param transaction transaction to execute
     * @param timeout, The value of the timeout in seconds. If the value is zero, the transaction service uses the default value.
     * @return result
     * @throws Exception
     */
     T execTransaction(Callable transaction, int timeout)
            throws Exception, ContextException;
    
    void setRollbackOnly() throws Exception;

    /**
     * Same as execTransaction but executes in a different thread to guarantee
     * isolation from the main execution thread.
     * @param transaction
     * @return
     * @throws Exception
     * @throws ContextException
     */
     Future execIsolatedTransaction(final Callable transaction)
            throws Exception, ContextException;

    /**
     * @return true if the current thread is associated with a transaction.
     */
    boolean isTransacted();

    /**
     * Register a transaction synchronizer.
     * @param synch synchronizer
     * @throws ContextException
     */
    void registerSynchronizer(Synchronizer synch) throws ContextException;

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    void start();

    void stop();
Solution content
     */
    void cancelJob(String jobId) throws ContextException;

    /**
     * Execute a {@link Callable} in a transactional context. If the callable
     * throws an exception, then the transaction will be rolled back, otherwise
     * the transaction will commit.
     *
     * @param  return type
     * @param transaction transaction to execute
     * @return result
     * @throws Exception
     */
     T execTransaction(Callable transaction)
            throws Exception, ContextException;

    /**
     * Execute a {@link Callable} in a transactional context. If the callable
     * throws an exception, then the transaction will be rolled back, otherwise
     * the transaction will commit. Also, modify the value of the timeout value 
     * that is associated with the transactions started by the current thread. 
     *
     * @param  return type
     * @param transaction transaction to execute
     * @param timeout, The value of the timeout in seconds. If the value is zero, the transaction service uses the default value.
     * @return result
     * @throws Exception
     */
     T execTransaction(Callable transaction, int timeout)
            throws Exception, ContextException;
    
    void setRollbackOnly() throws Exception;

    /**
     * Same as execTransaction but executes in a different thread to guarantee
     * isolation from the main execution thread.
     * @param transaction
     * @return
     * @throws Exception
     * @throws ContextException
     */
     Future execIsolatedTransaction(final Callable transaction)
            throws Exception, ContextException;

    /**
     * @return true if the current thread is associated with a transaction.
     */
    boolean isTransacted();

    /**
     * Register a transaction synchronizer.
     * @param synch synchronizer
     * @throws ContextException
     */
    void registerSynchronizer(Synchronizer synch) throws ContextException;

    void start();

    void stop();
File
Scheduler.java
Developer's decision
Version 2
Kind of conflict
Comment
Method interface
Chunk
Conflicting content
    void shutdown();

<<<<<<< HEAD
=======
    public interface Synchronizer {
        /**
         * Called after the transaction is completed.
         * @param success indicates whether the transaction was comitted
         */
        void afterCompletion(boolean success);

        /**
         * Called before the transaction is completed.
         */
        void beforeCompletion();
    }

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    /**
     * Interface implemented by the object responsible for job execution.
     * @author mszefler
Solution content
    void shutdown();

    public interface Synchronizer {
        /**
         * Called after the transaction is completed.
         * @param success indicates whether the transaction was comitted
         */
        void afterCompletion(boolean success);

        /**
         * Called before the transaction is completed.
         */
        void beforeCompletion();
    }

    /**
     * Interface implemented by the object responsible for job execution.
     * @author mszefler
File
Scheduler.java
Developer's decision
Version 2
Kind of conflict
Interface declaration
Chunk
Conflicting content
    public enum JobType {
        TIMER, 
<<<<<<< HEAD
        
        RESUME, 
        
        /** Response from partner (i.e. the result of a partner-role invoke) has been received. */
        PARTNER_RESPONSE, 
        
        MATCHER, 
        
        /** Invoke a "my role" operation (i.e. implemented by the process). */
        MYROLE_INVOKE, 
        
        MYROLE_INVOKE_ASYNC_RESPONSE,

        INVOKE_CHECK
    }
    
    public static class JobDetails implements Cloneable {
=======
        RESUME, 
        INVOKE_INTERNAL, 
        INVOKE_RESPONSE, 
        MATCHER, 
        INVOKE_CHECK
    }
    
    public static class JobDetails {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        public Long instanceId;
        public String mexId;
        public String processId;
Solution content
    public enum JobType {
        TIMER, 
        RESUME, 
        INVOKE_INTERNAL, 
        INVOKE_RESPONSE, 
        MATCHER, 
        INVOKE_CHECK
    }
    
    public static class JobDetails {
        public Long instanceId;
        public String mexId;
        public String processId;
File
Scheduler.java
Developer's decision
Version 2
Kind of conflict
Class signature
Comment
Enum value
Chunk
Conflicting content
        public String type;
        public String channel;
        public String correlatorId;
<<<<<<< HEAD
        public String correlationKey;
        public Integer retryCount;
        public Boolean inMem;
        public Map detailsExt = new HashMap();

        @Override
        public JobDetails clone() throws CloneNotSupportedException {
          return (JobDetails)super.clone();
        }

=======
        public String correlationKeySet;
        public Integer retryCount;
        public Boolean inMem;
        public Map detailsExt = new HashMap();
        
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        public Boolean getInMem() {
            return inMem == null ? false : inMem;
        }
Solution content
        public String type;
        public String channel;
        public String correlatorId;
        public String correlationKeySet;
        public Integer retryCount;
        public Boolean inMem;
        public Map detailsExt = new HashMap();
        
        public Boolean getInMem() {
            return inMem == null ? false : inMem;
        }
File
Scheduler.java
Developer's decision
Version 2
Kind of conflict
Annotation
Attribute
Method declaration
Method invocation
Chunk
Conflicting content
        public void setCorrelatorId(String correlatorId) {
            this.correlatorId = correlatorId;
        }
<<<<<<< HEAD
        public CorrelationKey getCorrelationKey() {
            return new CorrelationKey(correlationKey);
        }
        public void setCorrelationKey(CorrelationKey correlationKey) {
            this.correlationKey = correlationKey == null ? null : correlationKey.toCanonicalString();
=======
        public CorrelationKeySet getCorrelationKeySet() {
            return new CorrelationKeySet(correlationKeySet);
        }
        public void setCorrelationKeySet(CorrelationKeySet correlationKeySet) {
            this.correlationKeySet = correlationKeySet == null ? null : correlationKeySet.toCanonicalString();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }
        public Integer getRetryCount() {
            return retryCount == null ? 0 : retryCount;
Solution content
        public void setCorrelatorId(String correlatorId) {
            this.correlatorId = correlatorId;
        }
        public CorrelationKeySet getCorrelationKeySet() {
            return new CorrelationKeySet(correlationKeySet);
        }
        public void setCorrelationKeySet(CorrelationKeySet correlationKeySet) {
            this.correlationKeySet = correlationKeySet == null ? null : correlationKeySet.toCanonicalString();
        }
        public Integer getRetryCount() {
            return retryCount == null ? 0 : retryCount;
File
Scheduler.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method declaration
Method invocation
Method signature
Chunk
Conflicting content
            + " type: " + type
            + " channel: " + channel
            + " correlatorId: " + correlatorId
<<<<<<< HEAD
            + " correlationKey: " + correlationKey
=======
            + " correlationKeySet: " + correlationKeySet
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            + " retryCount: " + retryCount
            + " inMem: " + inMem
            + " detailsExt: " + detailsExt
Solution content
            + " type: " + type
            + " channel: " + channel
            + " correlatorId: " + correlatorId
            + " correlationKeySet: " + correlationKeySet
            + " retryCount: " + retryCount
            + " inMem: " + inMem
            + " detailsExt: " + detailsExt
File
Scheduler.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
            this.retry = retry;
        }

<<<<<<< HEAD
    }

=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public interface MapSerializableRunnable extends Runnable, Serializable {
        void storeToDetails(JobDetails details);
        void restoreFromDetails(JobDetails details);
Solution content
            this.retry = retry;
        }
    }

    public interface MapSerializableRunnable extends Runnable, Serializable {
        void storeToDetails(JobDetails details);
        void restoreFromDetails(JobDetails details);
File
Scheduler.java
Developer's decision
Version 2
Kind of conflict
Other
Chunk
Conflicting content
        void storeToDetails(JobDetails details);
        void restoreFromDetails(JobDetails details);
    }
<<<<<<< HEAD
}
=======
}
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
Solution content
        void storeToDetails(JobDetails details);
        void restoreFromDetails(JobDetails details);
    }
}
File
Scheduler.java
Developer's decision
Version 1
Kind of conflict
Other
Chunk
Conflicting content
     */
    InstanceInfoListDocument listInstancesSummary(String filter, String order, int limit);

<<<<<<< HEAD
    /** @deprecated use listInstances instead */
=======
    /**
     * @deprecated As of Ode 1.3, this method is deprecated in favor of 
     *             listInstances(filter, order, limit)
     */
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    InstanceInfoListDocument queryInstances(String query);

    /**
Solution content
     */
    InstanceInfoListDocument listInstancesSummary(String filter, String order, int limit);

    /**
     * @deprecated As of Ode 1.3, this method is deprecated in favor of 
     *             listInstances(filter, order, limit)
     */
    InstanceInfoListDocument queryInstances(String query);

    /**
File
InstanceManagement.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
import java.io.OutputStream;
import java.net.URI;
import java.util.Map;
<<<<<<< HEAD
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import javax.xml.namespace.QName;

import org.apache.commons.logging.Log;
Solution content
import java.io.OutputStream;
import java.net.URI;
import java.util.Map;

import javax.xml.namespace.QName;

import org.apache.commons.logging.Log;
File
BpelC.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
        ProcessModel pmodel;
        try {
<<<<<<< HEAD
            pmodel = compiler.compile(process, wf);
=======
            oprocess = compiler.compile(process,wf,version);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }
        catch (CompilationException cex) {
            this.invalidate();
Solution content
        OProcess oprocess;
        try {
            oprocess = compiler.compile(process,wf,version);
        }
        catch (CompilationException cex) {
            this.invalidate();
File
BpelC.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
package org.apache.ode.bpel.compiler;

<<<<<<< HEAD
import org.apache.ode.bpel.compiler.api.CompileListener;
import org.apache.ode.bpel.extension.ExtensionValidator;
import org.apache.ode.bpel.compiler.bom.Process;
import org.apache.ode.bpel.rapi.ProcessModel;
import org.w3c.dom.Node;

import javax.xml.namespace.QName;
import java.util.Map;
import java.net.URI;

public interface BpelCompiler {
=======
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;

import javax.wsdl.Definition;
import javax.wsdl.Message;
import javax.wsdl.Operation;
import javax.wsdl.Part;
import javax.wsdl.PortType;
import javax.wsdl.WSDLException;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.compiler.api.CompilationException;
import org.apache.ode.bpel.compiler.api.CompilationMessage;
import org.apache.ode.bpel.compiler.api.CompileListener;
import org.apache.ode.bpel.compiler.api.CompilerContext;
        return msgType;
    }

        } else {

        default:
import org.apache.ode.utils.xsl.XslTransformHandler;
        } else {
import org.apache.xerces.xni.parser.XMLEntityResolver;

import org.apache.ode.bpel.compiler.api.ExpressionCompiler;
import org.apache.ode.bpel.compiler.api.ExpressionValidator;
import org.apache.ode.bpel.compiler.api.SourceLocation;
import org.apache.ode.bpel.compiler.bom.Activity;
import org.apache.ode.bpel.compiler.bom.Bpel11QNames;
import org.apache.ode.bpel.compiler.bom.Bpel20QNames;
import org.apache.ode.bpel.compiler.bom.BpelObject;
import org.apache.ode.bpel.compiler.bom.Catch;
import org.apache.ode.bpel.compiler.bom.CompensationHandler;
import org.apache.ode.bpel.compiler.bom.Correlation;
import org.apache.ode.bpel.compiler.bom.CorrelationSet;
import org.apache.ode.bpel.compiler.bom.Expression;
import org.apache.ode.bpel.compiler.bom.Expression11;
import org.apache.ode.bpel.compiler.bom.FaultHandler;
import org.apache.ode.bpel.compiler.bom.Import;
import org.apache.ode.bpel.compiler.bom.LinkSource;
import org.apache.ode.bpel.compiler.bom.LinkTarget;
import org.apache.ode.bpel.compiler.bom.OnAlarm;
import org.apache.ode.bpel.compiler.bom.OnEvent;
import org.apache.ode.bpel.compiler.bom.PartnerLink;
import org.apache.ode.bpel.compiler.bom.PartnerLinkType;
import org.apache.ode.bpel.compiler.bom.Process;
import org.apache.ode.bpel.compiler.bom.Property;
import org.apache.ode.bpel.compiler.bom.PropertyAlias;
import org.apache.ode.bpel.compiler.bom.Scope;
import org.apache.ode.bpel.compiler.bom.ScopeActivity;
import org.apache.ode.bpel.compiler.bom.ScopeLikeActivity;
import org.apache.ode.bpel.compiler.bom.TerminationHandler;
import org.apache.ode.bpel.compiler.bom.Variable;
import org.apache.ode.bpel.compiler.wsdl.Definition4BPEL;
import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
import org.apache.ode.bpel.o.DebugInfo;
import org.apache.ode.bpel.o.OActivity;
import org.apache.ode.bpel.o.OAssign;
import org.apache.ode.bpel.o.OCatch;
import org.apache.ode.bpel.o.OCompensate;
import org.apache.ode.bpel.o.OCompensationHandler;
import org.apache.ode.bpel.o.OConstantExpression;
import org.apache.ode.bpel.o.OConstantVarType;
import org.apache.ode.bpel.o.OConstants;
import org.apache.ode.bpel.o.OElementVarType;
import org.apache.ode.bpel.o.OEventHandler;
import org.apache.ode.bpel.o.OExpression;
import org.apache.ode.bpel.o.OExpressionLanguage;
import org.apache.ode.bpel.o.OExtVar;
import org.apache.ode.bpel.o.OFaultHandler;
import org.apache.ode.bpel.o.OFlow;
import org.apache.ode.bpel.o.OLValueExpression;
import org.apache.ode.bpel.o.OLink;
import org.apache.ode.bpel.o.OMessageVarType;
import org.apache.ode.bpel.o.OPartnerLink;
import org.apache.ode.bpel.o.OProcess;
import org.apache.ode.bpel.o.ORethrow;
import org.apache.ode.bpel.o.OScope;
import org.apache.ode.bpel.o.OSequence;
import org.apache.ode.bpel.o.OTerminationHandler;
import org.apache.ode.bpel.o.OVarType;
import org.apache.ode.bpel.o.OXsdTypeVarType;
import org.apache.ode.bpel.o.OXslSheet;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.NSContext;
import org.apache.ode.utils.Namespaces;
import org.apache.ode.utils.StreamUtils;
import org.apache.ode.utils.fs.FileUtils;
import org.apache.ode.utils.msg.MessageBundle;
import org.apache.ode.utils.stl.CollectionsX;
import org.apache.ode.utils.stl.MemberOfFunction;
import org.apache.ode.utils.stl.UnaryFunction;
import org.apache.ode.utils.xsd.SchemaModel;
import org.apache.ode.utils.xsd.XSUtils;
import org.apache.ode.utils.xsd.XsdException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;

/**
 * Compiler for converting BPEL process descriptions (and their associated WSDL
 * and XSD documents) into compiled representations suitable for execution by
 * the ODE BPEL Service Provider. TODO: Move process validation into this class.
 */
public abstract class BpelCompiler implements CompilerContext {
    /** Class-severity logger. */
    protected static final Log __log = LogFactory.getLog(BpelCompiler.class);

    /** Standardized compiler messages. */
        OScope.Variable var = resolveMessageVariable(inputVar);
    private static final CommonCompilationMessages __cmsgs = MessageBundle.getMessages(CommonCompilationMessages.class);

    private org.apache.ode.bpel.compiler.bom.Process _processDef;

    private Date _generatedDate;

    @SuppressWarnings("unchecked")
    private HashMap _actGenerators = new HashMap();

    private boolean _supressJoinFailure = false;

    private boolean _atomicScope = false;

    /** Syntactic scope stack. */
    private StructureStack _structureStack = new StructureStack();
    /** Fault/compensate recovery stack. */
    private Stack _recoveryContextStack = new Stack();

    /** History of compiled activities */
    private List _compiledActivities = new ArrayList();

    private OProcess _oprocess;

    private ResourceFinder _resourceFinder;

    private WSDLRegistry _wsdlRegistry;

    private final List _errors = new ArrayList();

    private CompileListener _compileListener;

    private final HashMap _expLanguageCompilers = new HashMap();

    private final HashMap _expLanguages = new HashMap();
    
    private ExpressionValidatorFactory _expressionValidatorFactory = new ExpressionValidatorFactory(System.getProperties());

    private WSDLFactory4BPEL _wsdlFactory;

    private OExpressionLanguage _konstExprLang;

    private Map _customProcessProperties;

    private URI _processURI;
    
    BpelCompiler(WSDLFactory4BPEL wsdlFactory) {
        _wsdlFactory = wsdlFactory;
        _wsdlRegistry = new WSDLRegistry(this);
    }

    public void addWsdlImport(URI from, URI wsdlImport, SourceLocation sloc) {
        Definition4BPEL def;
        try {
            WSDLReader r = _wsdlFactory.newWSDLReader();
            WSDLLocatorImpl locator = new WSDLLocatorImpl(_resourceFinder, _resourceFinder.resolve(from, wsdlImport));
            def = (Definition4BPEL) r.readWSDL(locator);
        } catch (WSDLException e) {
            recoveredFromError(sloc, new CompilationException(__cmsgs.errWsdlParseError(e
                    .getFaultCode(), e.getLocation(), e.getMessage())));
            throw new CompilationException(__cmsgs.errWsdlImportFailed(wsdlImport.toASCIIString(), e.getFaultCode())
                    .setSource(sloc), e);
        }

        try {
            _wsdlRegistry.addDefinition(def, _resourceFinder, _resourceFinder.resolve(from, wsdlImport));
            if (__log.isDebugEnabled())
                __log.debug("Added WSDL Definition: " + wsdlImport);
        } catch (CompilationException ce) {
            recoveredFromError(sloc, ce);
        }
    }

    public void addXsdImport(URI from, URI location, SourceLocation sloc) {
        URI resFrom = _resourceFinder.resolve(from, location);
        if (__log.isDebugEnabled())
            __log.debug("Adding XSD import from " + resFrom + " location " + location);
        XMLEntityResolver resolver = new WsdlFinderXMLEntityResolver(_resourceFinder,
                location, new HashMap(), true);
        try {
            InputStream xsdStream = _resourceFinder.openResource(resFrom);
            byte[] data;
            try {
                data = StreamUtils.read(xsdStream);
            } finally {
                xsdStream.close();
            }
            
            Map schemas = XSUtils.captureSchema(resFrom, data, resolver);
            _wsdlRegistry.addSchemas(schemas);
        } catch (XsdException e) {
            oexpr.expressionLanguage = expLanguage;
        if (finder == null) {
            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
            recoveredFromError(sloc, ce);
        } catch (MalformedURLException e) {
            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
            recoveredFromError(sloc, ce);
        } catch (IOException e) {
            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
            recoveredFromError(sloc, ce);
        }
    }

    public void setResourceFinder(ResourceFinder finder) {
            _resourceFinder = new DefaultResourceFinder();
        } else {
            _resourceFinder = finder;
        }

    }

    public void setCompileListener(CompileListener compileListener) {
        _compileListener = compileListener;
    }

    public CompileListener getCompileListener() {
        return _compileListener;
    }

    public void setCustomProperties(Map customProperties) {
        _customProcessProperties = customProperties;
    }

    /**
     * Get the process definition.
     * 
     * @return the process definition
     */
    public Process getProcessDef() {
        return _processDef;
    }

    public PortType resolvePortType(final QName portTypeName) {
        if (portTypeName == null)
            throw new NullPointerException("Null portTypeName argument!");

        PortType portType = _wsdlRegistry.getPortType(portTypeName);
        if (portType == null)
            throw new CompilationException(__cmsgs.errUndeclaredPortType(portTypeName));
        return portType;
    }

    public OLink resolveLink(String linkName) {
        OLink ret = null;

        // Fist find where the link is declared.
        for (Iterator i = _structureStack.iterator(); i.hasNext();) {
            OActivity oact = i.next();
            if (oact instanceof OFlow)
                ret = ((OFlow) oact).getLocalLink(linkName);
            if (ret != null)
                return ret;
        }

        throw new CompilationException(__cmsgs.errUndeclaredLink(linkName));
    }

    public OScope.Variable resolveVariable(String varName) {
        for (Iterator i = _structureStack.oscopeIterator(); i.hasNext();) {
            OScope.Variable var = i.next().getLocalVariable(varName);
            if (var != null)
                return var;
        }
        // A "real" variable couldn't be found, checking if we're dealing with a
        // process custom property
        if (_customProcessProperties != null && _customProcessProperties.get(QName.valueOf(varName)) != null) {

        }
        throw new CompilationException(__cmsgs.errUndeclaredVariable(varName));
    }

    public List getAccessibleVariables() {
        ArrayList result = new ArrayList();
        for (Iterator i = _structureStack.oscopeIterator(); i.hasNext();) {
            result.addAll(i.next().variables.values());
        }
        return result;
    }

    public OScope.Variable resolveMessageVariable(String inputVar) throws CompilationException {
        OScope.Variable var = resolveVariable(inputVar);
        if (!(var.type instanceof OMessageVarType))
            throw new CompilationException(__cmsgs.errMessageVariableRequired(inputVar));
        return var;
    }

    public OScope.Variable resolveMessageVariable(String inputVar, QName messageType) throws CompilationException {
        if (!((OMessageVarType) var.type).messageType.equals(messageType))
    public OXsdTypeVarType resolveXsdType(QName typeName) throws CompilationException {
            }
            throw new CompilationException(__cmsgs.errVariableTypeMismatch(var.name, messageType,
                    ((OMessageVarType) var.type).messageType));
        return var;
    }

    public OProcess.OProperty resolveProperty(QName name) {

        for (OProcess.OProperty prop : _oprocess.properties) {
            if (prop.name.equals(name))
                return prop;
        }
        throw new CompilationException(__cmsgs.errUndeclaredProperty(name));
    }

    public OProcess.OPropertyAlias resolvePropertyAlias(OScope.Variable variable, QName propertyName) {
        if (!(variable.type instanceof OMessageVarType))
            throw new CompilationException(__cmsgs.errMessageVariableRequired(variable.name));

        OProcess.OProperty property = resolveProperty(propertyName);
        OProcess.OPropertyAlias alias = property.getAlias(variable.type);
        if (alias == null)
            throw new CompilationException(__cmsgs.errUndeclaredPropertyAlias(variable.type.toString(), propertyName));

        return alias;
    }

    public OExpression constantExpr(boolean value) {
    public OScope resolveCompensatableScope(final String scopeToCompensate) throws CompilationException {
        if (_recoveryContextStack.isEmpty())
            throw new CompilationException(__cmsgs.errCompensateNAtoContext());
        OScope recoveryContext = _recoveryContextStack.peek();

        OScope scopeToComp = CollectionsX.find_if(recoveryContext.compensatable, new MemberOfFunction() {
            public boolean isMember(OScope o) {
                return o.name != null && o.name.equals(scopeToCompensate);
            }
        });
        if (scopeToComp == null)
            throw new CompilationException(__cmsgs.errCompensateOfInvalidScope(scopeToCompensate));

        return scopeToComp; 
    }

    public String getSourceLocation() {
        return _processDef.getSource() == null ? null : _processDef.getSource();
    }

    public OScope.CorrelationSet resolveCorrelationSet(String csetName) {
        for (Iterator i = _structureStack.oscopeIterator(); i.hasNext();) {
            OScope.CorrelationSet cset = i.next().getCorrelationSet(csetName);
            if (cset != null)
                return cset;
        }

        throw new CompilationException(__cmsgs.errUndeclaredCorrelationSet(csetName));
    }

    @SuppressWarnings("unchecked")
    public OMessageVarType resolveMessageType(QName messageType) {
        OMessageVarType msgType = _oprocess.messageTypes.get(messageType);
        if (msgType == null) {
            Message msg = _wsdlRegistry.getMessage(messageType);
            if (msg == null) {
                throw new CompilationException(__cmsgs.errUndeclaredMessage(messageType.getLocalPart(), messageType
                        .getNamespaceURI()));
            }

            List parts = new ArrayList();
            CollectionsX.transform(parts, ((List) msg.getOrderedParts(null)),
                    new UnaryFunction() {
                        public OMessageVarType.Part apply(Part part) {
                            OVarType partType;
                            if (part.getElementName() != null) {
                                partType = resolveElementType(part.getElementName());
                            } else {
                                partType = resolveXsdType(part.getTypeName());
                            }

                            OMessageVarType.Part opart = new OMessageVarType.Part(_oprocess, part.getName(), partType);
                            opart.debugInfo = createDebugInfo(_processDef, "Message Variable Part: " + part.getName());
                            return opart;
                        }
                    });
            msgType = new OMessageVarType(_oprocess, msg.getQName(), parts);
            msgType.debugInfo = createDebugInfo(_processDef, "Message Type: " + msg.getQName());
            _oprocess.messageTypes.put(msg.getQName(), msgType);
        }
        OXsdTypeVarType type = _oprocess.xsdTypes.get(typeName);
        if (type == null) {
            __log.debug("Resolving XSD type " + typeName);
            SchemaModel model = null;
            try {
                model = _wsdlRegistry.getSchemaModel();
            } catch (IllegalArgumentException iaa) { }
            if (model == null || !model.knowsSchemaType(typeName))
                throw new CompilationException(__cmsgs.errUndeclaredXsdType(typeName));
            
            type = new OXsdTypeVarType(_oprocess);
            type.debugInfo = createDebugInfo(_processDef, "XSD Type: " + typeName);
            type.xsdType = typeName;
            type.simple = _wsdlRegistry.getSchemaModel().isSimpleType(typeName);
            _oprocess.xsdTypes.put(typeName, type);
        }

        return type;
    }

    public OMessageVarType.Part resolvePart(OScope.Variable var, String partname) {
        if (!(var.type instanceof OMessageVarType))
            throw new CompilationException(__cmsgs.errMessageVariableRequired(var.name));
        OMessageVarType msgVarType = (OMessageVarType) var.type;
        OMessageVarType.Part part = msgVarType.parts.get(partname);
        if (part == null)
            throw new CompilationException(__cmsgs.errUndeclaredMessagePart(var.name,
                    ((OMessageVarType) var.type).messageType, partname));
        return part;
    }

    public OMessageVarType.Part resolveHeaderPart(OScope.Variable var, String partname) {
        if (!(var.type instanceof OMessageVarType))
            throw new CompilationException(__cmsgs.errMessageVariableRequired(var.name));
        OMessageVarType msgVarType = (OMessageVarType) var.type;
        return msgVarType.parts.get(partname);
    }

    public PartnerLinkType resolvePartnerLinkType(QName partnerLinkType) {

        PartnerLinkType plinkType = _wsdlRegistry.getPartnerLinkType(partnerLinkType);
        if (plinkType == null)
            throw new CompilationException(__cmsgs.errUndeclaredPartnerLinkType(partnerLinkType));
        return plinkType;
    }

    public OPartnerLink resolvePartnerLink(String name) {
        for (Iterator i = _structureStack.oscopeIterator(); i.hasNext();) {
            OPartnerLink oplink = i.next().getLocalPartnerLink(name);
            if (oplink != null)
                return oplink;
        }

        throw new CompilationException(__cmsgs.errUndeclaredPartnerLink(name));
    }

    @SuppressWarnings("unchecked")
    public Operation resolvePartnerRoleOperation(final OPartnerLink partnerLink, final String operationName) {
        if (partnerLink.partnerRolePortType == null) {
            throw new CompilationException(__cmsgs.errPartnerLinkDoesNotDeclarePartnerRole(partnerLink.getName()));
        }

        Operation found = CollectionsX.find_if((List) partnerLink.partnerRolePortType.getOperations(),
                new MemberOfFunction() {
                    public boolean isMember(Operation o) {
                        // Guard against WSDL4j funny business.
                        if ((o.getInput() == null || o.getInput().getMessage() == null)
                                && (o.getOutput() == null || o.getOutput().getMessage() == null)) {
                            return false;
                        }
                        return o.getName().equals(operationName);
                    }
                });

        if (found == null)
            throw new CompilationException(__cmsgs.errUndeclaredOperation(partnerLink.partnerRolePortType.getQName(),
                    operationName));
        return found;
    }

    @SuppressWarnings("unchecked")
    public Operation resolveMyRoleOperation(final OPartnerLink partnerLink, final String operationName) {
        if (partnerLink.myRolePortType == null) {
            throw new CompilationException(__cmsgs.errPartnerLinkDoesNotDeclareMyRole(partnerLink.getName()));
        }

        Operation found = CollectionsX.find_if((List) partnerLink.myRolePortType.getOperations(),
                new MemberOfFunction() {
                    public boolean isMember(Operation o) {
                        // Again, guard against WSDL4J's "help"
                        if ((o.getInput() == null || o.getInput().getMessage() == null)
                                && (o.getOutput() == null || o.getOutput().getMessage() == null))
                            return false;
                        return o.getName().equals(operationName);
                    }
                });
        if (found == null) {
            throw new CompilationException(__cmsgs.errUndeclaredOperation(partnerLink.myRolePortType.getQName(),
                    operationName));
        }
        return found;
    }

    /**
     * Produce a boolean {@link OExpression} expression that returns a constant
     * value.
     * 
     * @param value
     *            constant value to return
     * @return {@link OExpression} returning a constant value.
     */
     * 
    OConstantExpression ce = new OConstantExpression(_oprocess, value ? Boolean.TRUE : Boolean.FALSE); ce.debugInfo = createDebugInfo(_processDef, "Constant Boolean Expression: " + value); ce.expressionLanguage = _konstExprLang; return ce; } public OLValueExpression compileLValueExpr(Expression expression) throws CompilationException { return compileLValueExpr(expression, null, null, new Object[1]); } public OLValueExpression compileLValueExpr(Expression expression, OVarType rootNodeType, Object requestedResultType, Object[] resultType) throws CompilationException { return (OLValueExpression) compileExpr(expression, false, true, rootNodeType, requestedResultType, resultType); } public OExpression compileJoinCondition(Expression expression) throws CompilationException { return compileExpr(expression, true, false, null, null, new Object[1]); } public OExpression compileExpr(Expression expression) throws CompilationException { return compileExpr(expression, null, null, new Object[1]); } public OExpression compileExpr(Expression expression, OVarType rootNodeType, Object requestedResultType, Object[] resultType) throws CompilationException { return compileExpr(expression, false, false, rootNodeType, requestedResultType, resultType); } public OExpression compileExpr(String expr, NSContext nc) { // Does this really work? BpelObject cur = _structureStack.topSource(); return compileExpr(new Expression11(cur.getElement(),cur.getElement().getOwnerDocument().createTextNode(expr)), false, false, null, null, new Object[1]); } private OExpression compileExpr(Expression expression, boolean isJoinCondition, boolean isLValue, OVarType rootNodeType, Object requestedResultType, Object[] resultType) { String expLang = getExpressionLanguage(expression); ExpressionCompiler ec = findExpLangCompiler(expLang); ec.setCompilerContext(this); ExpressionValidator ev = _expressionValidatorFactory.getValidator(); try { OExpression oexpr; if (isJoinCondition) { oexpr = ec.compileJoinCondition(expression); } else { oexpr = ec.compile(expression); resultType[0] = ev.validate(expression, rootNodeType, requestedResultType); } oexpr.debugInfo = createDebugInfo(expression, expression.toString()); OExpressionLanguage expLanguage = _expLanguages.get(expLang); if (expLanguage == null) { expLanguage = new OExpressionLanguage(_oprocess, ec.getProperties()); expLanguage.debugInfo = createDebugInfo(_processDef, "Expression Language: " + expLang); expLanguage.expressionLanguageUri = expLang; _expLanguages.put(expLang, expLanguage); _oprocess.expressionLanguages.add(expLanguage); } // Cleaning up expression compiler for furter compilation ec.setCompilerContext(null); return oexpr; } catch (CompilationException ce) { if (ce.getCompilationMessage().source == null) ce.getCompilationMessage().setSource(expression); throw ce; } } public OProcess getOProcess() throws CompilationException { return _oprocess; } public void recoveredFromError(SourceLocation where, CompilationException bce) throws CompilationException { if (bce.getCompilationMessage().source == null) bce.getCompilationMessage().source = where; if (_compileListener == null) { switch (bce.getCompilationMessage().severity) { case CompilationMessage.INFO: if (__log.isInfoEnabled()) { __log.info(bce.toErrorMessage()); } break; case CompilationMessage.WARN: if (__log.isWarnEnabled()) { __log.warn(bce.toErrorMessage()); } break; case CompilationMessage.ERROR: if (__log.isErrorEnabled()) { __log.error(bce.toErrorMessage()); } } } else { if (__log.isDebugEnabled()) { __log.debug(bce.toErrorMessage(), bce); } _compileListener.onCompilationMessage(bce.getCompilationMessage()); } _errors.add(bce.getCompilationMessage()); } public static long getVersion(String dirName) { try { return Integer.parseInt(dirName.substring(dirName.lastIndexOf("-") + 1)); } catch (Throwable t) { return 0; } } /** * Compile a process. */ public OProcess compile(final Process process, ResourceFinder rf, long version) throws CompilationException { if (process == null) throw new NullPointerException("Null process parameter"); setResourceFinder(rf); _processURI = process.getURI(); _processDef = process; _generatedDate = new Date(); _structureStack.clear(); String bpelVersionUri = null; switch (process.getBpelVersion()) { case BPEL11: bpelVersionUri = Bpel11QNames.NS_BPEL4WS_2003_03; break; case BPEL20_DRAFT: bpelVersionUri = Bpel20QNames.NS_WSBPEL2_0; break; case BPEL20: bpelVersionUri = Bpel20QNames.NS_WSBPEL2_0_FINAL_EXEC; break; default: throw new IllegalStateException("Bad bpel version: " + process.getBpelVersion()); } _oprocess = new OProcess(bpelVersionUri); _oprocess.guid = null; _oprocess.constants = makeConstants(); _oprocess.debugInfo = createDebugInfo(process, "process"); if (process.getTargetNamespace() == null) { _oprocess.targetNamespace = "--UNSPECIFIED--"; recoveredFromError(process, new CompilationException(__cmsgs.errProcessNamespaceNotSpecified())); } else { _oprocess.targetNamespace = _processDef.getTargetNamespace(); } if (process.getName() == null) { _oprocess.processName = "--UNSPECIFIED--"; recoveredFromError(process, new CompilationException(__cmsgs.errProcessNameNotSpecified())); _oprocess.processName = _processDef.getName(); } _oprocess.compileDate = _generatedDate; _konstExprLang = new OExpressionLanguage(_oprocess, null); _konstExprLang.debugInfo = createDebugInfo(_processDef, "Constant Value Expression Language"); _konstExprLang.expressionLanguageUri = "uri:www.fivesight.com/konstExpression"; _konstExprLang.properties.put("runtime-class", "org.apache.ode.bpel.runtime.explang.konst.KonstExpressionLanguageRuntimeImpl"); _oprocess.expressionLanguages.add(_konstExprLang); // Process the imports. Note, we expect all processes (Event BPEL 1.1) // to have an import declaration. This should be automatically generated // by the 1.1 parser. for (Import imprt : _processDef.getImports()) { try { compile(_processURI, imprt); } catch (CompilationException bce) { // We try to recover from import problems by continuing recoveredFromError(imprt, bce); } } _expressionValidatorFactory.getValidator().bpelImportsLoaded(_processDef, this); switch (_processDef.getSuppressJoinFailure()) { case NO: case NOTSET: _supressJoinFailure = false; break; case YES: _supressJoinFailure = true; break; } // compile ALL wsdl properties; needed for property extraction Definition4BPEL[] defs = _wsdlRegistry.getDefinitions(); for (Definition4BPEL def : defs) { for (Property property : def.getProperties()) { compile(property); } } // compile ALL wsdl property aliases for (Definition4BPEL def1 : defs) { for (PropertyAlias propertyAlias : def1.getPropertyAliases()) { compile(propertyAlias); } } OScope procesScope = new OScope(_oprocess, null); procesScope.name = "__PROCESS_SCOPE:" + process.getName(); procesScope.debugInfo = createDebugInfo(process, null); _oprocess.procesScope = compileScope(procesScope, process, new Runnable() { public void run() { if (process.getRootActivity() == null) { throw new CompilationException(__cmsgs.errNoRootActivity()); } // Process custom properties are created as variables associated // with the top scope if (_customProcessProperties != null) { // switch(_processDef.getBpelVersion()){ for (Map.Entry customVar : _customProcessProperties.entrySet()) { final OScope oscope = _structureStack.topScope(); OVarType varType = new OConstantVarType(_oprocess, customVar.getValue()); OScope.Variable ovar = new OScope.Variable(_oprocess, varType); ovar.name = customVar.getKey().getLocalPart(); ovar.declaringScope = oscope; ovar.debugInfo = createDebugInfo(null, "Process custom property variable"); oscope.addLocalVariable(ovar); if (__log.isDebugEnabled()) __log.debug("Compiled custom property variable " + ovar); } } _structureStack.topScope().activity = compile(process.getRootActivity()); } }); assert _structureStack.size() == 0; boolean hasErrors = false; StringBuffer sb = new StringBuffer(); for (CompilationMessage msg : _errors) { if (msg.severity >= CompilationMessage.ERROR) { hasErrors = true; sb.append('\t'); sb.append(msg.toErrorString()); sb.append('\n'); } } XslTransformHandler.getInstance().clearXSLSheets(_oprocess.getQName()); _expressionValidatorFactory.getValidator().bpelCompilationCompleted(_processDef); if (hasErrors) { throw new CompilationException(__cmsgs.errCompilationErrors(_errors.size(), sb.toString())); } { String digest = "version:" + version + ";" + _oprocess.digest(); _oprocess.guid = GUID.makeGUID(digest); if (__log.isDebugEnabled()) { __log.debug("Compiled process digest: " + digest + "\nguid: " + _oprocess.guid); } } return _oprocess; } private OConstants makeConstants() { OConstants constants = new OConstants(_oprocess); constants.qnConflictingReceive = new QName(getBpwsNamespace(), "conflictingReceive"); constants.qnConflictingRequest = new QName(getBpwsNamespace(), "conflictingRequest"); constants.qnCorrelationViolation = new QName(getBpwsNamespace(), "correlationViolation"); constants.qnForcedTermination = new QName(getBpwsNamespace(), "forcedTermination"); constants.qnJoinFailure = new QName(getBpwsNamespace(), "joinFailure"); constants.qnMismatchedAssignmentFailure = new QName(getBpwsNamespace(), "mismatchedAssignment"); constants.qnMissingReply = new QName(getBpwsNamespace(), "missingReply"); constants.qnMissingRequest = new QName(getBpwsNamespace(), "missingRequest"); constants.qnSelectionFailure = new QName(getBpwsNamespace(), "selectionFailure"); constants.qnUninitializedVariable = new QName(getBpwsNamespace(), "uninitializedVariable"); constants.qnXsltInvalidSource = new QName(getBpwsNamespace(), "xsltInvalidSource"); constants.qnSubLanguageExecutionFault = new QName(getBpwsNamespace(), "subLanguageExecutionFault"); constants.qnUninitializedPartnerRole = new QName(getBpwsNamespace(), "uninitializedPartnerRole"); constants.qnForEachCounterError = new QName(getBpwsNamespace(), "forEachCounterError"); constants.qnInvalidBranchCondition = new QName(getBpwsNamespace(), "invalidBranchCondition"); constants.qnInvalidExpressionValue = new QName(getBpwsNamespace(), "invalidExpressionValue"); constants.qnRetiredProcess = new QName(getOdeNamespace(), "retiredProcess"); constants.qnTooManyInstances = new QName(getOdeNamespace(), "tooManyInstances"); constants.qnUnknownFault = new QName(getOdeNamespace(), "unknownFault"); constants.qnTooManyProcesses = new QName(getOdeNamespace(), "tooManyProcesses"); constants.qnTooHugeProcesses = new QName(getOdeNamespace(), "tooHugeProcesses"); return constants; } private String getOdeNamespace() { return Namespaces.ODE_EXTENSION_NS; } // TODO unused? // private String getBpelPartnerLinkUri(){ // case Process.BPEL_V110: // return Constants.NS_BPEL4WS_PARTNERLINK_2003_05; // case Process.BPEL_V200: // return Constants.NS_WSBPEL_PARTNERLINK_2004_03; // default: // throw new IllegalStateException("Bad bpel version."); // } // } /** * Compile an import declaration. According to the specification: *
    A BPEL4WSWS-BPEL process definition relies on XML Schema and * WSDL 1.1 for the definition of datatypes and service interfaces. Process * definitions also rely on other constructs such as partner link types, * message properties and property aliases (defined later in this * specification) which are defined within WSDL 1.1 documents using the WSDL * 1.1 language extensibility feature. * * The <import> element is used within a BPEL4WSWS-BPEL process to * explicitly indicate a dependency on external XML Schema or WSDL * definitions. Any number of elements may appear as initial * children of the element, before any other child element. Each * element contains three mandatory attributes: *
  1. namespace -- The namespace attribute specifies the URI namespace of * the imported definitions.
  2. *
  3. location -- The location attribute contains a URI indicating the * location of a document that contains relevant definitions in the * namespace specified. The document located at the URI MUST contain * definitions belonging to the same namespace as indicated by the namespace * attribute.
  4. *
  5. importType -- The importType attribute identifies the type of * document being imported by providing the URI of the encoding language. * The value MUST be set to "http://www.w3.org/2001/XMLSchema" when * importing XML Schema 1.0 documents, and to * "http://schemas.xmlsoap.org/wsdl/" when importing WSDL 1.1 documents. * * @param imprt * BOM representation of the import */ private void compile(URI current, Import imprt) { try { if (imprt.getImportType() == null) throw new CompilationException(__cmsgs.errUnspecifiedImportType().setSource(imprt)); if (imprt.getLocation() == null) throw new CompilationException(__cmsgs.errMissingImportLocation().setSource(imprt)); if (Import.IMPORTTYPE_WSDL11.equals(imprt.getImportType())) { addWsdlImport(current, imprt.getLocation(), imprt); } else if (Import.IMPORTTYPE_XMLSCHEMA10.equals(imprt.getImportType())) { addXsdImport(current, imprt.getLocation(), imprt); } else throw new CompilationException(__cmsgs.errUnknownImportType(imprt.getImportType()).setSource(imprt)); } catch (CompilationException ce) { if (ce.getCompilationMessage().source == null) ce.getCompilationMessage().setSource(imprt); throw ce; } } public OActivity compile(final Activity source) { if (source == null) throw new IllegalArgumentException("null-argument"); boolean previousSupressJoinFailure = _supressJoinFailure; switch (source.getSuppressJoinFailure()) { case NO: _supressJoinFailure = false; break; case YES: _supressJoinFailure = true; break; } OActivity compiled; try { compiled = (source instanceof ScopeLikeActivity) ? compileSLC((ScopeLikeActivity) source, new OScope.Variable[0]) : compileActivity(true, source); compiled.suppressJoinFailure = _supressJoinFailure; } finally { _supressJoinFailure = previousSupressJoinFailure; } if (__log.isDebugEnabled()) __log.debug("Compiled activity " + compiled); return compiled; } private OCompensate createDefaultCompensateActivity(BpelObject source, String desc) { OCompensate activity = new OCompensate(_oprocess, getCurrent()); activity.name = "__autoGenCompensate:" + _structureStack.topScope().name; activity.debugInfo = createDebugInfo(source, desc); return activity; } public OScope compileSLC(final ScopeLikeActivity source, final OScope.Variable[] variables) { final OScope implicitScope = new OScope(_oprocess, getCurrent()); implicitScope.implicitScope = true; implicitScope.name = createName(source, "implicit-scope"); implicitScope.debugInfo = createDebugInfo(source, "Scope-like construct " + source); compileScope(implicitScope, source.getScope(), new Runnable() { public void run() { compileLinks(source); for (OScope.Variable v : variables) { v.declaringScope = implicitScope; implicitScope.addLocalVariable(v); } if (source instanceof ScopeActivity) { Activity scopeChild = ((ScopeActivity) source).getChildActivity(); if (scopeChild == null) throw new CompilationException(__cmsgs.errEmptyScope().setSource(source)); } implicitScope.activity = compile(scopeChild); } else { implicitScope.activity = compileActivity(false, source); } } }); return implicitScope; } private OActivity compileActivity(final boolean doLinks, final Activity source) { final ActivityGenerator actgen = findActivityGen(source); final OActivity oact = actgen.newInstance(source); oact.name = createName(source, "activity"); oact.debugInfo = createDebugInfo(source, "Activity body for " + source); _compiledActivities.add(oact); compile(oact, source, new Runnable() { public void run() { if (doLinks) compileLinks(source); actgen.compile(oact, source); } }); return oact; } private void compileLinks(Activity source) { /* Source Links Fixup */ for (LinkSource ls : source.getLinkSources()) compileLinkSource(ls); /* Target Links Fixup */ for (LinkTarget lt : source.getLinkTargets()) compileLinkTarget(lt); _structureStack.topActivity().joinCondition = (source.getJoinCondition() == null || source.getLinkTargets() .isEmpty()) ? null : compileJoinCondition(source.getJoinCondition()); } private String createName(Activity source, String type) { if (source.getName() != null) return source.getName(); return source.getType().getLocalPart() + "-" + type + "-line-" + source.getLineNo(); } private OProcess.OProperty compile(Property property) { OProcess.OProperty oproperty = new OProcess.OProperty(_oprocess); oproperty.name = property.getName(); oproperty.debugInfo = createDebugInfo(_processDef, "Property " + property.getName()); if (!_wsdlRegistry.getSchemaModel().isSimpleType(property.getPropertyType())) throw new CompilationException(__cmsgs.errPropertyDeclaredWithComplexType(property.getName(), property.getPropertyType()).setSource(property)); _oprocess.properties.add(oproperty); if (__log.isDebugEnabled()) __log.debug("Compiled property " + oproperty); return oproperty; } private OProcess.OPropertyAlias compile(PropertyAlias src) { OProcess.OProperty property = resolveProperty(src.getPropertyName()); OProcess.OPropertyAlias alias = new OProcess.OPropertyAlias(_oprocess); alias.debugInfo = createDebugInfo(_processDef, "PropertyAlias " + src.getPropertyName() + " for " + src.getMessageType()); if (src.getMessageType() == null){ throw new CompilationException(__cmsgs.errAliasUndeclaredMessage(src.getPropertyName(), src.getQuery().getPath())); } OMessageVarType messageType = resolveMessageType(src.getMessageType()); OVarType rootNodeType = messageType; alias.varType = messageType; // bpel 2.0 excludes declaration of part; // bpel 1.1 requires it if (src.getPart() != null) { alias.part = messageType.parts.get(src.getPart()); if (alias.part == null) throw new CompilationException(__cmsgs.errUnknownPartInAlias(src.getPart(), messageType.messageType.toString())); rootNodeType = alias.part.type; } if (src.getQuery() != null) alias.location = compileExpr(src.getQuery(), rootNodeType, null, new Object[1]); property.aliases.add(alias); alias.debugInfo = createDebugInfo(_processDef, src.getMessageType() + " --> " + src.getPropertyName()); return alias; } private void compileLinkTarget(LinkTarget target) { OLink ol = resolveLink(target.getLinkName()); assert ol != null; ol.debugInfo = createDebugInfo(target, target.toString()); if (ol.target != null) throw new CompilationException(__cmsgs.errDuplicateLinkTarget(target.getLinkName()).setSource(target)); ol.target = _structureStack.topActivity(); _structureStack.topActivity().targetLinks.add(ol); } private void compileLinkSource(LinkSource linksrc) { OLink ol = resolveLink(linksrc.getLinkName()); assert ol != null; ol.debugInfo = createDebugInfo(linksrc, linksrc.toString()); if (ol.source != null) throw new CompilationException(__cmsgs.errDuplicateLinkSource(linksrc.getLinkName()).setSource(linksrc)); ol.source = _structureStack.topActivity(); ol.transitionCondition = linksrc.getTransitionCondition() == null ? constantExpr(true) : compileExpr(linksrc .getTransitionCondition()); _structureStack.topActivity().sourceLinks.add(ol); _structureStack.topActivity().outgoingLinks.add(ol); } private void compile(final PartnerLink plink) { OPartnerLink oplink = new OPartnerLink(_oprocess); oplink.debugInfo = createDebugInfo(plink, plink.toString()); try { PartnerLinkType plinkType = resolvePartnerLinkType(plink.getPartnerLinkType()); oplink.partnerLinkType = plinkType.getName(); oplink.name = plink.getName(); oplink.initializePartnerRole = plink.isInitializePartnerRole(); if (plink.hasMyRole()) { PartnerLinkType.Role myRole = plinkType.getRole(plink.getMyRole()); if (myRole == null) throw new CompilationException(__cmsgs.errUndeclaredRole(plink.getMyRole(), plinkType.getName())); oplink.myRoleName = myRole.getName(); QName portType = myRole.getPortType(); if (portType == null) throw new CompilationException(__cmsgs.errMissingMyRolePortType(myRole.getPortType(), plink.getMyRole(), plinkType.getName())); oplink.myRolePortType = resolvePortType(portType); } } if (plink.isInitializePartnerRole() && !plink.hasPartnerRole()) { throw new CompilationException(__cmsgs.errPartnerLinkNoPartnerRoleButInitialize(plink.getName())); } if (plink.hasPartnerRole()) { PartnerLinkType.Role partnerRole = plinkType.getRole(plink.getPartnerRole()); if (partnerRole == null) throw new CompilationException(__cmsgs.errUndeclaredRole(plink.getPartnerRole(), plinkType .getName())); oplink.partnerRoleName = partnerRole.getName(); QName portType = partnerRole.getPortType(); if (portType == null) throw new CompilationException(__cmsgs.errMissingPartnerRolePortType(partnerRole.getPortType(), plink.getPartnerRole(), plinkType.getName())); oplink.partnerRolePortType = resolvePortType(portType); } oplink.declaringScope = _structureStack.topScope(); if (oplink.declaringScope.partnerLinks.containsKey(oplink.name)) throw new CompilationException(__cmsgs.errDuplicatePartnerLinkDecl(oplink.name)); oplink.declaringScope.partnerLinks.put(oplink.name, oplink); _oprocess.allPartnerLinks.add(oplink); } catch (CompilationException ce) { ce.getCompilationMessage().setSource(plink); throw ce; } } private void compile(CorrelationSet cset) { OScope oscope = _structureStack.topScope(); OScope.CorrelationSet ocset = new OScope.CorrelationSet(_oprocess); ocset.name = cset.getName(); ocset.declaringScope = oscope; ocset.debugInfo = createDebugInfo(cset, cset.toString()); QName[] setprops = cset.getProperties(); for (int j = 0; j < setprops.length; ++j) ocset.properties.add(resolveProperty(setprops[j])); oscope.addCorrelationSet(ocset); } public OActivity getCurrent() { return _structureStack.topActivity(); } public void compile(OActivity context, BpelObject source, Runnable run) { DefaultActivityGenerator.defaultExtensibilityElements(context, source); _structureStack.push(context,source); try { run.run(); } finally { OActivity popped = _structureStack.pop(); OActivity newtop = _structureStack.topActivity(); OScope topScope = _structureStack.topScope(); if (newtop != null) { newtop.nested.add(popped); // Transfer outgoing and incoming links, excluding the locally defined links. newtop.incomingLinks.addAll(popped.incomingLinks); if (newtop instanceof OFlow) newtop.incomingLinks.removeAll(((OFlow) newtop).localLinks); newtop.outgoingLinks.addAll(popped.outgoingLinks); if (newtop instanceof OFlow) newtop.outgoingLinks.removeAll(((OFlow) newtop).localLinks); // Transfer variables read/writen newtop.variableRd.addAll(popped.variableRd); newtop.variableWr.addAll(popped.variableWr); } if (topScope != null && popped instanceof OScope) topScope.compensatable.add((OScope) popped); } } private OScope compileScope(final OScope oscope, final Scope src, final Runnable init) { if (oscope.name == null) throw new IllegalArgumentException("Unnamed scope:" + src); oscope.debugInfo = createDebugInfo(src, src.toString()); boolean previousAtomicScope = _atomicScope; if (src.getAtomicScope() != null) { boolean newValue = src.getAtomicScope().booleanValue(); if (_atomicScope) throw new CompilationException(__cmsgs.errAtomicScopeNesting(newValue)); oscope.atomicScope = _atomicScope = newValue; } try { compile(oscope, src, new Runnable() { public void run() { for (Variable var : src.getVariables()) { try { compile(var); } catch (CompilationException ce) { recoveredFromError(var, ce); } } for (CorrelationSet cset : src.getCorrelationSetDecls()) { try { compile(cset); } catch (CompilationException ce) { recoveredFromError(cset, ce); } } for (PartnerLink plink : src.getPartnerLinks()) { try { compile(plink); } catch (CompilationException ce) { recoveredFromError(plink, ce); } } if (!src.getEvents().isEmpty() || !src.getAlarms().isEmpty()) { oscope.eventHandler = new OEventHandler(_oprocess); oscope.eventHandler.debugInfo = createDebugInfo(src, "Event Handler for " + src); } for (OnEvent onEvent : src.getEvents()) { try { compile(onEvent); } catch (CompilationException ce) { recoveredFromError(src, ce); } } for (OnAlarm onAlarm : src.getAlarms()) { try { compile(onAlarm); } catch (CompilationException ce) { recoveredFromError(src, ce); } } if (init != null) try { init.run(); } catch (CompilationException ce) { recoveredFromError(src, ce); } try { compile(src.getCompensationHandler()); } catch (CompilationException bce) { recoveredFromError(src.getCompensationHandler(), bce); } try { compile(src.getTerminationHandler()); } catch (CompilationException bce) { recoveredFromError(src.getTerminationHandler(), bce); } try { compile(src.getFaultHandler()); } catch (CompilationException bce) { recoveredFromError(src.getFaultHandler(), bce); } } }); } finally { _atomicScope = previousAtomicScope; } return oscope; } private void compile(final OnAlarm onAlarm) { OScope oscope = _structureStack.topScope(); assert oscope.eventHandler != null; final OEventHandler.OAlarm oalarm = new OEventHandler.OAlarm(_oprocess); oalarm.debugInfo = createDebugInfo(onAlarm, "OnAlarm Event Handler: " + onAlarm); if (onAlarm.getFor() != null && onAlarm.getUntil() == null) { oalarm.forExpr = compileExpr(onAlarm.getFor()); } else if (onAlarm.getFor() == null && onAlarm.getUntil() != null) { oalarm.untilExpr = compileExpr(onAlarm.getUntil()); } else if (onAlarm.getFor() != null && onAlarm.getUntil() != null) { throw new CompilationException(__cmsgs.errInvalidAlarm().setSource(onAlarm)); } else if (onAlarm.getRepeatEvery() == null) { throw new CompilationException(__cmsgs.errInvalidAlarm().setSource(onAlarm)); } if (onAlarm.getRepeatEvery() != null) oalarm.repeatExpr = compileExpr(onAlarm.getRepeatEvery()); if (onAlarm.getActivity() == null) throw new CompilationException(__cmsgs.errInvalidAlarm().setSource(onAlarm)); oalarm.activity = compile(onAlarm.getActivity()); // Check links crossing restrictions. for (OLink link : oalarm.incomingLinks) try { throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name).setSource(onAlarm)); } catch (CompilationException ce) { recoveredFromError(onAlarm, ce); } for (OLink link : oalarm.outgoingLinks) try { throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name).setSource(onAlarm)); } catch (CompilationException ce) { recoveredFromError(onAlarm, ce); } oscope.eventHandler.onAlarms.add(oalarm); } private void compile(final OnEvent onEvent) { final OScope oscope = _structureStack.topScope(); assert oscope.eventHandler != null; final OEventHandler.OEvent oevent = new OEventHandler.OEvent(_oprocess, oscope); oevent.name = "__eventHandler:"; oevent.debugInfo = createDebugInfo(onEvent, null); compile(oevent, onEvent, new Runnable() { public void run() { switch (_processDef.getBpelVersion()) { case BPEL11: oevent.variable = resolveMessageVariable(onEvent.getVariable()); break; case BPEL20_DRAFT: case BPEL20: if (onEvent.getMessageType() == null && onEvent.getElementType() == null) throw new CompilationException(__cmsgs.errVariableDeclMissingType(onEvent.getVariable()) .setSource(onEvent)); if (onEvent.getMessageType() != null && onEvent.getElementType() != null) throw new CompilationException(__cmsgs.errVariableDeclInvalid(onEvent.getVariable()).setSource( onEvent)); OVarType varType; if (onEvent.getMessageType() != null) varType = resolveMessageType(onEvent.getMessageType()); else if (onEvent.getElement() != null) varType = resolveElementType(onEvent.getElementType()); else throw new CompilationException(__cmsgs .errUnrecognizedVariableDeclaration(onEvent.getVariable())); oevent.variable = new OScope.Variable(_oprocess, varType); oevent.variable.name = onEvent.getVariable(); oevent.variable.declaringScope = _structureStack.topScope(); oevent.addLocalVariable(oevent.variable); break; default: throw new AssertionError("Unexpected BPEL VERSION constatnt: " + _processDef.getBpelVersion()); } oevent.partnerLink = resolvePartnerLink(onEvent.getPartnerLink()); oevent.operation = resolveMyRoleOperation(oevent.partnerLink, onEvent.getOperation()); oevent.messageExchangeId = onEvent.getMessageExchangeId(); oevent.route = onEvent.getRoute(); if (onEvent.getPortType() != null && !onEvent.getPortType().equals(oevent.partnerLink.myRolePortType.getQName())) throw new CompilationException(__cmsgs.errPortTypeMismatch(onEvent.getPortType(), oevent.partnerLink.myRolePortType.getQName())); Set csetNames = new HashSet(); // prevents duplicate cset in on one set of correlations for (Correlation correlation : onEvent.getCorrelations()) { if( csetNames.contains(correlation.getCorrelationSet() ) ) { throw new CompilationException(__cmsgs.errDuplicateUseCorrelationSet(correlation .getCorrelationSet())); } OScope.CorrelationSet cset = resolveCorrelationSet(correlation.getCorrelationSet()); switch (correlation.getInitiate()) { case UNSET: case NO: oevent.matchCorrelations.add(cset); oevent.partnerLink.addCorrelationSetForOperation(oevent.operation, cset, false); break; case YES: oevent.initCorrelations.add(cset); break; case JOIN: cset.hasJoinUseCases = true; oevent.joinCorrelations.add(cset); oevent.partnerLink.addCorrelationSetForOperation(oevent.operation, cset, true); } for (OProcess.OProperty property : cset.properties) { // Force resolution of alias, to make sure that we have // one for this variable-property pair. resolvePropertyAlias(oevent.variable, property.name); } csetNames.add(correlation.getCorrelationSet()); } if (onEvent.getActivity() == null) throw new CompilationException(__cmsgs.errInvalidAlarm().setSource(onEvent)); oevent.activity = compile(onEvent.getActivity()); } }); // Check links crossing restrictions. for (OLink link : oevent.incomingLinks) try { throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name)); } catch (CompilationException ce) { recoveredFromError(onEvent, ce); } for (OLink link : oevent.outgoingLinks) try { throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name)); } catch (CompilationException ce) { recoveredFromError(onEvent, ce); } oscope.eventHandler.onMessages.add(oevent); } private DebugInfo createDebugInfo(BpelObject bpelObject, String description) { int lineNo = bpelObject == null ? -1 : bpelObject.getLineNo(); String str = description == null && bpelObject != null ? bpelObject.toString() : null; Map extElmt = bpelObject == null ? null : bpelObject.getExtensibilityElements(); DebugInfo debugInfo = new DebugInfo(_processDef.getSource(), lineNo, extElmt); debugInfo.description = str; return debugInfo; } private void compile(final Variable src) { final OScope oscope = _structureStack.topScope(); if (src.getKind() == null) throw new CompilationException(__cmsgs.errVariableDeclMissingType(src.getName()).setSource(src)); if (oscope.getLocalVariable(src.getName()) != null) throw new CompilationException(__cmsgs.errDuplicateVariableDecl(src.getName()).setSource(src)); if (src.getTypeName() == null) throw new CompilationException(__cmsgs.errUnrecognizedVariableDeclaration(src.getName())); OVarType varType; switch (src.getKind()) { case ELEMENT: varType = resolveElementType(src.getTypeName()); break; case MESSAGE: varType = resolveMessageType(src.getTypeName()); break; case SCHEMA: varType = resolveXsdType(src.getTypeName()); break; throw new CompilationException(__cmsgs.errUnrecognizedVariableDeclaration(src.getName())); } OScope.Variable ovar = new OScope.Variable(_oprocess, varType); ovar.name = src.getName(); ovar.declaringScope = oscope; ovar.debugInfo = createDebugInfo(src, null); ovar.extVar = compileExtVar(src); oscope.addLocalVariable(ovar); if (__log.isDebugEnabled()) __log.debug("Compiled variable " + ovar); } private void compile(TerminationHandler terminationHandler) { OScope oscope = _structureStack.topScope(); oscope.terminationHandler = new OTerminationHandler(_oprocess, oscope); oscope.terminationHandler.name = "__terminationHandler:" + oscope.name; oscope.terminationHandler.debugInfo = createDebugInfo(terminationHandler, null); if (terminationHandler == null) { oscope.terminationHandler.activity = createDefaultCompensateActivity(null, "Auto-generated 'compensate all' pseudo-activity for default termination handler on " + oscope.toString()); _recoveryContextStack.push(oscope); try { oscope.terminationHandler.activity = compile(terminationHandler.getActivity()); } finally { _recoveryContextStack.pop(); } } } private void compile(CompensationHandler compensationHandler) { OScope oscope = _structureStack.topScope(); oscope.compensationHandler = new OCompensationHandler(_oprocess, oscope); oscope.compensationHandler.name = "__compenationHandler_" + oscope.name; oscope.compensationHandler.debugInfo = createDebugInfo(compensationHandler, null); if (compensationHandler == null) { oscope.compensationHandler.activity = createDefaultCompensateActivity(compensationHandler, "Auto-generated 'compensate all' pseudo-activity for default compensation handler on " + oscope.toString()); } else { _recoveryContextStack.push(oscope); try { oscope.compensationHandler.activity = compile(compensationHandler.getActivity()); } finally { _recoveryContextStack.pop(); } } } private void compile(FaultHandler fh) { OScope oscope = _structureStack.topScope(); oscope.faultHandler = new OFaultHandler(_oprocess); if (fh == null) { // The default fault handler compensates all child activities // AND then rethrows the fault! final OCatch defaultCatch = new OCatch(_oprocess, oscope); defaultCatch.name = "__defaultFaultHandler:" + oscope.name; defaultCatch.faultName = null; // catch any fault defaultCatch.faultVariable = null; OSequence sequence = new OSequence(_oprocess, defaultCatch); sequence.name = "__defaultFaultHandler_sequence:" + oscope.name; sequence.debugInfo = createDebugInfo(fh, "Auto-generated sequence activity."); ORethrow rethrow = new ORethrow(_oprocess, sequence); rethrow.name = "__defaultFaultHandler_rethrow:" + oscope.name; rethrow.debugInfo = createDebugInfo(fh, "Auto-generated re-throw activity."); sequence.sequence.add(createDefaultCompensateActivity(fh, "Default compensation handler for " + oscope)); sequence.sequence.add(rethrow); defaultCatch.activity = sequence; oscope.faultHandler.catchBlocks.add(defaultCatch); if (__log.isDebugEnabled()) __log.debug("Compiled default catch block " + defaultCatch + " for " + oscope); } else { _recoveryContextStack.push(oscope); try { int i = 0; for (final Catch catchSrc : fh.getCatches()) { } final OCatch ctch = new OCatch(_oprocess, oscope); ctch.debugInfo = createDebugInfo(catchSrc, catchSrc.toString()); ctch.name = "__catch#" + i + ":" + _structureStack.topScope().name; ctch.faultName = catchSrc.getFaultName(); compile(ctch, catchSrc, new Runnable() { public void run() { if (catchSrc.getFaultVariable() != null) { OScope.Variable faultVar; switch (_processDef.getBpelVersion()) { case BPEL11: faultVar = resolveVariable(catchSrc.getFaultVariable()); if (!(faultVar.type instanceof OMessageVarType)) throw new CompilationException(__cmsgs.errMessageVariableRequired( catchSrc.getFaultVariable()).setSource(catchSrc)); break; case BPEL20_DRAFT: case BPEL20: if (catchSrc.getFaultVariableMessageType() == null && catchSrc.getFaultVariableElementType() == null) throw new CompilationException(__cmsgs.errVariableDeclMissingType( catchSrc.getFaultVariable()).setSource(catchSrc)); if (catchSrc.getFaultVariableMessageType() != null && catchSrc.getFaultVariableElementType() != null) throw new CompilationException(__cmsgs.errVariableDeclMissingType( catchSrc.getFaultVariable()).setSource(catchSrc)); OVarType faultVarType; if (catchSrc.getFaultVariableMessageType() != null) faultVarType = resolveMessageType(catchSrc.getFaultVariableMessageType()); else if (catchSrc.getFaultVariableElementType() != null) faultVarType = resolveElementType(catchSrc.getFaultVariableElementType()); else throw new CompilationException(__cmsgs .errUnrecognizedVariableDeclaration(catchSrc.getFaultVariable())); faultVar = new OScope.Variable(_oprocess, faultVarType); faultVar.name = catchSrc.getFaultVariable(); faultVar.declaringScope = _structureStack.topScope(); ctch.addLocalVariable(faultVar); break; default: throw new AssertionError("Unexpected BPEL VERSION constatnt: " + _processDef.getBpelVersion()); } ctch.faultVariable = faultVar; } if (catchSrc.getActivity() == null) throw new CompilationException(__cmsgs.errEmptyCatch().setSource(catchSrc)); _structureStack.topScope().activity = compile(catchSrc.getActivity()); } }); oscope.faultHandler.catchBlocks.add(ctch); ++i; } } finally { _recoveryContextStack.pop(); } } } public OXslSheet compileXslt(String docStrUri) throws CompilationException { URI docUri; try { docUri = new URI(FileUtils.encodePath(docStrUri)); } catch (URISyntaxException e) { throw new CompilationException(__cmsgs.errInvalidDocXsltUri(docStrUri)); } String sheetBody = loadXsltSheet(_processURI.resolve(docUri)); if (sheetBody == null) { throw new CompilationException(__cmsgs.errCantFindXslt(docStrUri)); } OXslSheet oXslSheet = new OXslSheet(_oprocess); oXslSheet.uri = docUri; oXslSheet.sheetBody = sheetBody; _oprocess.xslSheets.put(oXslSheet.uri, oXslSheet); return oXslSheet; } private String loadXsltSheet(URI uri) { // TODO: lots of null returns, should have some better error messages. InputStream is; try { is = _resourceFinder.openResource(uri); } catch (Exception e1) { return null; } if (is == null) return null; try { return new String(StreamUtils.read(is)); } catch (IOException e) { __log.debug("IO error", e); // todo: this should produce a message return null; } finally { try { is.close(); } catch (Exception ex) { // No worries. public boolean isPartnerLinkAssigned(String plink) { for (OActivity act : _compiledActivities) { if (act instanceof OAssign) { OAssign assign = (OAssign) act; for (OAssign.Copy copy : assign.copy) { if (copy.to instanceof OAssign.PartnerLinkRef) { if (((OAssign.PartnerLinkRef) copy.to).partnerLink.getName().equals(plink)) return true; } } } } return false; } public Definition[] getWsdlDefinitions() { Definition[] result = new Definition[_wsdlRegistry.getDefinitions().length]; for (int m = 0; m < _wsdlRegistry.getDefinitions().length; m++) { Definition4BPEL definition4BPEL = _wsdlRegistry.getDefinitions()[m]; result[m] = definition4BPEL.getDefinition(); } return result; } private OElementVarType resolveElementType(QName faultVariableElementType) { OElementVarType type = _oprocess.elementTypes.get(faultVariableElementType); if (type == null) { type = new OElementVarType(_oprocess, faultVariableElementType); _oprocess.elementTypes.put(faultVariableElementType, type); } return type; } @SuppressWarnings("unchecked") private ActivityGenerator findActivityGen(Activity source) { Class actClass = source.getClass(); for (Map.Entry me : _actGenerators.entrySet()) { Class cls = me.getKey(); if (cls.isAssignableFrom(actClass)) { ActivityGenerator gen = me.getValue(); gen.setContext(this); return gen; } } throw new CompilationException(__cmsgs.errUnknownActivity(actClass.getName()).setSource(source)); } @SuppressWarnings("unchecked") protected void registerActivityCompiler(Class defClass, ActivityGenerator generator) { if (__log.isDebugEnabled()) { __log.debug("Adding compiler for nodes class \"" + defClass.getName() + " = " + generator); } _actGenerators.put(defClass, generator); } private ExpressionCompiler findExpLangCompiler(String expLang) { ExpressionCompiler compiler = _expLanguageCompilers.get(expLang); if (compiler == null) { throw new CompilationException(__cmsgs.errUnknownExpressionLanguage(expLang)); return compiler; } private String getExpressionLanguage(Expression exp) { String expLang = exp.getExpressionLanguage(); if (expLang == null) expLang = _processDef.getExpressionLanguage(); if (expLang == null) expLang = getDefaultExpressionLanguage(); return expLang; } protected abstract String getDefaultExpressionLanguage(); protected abstract String getBpwsNamespace(); protected void registerExpressionLanguage(String expLangUri, ExpressionCompiler expressionCompiler) { _expLanguageCompilers.put(expLangUri, expressionCompiler); } @SuppressWarnings("unchecked") protected void registerExpressionLanguage(String expLangUri, String classname) throws Exception { Class cls = Class.forName(classname); registerExpressionLanguage(expLangUri, (ExpressionCompiler) cls.newInstance()); } >>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a public enum Version { BPEL11,
Solution content
package org.apache.ode.bpel.compiler;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;

import javax.wsdl.Definition;
import javax.wsdl.Message;
import javax.wsdl.Operation;
import javax.wsdl.Part;
import javax.wsdl.PortType;
import javax.wsdl.WSDLException;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.compiler.api.CompilationException;
import org.apache.ode.bpel.compiler.api.CompilationMessage;
import org.apache.ode.bpel.compiler.api.CompileListener;
import org.apache.ode.bpel.compiler.api.CompilerContext;
import org.apache.ode.bpel.compiler.api.ExpressionCompiler;
import org.apache.ode.bpel.compiler.api.ExpressionValidator;
import org.apache.ode.bpel.compiler.api.SourceLocation;
import org.apache.ode.bpel.compiler.bom.Activity;
import org.apache.ode.bpel.compiler.bom.Bpel11QNames;
import org.apache.ode.bpel.compiler.bom.Bpel20QNames;
import org.apache.ode.bpel.compiler.bom.BpelObject;
import org.apache.ode.bpel.compiler.bom.Catch;
import org.apache.ode.bpel.compiler.bom.CompensationHandler;
import org.apache.ode.bpel.compiler.bom.Correlation;
import org.apache.ode.bpel.compiler.bom.CorrelationSet;
import org.apache.ode.bpel.compiler.bom.Expression;
import org.apache.ode.bpel.compiler.bom.Expression11;
import org.apache.ode.bpel.compiler.bom.FaultHandler;
import org.apache.ode.bpel.compiler.bom.Import;
import org.apache.ode.bpel.compiler.bom.LinkSource;
import org.apache.ode.bpel.compiler.bom.LinkTarget;
import org.apache.ode.bpel.compiler.bom.OnAlarm;
import org.apache.ode.bpel.compiler.bom.OnEvent;
import org.apache.ode.bpel.compiler.bom.PartnerLink;
import org.apache.ode.bpel.compiler.bom.PartnerLinkType;
import org.apache.ode.bpel.compiler.bom.Process;
import org.apache.ode.bpel.compiler.bom.Property;
import org.apache.ode.bpel.compiler.bom.PropertyAlias;
import org.apache.ode.bpel.compiler.bom.Scope;
import org.apache.ode.bpel.compiler.bom.ScopeActivity;
import org.apache.ode.bpel.compiler.bom.ScopeLikeActivity;
import org.apache.ode.bpel.compiler.bom.TerminationHandler;
import org.apache.ode.bpel.compiler.bom.Variable;
import org.apache.ode.bpel.compiler.wsdl.Definition4BPEL;
import org.apache.ode.bpel.compiler.wsdl.WSDLFactory4BPEL;
import org.apache.ode.bpel.o.DebugInfo;
import org.apache.ode.bpel.o.OActivity;
import org.apache.ode.bpel.o.OAssign;
import org.apache.ode.bpel.o.OCatch;
import org.apache.ode.bpel.o.OCompensate;
import org.apache.ode.bpel.o.OCompensationHandler;
import org.apache.ode.bpel.o.OConstantExpression;
import org.apache.ode.bpel.o.OConstantVarType;
import org.apache.ode.bpel.o.OConstants;
import org.apache.ode.bpel.o.OElementVarType;
import org.apache.ode.bpel.o.OEventHandler;
import org.apache.ode.bpel.o.OExpression;
import org.apache.ode.bpel.o.OExpressionLanguage;
import org.apache.ode.bpel.o.OExtVar;
import org.apache.ode.bpel.o.OFaultHandler;
import org.apache.ode.bpel.o.OFlow;
import org.apache.ode.bpel.o.OLValueExpression;
import org.apache.ode.bpel.o.OLink;
import org.apache.ode.bpel.o.OMessageVarType;
import org.apache.ode.bpel.o.OPartnerLink;
import org.apache.ode.bpel.o.OProcess;
import org.apache.ode.bpel.o.ORethrow;
import org.apache.ode.bpel.o.OScope;
import org.apache.ode.bpel.o.OSequence;
import org.apache.ode.bpel.o.OTerminationHandler;
import org.apache.ode.bpel.o.OVarType;
import org.apache.ode.bpel.o.OXsdTypeVarType;
import org.apache.ode.bpel.o.OXslSheet;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.NSContext;
import org.apache.ode.utils.Namespaces;
import org.apache.ode.utils.StreamUtils;
import org.apache.ode.utils.fs.FileUtils;
import org.apache.ode.utils.msg.MessageBundle;
import org.apache.ode.utils.stl.CollectionsX;
import org.apache.ode.utils.stl.MemberOfFunction;
import org.apache.ode.utils.stl.UnaryFunction;
import org.apache.ode.utils.xsd.SchemaModel;
import org.apache.ode.utils.xsd.XSUtils;
import org.apache.ode.utils.xsd.XsdException;
import org.apache.ode.utils.xsl.XslTransformHandler;
import org.apache.xerces.xni.parser.XMLEntityResolver;
import org.w3c.dom.Document;
import org.w3c.dom.Node;

/**
 * Compiler for converting BPEL process descriptions (and their associated WSDL
 * and XSD documents) into compiled representations suitable for execution by
 * the ODE BPEL Service Provider. TODO: Move process validation into this class.
 */
public abstract class BpelCompiler implements CompilerContext {
    /** Class-severity logger. */
    protected static final Log __log = LogFactory.getLog(BpelCompiler.class);

    /** Standardized compiler messages. */
    private static final CommonCompilationMessages __cmsgs = MessageBundle.getMessages(CommonCompilationMessages.class);

    private org.apache.ode.bpel.compiler.bom.Process _processDef;

    private Date _generatedDate;

    @SuppressWarnings("unchecked")
    private HashMap _actGenerators = new HashMap();

    private boolean _supressJoinFailure = false;

    private boolean _atomicScope = false;

    /** Syntactic scope stack. */
    private StructureStack _structureStack = new StructureStack();

    /** Fault/compensate recovery stack. */
    private Stack _recoveryContextStack = new Stack();

    /** History of compiled activities */
    private List _compiledActivities = new ArrayList();

    private OProcess _oprocess;

    private ResourceFinder _resourceFinder;

    private WSDLRegistry _wsdlRegistry;

    private final List _errors = new ArrayList();

    private CompileListener _compileListener;

    private final HashMap _expLanguageCompilers = new HashMap();

    private final HashMap _expLanguages = new HashMap();
    
    private ExpressionValidatorFactory _expressionValidatorFactory = new ExpressionValidatorFactory(System.getProperties());

    private WSDLFactory4BPEL _wsdlFactory;

    private OExpressionLanguage _konstExprLang;

    private Map _customProcessProperties;

    private URI _processURI;
    
    BpelCompiler(WSDLFactory4BPEL wsdlFactory) {
        _wsdlFactory = wsdlFactory;
        _wsdlRegistry = new WSDLRegistry(this);
    }

    public void addWsdlImport(URI from, URI wsdlImport, SourceLocation sloc) {
        Definition4BPEL def;
        try {
            WSDLReader r = _wsdlFactory.newWSDLReader();
            WSDLLocatorImpl locator = new WSDLLocatorImpl(_resourceFinder, _resourceFinder.resolve(from, wsdlImport));
            def = (Definition4BPEL) r.readWSDL(locator);
        } catch (WSDLException e) {
            recoveredFromError(sloc, new CompilationException(__cmsgs.errWsdlParseError(e
                    .getFaultCode(), e.getLocation(), e.getMessage())));
            throw new CompilationException(__cmsgs.errWsdlImportFailed(wsdlImport.toASCIIString(), e.getFaultCode())
                    .setSource(sloc), e);
        }

        try {
            _wsdlRegistry.addDefinition(def, _resourceFinder, _resourceFinder.resolve(from, wsdlImport));
            if (__log.isDebugEnabled())
                __log.debug("Added WSDL Definition: " + wsdlImport);
        } catch (CompilationException ce) {
            recoveredFromError(sloc, ce);
        }
    }

    public void addXsdImport(URI from, URI location, SourceLocation sloc) {
        URI resFrom = _resourceFinder.resolve(from, location);
        if (__log.isDebugEnabled())
            __log.debug("Adding XSD import from " + resFrom + " location " + location);
        XMLEntityResolver resolver = new WsdlFinderXMLEntityResolver(_resourceFinder,
                location, new HashMap(), true);
        try {
            InputStream xsdStream = _resourceFinder.openResource(resFrom);
            byte[] data;
            try {
                data = StreamUtils.read(xsdStream);
            } finally {
                xsdStream.close();
            }
            
            Map schemas = XSUtils.captureSchema(resFrom, data, resolver);
            _wsdlRegistry.addSchemas(schemas);
        } catch (XsdException e) {
            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
            recoveredFromError(sloc, ce);
        } catch (MalformedURLException e) {
            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
            recoveredFromError(sloc, ce);
        } catch (IOException e) {
            CompilationException ce =  new CompilationException(__cmsgs.errInvalidImport(location.toString()));
            recoveredFromError(sloc, ce);
        }
    }

    public void setResourceFinder(ResourceFinder finder) {
        if (finder == null) {
            _resourceFinder = new DefaultResourceFinder();
        } else {
            _resourceFinder = finder;
        }

    }

    public void setCompileListener(CompileListener compileListener) {
        _compileListener = compileListener;
    }

    public CompileListener getCompileListener() {
        return _compileListener;
    }

    public void setCustomProperties(Map customProperties) {
        _customProcessProperties = customProperties;
    }

    /**
     * Get the process definition.
     * 
     * @return the process definition
     */
    public Process getProcessDef() {
        return _processDef;
    }

    public PortType resolvePortType(final QName portTypeName) {
        if (portTypeName == null)
            throw new NullPointerException("Null portTypeName argument!");

        PortType portType = _wsdlRegistry.getPortType(portTypeName);
        if (portType == null)
            throw new CompilationException(__cmsgs.errUndeclaredPortType(portTypeName));
        return portType;
    }

    public OLink resolveLink(String linkName) {
        OLink ret = null;

        // Fist find where the link is declared.
        for (Iterator i = _structureStack.iterator(); i.hasNext();) {
            OActivity oact = i.next();
            if (oact instanceof OFlow)
                ret = ((OFlow) oact).getLocalLink(linkName);
            if (ret != null)
                return ret;
        }

        throw new CompilationException(__cmsgs.errUndeclaredLink(linkName));
    }

    public OScope.Variable resolveVariable(String varName) {
        for (Iterator i = _structureStack.oscopeIterator(); i.hasNext();) {
            OScope.Variable var = i.next().getLocalVariable(varName);
            if (var != null)
                return var;
        }
        _processDef = process;
        // A "real" variable couldn't be found, checking if we're dealing with a
        // process custom property
        if (_customProcessProperties != null && _customProcessProperties.get(QName.valueOf(varName)) != null) {

        }
        throw new CompilationException(__cmsgs.errUndeclaredVariable(varName));
    }

    public List getAccessibleVariables() {
        ArrayList result = new ArrayList();
        for (Iterator i = _structureStack.oscopeIterator(); i.hasNext();) {
            result.addAll(i.next().variables.values());
        }
        return result;
    }

    public OScope.Variable resolveMessageVariable(String inputVar) throws CompilationException {
        OScope.Variable var = resolveVariable(inputVar);
        if (!(var.type instanceof OMessageVarType))
            throw new CompilationException(__cmsgs.errMessageVariableRequired(inputVar));
        return var;
    }

    public OScope.Variable resolveMessageVariable(String inputVar, QName messageType) throws CompilationException {
        OScope.Variable var = resolveMessageVariable(inputVar);
        if (!((OMessageVarType) var.type).messageType.equals(messageType))
            throw new CompilationException(__cmsgs.errVariableTypeMismatch(var.name, messageType,
                    ((OMessageVarType) var.type).messageType));
        return var;
    }

    public OProcess.OProperty resolveProperty(QName name) {

        for (OProcess.OProperty prop : _oprocess.properties) {
            if (prop.name.equals(name))
                return prop;
        }
        throw new CompilationException(__cmsgs.errUndeclaredProperty(name));
    }

    public OProcess.OPropertyAlias resolvePropertyAlias(OScope.Variable variable, QName propertyName) {
        if (!(variable.type instanceof OMessageVarType))
            throw new CompilationException(__cmsgs.errMessageVariableRequired(variable.name));

        OProcess.OProperty property = resolveProperty(propertyName);
        OProcess.OPropertyAlias alias = property.getAlias(variable.type);
        if (alias == null)
            throw new CompilationException(__cmsgs.errUndeclaredPropertyAlias(variable.type.toString(), propertyName));

        return alias;
    }

    public OScope resolveCompensatableScope(final String scopeToCompensate) throws CompilationException {
        if (_recoveryContextStack.isEmpty())
            throw new CompilationException(__cmsgs.errCompensateNAtoContext());
        OScope recoveryContext = _recoveryContextStack.peek();

        OScope scopeToComp = CollectionsX.find_if(recoveryContext.compensatable, new MemberOfFunction() {
            public boolean isMember(OScope o) {
                return o.name != null && o.name.equals(scopeToCompensate);
            }
        });
        if (scopeToComp == null)
            throw new CompilationException(__cmsgs.errCompensateOfInvalidScope(scopeToCompensate));

        return scopeToComp; 
    }

    public String getSourceLocation() {
        return _processDef.getSource() == null ? null : _processDef.getSource();
    }

    public OScope.CorrelationSet resolveCorrelationSet(String csetName) {
        for (Iterator i = _structureStack.oscopeIterator(); i.hasNext();) {
            OScope.CorrelationSet cset = i.next().getCorrelationSet(csetName);
            if (cset != null)
                return cset;
        }

        throw new CompilationException(__cmsgs.errUndeclaredCorrelationSet(csetName));
    }

    @SuppressWarnings("unchecked")
    public OMessageVarType resolveMessageType(QName messageType) {
        OMessageVarType msgType = _oprocess.messageTypes.get(messageType);
        if (msgType == null) {
            Message msg = _wsdlRegistry.getMessage(messageType);
            if (msg == null) {
        _generatedDate = new Date();
                throw new CompilationException(__cmsgs.errUndeclaredMessage(messageType.getLocalPart(), messageType
                        .getNamespaceURI()));
            }

            List parts = new ArrayList();
            CollectionsX.transform(parts, ((List) msg.getOrderedParts(null)),
                    new UnaryFunction() {
                        public OMessageVarType.Part apply(Part part) {
                            OVarType partType;
                            if (part.getElementName() != null) {
                                partType = resolveElementType(part.getElementName());
                            } else {
                                partType = resolveXsdType(part.getTypeName());
                            }

                            OMessageVarType.Part opart = new OMessageVarType.Part(_oprocess, part.getName(), partType);
                            opart.debugInfo = createDebugInfo(_processDef, "Message Variable Part: " + part.getName());
                            return opart;
                        }
                    });
            msgType = new OMessageVarType(_oprocess, msg.getQName(), parts);
            msgType.debugInfo = createDebugInfo(_processDef, "Message Type: " + msg.getQName());
            _oprocess.messageTypes.put(msg.getQName(), msgType);
        }
        return msgType;
    }

    public OXsdTypeVarType resolveXsdType(QName typeName) throws CompilationException {
        OXsdTypeVarType type = _oprocess.xsdTypes.get(typeName);
        if (type == null) {
            __log.debug("Resolving XSD type " + typeName);
            SchemaModel model = null;
            try {
                model = _wsdlRegistry.getSchemaModel();
            } catch (IllegalArgumentException iaa) { }
            if (model == null || !model.knowsSchemaType(typeName))
                throw new CompilationException(__cmsgs.errUndeclaredXsdType(typeName));
            
            type = new OXsdTypeVarType(_oprocess);
            type.debugInfo = createDebugInfo(_processDef, "XSD Type: " + typeName);
            type.xsdType = typeName;
            type.simple = _wsdlRegistry.getSchemaModel().isSimpleType(typeName);
            _oprocess.xsdTypes.put(typeName, type);
        }

        return type;
    }

    public OMessageVarType.Part resolvePart(OScope.Variable var, String partname) {
        if (!(var.type instanceof OMessageVarType))
            throw new CompilationException(__cmsgs.errMessageVariableRequired(var.name));
        OMessageVarType msgVarType = (OMessageVarType) var.type;
        OMessageVarType.Part part = msgVarType.parts.get(partname);
        if (part == null)
            throw new CompilationException(__cmsgs.errUndeclaredMessagePart(var.name,
                    ((OMessageVarType) var.type).messageType, partname));
        return part;
    }

    public OMessageVarType.Part resolveHeaderPart(OScope.Variable var, String partname) {
        if (!(var.type instanceof OMessageVarType))
            throw new CompilationException(__cmsgs.errMessageVariableRequired(var.name));
        OMessageVarType msgVarType = (OMessageVarType) var.type;
        return msgVarType.parts.get(partname);
    }

    public PartnerLinkType resolvePartnerLinkType(QName partnerLinkType) {

        PartnerLinkType plinkType = _wsdlRegistry.getPartnerLinkType(partnerLinkType);
        if (plinkType == null)
            throw new CompilationException(__cmsgs.errUndeclaredPartnerLinkType(partnerLinkType));
        return plinkType;
    }

    public OPartnerLink resolvePartnerLink(String name) {
        for (Iterator i = _structureStack.oscopeIterator(); i.hasNext();) {
            OPartnerLink oplink = i.next().getLocalPartnerLink(name);
            if (oplink != null)
                return oplink;
        }

        throw new CompilationException(__cmsgs.errUndeclaredPartnerLink(name));
    }

    @SuppressWarnings("unchecked")

    public Operation resolvePartnerRoleOperation(final OPartnerLink partnerLink, final String operationName) {
        if (partnerLink.partnerRolePortType == null) {

        case BPEL11:
            throw new CompilationException(__cmsgs.errPartnerLinkDoesNotDeclarePartnerRole(partnerLink.getName()));
        }

        Operation found = CollectionsX.find_if((List) partnerLink.partnerRolePortType.getOperations(),
                new MemberOfFunction() {
                    public boolean isMember(Operation o) {
                        // Guard against WSDL4j funny business.
                        if ((o.getInput() == null || o.getInput().getMessage() == null)
                                && (o.getOutput() == null || o.getOutput().getMessage() == null)) {
                            return false;
                        }
                        return o.getName().equals(operationName);
                    }
                });

        if (found == null)
            throw new CompilationException(__cmsgs.errUndeclaredOperation(partnerLink.partnerRolePortType.getQName(),
                    operationName));
        return found;
    }

    @SuppressWarnings("unchecked")
    public Operation resolveMyRoleOperation(final OPartnerLink partnerLink, final String operationName) {
        if (partnerLink.myRolePortType == null) {
            throw new CompilationException(__cmsgs.errPartnerLinkDoesNotDeclareMyRole(partnerLink.getName()));
        }

        Operation found = CollectionsX.find_if((List) partnerLink.myRolePortType.getOperations(),
                new MemberOfFunction() {
                    public boolean isMember(Operation o) {
                        // Again, guard against WSDL4J's "help"
                        if ((o.getInput() == null || o.getInput().getMessage() == null)
                                && (o.getOutput() == null || o.getOutput().getMessage() == null))
                            return false;
                        return o.getName().equals(operationName);
                    }
                });
        if (found == null) {
            throw new CompilationException(__cmsgs.errUndeclaredOperation(partnerLink.myRolePortType.getQName(),
                    operationName));
        }
        return found;
    }

    /**
     * Produce a boolean {@link OExpression} expression that returns a constant
     * value.
     * 
     * @param value
     *            constant value to return
     * @return {@link OExpression} returning a constant value.
     */
    public OExpression constantExpr(boolean value) {
        OConstantExpression ce = new OConstantExpression(_oprocess, value ? Boolean.TRUE : Boolean.FALSE);
        ce.debugInfo = createDebugInfo(_processDef, "Constant Boolean Expression: " + value);
        ce.expressionLanguage = _konstExprLang;
        return ce;
    }

    public OLValueExpression compileLValueExpr(Expression expression) throws CompilationException {
        return compileLValueExpr(expression, null, null, new Object[1]);
    }

    public OLValueExpression compileLValueExpr(Expression expression, OVarType rootNodeType, Object requestedResultType, Object[] resultType) throws CompilationException {
        return (OLValueExpression) compileExpr(expression, false, true, rootNodeType, requestedResultType, resultType);
    }

    public OExpression compileJoinCondition(Expression expression) throws CompilationException {
        return compileExpr(expression, true, false, null, null, new Object[1]);
    }

    public OExpression compileExpr(Expression expression) throws CompilationException {
        return compileExpr(expression, null, null, new Object[1]);
    }
    
    public OExpression compileExpr(Expression expression, OVarType rootNodeType, Object requestedResultType, Object[] resultType) throws CompilationException {
        return compileExpr(expression, false, false, rootNodeType, requestedResultType, resultType);
    }

    public OExpression compileExpr(String expr, NSContext nc) {
        // Does this really work?
        BpelObject cur = _structureStack.topSource();
        return compileExpr(new Expression11(cur.getElement(),cur.getElement().getOwnerDocument().createTextNode(expr)), false, false, null, null, new Object[1]);
    }
    private OExpression compileExpr(Expression expression, boolean isJoinCondition, boolean isLValue, OVarType rootNodeType, Object requestedResultType, Object[] resultType) {
        String expLang = getExpressionLanguage(expression);
        ExpressionCompiler ec = findExpLangCompiler(expLang);
        ec.setCompilerContext(this);
        ExpressionValidator ev = _expressionValidatorFactory.getValidator();

        try {
            OExpression oexpr;
            if (isJoinCondition) {
                oexpr = ec.compileJoinCondition(expression);
            } else {
                oexpr = ec.compile(expression);
                resultType[0] = ev.validate(expression, rootNodeType, requestedResultType);
            }

            oexpr.debugInfo = createDebugInfo(expression, expression.toString());

            OExpressionLanguage expLanguage = _expLanguages.get(expLang);
            if (expLanguage == null) {
                expLanguage = new OExpressionLanguage(_oprocess, ec.getProperties());
                expLanguage.debugInfo = createDebugInfo(_processDef, "Expression Language: " + expLang);
                expLanguage.expressionLanguageUri = expLang;
                _expLanguages.put(expLang, expLanguage);
                _oprocess.expressionLanguages.add(expLanguage);
            }
            oexpr.expressionLanguage = expLanguage;

            // Cleaning up expression compiler for furter compilation
            ec.setCompilerContext(null);
            
            return oexpr;
        } catch (CompilationException ce) {
            if (ce.getCompilationMessage().source == null)
                ce.getCompilationMessage().setSource(expression);
            throw ce;
        }
    }

    public OProcess getOProcess() throws CompilationException {
        return _oprocess;
    }

    public void recoveredFromError(SourceLocation where, CompilationException bce) throws CompilationException {
        if (bce.getCompilationMessage().source == null)
            bce.getCompilationMessage().source = where;

        if (_compileListener == null) {
            switch (bce.getCompilationMessage().severity) {
            case CompilationMessage.INFO:
                if (__log.isInfoEnabled()) {
                    __log.info(bce.toErrorMessage());
                }
                break;
            case CompilationMessage.WARN:
                if (__log.isWarnEnabled()) {
                    __log.warn(bce.toErrorMessage());
                }
                break;
            case CompilationMessage.ERROR:
                if (__log.isErrorEnabled()) {
                    __log.error(bce.toErrorMessage());
                }
            }
        } else {
            if (__log.isDebugEnabled()) {
                __log.debug(bce.toErrorMessage(), bce);
            }
            _compileListener.onCompilationMessage(bce.getCompilationMessage());
        }

        _errors.add(bce.getCompilationMessage());
    }

    public static long getVersion(String dirName) {
        try {
            return Integer.parseInt(dirName.substring(dirName.lastIndexOf("-") + 1));
        } catch (Throwable t) {
            return 0;
        }
    }
    
    /**
     * Compile a process.
     */
    public OProcess compile(final Process process, ResourceFinder rf, long version) throws CompilationException {
        if (process == null)
            throw new NullPointerException("Null process parameter");
        
        setResourceFinder(rf);
        _processURI = process.getURI();
        _structureStack.clear();

        String bpelVersionUri = null;
        switch (process.getBpelVersion()) {
            bpelVersionUri = Bpel11QNames.NS_BPEL4WS_2003_03;
            break;
        case BPEL20_DRAFT:
            bpelVersionUri = Bpel20QNames.NS_WSBPEL2_0;
            break;
        case BPEL20:
            bpelVersionUri = Bpel20QNames.NS_WSBPEL2_0_FINAL_EXEC;
            break;
        default:
            throw new IllegalStateException("Bad bpel version: " + process.getBpelVersion());
        }

        _oprocess = new OProcess(bpelVersionUri);
        _oprocess.guid = null;
        _oprocess.constants = makeConstants();
        _oprocess.debugInfo = createDebugInfo(process, "process");
        
        if (process.getTargetNamespace() == null) {
            _oprocess.targetNamespace = "--UNSPECIFIED--";
            recoveredFromError(process, new CompilationException(__cmsgs.errProcessNamespaceNotSpecified()));
        } else {
            _oprocess.targetNamespace = _processDef.getTargetNamespace();
        }
        
        if (process.getName() == null) {
            _oprocess.processName = "--UNSPECIFIED--";
            recoveredFromError(process, new CompilationException(__cmsgs.errProcessNameNotSpecified()));
        } else {
            _oprocess.processName = _processDef.getName();
        }
        
        _oprocess.compileDate = _generatedDate;

        _konstExprLang = new OExpressionLanguage(_oprocess, null);
        _konstExprLang.debugInfo = createDebugInfo(_processDef, "Constant Value Expression Language");
        _konstExprLang.expressionLanguageUri = "uri:www.fivesight.com/konstExpression";
        _konstExprLang.properties.put("runtime-class",
                "org.apache.ode.bpel.runtime.explang.konst.KonstExpressionLanguageRuntimeImpl");
        _oprocess.expressionLanguages.add(_konstExprLang);

        // Process the imports. Note, we expect all processes (Event BPEL 1.1)
        // to have an import declaration. This should be automatically generated
        // by the 1.1 parser.
        for (Import imprt : _processDef.getImports()) {
            try {
                compile(_processURI, imprt);
            } catch (CompilationException bce) {
                // We try to recover from import problems by continuing
                recoveredFromError(imprt, bce);
            }
        }

        _expressionValidatorFactory.getValidator().bpelImportsLoaded(_processDef, this);
        
        switch (_processDef.getSuppressJoinFailure()) {
        case NO:
        case NOTSET:
            _supressJoinFailure = false;
            break;
        case YES:
            _supressJoinFailure = true;
            break;
        }
        // compile ALL wsdl properties; needed for property extraction
        Definition4BPEL[] defs = _wsdlRegistry.getDefinitions();
        for (Definition4BPEL def : defs) {
            for (Property property : def.getProperties()) {
                compile(property);
            }
        }
        // compile ALL wsdl property aliases
        for (Definition4BPEL def1 : defs) {
            for (PropertyAlias propertyAlias : def1.getPropertyAliases()) {
                compile(propertyAlias);
            }
        }

        OScope procesScope = new OScope(_oprocess, null);
        procesScope.name = "__PROCESS_SCOPE:" + process.getName();
        procesScope.debugInfo = createDebugInfo(process, null);
        _oprocess.procesScope = compileScope(procesScope, process, new Runnable() {
            public void run() {
                if (process.getRootActivity() == null) {
                    throw new CompilationException(__cmsgs.errNoRootActivity());
                }
                    }
                // Process custom properties are created as variables associated
                // with the top scope
                if (_customProcessProperties != null) {
                    }
                    for (Map.Entry customVar : _customProcessProperties.entrySet()) {
                        final OScope oscope = _structureStack.topScope();
                        OVarType varType = new OConstantVarType(_oprocess, customVar.getValue());
                        OScope.Variable ovar = new OScope.Variable(_oprocess, varType);
                        ovar.name = customVar.getKey().getLocalPart();
                        ovar.declaringScope = oscope;
                        ovar.debugInfo = createDebugInfo(null, "Process custom property variable");
                        oscope.addLocalVariable(ovar);
                        if (__log.isDebugEnabled())
                            __log.debug("Compiled custom property variable " + ovar);
                    }
                }
                _structureStack.topScope().activity = compile(process.getRootActivity());
            }
        });

        assert _structureStack.size() == 0;

        boolean hasErrors = false;
        StringBuffer sb = new StringBuffer();
        for (CompilationMessage msg : _errors) {
            if (msg.severity >= CompilationMessage.ERROR) {
                hasErrors = true;
                sb.append('\t');
                sb.append(msg.toErrorString());
                sb.append('\n');
            }
        }
        
        XslTransformHandler.getInstance().clearXSLSheets(_oprocess.getQName());

        _expressionValidatorFactory.getValidator().bpelCompilationCompleted(_processDef);
        
        if (hasErrors) {
            throw new CompilationException(__cmsgs.errCompilationErrors(_errors.size(), sb.toString()));
        }
        
        {
            String digest = "version:" + version + ";" + _oprocess.digest();
            _oprocess.guid = GUID.makeGUID(digest);
            if (__log.isDebugEnabled()) {
                __log.debug("Compiled process digest: " + digest + "\nguid: " + _oprocess.guid);
            }
        }
        return _oprocess;
    }

    private OConstants makeConstants() {
        OConstants constants = new OConstants(_oprocess);
        constants.qnConflictingReceive = new QName(getBpwsNamespace(), "conflictingReceive");
        constants.qnConflictingRequest = new QName(getBpwsNamespace(), "conflictingRequest");
        constants.qnCorrelationViolation = new QName(getBpwsNamespace(), "correlationViolation");
        constants.qnForcedTermination = new QName(getBpwsNamespace(), "forcedTermination");
        constants.qnJoinFailure = new QName(getBpwsNamespace(), "joinFailure");
        constants.qnMismatchedAssignmentFailure = new QName(getBpwsNamespace(), "mismatchedAssignment");
        constants.qnMissingReply = new QName(getBpwsNamespace(), "missingReply");
        constants.qnMissingRequest = new QName(getBpwsNamespace(), "missingRequest");
        constants.qnSelectionFailure = new QName(getBpwsNamespace(), "selectionFailure");
        constants.qnUninitializedVariable = new QName(getBpwsNamespace(), "uninitializedVariable");
        constants.qnXsltInvalidSource = new QName(getBpwsNamespace(), "xsltInvalidSource");
        constants.qnSubLanguageExecutionFault = new QName(getBpwsNamespace(), "subLanguageExecutionFault");
        constants.qnUninitializedPartnerRole = new QName(getBpwsNamespace(), "uninitializedPartnerRole");
        constants.qnForEachCounterError = new QName(getBpwsNamespace(), "forEachCounterError");
        constants.qnInvalidBranchCondition = new QName(getBpwsNamespace(), "invalidBranchCondition");
        constants.qnInvalidExpressionValue = new QName(getBpwsNamespace(), "invalidExpressionValue");

        constants.qnRetiredProcess = new QName(getOdeNamespace(), "retiredProcess");
        constants.qnTooManyInstances = new QName(getOdeNamespace(), "tooManyInstances");
        constants.qnUnknownFault = new QName(getOdeNamespace(), "unknownFault");
        constants.qnTooManyProcesses = new QName(getOdeNamespace(), "tooManyProcesses");
        constants.qnTooHugeProcesses = new QName(getOdeNamespace(), "tooHugeProcesses");
        return constants;
    }
    
    private String getOdeNamespace() {
        return Namespaces.ODE_EXTENSION_NS;
    }

    // TODO unused?
    // private String getBpelPartnerLinkUri(){
    // switch(_processDef.getBpelVersion()){
    // case Process.BPEL_V110:
    // return Constants.NS_BPEL4WS_PARTNERLINK_2003_05;
    // case Process.BPEL_V200:
    // return Constants.NS_WSBPEL_PARTNERLINK_2004_03;
    // default:
    // throw new IllegalStateException("Bad bpel version.");
    // }
    // }

    /**
     * Compile an import declaration. According to the specification:
     * 
A BPEL4WSWS-BPEL process definition relies on XML Schema and * WSDL 1.1 for the definition of datatypes and service interfaces. Process * definitions also rely on other constructs such as partner link types, * message properties and property aliases (defined later in this * specification) which are defined within WSDL 1.1 documents using the WSDL * 1.1 language extensibility feature. * * The <import> element is used within a BPEL4WSWS-BPEL process to * explicitly indicate a dependency on external XML Schema or WSDL * definitions. Any number of elements may appear as initial * children of the element, before any other child element. Each * element contains three mandatory attributes: *
    *
  1. namespace -- The namespace attribute specifies the URI namespace of * the imported definitions.
  2. *
  3. location -- The location attribute contains a URI indicating the * location of a document that contains relevant definitions in the * namespace specified. The document located at the URI MUST contain * definitions belonging to the same namespace as indicated by the namespace * attribute.
  4. *
  5. importType -- The importType attribute identifies the type of * document being imported by providing the URI of the encoding language. * The value MUST be set to "http://www.w3.org/2001/XMLSchema" when * importing XML Schema 1.0 documents, and to * "http://schemas.xmlsoap.org/wsdl/" when importing WSDL 1.1 documents. * * @param imprt * BOM representation of the import */ private void compile(URI current, Import imprt) { try { if (imprt.getImportType() == null) throw new CompilationException(__cmsgs.errUnspecifiedImportType().setSource(imprt)); if (imprt.getLocation() == null) throw new CompilationException(__cmsgs.errMissingImportLocation().setSource(imprt)); if (Import.IMPORTTYPE_WSDL11.equals(imprt.getImportType())) { addWsdlImport(current, imprt.getLocation(), imprt); } else if (Import.IMPORTTYPE_XMLSCHEMA10.equals(imprt.getImportType())) { addXsdImport(current, imprt.getLocation(), imprt); } else throw new CompilationException(__cmsgs.errUnknownImportType(imprt.getImportType()).setSource(imprt)); } catch (CompilationException ce) { if (ce.getCompilationMessage().source == null) ce.getCompilationMessage().setSource(imprt); throw ce; } } public OActivity compile(final Activity source) { if (source == null) throw new IllegalArgumentException("null-argument"); boolean previousSupressJoinFailure = _supressJoinFailure; switch (source.getSuppressJoinFailure()) { case NO: _supressJoinFailure = false; break; case YES: _supressJoinFailure = true; break; } OActivity compiled; try { compiled = (source instanceof ScopeLikeActivity) ? compileSLC((ScopeLikeActivity) source, new OScope.Variable[0]) : compileActivity(true, source); compiled.suppressJoinFailure = _supressJoinFailure; } finally { _supressJoinFailure = previousSupressJoinFailure; } if (__log.isDebugEnabled()) __log.debug("Compiled activity " + compiled); return compiled; } private OCompensate createDefaultCompensateActivity(BpelObject source, String desc) { OCompensate activity = new OCompensate(_oprocess, getCurrent()); activity.name = "__autoGenCompensate:" + _structureStack.topScope().name; activity.debugInfo = createDebugInfo(source, desc); return activity; } public OScope compileSLC(final ScopeLikeActivity source, final OScope.Variable[] variables) { final OScope implicitScope = new OScope(_oprocess, getCurrent()); implicitScope.implicitScope = true; implicitScope.name = createName(source, "implicit-scope"); implicitScope.debugInfo = createDebugInfo(source, "Scope-like construct " + source); compileScope(implicitScope, source.getScope(), new Runnable() { public void run() { compileLinks(source); for (OScope.Variable v : variables) { v.declaringScope = implicitScope; implicitScope.addLocalVariable(v); } if (source instanceof ScopeActivity) { Activity scopeChild = ((ScopeActivity) source).getChildActivity(); if (scopeChild == null) throw new CompilationException(__cmsgs.errEmptyScope().setSource(source)); implicitScope.activity = compile(scopeChild); } else { implicitScope.activity = compileActivity(false, source); } } }); return implicitScope; } private OActivity compileActivity(final boolean doLinks, final Activity source) { final ActivityGenerator actgen = findActivityGen(source); final OActivity oact = actgen.newInstance(source); oact.name = createName(source, "activity"); oact.debugInfo = createDebugInfo(source, "Activity body for " + source); _compiledActivities.add(oact); compile(oact, source, new Runnable() { public void run() { if (doLinks) compileLinks(source); actgen.compile(oact, source); } }); return oact; } private void compileLinks(Activity source) { /* Source Links Fixup */ for (LinkSource ls : source.getLinkSources()) compileLinkSource(ls); /* Target Links Fixup */ for (LinkTarget lt : source.getLinkTargets()) compileLinkTarget(lt); _structureStack.topActivity().joinCondition = (source.getJoinCondition() == null || source.getLinkTargets() .isEmpty()) ? null : compileJoinCondition(source.getJoinCondition()); } private String createName(Activity source, String type) { if (source.getName() != null) return source.getName(); return source.getType().getLocalPart() + "-" + type + "-line-" + source.getLineNo(); } private OProcess.OProperty compile(Property property) { OProcess.OProperty oproperty = new OProcess.OProperty(_oprocess); oproperty.name = property.getName(); oproperty.debugInfo = createDebugInfo(_processDef, "Property " + property.getName()); if (!_wsdlRegistry.getSchemaModel().isSimpleType(property.getPropertyType())) throw new CompilationException(__cmsgs.errPropertyDeclaredWithComplexType(property.getName(), property.getPropertyType()).setSource(property)); _oprocess.properties.add(oproperty); if (__log.isDebugEnabled()) __log.debug("Compiled property " + oproperty); return oproperty; } private OProcess.OPropertyAlias compile(PropertyAlias src) { OProcess.OProperty property = resolveProperty(src.getPropertyName()); OProcess.OPropertyAlias alias = new OProcess.OPropertyAlias(_oprocess); alias.debugInfo = createDebugInfo(_processDef, "PropertyAlias " + src.getPropertyName() + " for " + src.getMessageType()); if (src.getMessageType() == null){ throw new CompilationException(__cmsgs.errAliasUndeclaredMessage(src.getPropertyName(), src.getQuery().getPath())); } OMessageVarType messageType = resolveMessageType(src.getMessageType()); OVarType rootNodeType = messageType; alias.varType = messageType; // bpel 2.0 excludes declaration of part; // bpel 1.1 requires it if (src.getPart() != null) { alias.part = messageType.parts.get(src.getPart()); if (alias.part == null) throw new CompilationException(__cmsgs.errUnknownPartInAlias(src.getPart(), messageType.messageType.toString())); rootNodeType = alias.part.type; } if (src.getQuery() != null) alias.location = compileExpr(src.getQuery(), rootNodeType, null, new Object[1]); property.aliases.add(alias); alias.debugInfo = createDebugInfo(_processDef, src.getMessageType() + " --> " + src.getPropertyName()); return alias; } private void compileLinkTarget(LinkTarget target) { OLink ol = resolveLink(target.getLinkName()); assert ol != null; ol.debugInfo = createDebugInfo(target, target.toString()); if (ol.target != null) throw new CompilationException(__cmsgs.errDuplicateLinkTarget(target.getLinkName()).setSource(target)); ol.target = _structureStack.topActivity(); _structureStack.topActivity().targetLinks.add(ol); } private void compileLinkSource(LinkSource linksrc) { OLink ol = resolveLink(linksrc.getLinkName()); assert ol != null; ol.debugInfo = createDebugInfo(linksrc, linksrc.toString()); if (ol.source != null) throw new CompilationException(__cmsgs.errDuplicateLinkSource(linksrc.getLinkName()).setSource(linksrc)); ol.source = _structureStack.topActivity(); ol.transitionCondition = linksrc.getTransitionCondition() == null ? constantExpr(true) : compileExpr(linksrc .getTransitionCondition()); _structureStack.topActivity().sourceLinks.add(ol); _structureStack.topActivity().outgoingLinks.add(ol); } private void compile(final PartnerLink plink) { OPartnerLink oplink = new OPartnerLink(_oprocess); oplink.debugInfo = createDebugInfo(plink, plink.toString()); try { PartnerLinkType plinkType = resolvePartnerLinkType(plink.getPartnerLinkType()); oplink.partnerLinkType = plinkType.getName(); oplink.name = plink.getName(); oplink.initializePartnerRole = plink.isInitializePartnerRole(); if (plink.hasMyRole()) { PartnerLinkType.Role myRole = plinkType.getRole(plink.getMyRole()); if (myRole == null) throw new CompilationException(__cmsgs.errUndeclaredRole(plink.getMyRole(), plinkType.getName())); oplink.myRoleName = myRole.getName(); QName portType = myRole.getPortType(); if (portType == null) throw new CompilationException(__cmsgs.errMissingMyRolePortType(myRole.getPortType(), plink.getMyRole(), plinkType.getName())); oplink.myRolePortType = resolvePortType(portType); } if (plink.isInitializePartnerRole() && !plink.hasPartnerRole()) { throw new CompilationException(__cmsgs.errPartnerLinkNoPartnerRoleButInitialize(plink.getName())); } if (plink.hasPartnerRole()) { PartnerLinkType.Role partnerRole = plinkType.getRole(plink.getPartnerRole()); if (partnerRole == null) } throw new CompilationException(__cmsgs.errUndeclaredRole(plink.getPartnerRole(), plinkType .getName())); oplink.partnerRoleName = partnerRole.getName(); QName portType = partnerRole.getPortType(); if (portType == null) throw new CompilationException(__cmsgs.errMissingPartnerRolePortType(partnerRole.getPortType(), plink.getPartnerRole(), plinkType.getName())); oplink.partnerRolePortType = resolvePortType(portType); } oplink.declaringScope = _structureStack.topScope(); if (oplink.declaringScope.partnerLinks.containsKey(oplink.name)) throw new CompilationException(__cmsgs.errDuplicatePartnerLinkDecl(oplink.name)); oplink.declaringScope.partnerLinks.put(oplink.name, oplink); _oprocess.allPartnerLinks.add(oplink); } catch (CompilationException ce) { ce.getCompilationMessage().setSource(plink); throw ce; } } private void compile(CorrelationSet cset) { OScope oscope = _structureStack.topScope(); OScope.CorrelationSet ocset = new OScope.CorrelationSet(_oprocess); ocset.name = cset.getName(); ocset.declaringScope = oscope; ocset.debugInfo = createDebugInfo(cset, cset.toString()); QName[] setprops = cset.getProperties(); for (int j = 0; j < setprops.length; ++j) ocset.properties.add(resolveProperty(setprops[j])); oscope.addCorrelationSet(ocset); } public OActivity getCurrent() { return _structureStack.topActivity(); } public void compile(OActivity context, BpelObject source, Runnable run) { DefaultActivityGenerator.defaultExtensibilityElements(context, source); _structureStack.push(context,source); try { run.run(); } finally { OActivity popped = _structureStack.pop(); OActivity newtop = _structureStack.topActivity(); OScope topScope = _structureStack.topScope(); if (newtop != null) { newtop.nested.add(popped); // Transfer outgoing and incoming links, excluding the locally defined links. newtop.incomingLinks.addAll(popped.incomingLinks); if (newtop instanceof OFlow) newtop.incomingLinks.removeAll(((OFlow) newtop).localLinks); newtop.outgoingLinks.addAll(popped.outgoingLinks); if (newtop instanceof OFlow) newtop.outgoingLinks.removeAll(((OFlow) newtop).localLinks); // Transfer variables read/writen newtop.variableRd.addAll(popped.variableRd); newtop.variableWr.addAll(popped.variableWr); } if (topScope != null && popped instanceof OScope) topScope.compensatable.add((OScope) popped); } } private OScope compileScope(final OScope oscope, final Scope src, final Runnable init) { if (oscope.name == null) throw new IllegalArgumentException("Unnamed scope:" + src); oscope.debugInfo = createDebugInfo(src, src.toString()); boolean previousAtomicScope = _atomicScope; if (src.getAtomicScope() != null) { boolean newValue = src.getAtomicScope().booleanValue(); if (_atomicScope) throw new CompilationException(__cmsgs.errAtomicScopeNesting(newValue)); oscope.atomicScope = _atomicScope = newValue; } try { compile(oscope, src, new Runnable() { public void run() { for (Variable var : src.getVariables()) { try { compile(var); } catch (CompilationException ce) { recoveredFromError(var, ce); for (CorrelationSet cset : src.getCorrelationSetDecls()) { try { compile(cset); } catch (CompilationException ce) { recoveredFromError(cset, ce); } } for (PartnerLink plink : src.getPartnerLinks()) { try { compile(plink); } catch (CompilationException ce) { recoveredFromError(plink, ce); } } if (!src.getEvents().isEmpty() || !src.getAlarms().isEmpty()) { oscope.eventHandler = new OEventHandler(_oprocess); oscope.eventHandler.debugInfo = createDebugInfo(src, "Event Handler for " + src); } for (OnEvent onEvent : src.getEvents()) { try { compile(onEvent); } catch (CompilationException ce) { recoveredFromError(src, ce); } } for (OnAlarm onAlarm : src.getAlarms()) { try { compile(onAlarm); } catch (CompilationException ce) { recoveredFromError(src, ce); } } if (init != null) try { init.run(); } catch (CompilationException ce) { recoveredFromError(src, ce); } try { compile(src.getCompensationHandler()); } catch (CompilationException bce) { recoveredFromError(src.getCompensationHandler(), bce); } try { compile(src.getTerminationHandler()); } catch (CompilationException bce) { recoveredFromError(src.getTerminationHandler(), bce); } try { compile(src.getFaultHandler()); } catch (CompilationException bce) { recoveredFromError(src.getFaultHandler(), bce); } } }); } finally { _atomicScope = previousAtomicScope; } return oscope; } private void compile(final OnAlarm onAlarm) { OScope oscope = _structureStack.topScope(); assert oscope.eventHandler != null; final OEventHandler.OAlarm oalarm = new OEventHandler.OAlarm(_oprocess); oalarm.debugInfo = createDebugInfo(onAlarm, "OnAlarm Event Handler: " + onAlarm); if (onAlarm.getFor() != null && onAlarm.getUntil() == null) { oalarm.forExpr = compileExpr(onAlarm.getFor()); } else if (onAlarm.getFor() == null && onAlarm.getUntil() != null) { oalarm.untilExpr = compileExpr(onAlarm.getUntil()); } else if (onAlarm.getFor() != null && onAlarm.getUntil() != null) { throw new CompilationException(__cmsgs.errInvalidAlarm().setSource(onAlarm)); } else if (onAlarm.getRepeatEvery() == null) { throw new CompilationException(__cmsgs.errInvalidAlarm().setSource(onAlarm)); } if (onAlarm.getRepeatEvery() != null) oalarm.repeatExpr = compileExpr(onAlarm.getRepeatEvery()); if (onAlarm.getActivity() == null) throw new CompilationException(__cmsgs.errInvalidAlarm().setSource(onAlarm)); oalarm.activity = compile(onAlarm.getActivity()); // Check links crossing restrictions. for (OLink link : oalarm.incomingLinks) try { throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name).setSource(onAlarm)); } catch (CompilationException ce) { recoveredFromError(onAlarm, ce); } for (OLink link : oalarm.outgoingLinks) try { throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name).setSource(onAlarm)); } catch (CompilationException ce) { recoveredFromError(onAlarm, ce); } oscope.eventHandler.onAlarms.add(oalarm); } private void compile(final OnEvent onEvent) { final OScope oscope = _structureStack.topScope(); assert oscope.eventHandler != null; final OEventHandler.OEvent oevent = new OEventHandler.OEvent(_oprocess, oscope); oevent.name = "__eventHandler:"; oevent.debugInfo = createDebugInfo(onEvent, null); compile(oevent, onEvent, new Runnable() { public void run() { switch (_processDef.getBpelVersion()) { case BPEL11: oevent.variable = resolveMessageVariable(onEvent.getVariable()); break; case BPEL20_DRAFT: case BPEL20: if (onEvent.getMessageType() == null && onEvent.getElementType() == null) throw new CompilationException(__cmsgs.errVariableDeclMissingType(onEvent.getVariable()) .setSource(onEvent)); if (onEvent.getMessageType() != null && onEvent.getElementType() != null) throw new CompilationException(__cmsgs.errVariableDeclInvalid(onEvent.getVariable()).setSource( onEvent)); OVarType varType; if (onEvent.getMessageType() != null) varType = resolveMessageType(onEvent.getMessageType()); else if (onEvent.getElement() != null) varType = resolveElementType(onEvent.getElementType()); else throw new CompilationException(__cmsgs .errUnrecognizedVariableDeclaration(onEvent.getVariable())); oevent.variable = new OScope.Variable(_oprocess, varType); oevent.variable.name = onEvent.getVariable(); oevent.variable.declaringScope = _structureStack.topScope(); oevent.addLocalVariable(oevent.variable); break; default: throw new AssertionError("Unexpected BPEL VERSION constatnt: " + _processDef.getBpelVersion()); } oevent.partnerLink = resolvePartnerLink(onEvent.getPartnerLink()); oevent.operation = resolveMyRoleOperation(oevent.partnerLink, onEvent.getOperation()); oevent.messageExchangeId = onEvent.getMessageExchangeId(); oevent.route = onEvent.getRoute(); if (onEvent.getPortType() != null && !onEvent.getPortType().equals(oevent.partnerLink.myRolePortType.getQName())) throw new CompilationException(__cmsgs.errPortTypeMismatch(onEvent.getPortType(), oevent.partnerLink.myRolePortType.getQName())); Set csetNames = new HashSet(); // prevents duplicate cset in on one set of correlations for (Correlation correlation : onEvent.getCorrelations()) { if( csetNames.contains(correlation.getCorrelationSet() ) ) { throw new CompilationException(__cmsgs.errDuplicateUseCorrelationSet(correlation .getCorrelationSet())); OScope.CorrelationSet cset = resolveCorrelationSet(correlation.getCorrelationSet()); switch (correlation.getInitiate()) { case UNSET: case NO: oevent.matchCorrelations.add(cset); oevent.partnerLink.addCorrelationSetForOperation(oevent.operation, cset, false); break; case YES: oevent.initCorrelations.add(cset); break; case JOIN: cset.hasJoinUseCases = true; oevent.joinCorrelations.add(cset); oevent.partnerLink.addCorrelationSetForOperation(oevent.operation, cset, true); } for (OProcess.OProperty property : cset.properties) { // Force resolution of alias, to make sure that we have // one for this variable-property pair. resolvePropertyAlias(oevent.variable, property.name); } csetNames.add(correlation.getCorrelationSet()); } if (onEvent.getActivity() == null) throw new CompilationException(__cmsgs.errInvalidAlarm().setSource(onEvent)); oevent.activity = compile(onEvent.getActivity()); } }); // Check links crossing restrictions. for (OLink link : oevent.incomingLinks) try { throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name)); } catch (CompilationException ce) { recoveredFromError(onEvent, ce); } for (OLink link : oevent.outgoingLinks) try { throw new CompilationException(__cmsgs.errLinkCrossesEventHandlerBoundary(link.name)); } catch (CompilationException ce) { recoveredFromError(onEvent, ce); } oscope.eventHandler.onMessages.add(oevent); } private DebugInfo createDebugInfo(BpelObject bpelObject, String description) { int lineNo = bpelObject == null ? -1 : bpelObject.getLineNo(); String str = description == null && bpelObject != null ? bpelObject.toString() : null; Map extElmt = bpelObject == null ? null : bpelObject.getExtensibilityElements(); DebugInfo debugInfo = new DebugInfo(_processDef.getSource(), lineNo, extElmt); debugInfo.description = str; return debugInfo; } private void compile(final Variable src) { final OScope oscope = _structureStack.topScope(); if (src.getKind() == null) throw new CompilationException(__cmsgs.errVariableDeclMissingType(src.getName()).setSource(src)); if (oscope.getLocalVariable(src.getName()) != null) throw new CompilationException(__cmsgs.errDuplicateVariableDecl(src.getName()).setSource(src)); if (src.getTypeName() == null) throw new CompilationException(__cmsgs.errUnrecognizedVariableDeclaration(src.getName())); OVarType varType; switch (src.getKind()) { case ELEMENT: varType = resolveElementType(src.getTypeName()); break; case MESSAGE: varType = resolveMessageType(src.getTypeName()); break; case SCHEMA: varType = resolveXsdType(src.getTypeName()); break; default: throw new CompilationException(__cmsgs.errUnrecognizedVariableDeclaration(src.getName())); } OScope.Variable ovar = new OScope.Variable(_oprocess, varType); ovar.name = src.getName(); ovar.declaringScope = oscope; ovar.debugInfo = createDebugInfo(src, null); ovar.extVar = compileExtVar(src); oscope.addLocalVariable(ovar); if (__log.isDebugEnabled()) __log.debug("Compiled variable " + ovar); } private void compile(TerminationHandler terminationHandler) { OScope oscope = _structureStack.topScope(); oscope.terminationHandler = new OTerminationHandler(_oprocess, oscope); oscope.terminationHandler.name = "__terminationHandler:" + oscope.name; oscope.terminationHandler.debugInfo = createDebugInfo(terminationHandler, null); if (terminationHandler == null) { oscope.terminationHandler.activity = createDefaultCompensateActivity(null, "Auto-generated 'compensate all' pseudo-activity for default termination handler on " + oscope.toString()); } else { _recoveryContextStack.push(oscope); try { oscope.terminationHandler.activity = compile(terminationHandler.getActivity()); } finally { _recoveryContextStack.pop(); } } } private void compile(CompensationHandler compensationHandler) { OScope oscope = _structureStack.topScope(); oscope.compensationHandler = new OCompensationHandler(_oprocess, oscope); oscope.compensationHandler.name = "__compenationHandler_" + oscope.name; oscope.compensationHandler.debugInfo = createDebugInfo(compensationHandler, null); if (compensationHandler == null) { oscope.compensationHandler.activity = createDefaultCompensateActivity(compensationHandler, "Auto-generated 'compensate all' pseudo-activity for default compensation handler on " + oscope.toString()); } else { _recoveryContextStack.push(oscope); try { oscope.compensationHandler.activity = compile(compensationHandler.getActivity()); } finally { _recoveryContextStack.pop(); } } } private void compile(FaultHandler fh) { OScope oscope = _structureStack.topScope(); oscope.faultHandler = new OFaultHandler(_oprocess); if (fh == null) { // The default fault handler compensates all child activities // AND then rethrows the fault! final OCatch defaultCatch = new OCatch(_oprocess, oscope); defaultCatch.name = "__defaultFaultHandler:" + oscope.name; defaultCatch.faultName = null; // catch any fault defaultCatch.faultVariable = null; OSequence sequence = new OSequence(_oprocess, defaultCatch); sequence.name = "__defaultFaultHandler_sequence:" + oscope.name; sequence.debugInfo = createDebugInfo(fh, "Auto-generated sequence activity."); ORethrow rethrow = new ORethrow(_oprocess, sequence); rethrow.name = "__defaultFaultHandler_rethrow:" + oscope.name; rethrow.debugInfo = createDebugInfo(fh, "Auto-generated re-throw activity."); sequence.sequence.add(createDefaultCompensateActivity(fh, "Default compensation handler for " + oscope)); sequence.sequence.add(rethrow); defaultCatch.activity = sequence; oscope.faultHandler.catchBlocks.add(defaultCatch); if (__log.isDebugEnabled()) __log.debug("Compiled default catch block " + defaultCatch + " for " + oscope); } else { _recoveryContextStack.push(oscope); try { int i = 0; for (final Catch catchSrc : fh.getCatches()) { final OCatch ctch = new OCatch(_oprocess, oscope); ctch.debugInfo = createDebugInfo(catchSrc, catchSrc.toString()); ctch.name = "__catch#" + i + ":" + _structureStack.topScope().name; ctch.faultName = catchSrc.getFaultName(); compile(ctch, catchSrc, new Runnable() { public void run() { if (catchSrc.getFaultVariable() != null) { OScope.Variable faultVar; is = _resourceFinder.openResource(uri); switch (_processDef.getBpelVersion()) { case BPEL11: faultVar = resolveVariable(catchSrc.getFaultVariable()); if (!(faultVar.type instanceof OMessageVarType)) throw new CompilationException(__cmsgs.errMessageVariableRequired( catchSrc.getFaultVariable()).setSource(catchSrc)); break; case BPEL20_DRAFT: case BPEL20: if (catchSrc.getFaultVariableMessageType() == null && catchSrc.getFaultVariableElementType() == null) throw new CompilationException(__cmsgs.errVariableDeclMissingType( catchSrc.getFaultVariable()).setSource(catchSrc)); if (catchSrc.getFaultVariableMessageType() != null && catchSrc.getFaultVariableElementType() != null) throw new CompilationException(__cmsgs.errVariableDeclMissingType( catchSrc.getFaultVariable()).setSource(catchSrc)); OVarType faultVarType; if (catchSrc.getFaultVariableMessageType() != null) faultVarType = resolveMessageType(catchSrc.getFaultVariableMessageType()); else if (catchSrc.getFaultVariableElementType() != null) faultVarType = resolveElementType(catchSrc.getFaultVariableElementType()); else throw new CompilationException(__cmsgs .errUnrecognizedVariableDeclaration(catchSrc.getFaultVariable())); faultVar = new OScope.Variable(_oprocess, faultVarType); faultVar.name = catchSrc.getFaultVariable(); faultVar.declaringScope = _structureStack.topScope(); ctch.addLocalVariable(faultVar); break; default: throw new AssertionError("Unexpected BPEL VERSION constatnt: " + _processDef.getBpelVersion()); } ctch.faultVariable = faultVar; } if (catchSrc.getActivity() == null) throw new CompilationException(__cmsgs.errEmptyCatch().setSource(catchSrc)); _structureStack.topScope().activity = compile(catchSrc.getActivity()); } }); oscope.faultHandler.catchBlocks.add(ctch); ++i; } } finally { _recoveryContextStack.pop(); } } } public OXslSheet compileXslt(String docStrUri) throws CompilationException { URI docUri; try { docUri = new URI(FileUtils.encodePath(docStrUri)); } catch (URISyntaxException e) { throw new CompilationException(__cmsgs.errInvalidDocXsltUri(docStrUri)); } String sheetBody = loadXsltSheet(_processURI.resolve(docUri)); if (sheetBody == null) { throw new CompilationException(__cmsgs.errCantFindXslt(docStrUri)); } OXslSheet oXslSheet = new OXslSheet(_oprocess); oXslSheet.uri = docUri; oXslSheet.sheetBody = sheetBody; _oprocess.xslSheets.put(oXslSheet.uri, oXslSheet); return oXslSheet; } private String loadXsltSheet(URI uri) { // TODO: lots of null returns, should have some better error messages. InputStream is; try { } catch (Exception e1) { return null; } if (is == null) return null; try { return new String(StreamUtils.read(is)); } catch (IOException e) { __log.debug("IO error", e); // todo: this should produce a message return null; } finally { try { is.close(); } catch (Exception ex) { // No worries. } } } public boolean isPartnerLinkAssigned(String plink) { for (OActivity act : _compiledActivities) { if (act instanceof OAssign) { OAssign assign = (OAssign) act; for (OAssign.Copy copy : assign.copy) { if (copy.to instanceof OAssign.PartnerLinkRef) { if (((OAssign.PartnerLinkRef) copy.to).partnerLink.getName().equals(plink)) return true; } } } } return false; } public Definition[] getWsdlDefinitions() { Definition[] result = new Definition[_wsdlRegistry.getDefinitions().length]; for (int m = 0; m < _wsdlRegistry.getDefinitions().length; m++) { Definition4BPEL definition4BPEL = _wsdlRegistry.getDefinitions()[m]; result[m] = definition4BPEL.getDefinition(); } return result; } private OElementVarType resolveElementType(QName faultVariableElementType) { OElementVarType type = _oprocess.elementTypes.get(faultVariableElementType); if (type == null) { type = new OElementVarType(_oprocess, faultVariableElementType); _oprocess.elementTypes.put(faultVariableElementType, type); } return type; } @SuppressWarnings("unchecked") private ActivityGenerator findActivityGen(Activity source) { Class actClass = source.getClass(); for (Map.Entry me : _actGenerators.entrySet()) { Class cls = me.getKey(); if (cls.isAssignableFrom(actClass)) { ActivityGenerator gen = me.getValue(); gen.setContext(this); return gen; } } throw new CompilationException(__cmsgs.errUnknownActivity(actClass.getName()).setSource(source)); } @SuppressWarnings("unchecked") protected void registerActivityCompiler(Class defClass, ActivityGenerator generator) { if (__log.isDebugEnabled()) { __log.debug("Adding compiler for nodes class \"" + defClass.getName() + " = " + generator); } _actGenerators.put(defClass, generator); } private ExpressionCompiler findExpLangCompiler(String expLang) { ExpressionCompiler compiler = _expLanguageCompilers.get(expLang); if (compiler == null) { throw new CompilationException(__cmsgs.errUnknownExpressionLanguage(expLang)); } return compiler; } private String getExpressionLanguage(Expression exp) { String expLang = exp.getExpressionLanguage(); if (expLang == null) expLang = _processDef.getExpressionLanguage(); if (expLang == null) expLang = getDefaultExpressionLanguage(); return expLang; } protected abstract String getDefaultExpressionLanguage(); protected abstract String getBpwsNamespace(); protected void registerExpressionLanguage(String expLangUri, ExpressionCompiler expressionCompiler) { _expLanguageCompilers.put(expLangUri, expressionCompiler); } @SuppressWarnings("unchecked") protected void registerExpressionLanguage(String expLangUri, String classname) throws Exception { Class cls = Class.forName(classname); registerExpressionLanguage(expLangUri, (ExpressionCompiler) cls.newInstance()); }
File
BpelCompiler.java
Developer's decision
Version 2
Kind of conflict
Annotation
Attribute
Class signature
Comment
Import
Interface signature
Method declaration
Method interface
Method invocation
Chunk
Conflicting content
    }

        return this.formatCompilationMessage("Empty scopes are forbidden.");
<<<<<<< HEAD
	public CompilationMessage errEmptySequence() {
		return this.formatCompilationMessage("Empty sequences are forbidden.");
=======
	public CompilationMessage errEmptyCatch() {
		return this.formatCompilationMessage("Empty catch faut handlers are forbidden.");
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
	}

	public CompilationMessage errMustSpecifyRelatedVariable(String name) {
Solution content
        return this.formatCompilationMessage("Empty scopes are forbidden.");
    }

	public CompilationMessage errEmptyCatch() {
		return this.formatCompilationMessage("Empty catch faut handlers are forbidden.");
	}

	public CompilationMessage errMustSpecifyRelatedVariable(String name) {
File
CommonCompilationMessages.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Method signature
Return statement
Chunk
Conflicting content
		return this.formatCompilationMessage("The external variable declaration for \"{0}\" must specify an external variable identifier.", name);
	}

<<<<<<< HEAD
	public CompilationMessage errEmptyCatch() {
	    return this.formatCompilationMessage("Empty catch faut handlers are forbidden.");
	}

    /** Context propagation must define a context attribute */
    public CompilationMessage errMissingContextAttribute() {
        return this.formatCompilationMessage(" element must define a 'context' attribute.");
    }

    /** Context propagation must define either a fromVariable or a 
     * fromPartnerLink attribute */
    public CompilationMessage errMissingVariableOrPartnerLinkAttribute() {
        return this.formatCompilationMessage(" element must define either a 'fromVariable' or a 'fromPartnerLink' attribute.");
    }
=======
	public CompilationMessage errEmptySequence() {
		return this.formatCompilationMessage("Empty sequences are forbidden.");
	}

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
		return this.formatCompilationMessage("The external variable declaration for \"{0}\" must specify an external variable identifier.", name);
	}

	public CompilationMessage errEmptySequence() {
		return this.formatCompilationMessage("Empty sequences are forbidden.");
	}

}
File
CommonCompilationMessages.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
            if (__log.isDebugEnabled()) __log.debug("resolveEntity: no schema location for "+resourceIdentifier.getNamespace());
            try {
                if (_internalSchemas.get(new URI(resourceIdentifier.getNamespace())) != null) {
<<<<<<< HEAD
                    src.setByteStream(new ByteArrayInputStream(_internalSchemas.get(new URI(resourceIdentifier.getNamespace())).getBytes()));
=======
                    src.setByteStream(new ByteArrayInputStream(_internalSchemas.get(new URI(resourceIdentifier.getNamespace()))));
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                    return src;
                }
            } catch (URISyntaxException e) {
Solution content
            if (__log.isDebugEnabled()) __log.debug("resolveEntity: no schema location for "+resourceIdentifier.getNamespace());
            try {
                if (_internalSchemas.get(new URI(resourceIdentifier.getNamespace())) != null) {
                    src.setByteStream(new ByteArrayInputStream(_internalSchemas.get(new URI(resourceIdentifier.getNamespace()))));
                    return src;
                }
            } catch (URISyntaxException e) {
File
WsdlFinderXMLEntityResolver.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
    public boolean isIgnoreMissingFromData() {
        return getAttribute("ignoreMissingFromData", "no").equals("yes");
    }
<<<<<<< HEAD
    
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public boolean isIgnoreUninitializedFromVariable() {
        return getAttribute("ignoreUninitializedFromVariable", "no").equals("yes");
    }
Solution content
    public boolean isIgnoreMissingFromData() {
        return getAttribute("ignoreMissingFromData", "no").equals("yes");
    }

    public boolean isIgnoreUninitializedFromVariable() {
        return getAttribute("ignoreUninitializedFromVariable", "no").equals("yes");
    }
File
Copy.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
<<<<<<< HEAD
    
    /**
    public String getRelated() {
    	return  getAttribute(ExtensibilityQNames.EXTVAR_RELATED, null);
    }
     * Returns from-spec Element for variable inline initialization
     * @author madars.vitolins _at gmail.com
     * @return
     */
    public From getFrom() {
    	return getFirstChild(From.class);
    }
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
    public String getRelated() {
    	return  getAttribute(ExtensibilityQNames.EXTVAR_RELATED, null);
    }
}
File
Variable.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
  private static String WRONG_PARAMETER_CODE = "WrongParameter";

  private CompilationTestMessages _bundle;
<<<<<<< HEAD
  private SourceLocation sloc;
=======
  private SourceLocationImpl sloc;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
  private Locale oldLocale;
  @Override
  protected void setUp() throws Exception {
Solution content
  private static String WRONG_PARAMETER_CODE = "WrongParameter";

  private CompilationTestMessages _bundle;
  private SourceLocationImpl sloc;
  private Locale oldLocale;
  @Override
  protected void setUp() throws Exception {
File
CompilationMessageTest.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
    oldLocale = Locale.getDefault();
    Locale.setDefault(Locale.ENGLISH);
    _bundle = MessageBundle.getMessages(CompilationTestMessages.class);
<<<<<<< HEAD
    sloc = new SourceLocation(new URI("urn:foo"));
=======
    sloc = new SourceLocationImpl(new URI("urn:foo"));
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
  }

  @Override
Solution content
    oldLocale = Locale.getDefault();
    Locale.setDefault(Locale.ENGLISH);
    _bundle = MessageBundle.getMessages(CompilationTestMessages.class);
    sloc = new SourceLocationImpl(new URI("urn:foo"));
  }

  @Override
File
CompilationMessageTest.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
public class StaticCheckSuite extends TestCase {
 */

<<<<<<< HEAD
  public static Test suite() throws Exception {
    TestSuite suite = new StaticCheckSuite();
    suite.addTest(new StaticCheckTCase("NoRootActivity"));
    suite.addTest(new StaticCheckTCase("PortTypeMismatch"));
    suite.addTest(new StaticCheckTCase("UndeclaredPropertyAlias"));
    suite.addTest(new StaticCheckTCase("UnknownBpelFunction"));
    suite.addTest(new StaticCheckTCase("UndeclaredVariable"));
    suite.addTest(new StaticCheckTCase("DuplicateLinkTarget"));
    suite.addTest(new StaticCheckTCase("DuplicateLinkSource"));
    suite.addTest(new StaticCheckTCase("DuplicateLinkDecl"));
    suite.addTest(new StaticCheckTCase("LinkMissingSourceActivity"));
    suite.addTest(new StaticCheckTCase("LinkMissingTargetActivity"));
    suite.addTest(new StaticCheckTCase("DuplicateVariableDecl"));
    suite.addTest(new StaticCheckTCase("UndeclaredExtensionActivity"));
    suite.addTest(new StaticCheckTCase("UndeclaredExtensionAssignOperation"));
    suite.addTest(new StaticCheckTCase("MissingExtensionActivityElement"));
    suite.addTest(new StaticCheckTCase("MissingExtensionAssignOperationElement"));
    suite.addTest(new StaticCheckTCase("ExtensibleAssignNotSupported"));
    // We simply can't test the next one without using the BOM; both the parser
    // and schema validation would rule it out.
    //suite.addTest(new StaticCheckTest("CompensateNAtoContext"));
    return suite;
  }
=======
    /**
     * @return a test suite of tests that show compilation failures.
     * @throws Exception
     */
    public static Test suite() throws Exception {
        TestSuite suite = new TestSuite();
        suite.addTest(new StaticCheckTCase("NoRootActivity"));
        suite.addTest(new StaticCheckTCase("PortTypeMismatch"));
        suite.addTest(new StaticCheckTCase("UndeclaredPropertyAlias"));
        suite.addTest(new StaticCheckTCase("UnknownBpelFunction"));
        suite.addTest(new StaticCheckTCase("UndeclaredVariable"));
        suite.addTest(new StaticCheckTCase("DuplicateLinkTarget"));
        suite.addTest(new StaticCheckTCase("DuplicateLinkSource"));
        suite.addTest(new StaticCheckTCase("DuplicateLinkDecl"));
        suite.addTest(new StaticCheckTCase("LinkMissingSourceActivity"));
        suite.addTest(new StaticCheckTCase("LinkMissingTargetActivity"));
        suite.addTest(new StaticCheckTCase("DuplicateVariableDecl"));
        // We simply can't test the next one without using the BOM; both the parser
        // and schema validation would rule it out.
        //suite.addTest(new StaticCheckTest("CompensateNAtoContext"));
        return suite;
    }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
}
 */
public class StaticCheckSuite extends TestCase {

    /**
     * @return a test suite of tests that show compilation failures.
     * @throws Exception
     */
    public static Test suite() throws Exception {
        TestSuite suite = new TestSuite();
        suite.addTest(new StaticCheckTCase("NoRootActivity"));
        suite.addTest(new StaticCheckTCase("PortTypeMismatch"));
        suite.addTest(new StaticCheckTCase("UndeclaredPropertyAlias"));
        suite.addTest(new StaticCheckTCase("UnknownBpelFunction"));
        suite.addTest(new StaticCheckTCase("UndeclaredVariable"));
        suite.addTest(new StaticCheckTCase("DuplicateLinkTarget"));
        suite.addTest(new StaticCheckTCase("DuplicateLinkSource"));
        suite.addTest(new StaticCheckTCase("DuplicateLinkDecl"));
        suite.addTest(new StaticCheckTCase("LinkMissingSourceActivity"));
        suite.addTest(new StaticCheckTCase("LinkMissingTargetActivity"));
        suite.addTest(new StaticCheckTCase("DuplicateVariableDecl"));
        // We simply can't test the next one without using the BOM; both the parser
        // and schema validation would rule it out.
        //suite.addTest(new StaticCheckTest("CompensateNAtoContext"));
        return suite;
    }
File
StaticCheckSuite.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
import org.apache.ode.bpel.compiler.api.CompilationException;
import org.apache.ode.bpel.compiler.api.CompilationMessage;
import org.apache.ode.bpel.compiler.api.CompileListener;
<<<<<<< HEAD
import org.junit.*;
=======
import org.apache.ode.utils.xsl.XslTransformHandler;

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

/**
 * JUnit {@link TestCase} of static-analysis checking in the ODE BPEL compiler.
Solution content
import org.apache.ode.bpel.compiler.api.CompilationException;
import org.apache.ode.bpel.compiler.api.CompilationMessage;
import org.apache.ode.bpel.compiler.api.CompileListener;
import org.apache.ode.utils.xsl.XslTransformHandler;


/**
 * JUnit {@link TestCase} of static-analysis checking in the ODE BPEL compiler.
File
StaticCheckTCase.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import java.io.IOException;
import java.net.URI;
<<<<<<< HEAD
=======
import java.util.ArrayList;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
Solution content
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
File
XPathTest.java
Developer's decision
Version 1
Kind of conflict
Import
Chunk
Conflicting content
import junit.framework.TestCase;

import org.apache.ode.bpel.compiler.api.CompilationException;
<<<<<<< HEAD
import org.apache.ode.bpel.compiler.v2.CompilerContext;
import org.apache.ode.bpel.compiler.v2.ExpressionCompiler;
import org.apache.ode.bpel.extension.ExtensionValidator;
import org.apache.ode.bpel.compiler.bom.*;
import org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL11;
import org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL20;
import org.apache.ode.bpel.compiler.v2.xpath10.XPath10ExpressionCompilerBPEL20Draft;
import org.apache.ode.bpel.compiler.v2.xpath20.XPath20ExpressionCompilerBPEL20;
import org.apache.ode.bpel.compiler.v2.xpath20.XPath20ExpressionCompilerBPEL20Draft;
import org.apache.ode.bpel.rtrep.v2.*;
=======
import org.apache.ode.bpel.compiler.api.CompilerContext;
import org.apache.ode.bpel.compiler.api.ExpressionCompiler;
import org.apache.ode.bpel.compiler.api.SourceLocation;
import org.apache.ode.bpel.compiler.bom.Activity;
import org.apache.ode.bpel.compiler.bom.BpelObject;
import org.apache.ode.bpel.compiler.bom.Expression;
import org.apache.ode.bpel.compiler.bom.ScopeLikeActivity;
import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL11;
import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL20;
import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL20Draft;
import org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20;
import org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20Draft;
import org.apache.ode.bpel.o.OActivity;
import org.apache.ode.bpel.o.OElementVarType;
import org.apache.ode.bpel.o.OExpression;
import org.apache.ode.bpel.o.OLValueExpression;
import org.apache.ode.bpel.o.OLink;
import org.apache.ode.bpel.o.OMessageVarType;
import org.apache.ode.bpel.o.OPartnerLink;
import org.apache.ode.bpel.o.OProcess;
import org.apache.ode.bpel.o.OScope;
import org.apache.ode.bpel.o.OVarType;
import org.apache.ode.bpel.o.OXsdTypeVarType;
import org.apache.ode.bpel.o.OXslSheet;
import org.apache.ode.bpel.o.OMessageVarType.Part;
import org.apache.ode.bpel.o.OProcess.OProperty;
import org.apache.ode.bpel.o.OProcess.OPropertyAlias;
import org.apache.ode.bpel.o.OScope.CorrelationSet;
import org.apache.ode.bpel.o.OScope.Variable;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.NSContext;
import org.w3c.dom.Element;
Solution content
import junit.framework.TestCase;

import org.apache.ode.bpel.compiler.api.CompilationException;
import org.apache.ode.bpel.compiler.api.CompilerContext;
import org.apache.ode.bpel.compiler.api.ExpressionCompiler;
import org.apache.ode.bpel.compiler.api.SourceLocation;
import org.apache.ode.bpel.compiler.bom.Activity;
import org.apache.ode.bpel.compiler.bom.BpelObject;
import org.apache.ode.bpel.compiler.bom.Expression;
import org.apache.ode.bpel.compiler.bom.ScopeLikeActivity;
import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL11;
import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL20;
import org.apache.ode.bpel.elang.xpath10.compiler.XPath10ExpressionCompilerBPEL20Draft;
import org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20;
import org.apache.ode.bpel.elang.xpath20.compiler.XPath20ExpressionCompilerBPEL20Draft;
import org.apache.ode.bpel.o.OActivity;
import org.apache.ode.bpel.o.OElementVarType;
import org.apache.ode.bpel.o.OExpression;
import org.apache.ode.bpel.o.OLValueExpression;
import org.apache.ode.bpel.o.OLink;
import org.apache.ode.bpel.o.OMessageVarType;
import org.apache.ode.bpel.o.OPartnerLink;
import org.apache.ode.bpel.o.OProcess;
import org.apache.ode.bpel.o.OScope;
import org.apache.ode.bpel.o.OVarType;
import org.apache.ode.bpel.o.OXsdTypeVarType;
import org.apache.ode.bpel.o.OXslSheet;
import org.apache.ode.bpel.o.OMessageVarType.Part;
import org.apache.ode.bpel.o.OProcess.OProperty;
import org.apache.ode.bpel.o.OProcess.OPropertyAlias;
import org.apache.ode.bpel.o.OScope.CorrelationSet;
import org.apache.ode.bpel.o.OScope.Variable;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.NSContext;
import org.w3c.dom.Element;
File
XPathTest.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
			CompilationException error) {
	}

<<<<<<< HEAD
	public boolean isExtensionDeclared(String namespace) {
		return false;
	}

	public ExtensionValidator getExtensionValidator(QName extensionElementName) {
		return null;
	}

    public OMessageVarType.Part resolveHeaderPart(OScope.Variable variable, String partname) throws CompilationException {
=======
    public Part resolveHeaderPart(Variable variable, String partname) throws CompilationException {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        return null;
    }
    
Solution content
			CompilationException error) {
	}

    public Part resolveHeaderPart(Variable variable, String partname) throws CompilationException {
        return null;
    }
    
File
XPathTest.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Method signature
Chunk
Conflicting content
    }
    
    public Map getSchemaSources() {
<<<<<<< HEAD
		return null;
	}

	public URI getBaseResourceURI() {
=======
    	return null;
    }

	public URI getBaseResourceURI() {
		// TODO Auto-generated method stub
		return null;
	}

	public OExpression compileExpr(Expression expr, OVarType rootNodeType,
			Object requestedResultType, Object[] resultType)
			throws CompilationException {
		// TODO Auto-generated method stub
		return null;
	}

	public OLValueExpression compileLValueExpr(Expression expr,
			OVarType rootNodeType, Object requestedResultType,
			Object[] resultType) throws CompilationException {
		// TODO Auto-generated method stub
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
		return null;
	}
}
Solution content
    }
    
    public Map getSchemaSources() {
    	return null;
    }

	public URI getBaseResourceURI() {
		// TODO Auto-generated method stub
		return null;
	}

	public OExpression compileExpr(Expression expr, OVarType rootNodeType,
			Object requestedResultType, Object[] resultType)
			throws CompilationException {
		// TODO Auto-generated method stub
		return null;
	}

	public OLValueExpression compileLValueExpr(Expression expr,
			OVarType rootNodeType, Object requestedResultType,
			Object[] resultType) throws CompilationException {
		// TODO Auto-generated method stub
		return null;
	}
}
File
XPathTest.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Method signature
Return statement
Chunk
Conflicting content
        org.apache.ode.ql.jcc.ASTStart start = new Parser(query).start();
        return build(start);
      }catch(ParseException ex) {
<<<<<<< HEAD
=======
        //TODO create common exception which will indicate parsing exception
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        throw new RuntimeException(ex.getMessage(), ex);
      }
    }
Solution content
        org.apache.ode.ql.jcc.ASTStart start = new Parser(query).start();
        return build(start);
      }catch(ParseException ex) {
        //TODO create common exception which will indicate parsing exception
        throw new RuntimeException(ex.getMessage(), ex);
      }
    }
File
TreeBuilder.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
            ASTOrderType astType = (ASTOrderType)extractChildNode(node, 1);
            type = OrderByType.valueOf(astType.getValue().toUpperCase());
        } else {
<<<<<<< HEAD
=======
            //TODO
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            throw new IllegalArgumentException();
        }
        Identifier id = createIdentifier(node, 0);
Solution content
        } else {
            //TODO
            ASTOrderType astType = (ASTOrderType)extractChildNode(node, 1);
            type = OrderByType.valueOf(astType.getValue().toUpperCase());
            throw new IllegalArgumentException();
        }
        Identifier id = createIdentifier(node, 0);
File
TreeBuilder.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
        if(node instanceof ASTProperty) {
            return new org.apache.ode.ql.tree.nodes.Property(((ASTProperty)node).getName());
        }
<<<<<<< HEAD
=======
        //TODO
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        throw new IllegalArgumentException("");
    }
    private ASTValue extractValue(Node parentNode, int index) {
Solution content
        if(node instanceof ASTProperty) {
            return new org.apache.ode.ql.tree.nodes.Property(((ASTProperty)node).getName());
        }
        //TODO
        throw new IllegalArgumentException("");
    }
    private ASTValue extractValue(Node parentNode, int index) {
File
TreeBuilder.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
    private Node extractChildNode(Node parentNode, int index, Class expected) {
        Node node = extractChildNode(parentNode, index);
        if(!(expected.isAssignableFrom(node.getClass()))) {
<<<<<<< HEAD
=======
            //TODO
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            throw new IllegalArgumentException("");
        }
        return node;
Solution content
    private Node extractChildNode(Node parentNode, int index, Class expected) {
        Node node = extractChildNode(parentNode, index);
        if(!(expected.isAssignableFrom(node.getClass()))) {
            //TODO
            throw new IllegalArgumentException("");
        }
        return node;
File
TreeBuilder.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
    }
    private Node extractChildNode(Node parentNode, int index) {
        if(parentNode.jjtGetNumChildren()<=index) {
<<<<<<< HEAD
=======
            //TODO
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            throw new IllegalArgumentException("");
        }
        return parentNode.jjtGetChild(index);
Solution content
    }
    private Node extractChildNode(Node parentNode, int index) {
        if(parentNode.jjtGetNumChildren()<=index) {
            //TODO
            throw new IllegalArgumentException("");
        }
        return parentNode.jjtGetChild(index);
File
TreeBuilder.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
public class SyntaxTest extends TestCase {

<<<<<<< HEAD
  private final static String TESTS_DIR = "target/test/resources";
=======
  private final static String TESTS_DIR = "target/test-classes";
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
  
  private File[] casesFiles = new File(TESTS_DIR).listFiles();
  
Solution content
public class SyntaxTest extends TestCase {

  private final static String TESTS_DIR = "target/test-classes";
  
  private File[] casesFiles = new File(TESTS_DIR).listFiles();
  
File
SyntaxTest.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
  @Override
  protected void setUp() throws Exception {
      super.setUp();
<<<<<<< HEAD

      if (!new File(TESTS_DIR).exists())
          casesFiles = new File("target/test-classes").listFiles();
=======
      
      casesFiles = new File(System.getProperty("baseDir")).listFiles();
      //casesFiles = new File(TESTS_DIR).listFiles();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
  }
  
  public void test() throws Exception {
Solution content
  @Override
  protected void setUp() throws Exception {
      super.setUp();
      
      casesFiles = new File(System.getProperty("baseDir")).listFiles();
      //casesFiles = new File(TESTS_DIR).listFiles();
  }
  
  public void test() throws Exception {
File
SyntaxTest.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
If statement
Method invocation
Chunk
Conflicting content
import org.apache.ode.bpel.dd.TDeployment;
import org.apache.ode.bpel.dd.TDeployment.Process;
import org.apache.ode.bpel.iapi.ContextException;
<<<<<<< HEAD
import org.apache.ode.bpel.rapi.Serializer;
=======
import org.apache.ode.bpel.o.Serializer;
import org.apache.ode.utils.InternPool;
import org.apache.ode.utils.InternPool.InternableBlock;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.utils.fs.FileUtils;
import org.apache.xmlbeans.XmlOptions;
import org.springframework.beans.BeansException;
Solution content
import org.apache.ode.bpel.dd.TDeployment;
import org.apache.ode.bpel.dd.TDeployment.Process;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.o.Serializer;
import org.apache.ode.utils.InternPool;
import org.apache.ode.utils.InternPool.InternableBlock;
import org.apache.ode.utils.fs.FileUtils;
import org.apache.xmlbeans.XmlOptions;
import org.springframework.beans.BeansException;
File
DeploymentUnitDir.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.springframework.core.io.Resource;
import org.w3c.dom.Node;

<<<<<<< HEAD
import javax.wsdl.Definition;
import javax.wsdl.WSDLException;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
/**
 * Container providing various functions on the deployment directory.
 */
Solution content
import org.springframework.core.io.Resource;
import org.w3c.dom.Node;

/**
 * Container providing various functions on the deployment directory.
 *
 * @author mriou
 * @author Maciej Szefler 
 */
File
DeploymentUnitDir.java
Developer's decision
Manual
Kind of conflict
Import
Chunk
Conflicting content
    private File _descriptorFile;
    private Properties _properties = new Properties();

<<<<<<< HEAD
    private HashMap _processes = new HashMap();
    private HashMap _processInfo = new HashMap();
    private Map _extensionValidators;
    
=======
    private HashMap _processes = new HashMap();
    private HashMap _processInfo = new HashMap();

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    private volatile DeployDocument _dd;
    private volatile DocumentRegistry _docRegistry;
Solution content
    private File _descriptorFile;
    private Properties _properties = new Properties();

    private HashMap _processes = new HashMap();
    private HashMap _processInfo = new HashMap();

    private volatile DeployDocument _dd;
    private volatile DocumentRegistry _docRegistry;
File
DeploymentUnitDir.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
        return !_duDirectory.exists();
    }

<<<<<<< HEAD
    private void compile(File bpelFile) {
        BpelC bpelc = BpelC.newBpelCompiler();
=======
    private void compile(final File bpelFile) {
        final BpelC bpelc = BpelC.newBpelCompiler();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

        // BPEL 1.1 does not suport the  element, so "global" WSDL needs to be configured explicitly.
        File bpel11wsdl = findBpel11Wsdl(bpelFile);
Solution content
        return !_duDirectory.exists();
    }

    private void compile(final File bpelFile) {
        final BpelC bpelc = BpelC.newBpelCompiler();

        // BPEL 1.1 does not suport the  element, so "global" WSDL needs to be configured explicitly.
        File bpel11wsdl = findBpel11Wsdl(bpelFile);
File
DeploymentUnitDir.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Method signature
Variable
Chunk
Conflicting content
        });
        bpelc.setCompileProperties(prepareCompileProperties(bpelFile));
        bpelc.setExtensionValidators(_extensionValidators);
        bpelc.setBaseDirectory(_duDirectory);
<<<<<<< HEAD
        try {
            bpelc.compile(bpelFile);
        } catch (IOException e) {
            __log.error("Compile error in " + bpelFile, e);
            throw new RuntimeException(e);
        }
=======
        // Create process such that immutable objects are intern'ed.
        InternPool.runBlock(new InternableBlock() {
        	public void run() {
                try {
                    bpelc.compile(bpelFile, getVersion());
                } catch (IOException e) {
                    __log.error("Compile error in " + bpelFile, e);
                }
        	}
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    /**
Solution content
        bpelc.setCompileProperties(prepareCompileProperties(bpelFile));
        bpelc.setBaseDirectory(_duDirectory);
        // Create process such that immutable objects are intern'ed.
        InternPool.runBlock(new InternableBlock() {
        	public void run() {
                try {
                    bpelc.compile(bpelFile, getVersion());
                } catch (IOException e) {
                    __log.error("Compile error in " + bpelFile, e);
                }
        	}
        });
    }

    /**
File
DeploymentUnitDir.java
Developer's decision
Version 2
Kind of conflict
Comment
Method invocation
Try statement
Chunk
Conflicting content
        try {
            is = new FileInputStream(f);
            Serializer ofh = new Serializer(is);
<<<<<<< HEAD
            return new CBPInfo(ofh.getType(), ofh.getGuid(), f);
=======
            CBPInfo info = new CBPInfo(ofh.type, ofh.guid, f);
            return info;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        } catch (Exception e) {
            throw new ContextException("Couldn't read compiled BPEL process " + f.getAbsolutePath(), e);
        } finally {
Solution content
        try {
            is = new FileInputStream(f);
            Serializer ofh = new Serializer(is);
            CBPInfo info = new CBPInfo(ofh.type, ofh.guid, f);
            return info;
        } catch (Exception e) {
            throw new ContextException("Couldn't read compiled BPEL process " + f.getAbsolutePath(), e);
        } finally {
File
DeploymentUnitDir.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Return statement
Variable
Chunk
Conflicting content
    }

    /**
<<<<<<< HEAD
     * The list of endpoint configuration files contained in the deployment directory and its subdirectories.
     * Files are ordered lexicographically but for each directory, files come before its sudirectories.
     * 

The list is built on each call to handle changes. * * @see org.apache.ode.utils.fs.FileUtils#directoryEntriesInPath(java.io.File) */ public List getEndpointConfigFiles() { return FileUtils.directoryEntriesInPath(getDeployDir(), _endpointFilter); } ======= * * The list of endpoint configuration files contained in the deployment directory and its subdirectories. * Files are ordered lexicographically but for each directory, files come before its sudirectories. *

The list is built on each call to handle changes. * @see org.apache.ode.utils.fs.FileUtils#directoryEntriesInPath(java.io.File) */ public List getEndpointConfigFiles() { return FileUtils.directoryEntriesInPath(getDeployDir(),_endpointFilter); } >>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a public DeployDocument getDeploymentDescriptor() { if (_dd == null) { File ddLocation = new File(_duDirectory, "deploy.xml");

Solution content
    }

    /**
     *
     * The list of endpoint configuration files contained in the deployment directory and its subdirectories.
     * Files are ordered lexicographically but for each directory, files come before its sudirectories.
     * 

The list is built on each call to handle changes. * @see org.apache.ode.utils.fs.FileUtils#directoryEntriesInPath(java.io.File) */ public List getEndpointConfigFiles() { return FileUtils.directoryEntriesInPath(getDeployDir(),_endpointFilter); } public DeployDocument getDeploymentDescriptor() { if (_dd == null) { File ddLocation = new File(_duDirectory, "deploy.xml");

File
DeploymentUnitDir.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
        return result;
    }

<<<<<<< HEAD
    public static final class CBPInfo {
=======
    public final class CBPInfo {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        final QName processName;
        final String guid;
        final File cbp;
Solution content
        return result;
    }

    public final class CBPInfo {
        final QName processName;
        final String guid;
        final File cbp;
File
DeploymentUnitDir.java
Developer's decision
Version 2
Kind of conflict
Class signature
Chunk
Conflicting content
        _version = version;
    }

<<<<<<< HEAD
    public void setExtensionValidators(Map extensionValidators) {
    	_extensionValidators = extensionValidators;
=======
    public Properties getProperties() {
        return _properties;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }
}
Solution content
        _version = version;
    }

    public Properties getProperties() {
        return _properties;
    }
}
File
DeploymentUnitDir.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method signature
Return statement
Variable
Chunk
Conflicting content
=======
package org.apache.ode.store;

import java.io.File;
<<<<<<< HEAD
import java.io.FileFilter;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
Solution content
package org.apache.ode.store;

import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
<<<<<<< HEAD
import java.io.FileFilter;
import java.net.URI;
import java.text.ParseException;
import java.util.*;
=======
import java.net.URI;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

import javax.wsdl.Definition;
import javax.xml.namespace.QName;
Solution content
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.wsdl.Definition;
import javax.xml.namespace.QName;
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
<<<<<<< HEAD
import org.apache.ode.bpel.dd.TCleanup;
import org.apache.ode.bpel.dd.TContextInterceptor;
=======
import org.apache.ode.activityRecovery.FailureHandlingDocument.FailureHandling;
import org.apache.ode.bpel.dd.TCleanup;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.bpel.dd.TDeployment;
import org.apache.ode.bpel.dd.TInvoke;
import org.apache.ode.bpel.dd.TMexInterceptor;
Solution content
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.activityRecovery.FailureHandlingDocument.FailureHandling;
import org.apache.ode.bpel.dd.TCleanup;
import org.apache.ode.bpel.dd.TDeployment;
import org.apache.ode.bpel.dd.TInvoke;
import org.apache.ode.bpel.dd.TMexInterceptor;
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.bpel.iapi.ProcessState;
<<<<<<< HEAD
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
import org.apache.ode.bpel.rapi.ProcessModel;
import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
=======
import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
import org.apache.ode.bpel.o.OFailureHandling;
import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
import org.apache.ode.utils.CollectionUtils;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.utils.CronExpression;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.HierarchicalProperties;
Solution content
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.bpel.iapi.ProcessState;
import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
import org.apache.ode.bpel.o.OFailureHandling;
import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
import org.apache.ode.utils.CollectionUtils;
import org.apache.ode.utils.CronExpression;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.HierarchicalProperties;
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.HierarchicalProperties;
import org.apache.ode.utils.WatchDog;
<<<<<<< HEAD
import org.apache.ode.utils.CollectionUtils;
import org.w3c.dom.Document;
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Solution content
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.HierarchicalProperties;
import org.apache.ode.utils.WatchDog;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
    private File _configDir;
    private final Map _props;
    private final HashMap _partnerRoleInitialValues = new HashMap();
<<<<<<< HEAD
=======
    private final HashMap _partnerRoleConfig = new HashMap();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    private final HashMap _myRoleEndpoints = new HashMap();
    private final ArrayList _sharedServices = new ArrayList();
Solution content
    private File _configDir;
    private final Map _props;
    private final HashMap _myRoleEndpoints = new HashMap();
    private final HashMap _partnerRoleInitialValues = new HashMap();
    private final HashMap _partnerRoleConfig = new HashMap();

    private final ArrayList _sharedServices = new ArrayList();
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    // cache the inMemory flag because XMLBeans objects are heavily synchronized (guarded by a coarse-grained lock)
    private volatile boolean _inMemory = false;

<<<<<<< HEAD
    // monitor the EPR property file and reload it if necessary
=======
    // monitor the IL property file and reload it if necessary
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    private WatchDog, PropertiesObserver> propertiesWatchDog;

    private EndpointReferenceContext eprContext;
Solution content
    // cache the inMemory flag because XMLBeans objects are heavily synchronized (guarded by a coarse-grained lock)
    private volatile boolean _inMemory = false;

    // monitor the IL property file and reload it if necessary
    private WatchDog, PropertiesObserver> propertiesWatchDog;

    private EndpointReferenceContext eprContext;
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
    private EndpointReferenceContext eprContext;

    private final ProcessCleanupConfImpl processCleanupConfImpl;
<<<<<<< HEAD

    ProcessConfImpl(QName pid, QName type, long version, DeploymentUnitDir du, TDeployment.Process pinfo, Date deployDate,
                    Map props, ProcessState pstate, EndpointReferenceContext eprContext, File configDir) {
=======
    
    private final boolean generateProcessEventsAll;

    ProcessConfImpl(QName pid, QName type, long version, DeploymentUnitDir du, TDeployment.Process pinfo, Date deployDate,
                    Map props, ProcessState pstate, EndpointReferenceContext eprContext, File configDir, boolean generateProcessEventsAll) {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        _pid = pid;
        _version = version;
        _du = du;
Solution content
    private EndpointReferenceContext eprContext;

    private final ProcessCleanupConfImpl processCleanupConfImpl;
    
    private final boolean generateProcessEventsAll;

    ProcessConfImpl(QName pid, QName type, long version, DeploymentUnitDir du, TDeployment.Process pinfo, Date deployDate,
                    Map props, ProcessState pstate, EndpointReferenceContext eprContext, File configDir, boolean generateProcessEventsAll) {
        _pid = pid;
        _version = version;
        _du = du;
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method signature
Chunk
Conflicting content
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        this.generateProcessEventsAll = generateProcessEventsAll;
        this.eprContext = eprContext;
        _state = pstate;
        _type = type;
        _inMemory = _pinfo.isSetInMemory() && _pinfo.getInMemory();
<<<<<<< HEAD
        this.eprContext = eprContext;
=======
        propertiesWatchDog = new WatchDog, PropertiesObserver>(new PropertiesMutable(), new PropertiesObserver());

        initLinks();
Solution content
        _state = pstate;
        _type = type;
        _inMemory = _pinfo.isSetInMemory() && _pinfo.getInMemory();
        this.generateProcessEventsAll = generateProcessEventsAll;
        this.eprContext = eprContext;

        propertiesWatchDog = new WatchDog, PropertiesObserver>(new PropertiesMutable(), new PropertiesObserver());

        initLinks();
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
        initLinks();
        initMexInterceptors();
        initEventList();
<<<<<<< HEAD
        initPropagationRules();
        initContextInterceptors();

        processCleanupConfImpl = new ProcessCleanupConfImpl(pinfo);
        
        initCronSchedules();
=======

        processCleanupConfImpl = new ProcessCleanupConfImpl(pinfo);
        
        initSchedules();
    }

    private List collectEndpointConfigFiles() {
        // please mind the order: process-level files must be before system-level files
        List propFiles = new ArrayList();

        propFiles.addAll(_du.getEndpointConfigFiles());
        if (_configDir == null) {
            if (__log.isDebugEnabled()) __log.debug("No config directory set up.");
        } else if (_configDir.isDirectory()) {
            // list and sort endpoint config files
            File[] files = _configDir.listFiles(new FileFilter() {
                public boolean accept(File path) {
                    return path.getName().endsWith(".endpoint") && path.isFile();
                }
            });
            if (files != null) {
                Arrays.sort(files);
                propFiles.addAll(Arrays.asList(files));
            } else {
                if (__log.isErrorEnabled()) __log.error(_configDir + " does not exist or is not a directory");
            }
        } else {
            if (__log.isErrorEnabled()) __log.error(_configDir + " does not exist or is not a directory");
        }
        return propFiles;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    private List collectEndpointConfigFiles() {
Solution content
        initLinks();
        initMexInterceptors();
        initEventList();

        processCleanupConfImpl = new ProcessCleanupConfImpl(pinfo);
        
        initSchedules();
    }

    private List collectEndpointConfigFiles() {
        // please mind the order: process-level files must be before system-level files
        List propFiles = new ArrayList();

        propFiles.addAll(_du.getEndpointConfigFiles());
        if (_configDir == null) {
            if (__log.isDebugEnabled()) __log.debug("No config directory set up.");
        } else if (_configDir.isDirectory()) {
            // list and sort endpoint config files
            File[] files = _configDir.listFiles(new FileFilter() {
                public boolean accept(File path) {
                    return path.getName().endsWith(".endpoint") && path.isFile();
                }
            });
            if (files != null) {
                Arrays.sort(files);
                propFiles.addAll(Arrays.asList(files));
            } else {
                if (__log.isErrorEnabled()) __log.error(_configDir + " does not exist or is not a directory");
            }
        } else {
            if (__log.isErrorEnabled()) __log.error(_configDir + " does not exist or is not a directory");
        }
        return propFiles;
    }
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
If statement
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
                __log.debug("Processing  element for process " + _pinfo.getName() + ": partnerlink " + plinkName + " --> "
                        + service.getName() + " : " + service.getPort());
                _myRoleEndpoints.put(plinkName, new Endpoint(service.getName(), service.getPort()));
<<<<<<< HEAD
                
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                if (provide.isSetEnableSharing()) {
                    _sharedServices.add(service.getName());
                }
Solution content
                __log.debug("Processing  element for process " + _pinfo.getName() + ": partnerlink " + plinkName + " --> "
                        + service.getName() + " : " + service.getPort());
                _myRoleEndpoints.put(plinkName, new Endpoint(service.getName(), service.getPort()));

                if (provide.isSetEnableSharing()) {
                    _sharedServices.add(service.getName());
                }
File
ProcessConfImpl.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
    public ProcessModel getProcessModel() {
        throw new UnsupportedOperationException();
    }

=======
    public long getCBPFileSize() {
        CBPInfo cbpInfo = _du.getCBPInfo(getType());
        if (cbpInfo == null)
            throw new ContextException("CBP record not found for type " + getType());
        return cbpInfo.cbp.length();
    }
    
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public String getBpelDocument() {
        CBPInfo cbpInfo = _du.getCBPInfo(getType());
        if (cbpInfo == null)
Solution content
        }
    }

    public long getCBPFileSize() {
        CBPInfo cbpInfo = _du.getCBPInfo(getType());
        if (cbpInfo == null)
            throw new ContextException("CBP record not found for type " + getType());
        return cbpInfo.cbp.length();
    }
    
    public String getBpelDocument() {
        CBPInfo cbpInfo = _du.getCBPInfo(getType());
        if (cbpInfo == null)
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
    public Map getProvideEndpoints() {
        return Collections.unmodifiableMap(_myRoleEndpoints);
    }
<<<<<<< HEAD
    
    public boolean isSharedService(QName serviceName) {
        return _sharedServices.contains(serviceName);
=======

    public boolean isSharedService(QName serviceName) {
        return _sharedServices.contains(serviceName);
    }

    @SuppressWarnings("unused")
    private void handleEndpoints() {
        // for (TProvide provide : _pinfo.getProvideList()) {
        // OPartnerLink pLink = _oprocess.getPartnerLink(provide.getPartnerLink());
        // if (pLink == null) {
        // String msg = __msgs.msgDDPartnerLinkNotFound(provide.getPartnerLink());
        // __log.error(msg);
        // throw new BpelEngineException(msg);
        // }
        // if (!pLink.hasMyRole()) {
        // String msg = __msgs.msgDDMyRoleNotFound(provide.getPartnerLink());
        // __log.error(msg);
        // throw new BpelEngineException(msg);
        // }
        // }
        // for (TInvoke invoke : _pinfo.getInvokeList()) {
        // OPartnerLink pLink = _oprocess.getPartnerLink(invoke.getPartnerLink());
        // if (pLink == null) {
        // String msg = __msgs.msgDDPartnerLinkNotFound(invoke.getPartnerLink());
        // __log.error(msg);
        // throw new BpelEngineException(msg);
        // }
        // if (!pLink.hasPartnerRole()) {
        // String msg = __msgs.msgDDPartnerRoleNotFound(invoke.getPartnerLink());
        // __log.error(msg);
        // throw new BpelEngineException(msg);
        // }
        // TODO Handle non initialize partner roles that just provide a binding
        // if (!pLink.initializePartnerRole && _oprocess.version.equals(Namespaces.WS_BPEL_20_NS)) {
        // String msg = ProcessDDInitializer.__msgs.msgDDNoInitiliazePartnerRole(invoke.getPartnerLink());
        // ProcessDDInitializer.__log.error(msg);
        // throw new BpelEngineException(msg);
        // }
        // }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    DeploymentUnitDir getDeploymentUnit() {
Solution content
    }

    public Map getProvideEndpoints() {
        return Collections.unmodifiableMap(_myRoleEndpoints);
    }

    public boolean isSharedService(QName serviceName) {
        return _sharedServices.contains(serviceName);
    @SuppressWarnings("unused")
    private void handleEndpoints() {
        // for (TProvide provide : _pinfo.getProvideList()) {
        // OPartnerLink pLink = _oprocess.getPartnerLink(provide.getPartnerLink());
        // if (pLink == null) {
        // String msg = __msgs.msgDDPartnerLinkNotFound(provide.getPartnerLink());
        // __log.error(msg);
        // throw new BpelEngineException(msg);
        // }
        // if (!pLink.hasMyRole()) {
        // String msg = __msgs.msgDDMyRoleNotFound(provide.getPartnerLink());
        // __log.error(msg);
        // throw new BpelEngineException(msg);
        // }
        // }
        // for (TInvoke invoke : _pinfo.getInvokeList()) {
        // OPartnerLink pLink = _oprocess.getPartnerLink(invoke.getPartnerLink());
        // if (pLink == null) {
        // String msg = __msgs.msgDDPartnerLinkNotFound(invoke.getPartnerLink());
        // __log.error(msg);
        // throw new BpelEngineException(msg);
        // }
        // if (!pLink.hasPartnerRole()) {
        // String msg = __msgs.msgDDPartnerRoleNotFound(invoke.getPartnerLink());
        // __log.error(msg);
        // throw new BpelEngineException(msg);
        // }
        // TODO Handle non initialize partner roles that just provide a binding
        // if (!pLink.initializePartnerRole && _oprocess.version.equals(Namespaces.WS_BPEL_20_NS)) {
        // String msg = ProcessDDInitializer.__msgs.msgDDNoInitiliazePartnerRole(invoke.getPartnerLink());
        // ProcessDDInitializer.__log.error(msg);
        // throw new BpelEngineException(msg);
        // }
        // }
    }

    DeploymentUnitDir getDeploymentUnit() {
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Annotation
Comment
Method declaration
Method invocation
Method signature
Return statement
Chunk
Conflicting content
        return _inMemory;
    }

<<<<<<< HEAD
    public boolean isRestful() {
        return getProvideEndpoints().size() == 0;
    }

=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public void setTransient(boolean t) {
        _pinfo.setInMemory(t);
        _inMemory = t;
Solution content
        return _inMemory;
    }

    public void setTransient(boolean t) {
        _pinfo.setInMemory(t);
        _inMemory = t;
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
                }
                _events.put(null, all);
            }
<<<<<<< HEAD
            _events.put(null, all);
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            return;
        }
Solution content
                }
                _events.put(null, all);
            }
            return;
        }
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
        @Override
        public String toString() {
<<<<<<< HEAD
            return "Endpoint files for " + _du.toString();
=======
            return "Endpoint files for "+_du.toString();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }
    }
Solution content
        @Override
        public String toString() {
            return "Endpoint files for "+_du.toString();
        }
    }
File
ProcessConfImpl.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Return statement
Chunk
Conflicting content
    
    private void initSchedules() {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public Set getCleanupCategories(boolean instanceSucceeded) {
        return processCleanupConfImpl.getCleanupCategories(instanceSucceeded);
    }
<<<<<<< HEAD

    private void initCronSchedules() {
=======
        for(TSchedule schedule : _pinfo.getScheduleList()) {
            for(TCleanup cleanup : schedule.getCleanupList()) {
                assert !cleanup.getFilterList().isEmpty();
Solution content
    public Set getCleanupCategories(boolean instanceSucceeded) {
        return processCleanupConfImpl.getCleanupCategories(instanceSucceeded);
    }
    
    private void initSchedules() {
        for(TSchedule schedule : _pinfo.getScheduleList()) {
            for(TCleanup cleanup : schedule.getCleanupList()) {
                assert !cleanup.getFilterList().isEmpty();
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Method signature
Chunk
Conflicting content
        
        return jobs;
    }
<<<<<<< HEAD

    public Map getContextInterceptors() {
        return _ctxi;
    }


    public List getPropagationRules() {
        return _propagationRules;
    }
    
    @SuppressWarnings("unchecked")
    private void initPropagationRules() {
        if (_pinfo.getContext() != null) {
            for (TPropagate propagate : _pinfo.getContext().getPropagateList()) {
                PropagationRule rule = new PropagationRule();
                rule.setFromPL(propagate.getFrom());
                rule.setToPL(propagate.getTo());
                rule.setContexts(propagate.getContext());
                _propagationRules.add(rule);
            }
        }
    }
    
    private void initContextInterceptors() {
        if (_pinfo.getContext() != null) {
            for (TContextInterceptor i : _pinfo.getContext().getInterceptorList()) {
                if (i.getConfig().getDomNode().getNodeType() != Node.ELEMENT_NODE){
                    __log.warn("Ignoring configuration for " + i.getClassName() + " since it is not an XML element.");
                    continue;
                }
                Element config = (Element)i.getConfig().getDomNode();
                if (config != null) {
                    // We'll need DOM Level 3
                    Document doc = DOMUtils.newDocument();
                    doc.appendChild(doc.importNode(config, true));
                    _ctxi.put(i.getClassName(), doc.getDocumentElement());
                } else {
                    _ctxi.put(i.getClassName(), null);
                }
            }
        }
    }
}
=======
}
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
Solution content
        
        return jobs;
    }
}
File
ProcessConfImpl.java
Developer's decision
Version 2
Kind of conflict
Annotation
Method declaration
Chunk
Conflicting content
import org.apache.ode.bpel.dd.DeployDocument;
import org.apache.ode.bpel.dd.TDeployment;
import org.apache.ode.bpel.iapi.*;
<<<<<<< HEAD
=======
import org.apache.ode.il.config.OdeConfigProperties;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.msg.MessageBundle;
Solution content
import org.apache.ode.bpel.dd.DeployDocument;
import org.apache.ode.bpel.dd.TDeployment;
import org.apache.ode.bpel.iapi.*;
import org.apache.ode.il.config.OdeConfigProperties;
import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
import org.apache.ode.utils.DOMUtils;
import org.apache.ode.utils.GUID;
import org.apache.ode.utils.msg.MessageBundle;
File
ProcessStoreImpl.java
Developer's decision
Concatenation
Kind of conflict
Import
Chunk
Conflicting content
import org.w3c.dom.Element;
import org.w3c.dom.Node;

<<<<<<< HEAD
=======
import javax.sql.DataSource;
import javax.xml.namespace.QName;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
/**
 * 

* JDBC-based implementation of a process store. Also provides an "in-memory" store by way of HSQL database.

Solution content
import org.w3c.dom.Element;
import org.w3c.dom.Node;

import javax.sql.DataSource;
import javax.xml.namespace.QName;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 

* JDBC-based implementation of a process store. Also provides an "in-memory" store by way of HSQL database.

File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
    /** Guards access to the _processes and _deploymentUnits */
    private final ReadWriteLock _rw = new ReentrantReadWriteLock();

<<<<<<< HEAD
    final private ConfStoreDAOConnectionFactory _cf;

    final private EndpointReferenceContext _eprContext;

    final private TransactionManager _txm;
=======
    private ConfStoreConnectionFactory _cf;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    private EndpointReferenceContext eprContext;
    
Solution content
    
    /** Guards access to the _processes and _deploymentUnits */
    private final ReadWriteLock _rw = new ReentrantReadWriteLock();

    private EndpointReferenceContext eprContext;
    private ConfStoreConnectionFactory _cf;
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
            } else {
<<<<<<< HEAD
    /**
     * Constructor that hardwires OpenJPA on a new in-memory database. Suitable for tests.
     */
    public  ProcessStoreImpl(EndpointReferenceContext eprContext, TransactionManager mgr, ConfStoreDAOConnectionFactory cf) {
        _eprContext = eprContext;
        _txm = mgr;
        _cf=cf;
=======
    private DataSource _inMemDs;

    public ProcessStoreImpl() {
        this(null, null, "", new OdeConfigProperties(new Properties(), ""), true);
    }

    public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource ds, String persistenceType, OdeConfigProperties props, boolean createDatamodel) {
        this.eprContext = eprContext;
        this.generateProcessEventsAll = props.getProperty("generateProcessEvents", "all").equals("all");
        if (ds != null) {
            // ugly hack
            if (persistenceType.toLowerCase().indexOf("hib") != -1) {
                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, props.getProperties(), createDatamodel, props.getTxFactoryClass());
                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds, createDatamodel, props.getTxFactoryClass());
            }
         } else {
            // If the datasource is not provided, then we create a HSQL-based
            // in-memory database. Makes testing a bit simpler.
            DataSource hsqlds = createInternalDS(new GUID().toString());
            if ("hibernate".equalsIgnoreCase(persistenceType)) {
                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, props.getProperties(), createDatamodel, props.getTxFactoryClass());
            } else {
                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, createDatamodel, props.getTxFactoryClass());
            }
            _inMemDs = hsqlds;
        }
    }

    /**
     * Constructor that hardwires OpenJPA on a new in-memory database. Suitable for tests.
     */
    public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource inMemDs) {
        this.eprContext = eprContext;
        DataSource hsqlds = createInternalDS(new GUID().toString());
        //when in memory we always create the model as we are starting from scratch
        _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, true, OdeConfigProperties.DEFAULT_TX_FACTORY_CLASS_NAME);
        _inMemDs = hsqlds;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    public void shutdown() {
Solution content
    /**
     * In-memory DataSource, or null if we are using a real DS. We need this to shutdown the DB.
     */
    private DataSource _inMemDs;

    public ProcessStoreImpl() {
        this(null, null, "", new OdeConfigProperties(new Properties(), ""), true);
    }

    public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource ds, String persistenceType, OdeConfigProperties props, boolean createDatamodel) {
        this.eprContext = eprContext;
        this.generateProcessEventsAll = props.getProperty("generateProcessEvents", "all").equals("all");
        if (ds != null) {
            // ugly hack
            if (persistenceType.toLowerCase().indexOf("hib") != -1) {
                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(ds, props.getProperties(), createDatamodel, props.getTxFactoryClass());
            } else {
                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(ds, createDatamodel, props.getTxFactoryClass());
            }
         } else {
            // If the datasource is not provided, then we create a HSQL-based
            // in-memory database. Makes testing a bit simpler.
            DataSource hsqlds = createInternalDS(new GUID().toString());
            if ("hibernate".equalsIgnoreCase(persistenceType)) {
                _cf = new org.apache.ode.store.hib.DbConfStoreConnectionFactory(hsqlds, props.getProperties(), createDatamodel, props.getTxFactoryClass());
            } else {
                _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, createDatamodel, props.getTxFactoryClass());
            }
            _inMemDs = hsqlds;
        }
    }

    /**
     * Constructor that hardwires OpenJPA on a new in-memory database. Suitable for tests.
     */
    public ProcessStoreImpl(EndpointReferenceContext eprContext, DataSource inMemDs) {
        this.eprContext = eprContext;
        DataSource hsqlds = createInternalDS(new GUID().toString());
        //when in memory we always create the model as we are starting from scratch
        _cf = new org.apache.ode.store.jpa.DbConfStoreConnectionFactory(hsqlds, true, OdeConfigProperties.DEFAULT_TX_FACTORY_CLASS_NAME);
        _inMemDs = hsqlds;
    }

    public void shutdown() {
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
        // Create the DU and compile/scan it before acquiring lock.
        final DeploymentUnitDir du = new DeploymentUnitDir(deploymentUnitDirectory);
<<<<<<< HEAD
        du.setExtensionValidators(_extensionValidators);
=======
        if( duName != null ) {
        	// Override the package name if given from the parameter
        	du.setName(duName);
        }
        
        long version;
        if (autoincrementVersion || du.getStaticVersion() == -1) {
            // Process and DU use a monotonically increased single version number by default.
            version = exec(new Callable() {
                public Long call(ConfStoreConnection conn) {
                    return conn.getNextVersion();
                }
            });
        } else {
            version = du.getStaticVersion();
        }
        du.setVersion(version);
        
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        try {
            du.compile();
        } catch (CompilationException ce) {
Solution content
        // Create the DU and compile/scan it before acquiring lock.
        final DeploymentUnitDir du = new DeploymentUnitDir(deploymentUnitDirectory);
        if( duName != null ) {
        	// Override the package name if given from the parameter
        	du.setName(duName);
        }
        
        long version;
        if (autoincrementVersion || du.getStaticVersion() == -1) {
            // Process and DU use a monotonically increased single version number by default.
            version = exec(new Callable() {
                public Long call(ConfStoreConnection conn) {
                    return conn.getNextVersion();
                }
            });
        } else {
            version = du.getStaticVersion();
        }
        du.setVersion(version);
        
        try {
            du.compile();
        } catch (CompilationException ce) {
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Variable
Chunk
Conflicting content
        Collection deployed;

        _rw.writeLock().lock();
<<<<<<< HEAD
        // Process and DU use a monotonically increased single version number.
        long version = exec(new Callable() {
            public Long call(ConfStoreDAOConnection conn) {
                return conn.getNextVersion();
            }
        });
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

        try {
            if (_deploymentUnits.containsKey(du.getName())) {
Solution content
        Collection deployed;

        _rw.writeLock().lock();

        try {
            if (_deploymentUnits.containsKey(du.getName())) {
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Comment
Method invocation
Variable
Chunk
Conflicting content
                }

                ProcessConfImpl pconf = new ProcessConfImpl(pid, processDD.getName(), version, du, processDD, deployDate,
<<<<<<< HEAD
                        calcInitialProperties(processDD), calcInitialState(processDD), _eprContext, _configDir);
=======
                        calcInitialProperties(du.getProperties(), processDD), calcInitialState(processDD), eprContext, _configDir, generateProcessEventsAll);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                processes.add(pconf);
            }
Solution content
                }

                ProcessConfImpl pconf = new ProcessConfImpl(pid, processDD.getName(), version, du, processDD, deployDate,
                        calcInitialProperties(du.getProperties(), processDD), calcInitialState(processDD), eprContext, _configDir, generateProcessEventsAll);
                processes.add(pconf);
            }
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    private void retirePreviousPackageVersions(DeploymentUnitDir du) {
        //retire all the other versions of the same DU
        String[] nameParts = du.getName().split("/");
<<<<<<< HEAD
        /* Replace the version number (if any) with regexp to match any version number */
        nameParts[0] = nameParts[0].replaceAll("([-\\Q.\\E](\\d)+)?\\z", "");
        nameParts[0] += "([-\\Q.\\E](\\d)+)?";
=======
           /* Replace the version number (if any) with regexp to match any version number */
            nameParts[0] = nameParts[0].replaceAll("([-\\Q.\\E](\\d)+)?\\z", "");
            nameParts[0] += "([-\\Q.\\E](\\d)+)?";
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        StringBuilder duNameRegExp = new StringBuilder(du.getName().length() * 2);
        for (int i = 0, n = nameParts.length; i < n; i++) {
            if (i > 0) duNameRegExp.append("/");
Solution content
            nameParts[0] += "([-\\Q.\\E](\\d)+)?";
    private void retirePreviousPackageVersions(DeploymentUnitDir du) {
        //retire all the other versions of the same DU
        String[] nameParts = du.getName().split("/");
           /* Replace the version number (if any) with regexp to match any version number */
            nameParts[0] = nameParts[0].replaceAll("([-\\Q.\\E](\\d)+)?\\z", "");
        StringBuilder duNameRegExp = new StringBuilder(du.getName().length() * 2);
        for (int i = 0, n = nameParts.length; i < n; i++) {
            if (i > 0) duNameRegExp.append("/");
File
ProcessStoreImpl.java
Developer's decision
Version 1
Kind of conflict
Array access
Comment
Method invocation
Chunk
Conflicting content
   	public Collection undeploy(final String duName) {
        try {
            exec(new Callable>() {
<<<<<<< HEAD
                public Collection call(ConfStoreDAOConnection conn) {
                    DeploymentUnitDAO dudao = conn.getDeploymentUnit(dir.getName());
=======
                public Collection call(ConfStoreConnection conn) {
                    DeploymentUnitDAO dudao = conn.getDeploymentUnit(duName);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                    if (dudao != null)
                        dudao.delete();
                    return null;
Solution content
   	public Collection undeploy(final String duName) {
        try {
            exec(new Callable>() {
                public Collection call(ConfStoreConnection conn) {
                    DeploymentUnitDAO dudao = conn.getDeploymentUnit(duName);
                    if (dudao != null)
                        dudao.delete();
                    return null;
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Method signature
Variable
Chunk
Conflicting content
    private void fireStateChange(QName processId, ProcessState state, String duname) {
        switch (state) {
<<<<<<< HEAD
        case ACTIVE:
            fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.ACTIVATED, processId, duname));
            break;
        case DISABLED:
            fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.DISABLED, processId, duname));
            break;
        case RETIRED:
            fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.RETIRED, processId, duname));
            break;
=======
            case ACTIVE:
                fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.ACTVIATED, processId, duname));
                break;
            case DISABLED:
                fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.DISABLED, processId, duname));
                break;
            case RETIRED:
                fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.RETIRED, processId, duname));
                break;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }

    }
Solution content
    private void fireStateChange(QName processId, ProcessState state, String duname) {
        switch (state) {
            case ACTIVE:
                fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.ACTVIATED, processId, duname));
                break;
            case DISABLED:
                fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.DISABLED, processId, duname));
                break;
            case RETIRED:
                fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.RETIRED, processId, duname));
                break;
        }

    }
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Break statement
Case statement
Method invocation
Chunk
Conflicting content
        File dudir = findDeployDir(dudao);

        if (dudir == null || !dudir.exists())
<<<<<<< HEAD
            throw new ContextException("Deployed directory " +
                    (dudir == null ? "(unknown)" : dudir) + " no longer there!");
=======
            throw new ContextException("Deployed directory " + (dudir == null ? "(unknown)" : dudir) + " no longer there!");
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        DeploymentUnitDir dud = new DeploymentUnitDir(dudir);
        // set the name with the one from database
        dud.setName(dudao.getName());
Solution content
        File dudir = findDeployDir(dudao);

        if (dudir == null || !dudir.exists())
            throw new ContextException("Deployed directory " + (dudir == null ? "(unknown)" : dudir) + " no longer there!");
        DeploymentUnitDir dud = new DeploymentUnitDir(dudir);
        // set the name with the one from database
        dud.setName(dudao.getName());
File
ProcessStoreImpl.java
Developer's decision
Version 1
Kind of conflict
Throw statement
Chunk
Conflicting content
                        .getDeployDate(), props, p.getState(), eprContext, _configDir, generateProcessEventsAll);
                // TODO: update the props based on the values in the DB.

                ProcessConfImpl pconf = new ProcessConfImpl(p.getPID(), p.getType(), p.getVersion(), dud, pinfo, dudao
<<<<<<< HEAD
                        .getDeployDate(), props, p.getState(), _eprContext, _configDir);
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                version = p.getVersion();

                _processes.put(pconf.getProcessId(), pconf);
Solution content
                // TODO: update the props based on the values in the DB.

                ProcessConfImpl pconf = new ProcessConfImpl(p.getPID(), p.getType(), p.getVersion(), dud, pinfo, dudao
                        .getDeployDate(), props, p.getState(), eprContext, _configDir, generateProcessEventsAll);
                version = p.getVersion();

                _processes.put(pconf.getProcessId(), pconf);
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Variable
Chunk
Conflicting content
            boolean success = false;
<<<<<<< HEAD
    abstract class Callable implements java.util.concurrent.Callable {
        public V call() {
            ConfStoreDAOConnection conn = _cf.getConnection();
            try {
                if (_txm!=null)
                    _txm.begin();
                V r = call(conn);
                if (_txm!=null)
                    _txm.commit();
=======
            // in JTA, transaction is bigger than the session
            _cf.beginTransaction();
            ConfStoreConnection conn = getConnection();
            try {
                V r = call(conn);
                _cf.commitTransaction();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                success = true;
                return r;
            }catch (Exception e){
Solution content
    abstract class Callable implements java.util.concurrent.Callable {
        public V call() {
            boolean success = false;
            // in JTA, transaction is bigger than the session
            _cf.beginTransaction();
            ConfStoreConnection conn = getConnection();
            try {
                V r = call(conn);
                _cf.commitTransaction();
                success = true;
                return r;
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Comment
If statement
Method invocation
Try statement
Variable
Chunk
Conflicting content
                if (!success && _txm != null)
                    try {
<<<<<<< HEAD
            } finally {
                        _txm.rollback();
=======
                        _cf.rollbackTransaction();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                    } catch (Exception ex) {
                        __log.error("TxError", ex);
                    }
Solution content
            } finally {
                if (!success)
                    try {
                        _cf.rollbackTransaction();
                    } catch (Exception ex) {
                        __log.error("DbError", ex);
                    }
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
                    } catch (Exception ex) {
                        __log.error("TxError", ex);
                    }
<<<<<<< HEAD
                    conn.close();
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            }
         // session is closed automatically when committed or rolled back under JTA
        }
Solution content
                    } catch (Exception ex) {
                        __log.error("DbError", ex);
                    }
            }
         // session is closed automatically when committed or rolled back under JTA
        }
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
    }

    public void setDeployDir(File depDir) {
<<<<<<< HEAD
        if (depDir != null && !depDir.isDirectory())
            throw new IllegalArgumentException("Deploy directory is not a directory or does not exist:  " + depDir);
=======
        if (depDir != null) {
        	if( !depDir.exists() ) {
        		depDir.mkdirs();
        		__log.warn("Deploy directory: " + depDir.getAbsolutePath() + " does not exist; created it.");
        	} else if(!depDir.isDirectory()) {
                throw new IllegalArgumentException("Deploy directory is not a directory:  " + depDir);
        	}
        }
        
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        _deployDir = depDir;
    }
Solution content
    }

    public void setDeployDir(File depDir) {
        if (depDir != null) {
        	if( !depDir.exists() ) {
        		depDir.mkdirs();
        		__log.warn("Deploy directory: " + depDir.getAbsolutePath() + " does not exist; created it.");
        	} else if(!depDir.isDirectory()) {
                throw new IllegalArgumentException("Deploy directory is not a directory:  " + depDir);
        	}
        }
        
        _deployDir = depDir;
    }
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
If statement
Chunk
Conflicting content
    public File getDeployDir() {
        return _deployDir;
<<<<<<< HEAD
=======
    }

    public File getConfigDir() {
        return _configDir;
    }

    public void setConfigDir(File configDir) {
        if (configDir != null && !configDir.isDirectory())
            throw new IllegalArgumentException("Config directory is not a directory or does not exist: " + configDir);
        this._configDir = configDir;
    }

    public static DataSource createInternalDS(String guid) {
        jdbcDataSource hsqlds = new jdbcDataSource();
        hsqlds.setDatabase("jdbc:hsqldb:mem:" + guid);
        hsqlds.setUser("sa");
        hsqlds.setPassword("");
        return hsqlds;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    public File getConfigDir() {
Solution content

    public File getDeployDir() {
        return _deployDir;
    }

    public File getConfigDir() {
        return _configDir;
    }

    public void setConfigDir(File configDir) {
        if (configDir != null && !configDir.isDirectory())
            throw new IllegalArgumentException("Config directory is not a directory or does not exist: " + configDir);
        this._configDir = configDir;
    }
    public static DataSource createInternalDS(String guid) {
        jdbcDataSource hsqlds = new jdbcDataSource();
        hsqlds.setDatabase("jdbc:hsqldb:mem:" + guid);
        hsqlds.setUser("sa");
        hsqlds.setPassword("");
        return hsqlds;
    }
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
        public Thread newThread(Runnable r) {
        return new QName(processType.getNamespaceURI(), processType.getLocalPart() + "-" + version);
    }

<<<<<<< HEAD
	public void setExtensionValidators(Map extensionValidators) {
		_extensionValidators = extensionValidators;
	}
    

    private static class SimpleThreadFactory implements ThreadFactory {
=======
    private class SimpleThreadFactory implements ThreadFactory {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        int threadNumber = 0;
            threadNumber += 1;
Solution content
        return new QName(processType.getNamespaceURI(), processType.getLocalPart() + "-" + version);
    }

    private class SimpleThreadFactory implements ThreadFactory {
        int threadNumber = 0;
        public Thread newThread(Runnable r) {
            threadNumber += 1;
File
ProcessStoreImpl.java
Developer's decision
Version 2
Kind of conflict
Class signature
Method declaration
Chunk
Conflicting content
        }
    }
<<<<<<< HEAD
    
=======

            return t;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public void refreshSchedules(String packageName) {
        for( QName pid : listProcesses(packageName) ) {
            fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.SCHEDULE_SETTINGS_CHANGED, pid, packageName));
Solution content
            return t;
        }
    }

    public void refreshSchedules(String packageName) {
        for( QName pid : listProcesses(packageName) ) {
            fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.SCHEDULE_SETTINGS_CHANGED, pid, packageName));
File
ProcessStoreImpl.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
  public void setUp() throws Exception {
import junit.framework.TestCase;

import org.apache.ode.bpel.iapi.ProcessConf;
<<<<<<< HEAD
import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
import org.apache.ode.il.config.OdeConfigProperties;
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.il.txutil.TxManager;
import org.apache.ode.utils.DOMUtils;

public class ProcessStoreTest extends TestCase {

  ProcessStoreImpl _ps;
  Database _db;
  ConfStoreDAOConnectionFactory _cf;
  private File _testdd;

     Properties props = new Properties();
     props.setProperty(OdeConfigProperties.PROP_DAOCF_STORE,System.getProperty(OdeConfigProperties.PROP_DAOCF_STORE,OdeConfigProperties.DEFAULT_DAOCF_STORE_CLASS));
     OdeConfigProperties odeProps = new OdeConfigProperties(props, "");
     _db = new Database(odeProps);
     TxManager tx = new TxManager(odeProps);
     TransactionManager txm = tx.createTransactionManager();
     _db.setTransactionManager(txm);
     _db.start();
     _cf = _db.createDaoStoreCF();
     _ps = new ProcessStoreImpl(null,txm,  _cf);
     _ps.loadAll();
     URI tdd = getClass().getResource("/testdd/deploy.xml").toURI();
     _testdd = new File(tdd.getPath()).getParentFile();
  }

  public void tearDown() throws Exception {
    _ps.shutdown();
    _cf.shutdown();
    _db.shutdown();
  }

  public void testSanity() {
    assertEquals(0, _ps.getProcesses().size());
    assertEquals(0, _ps.getPackages().size());
    assertNull(_ps.listProcesses("foobar"));
  }

  public void testDeploy() {
    Collection deployed = _ps.deploy(_testdd);
    assertNotNull(deployed);
    assertEquals(1, deployed.size());
  }

  public void testGetProcess() {
    Collection deployed = _ps.deploy(_testdd);
    QName pname = deployed.iterator().next();
    assertNotNull(deployed);
    assertEquals(1, deployed.size());
    ProcessConf pconf = _ps.getProcessConfiguration(pname);
    assertNotNull(pconf);
    assertEquals(_testdd.getName(), pconf.getPackage());
    assertEquals(pname, pconf.getProcessId());
    assertEquals(1, pconf.getPropagationRules().size());
    assertEquals(1, pconf.getContextInterceptors().keySet().size());
    assertNotNull(pconf.getContextInterceptors().get("org.apache.ode.bpel.context.TestInterceptor"));
    assertEquals("myparam1", DOMUtils.getElementContent(pconf.getContextInterceptors().get("org.apache.ode.bpel.context.TestInterceptor")).getLocalName());
  }

  public void testGetProcesses() {
    Collection deployed = _ps.deploy(_testdd);
    QName pname = deployed.iterator().next();
    assertNotNull(deployed);
    assertEquals(1, deployed.size());
    List pconfs = _ps.getProcesses();
    assertEquals(pname, pconfs.get(0));
  }
=======
import org.apache.ode.bpel.iapi.ProcessConf.CLEANUP_CATEGORY;

public class ProcessStoreTest extends TestCase {

    ProcessStoreImpl _ps;
    private File _testdd;
    
    public void setUp() throws Exception {
        System.setProperty("openjpa.properties", "/openjpa.xml");
        _ps = new ProcessStoreImpl();
        _ps.loadAll();
        URI tdd= getClass().getResource("/testdd/deploy.xml").toURI();
        _testdd = new File(tdd.getPath()).getParentFile();
    } 
    
    public void tearDown() throws Exception {
        _ps.shutdown();
        assertNotNull(pconf);
    }
     
        assertEquals(pname, pconf.getProcessId());
    public void testSanity() {
    } 
    
        assertEquals(0,_ps.getProcesses().size());
    public void testGetProcesses() {
        assertEquals(_testdd.getName(),pconf.getPackage());
        assertEquals(0,_ps.getPackages().size());
        assertNull(_ps.listProcesses("foobar"));
    }
    
    public void testDeploy() {
        Collection deployed = _ps.deploy(_testdd);
        assertNotNull(deployed);
        assertEquals(1,deployed.size());
    }
    
    public void testGetProcess() {
        Collection deployed = _ps.deploy(_testdd);
        QName pname = deployed.iterator().next();
        assertNotNull(deployed);
        assertEquals(1,deployed.size());
        ProcessConf pconf = _ps.getProcessConfiguration(pname);
        Collection deployed = _ps.deploy(_testdd);
        QName pname = deployed.iterator().next();
        assertNotNull(deployed);
        assertEquals(1,deployed.size());
        List pconfs = _ps.getProcesses();
        assertEquals(pname,pconfs.get(0));
    }
    
    public void testCleanupConfigurations() {
        Collection deployed = _ps.deploy(_testdd);
        QName pname = deployed.iterator().next();
        assertNotNull(deployed);
        assertEquals(1,deployed.size());
        ProcessConf pconf = _ps.getProcessConfiguration(pname);
        assertNotNull(pconf);
        assertEquals(_testdd.getName(),pconf.getPackage());
        assertEquals(pname, pconf.getProcessId());
        
        assertEquals(EnumSet.allOf(CLEANUP_CATEGORY.class), pconf.getCleanupCategories(true));
        assertEquals(EnumSet.of(CLEANUP_CATEGORY.MESSAGES, CLEANUP_CATEGORY.EVENTS), pconf.getCleanupCategories(false));
        
        assertTrue(pconf.isCleanupCategoryEnabled(true, CLEANUP_CATEGORY.INSTANCE));
        assertTrue(pconf.isCleanupCategoryEnabled(true, CLEANUP_CATEGORY.VARIABLES));
        assertTrue(pconf.isCleanupCategoryEnabled(true, CLEANUP_CATEGORY.MESSAGES));
        assertTrue(pconf.isCleanupCategoryEnabled(true, CLEANUP_CATEGORY.CORRELATIONS));
        assertTrue(pconf.isCleanupCategoryEnabled(true, CLEANUP_CATEGORY.EVENTS));
        assertFalse(pconf.isCleanupCategoryEnabled(false, CLEANUP_CATEGORY.INSTANCE));
        assertFalse(pconf.isCleanupCategoryEnabled(false, CLEANUP_CATEGORY.VARIABLES));
        assertTrue(pconf.isCleanupCategoryEnabled(false, CLEANUP_CATEGORY.MESSAGES));
        assertFalse(pconf.isCleanupCategoryEnabled(false, CLEANUP_CATEGORY.CORRELATIONS));
        assertTrue(pconf.isCleanupCategoryEnabled(false, CLEANUP_CATEGORY.EVENTS));
        
        assertEquals(2, pconf.getCronJobs().size());
        assertNotNull(pconf.getCronJobs().get(0).getCronExpression());
        assertEquals(3, pconf.getCronJobs().get(0).getRunnableDetailList().size());
    } 
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
import junit.framework.TestCase;

import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.bpel.iapi.ProcessConf.CLEANUP_CATEGORY;

public class ProcessStoreTest extends TestCase {

    ProcessStoreImpl _ps;
    private File _testdd;
    
    public void setUp() throws Exception {
        System.setProperty("openjpa.properties", "/openjpa.xml");
        _ps = new ProcessStoreImpl();
        _ps.loadAll();
        URI tdd= getClass().getResource("/testdd/deploy.xml").toURI();
        _testdd = new File(tdd.getPath()).getParentFile();
    } 
    
    public void tearDown() throws Exception {
        _ps.shutdown();
    }
     
    public void testSanity() {
        assertEquals(0,_ps.getProcesses().size());
        assertEquals(0,_ps.getPackages().size());
        assertNull(_ps.listProcesses("foobar"));
    }
    
    public void testDeploy() {
        Collection deployed = _ps.deploy(_testdd);
        assertNotNull(deployed);
        assertEquals(1,deployed.size());
    }
    
    public void testGetProcess() {
        Collection deployed = _ps.deploy(_testdd);
        QName pname = deployed.iterator().next();
        assertNotNull(deployed);
        assertEquals(1,deployed.size());
        ProcessConf pconf = _ps.getProcessConfiguration(pname);
        assertNotNull(pconf);
        assertEquals(_testdd.getName(),pconf.getPackage());
        assertEquals(pname, pconf.getProcessId());
    } 
    
    public void testGetProcesses() {
        Collection deployed = _ps.deploy(_testdd);
        QName pname = deployed.iterator().next();
        assertNotNull(deployed);
        assertEquals(1,deployed.size());
        List pconfs = _ps.getProcesses();
        assertEquals(pname,pconfs.get(0));
    }
    
    public void testCleanupConfigurations() {
        Collection deployed = _ps.deploy(_testdd);
        QName pname = deployed.iterator().next();
        assertNotNull(deployed);
        assertEquals(1,deployed.size());
        ProcessConf pconf = _ps.getProcessConfiguration(pname);
        assertNotNull(pconf);
        assertEquals(_testdd.getName(),pconf.getPackage());
        assertEquals(pname, pconf.getProcessId());
        
        assertEquals(EnumSet.allOf(CLEANUP_CATEGORY.class), pconf.getCleanupCategories(true));
        assertEquals(EnumSet.of(CLEANUP_CATEGORY.MESSAGES, CLEANUP_CATEGORY.EVENTS), pconf.getCleanupCategories(false));
        
        assertTrue(pconf.isCleanupCategoryEnabled(true, CLEANUP_CATEGORY.INSTANCE));
        assertTrue(pconf.isCleanupCategoryEnabled(true, CLEANUP_CATEGORY.VARIABLES));
        assertTrue(pconf.isCleanupCategoryEnabled(true, CLEANUP_CATEGORY.MESSAGES));
        assertTrue(pconf.isCleanupCategoryEnabled(true, CLEANUP_CATEGORY.CORRELATIONS));
        assertTrue(pconf.isCleanupCategoryEnabled(true, CLEANUP_CATEGORY.EVENTS));
        assertFalse(pconf.isCleanupCategoryEnabled(false, CLEANUP_CATEGORY.INSTANCE));
        assertFalse(pconf.isCleanupCategoryEnabled(false, CLEANUP_CATEGORY.VARIABLES));
        assertTrue(pconf.isCleanupCategoryEnabled(false, CLEANUP_CATEGORY.MESSAGES));
        assertFalse(pconf.isCleanupCategoryEnabled(false, CLEANUP_CATEGORY.CORRELATIONS));
        assertTrue(pconf.isCleanupCategoryEnabled(false, CLEANUP_CATEGORY.EVENTS));
        
        assertEquals(2, pconf.getCronJobs().size());
        assertNotNull(pconf.getCronJobs().get(0).getCronExpression());
        assertEquals(3, pconf.getCronJobs().get(0).getRunnableDetailList().size());
    } 
}
File
ProcessStoreTest.java
Developer's decision
Version 2
Kind of conflict
Attribute
Class signature
Import
Method declaration
Chunk
Conflicting content
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
<<<<<<< HEAD
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
=======
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import java.util.regex.Matcher;
import java.util.regex.Pattern;
Solution content
import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
<<<<<<< HEAD
import javax.xml.namespace.QName;

import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.evtproc.DebugBpelEventListener;
import org.apache.ode.bpel.iapi.*;
import org.apache.ode.bpel.iapi.MessageExchange.AckType;
import org.apache.ode.bpel.iapi.MessageExchange.Status;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange.CorrelationStatus;
import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
import org.apache.ode.bpel.rtrep.common.extension.AbstractExtensionBundle;
import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
import org.apache.ode.il.MockScheduler;
import org.apache.ode.il.config.OdeConfigProperties;
import org.apache.ode.il.dbutil.Database;
=======
import javax.persistence.Persistence;
import javax.xml.namespace.QName;

import org.apache.ode.bpel.common.evt.DebugBpelEventListener;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchange;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
import org.apache.ode.bpel.iapi.ProcessStore;
import org.apache.ode.bpel.iapi.ProcessStoreEvent;
import org.apache.ode.bpel.iapi.ProcessStoreListener;
import org.apache.ode.bpel.iapi.MessageExchange.Status;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange.CorrelationStatus;
import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
import org.apache.ode.il.MockScheduler;
import org.apache.ode.il.config.OdeConfigProperties;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.store.ProcessConfImpl;
import org.apache.ode.store.ProcessStoreImpl;
import org.apache.ode.utils.DOMUtils;
Solution content
import org.apache.ode.store.ProcessConfImpl;
import org.apache.ode.store.ProcessStoreImpl;
import org.apache.ode.utils.DOMUtils;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.xml.namespace.QName;

import org.apache.ode.bpel.common.evt.DebugBpelEventListener;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchange;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
import org.apache.ode.bpel.iapi.ProcessStore;
import org.apache.ode.bpel.iapi.ProcessStoreEvent;
import org.apache.ode.bpel.iapi.ProcessStoreListener;
import org.apache.ode.bpel.iapi.MessageExchange.Status;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange.CorrelationStatus;
import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
import org.apache.ode.il.MockScheduler;
import org.apache.ode.il.config.OdeConfigProperties;
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
=======
import org.w3c.dom.Element;

public abstract class BPELTestAbstract {
<<<<<<< HEAD
    private static final String SHOW_EVENTS_ON_CONSOLE = "no";
	public static final long WAIT_BEFORE_INVOKE_TIMEOUT = 2000;
	
	private static final String SHOW_EVENTS_ON_CONSOLE = "no";
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    protected BpelServerImpl _server;
Solution content
import org.w3c.dom.Element;
public abstract class BPELTestAbstract {
	public static final long WAIT_BEFORE_INVOKE_TIMEOUT = 2000;
	
	private static final String SHOW_EVENTS_ON_CONSOLE = "no";

    protected BpelServerImpl _server;
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
            _server.setDaoConnectionFactory(_cf);
        _db.start();

        if (Boolean.getBoolean("org.apache.ode.test.persistent")) {
<<<<<<< HEAD
            _server.setDaoConnectionFactory(_bcf);
            scheduler = new MockScheduler(_txm);
=======
            emf = Persistence.createEntityManagerFactory("ode-unit-test-embedded");
            em = emf.createEntityManager();
            _cf = new org.apache.ode.daohib.bpel.BpelDAOConnectionFactoryImpl();
            scheduler = new MockScheduler() {
                @Override
                public void beginTransaction() {
                    super.beginTransaction();
                    em.getTransaction().begin();
                }

                @Override
                public void commitTransaction() {
                    super.commitTransaction();
                    em.getTransaction().commit();
                }

                @Override
                public void rollbackTransaction() {
                    super.rollbackTransaction();
                    em.getTransaction().rollback();
                }

            };
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        } else {
            scheduler = new MockScheduler(_txm);
            _bcf = new BpelDAOConnectionFactoryImpl();
Solution content
        if (Boolean.getBoolean("org.apache.ode.test.persistent")) {
            emf = Persistence.createEntityManagerFactory("ode-unit-test-embedded");
            em = emf.createEntityManager();
            _cf = new org.apache.ode.daohib.bpel.BpelDAOConnectionFactoryImpl();
            _server.setDaoConnectionFactory(_cf);
            scheduler = new MockScheduler() {
                @Override
                public void beginTransaction() {
                    super.beginTransaction();
                    em.getTransaction().begin();
                }

                @Override
                public void commitTransaction() {
                    super.commitTransaction();
                    em.getTransaction().commit();
                }

                @Override
                public void rollbackTransaction() {
                    super.rollbackTransaction();
                    em.getTransaction().rollback();
                }

            };
        } else {
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
        _server.setMessageExchangeContext(mexContext);
        _server.setTransactionManager(_txm);
        scheduler.setJobProcessor(_server);
<<<<<<< HEAD
        final EndpointReferenceContext eprContext = new EndpointReferenceContext() {
            public EndpointReference resolveEndpointReference(Element epr) {
                return null;
            }

            public EndpointReference convertEndpoint(QName targetType, Element sourceEndpoint) {
                return null;
=======
        store = new ProcessStoreImpl(null, null, "hibernate", new OdeConfigProperties(new Properties(), ""), true);
        store.registerListener(new ProcessStoreListener() {
            public void onProcessStoreEvent(ProcessStoreEvent event) {
                // bounce the process
                _server.unregister(event.pid);
                if (event.type != ProcessStoreEvent.Type.UNDEPLOYED) {
                    ProcessConfImpl conf = (ProcessConfImpl) store.getProcessConfiguration(event.pid);
                    // Test processes always run with in-mem DAOs
                    conf.setTransient(true);
                    _server.register(conf);
                }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            }

            public Map getConfigLookup(EndpointReference epr) {
Solution content
        return deployment;
    }
        _server.setMessageExchangeContext(mexContext);
        scheduler.setJobProcessor(_server);
        store = new ProcessStoreImpl(null, null, "hibernate", new OdeConfigProperties(new Properties(), ""), true);
        store.registerListener(new ProcessStoreListener() {
            public void onProcessStoreEvent(ProcessStoreEvent event) {
                // bounce the process
                _server.unregister(event.pid);
                if (event.type != ProcessStoreEvent.Type.UNDEPLOYED) {
                    ProcessConfImpl conf = (ProcessConfImpl) store.getProcessConfiguration(event.pid);
                    // Test processes always run with in-mem DAOs
                    conf.setTransient(true);
                    _server.register(conf);
                }
            }
        });
        _server.setConfigProperties(getConfigProperties());
        _server.registerBpelEventListener(new DebugBpelEventListener());
        _server.init();
        _server.start();
    }

    @After
    public void tearDown() throws Exception {
        for (Deployment d : _deployed) {
            try {
                store.undeploy(d.deployDir);
            } catch (Exception ex) {
                ex.printStackTrace();
                System.err.println("Error undeploying " + d);
            }
        }

        if (em != null) em.close();
        if (emf != null) emf.close();

        _server.stop();
        _failures = null;
        _deployed = null;
        _deployments = null;
        _invocations = null;

    }

    protected void negative(String deployDir) throws Throwable {
        try {
            go(new File(deployDir));
        } catch (junit.framework.AssertionFailedError ex) {
            return;
        }
        Assert.fail("Expecting test to fail");
    }

    protected void go(String deployDir) throws Exception {
        go(makeDeployDir(deployDir));
    }

    protected Deployment addDeployment(String deployDir) {
        return addDeployment(makeDeployDir(deployDir));
    }

    protected Deployment addDeployment(File deployDir) {
        Deployment deployment = new Deployment(deployDir);

    protected void go(File deployDir) throws Exception {
        _deployments.add(deployment);
    protected File makeDeployDir(String deployDir) {
        setup(deployDir);
        go();
    }

    protected void setup(File deployDir) throws Exception {
        addDeployment(deployDir);
        int propsFileCnt = 0;
        File testPropsFile = new File(deployDir, "test.properties");
        if (!testPropsFile.exists()) {
            propsFileCnt++;
            testPropsFile = new File(deployDir, "test" + propsFileCnt + ".properties");
            if (!testPropsFile.exists()) {
                System.err.println("can't find " + testPropsFile);
            }
        }

        if (!testPropsFile.exists()) {
            Assert.fail("Test property file not found in " + deployDir);
        }

        while (testPropsFile.exists()) {
            Properties testProps = new Properties();
            InputStream is = new FileInputStream(testPropsFile);
            try {
                testProps.load(is);
            } finally {
                is.close();
            }

            final QName serviceId = new QName(testProps.getProperty("namespace"), testProps.getProperty("service"));
            final String operation = testProps.getProperty("operation");

            Boolean sequential = Boolean.parseBoolean(testProps.getProperty("sequential", "false"));
            
            Invocation last = null;
            for (int i = 1; testProps.getProperty("request" + i) != null; i++) {
                final String in = testProps.getProperty("request" + i);
                final String responsePattern = testProps.getProperty("response" + i);

                last = addInvoke(testPropsFile + "#" + i, serviceId, operation, in, responsePattern, sequential ? last : null);
            }
            propsFileCnt++;
            testPropsFile = new File(deployDir, "test" + propsFileCnt + ".properties");
        }
    }

    protected Invocation addInvoke(String id, QName target, String operation, String request, String responsePattern) throws Exception {
        return addInvoke(id, target, operation, request, responsePattern, null);
    }
    
    protected Invocation addInvoke(String id, QName target, String operation, String request, String responsePattern, Invocation synchronizeWith)
            throws Exception {

        Invocation inv = new Invocation(id, synchronizeWith);
        inv.target = target;
        inv.operation = operation;
        inv.request = DOMUtils.stringToDOM(request);
        inv.expectedStatus = null;
        if (responsePattern != null) {
            inv.expectedFinalStatus = MessageExchange.Status.RESPONSE;
            inv.expectedResponsePattern = Pattern.compile(responsePattern, Pattern.DOTALL);
        }

        _invocations.add(inv);
        return inv;
    }

    protected void go() throws Exception {
        try {
            doDeployments();
            doInvokes();
        } finally {
            checkFailure();
        }
    }

    protected void checkFailure() {
        StringBuffer sb = new StringBuffer("Failure report:\n");
        for (Failure failure : _failures) {
            sb.append(failure);
            sb.append('\n');
        }
        if (_failures.size() != 0) {
            System.err.println(sb.toString());
            Assert.fail(sb.toString());
        }
    }


    protected Deployment deploy(String location) {
        Deployment deployment = new Deployment(makeDeployDir(location));
        doDeployment(deployment);
        return deployment;
    }

    protected void doDeployments() {
        for (Deployment d : _deployments)
            doDeployment(d);
    }

    /**
     * Do all the registered deployments.
     *
     * @param d
     */
    protected void doDeployment(Deployment d) {
        Collection procs;

        try {
            procs = store.deploy(d.deployDir);

            _deployed.add(d);
        } catch (Exception ex) {
            if (d.expectedException == null) {
                ex.printStackTrace();
                failure(d, "DEPLOY: Unexpected exception: " + ex, ex);
            } else if (!d.expectedException.isAssignableFrom(ex.getClass())) {
                ex.printStackTrace();
                failure(d, "DEPLOY: Wrong exception; expected " + d.expectedException + " but got " + ex.getClass(), ex);
            }
            return;
        }

        try {
            for (QName procName : procs) {
                ProcessConfImpl conf = (ProcessConfImpl) store.getProcessConfiguration(procName);
                // Test processes always run with in-mem DAOs
                conf.setTransient(true);
                _server.register(conf);
            }
        } catch (Exception ex) {
            if (d.expectedException == null)
                failure(d, "REGISTER: Unexpected exception: " + ex, ex);
            else if (!d.expectedException.isAssignableFrom(ex.getClass()))
                failure(d, "REGISTER: Wrong exception; expected " + d.expectedException + " but got " + ex.getClass(), ex);
        }
    }

    protected void doUndeployments() {
        for (Deployment d : _deployments) {
            try {
                undeploy(d);
            } catch (Exception ex) {
                ex.printStackTrace();
                failure(d, "Undeployment failed.", ex);
            }
        }

        _deployments.clear();
    }

    protected void undeploy(Deployment d) {
        if (_deployed.contains(d)) {
            _deployed.remove(d);
            store.undeploy(d.deployDir);
        }
    }
    protected void doInvokes() throws Exception {
        ArrayList testThreads = new ArrayList();
        for (Invocation i : _invocations) {
            InvokerThread t = new InvokerThread(i);
            testThreads.add(t);
        }

        for (Thread testThread : testThreads) {
            testThread.start();
            if (testThreads.size() > 0) Thread.sleep(getWaitBeforeInvokeTimeout());
        }

        for (Thread testThread : testThreads)
            testThread.join();

    }
    
    protected long getWaitBeforeInvokeTimeout() {
    	return WAIT_BEFORE_INVOKE_TIMEOUT;
    }

    private void failure(Object where) {
        failure(where, "Failure", null);
    }

    private void failure(Object where, String message, Exception ex) {
        Failure f = new Failure(where, message, ex);
        _failures.add(f);
        Assert.fail(f.toString());
    }

    private void failure(Object where, String message, Object expected, Object actual) {
        Failure f = new Failure(where, message, expected, actual, null);
        _failures.add(f);
        Assert.fail(f.toString());
    }

    protected boolean isFailed() {
        return !_failures.isEmpty();
    }

        String deployxml = deployDir + "/deploy.xml";
        URL deployxmlurl = getClass().getResource(deployxml);
        if (deployxmlurl == null) {
            Assert.fail("Resource not found: " + deployxml);
        }
        try {
            return new File(deployxmlurl.toURI().getPath()).getParentFile();
        } catch (URISyntaxException e) {
            e.printStackTrace();
            Assert.fail(e.getMessage());
            return null;
        }
    }

    /**
     * Override this to provide configuration properties for Ode extensions 
     * like BpelEventListeners.
     *
     * @return
     */
    protected Properties getConfigProperties() {
        // could also return null, returning an empty properties
        // object is more fail-safe.
        Properties p = new Properties();
        p.setProperty("debugeventlistener.dumpToStdOut", SHOW_EVENTS_ON_CONSOLE);
        return p;
    }

    protected static class Failure {
        Object where;

        String msg;

        Object expected;

        Object actual;

        Exception ex;

        public Failure(Object where, String msg, Exception ex) {
            this(where, msg, null, null, ex);
        }

        public Failure(Object where, String msg, Object expected, Object actual, Exception ex) {
            this.actual = actual;
            this.expected = expected;
            this.where = where;
            this.msg = msg;
            this.ex = ex;
        }

        public String toString() {
            StringBuffer sbuf = new StringBuffer(where + ": " + msg);
            if (ex != null) {
                sbuf.append("; got exception msg: " + ex.getMessage());
            }
            if (actual != null)
                sbuf.append("; got " + actual + ", expected " + expected);
            return sbuf.toString();
        }
    }

    /**
     * Represents a test deployement.
     *
     * @author mszefler
     *
     */
    public static class Deployment {
        /** The directory containing the deploy.xml and artefacts. */
        public File deployDir;

        /** If non-null the type of exception we expect to get when we deploy. */
        public Class expectedException = null;

        public Deployment(File deployDir) {
            this.deployDir = deployDir;
        }

        public String toString() {
            return "Deployment#" + deployDir;
        }
    }

    /**
     * Represents an test invocation of the BPEL engine.
     *
     * @author mszefler
     */
    public static class Invocation {
        /** Identifier (for reporting). */
        public String id;

        /** for sync invocations */
        public Invocation synchronizeWith;
        
        /** checking completion */
        public boolean done = false;
        
        /** Name of the operation to invoke. */
        public String operation;

        /** Name of service to invoke. */
        public QName target;

        /** Expected RegExp pattern for the response, or null */
        public Pattern expectedResponsePattern;

        /** The request message that should be sent to the server */
        public Element request;

        /** Number of ms to wait (relative to other invokes) before invoking. */
        public long invokeDelayMs = 0L;

        /** If non-null, expect an exception of this class (or subclass) on invoke. */
        public Class expectedInvokeException = null;

        /** If non-null, expecte this status right after invoke. */
        public MessageExchange.Status expectedStatus = null;

        /** If non-null, expect this status after response received. */
        public MessageExchange.Status expectedFinalStatus = MessageExchange.Status.COMPLETED_OK;

        /** If non-null, expect this correlation status right after invoke. */
        public CorrelationStatus expectedCorrelationStatus = null;

        /** If non-null, expect this correlation after response received. */
        public CorrelationStatus expectedFinalCorrelationStatus = null;

        /** Maximum number of ms to wait for a response. */
        public long maximumWaitMs = 60 * 1000;

        /** If non-null, minimum number of ms before a response should be available. */
        public Long minimumWaitMs = null;

        long invokeTime;

        Exception invokeException;

        QName requestType;

        public Invocation(String id, Invocation synchronizeWith) {
            this.id = id;
            this.synchronizeWith = synchronizeWith;
        }

        public String toString() {
            return "Invocation#" + id;
        }

    }

    class InvokerThread extends Thread {
        Invocation _invocation;

        InvokerThread(Invocation invocation) {
            _invocation = invocation;
        }

        public void run() {
            try {
                run2();
            } finally {
                synchronized (_invocation) {
                    _invocation.done = true;
                    _invocation.notify();
                }
            }
        }
        
        public void run2() {
            final MyRoleMessageExchange mex;
            final Future running;

            // Wait for it....
            try {
                Thread.sleep(_invocation.invokeDelayMs);
            } catch (Exception ex) {
            }
            
            if (_invocation.synchronizeWith != null) {
                synchronized (_invocation.synchronizeWith) {
                    while (!_invocation.synchronizeWith.done) {
                        try {
                            _invocation.synchronizeWith.wait(_invocation.maximumWaitMs);
                        } catch (InterruptedException e) {
                            failure(_invocation, "timed out waiting in sequence", e);
                            return;
                        }
                    }
                }
            }

            scheduler.beginTransaction();
            try {
                mex = _server.getEngine().createMessageExchange(new GUID().toString(), _invocation.target, _invocation.operation);
                mexContext.clearCurrentResponse();

                Message request = mex.createMessage(_invocation.requestType);
                request.setMessage(_invocation.request);
                _invocation.invokeTime = System.currentTimeMillis();
                running = mex.invoke(request);

                Status status = mex.getStatus();
                CorrelationStatus cstatus = mex.getCorrelationStatus();
                if (_invocation.expectedStatus != null && !status.equals(_invocation.expectedStatus))
                    failure(_invocation, "Unexpected message exchange status", _invocation.expectedStatus, status);

                if (_invocation.expectedCorrelationStatus != null && !cstatus.equals(_invocation.expectedCorrelationStatus))
                    failure(_invocation, "Unexpected correlation status", _invocation.expectedCorrelationStatus, cstatus);

            } catch (Exception ex) {
                if (_invocation.expectedInvokeException == null)
                    failure(_invocation, "Unexpected invocation exception.", ex);
                else if (_invocation.expectedInvokeException.isAssignableFrom(ex.getClass()))
                    failure(_invocation, "Unexpected invocation exception.", _invocation.expectedInvokeException, ex.getClass());

                return;
            } finally {
                scheduler.commitTransaction();
            }

            if (isFailed())
                return;

            try {
                running.get(_invocation.maximumWaitMs, TimeUnit.MILLISECONDS);
            } catch (Exception ex) {
                failure(_invocation, "Exception on future object.", ex);
                return;
            }

            long ctime = System.currentTimeMillis();
            long itime = ctime - _invocation.invokeTime;
            if (_invocation.minimumWaitMs != null && _invocation.minimumWaitMs >= itime)
                failure(_invocation, "Response received too soon.", _invocation.minimumWaitMs, itime);

            if (_invocation.maximumWaitMs <= itime)
                failure(_invocation, "Response took too long.", _invocation.maximumWaitMs, itime);

            if (isFailed())
                return;

            if (_invocation.expectedResponsePattern != null) {
                scheduler.beginTransaction();
                try {
                    Status finalstat = mex.getStatus();
                    if (_invocation.expectedFinalStatus != null && !_invocation.expectedFinalStatus.equals(finalstat))
                        if (finalstat.equals(Status.FAULT)) {
                            failure(_invocation, "Unexpected final message exchange status", _invocation.expectedFinalStatus, "FAULT: "
                                    + mex.getFault() + " | " + mex.getFaultExplanation());
                        } else {
                            failure(_invocation, "Unexpected final message exchange status", _invocation.expectedFinalStatus, finalstat);
                        }

                    if (_invocation.expectedFinalCorrelationStatus != null
                            && !_invocation.expectedFinalCorrelationStatus.equals(mex.getCorrelationStatus())) {
                        failure(_invocation, "Unexpected final correlation status", _invocation.expectedFinalCorrelationStatus, mex
                                .getCorrelationStatus());
                    }
                    if (mex.getResponse() == null)
                        failure(_invocation, "Expected response, but got none.", null);
                    String responseStr = DOMUtils.domToString(mex.getResponse().getMessage());
                    //System.out.println("=>" + responseStr);
                    Matcher matcher = _invocation.expectedResponsePattern.matcher(responseStr);
                    if (!matcher.matches())
                        failure(_invocation, "Response does not match expected pattern", _invocation.expectedResponsePattern, responseStr);
                } finally {
                    scheduler.commitTransaction();
                }
            }
        }
    }
}
File
BPELTestAbstract.java
Developer's decision
Manual
Kind of conflict
Attribute
Method invocation
Variable
Chunk
Conflicting content
        _deployed = null;
        _deployments = null;
        _invocations = null;
<<<<<<< HEAD
        _bcf.shutdown();
        _scf.shutdown();
        _db.shutdown();
    }

    public void registerExtensionBundle(AbstractExtensionBundle bundle) {
    	_server.registerExtensionBundle(bundle);
    }
    
    public void unregisterExtensionBundle(AbstractExtensionBundle bundle) {
    	_server.unregisterExtensionBundle(bundle.getNamespaceURI());
    }

    public void unregisterExtensionBundle(String nsURI) {
    	_server.unregisterExtensionBundle(nsURI);
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    protected void negative(String deployDir) throws Throwable {
Solution content
        _deployed = null;
        _deployments = null;
        _invocations = null;

    }

    protected void negative(String deployDir) throws Throwable {
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Method invocation
Method signature
Chunk
Conflicting content
<<<<<<< HEAD
        return inv;
    }
    public void go() throws Exception {
=======
    protected void go() throws Exception {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        try {
            doDeployments();
            doInvokes();
Solution content
        return inv;
    }

    protected void go() throws Exception {
        try {
            doDeployments();
            doInvokes();
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
Method signature
Chunk
Conflicting content
        doDeployment(deployment);
        }
    }

<<<<<<< HEAD
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    protected Deployment deploy(String location) {
        Deployment deployment = new Deployment(makeDeployDir(location));
Solution content
        }
    }


    protected Deployment deploy(String location) {
        Deployment deployment = new Deployment(makeDeployDir(location));
        doDeployment(deployment);
File
BPELTestAbstract.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
                ex.printStackTrace();
                failure(d, "DEPLOY: Wrong exception; expected " + d.expectedException + " but got " + ex.getClass(), ex);
            }
<<<<<<< HEAD

=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            return;
        }
Solution content
                ex.printStackTrace();
                failure(d, "DEPLOY: Wrong exception; expected " + d.expectedException + " but got " + ex.getClass(), ex);
            }
            return;
        }
File
BPELTestAbstract.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
        for (Thread testThread : testThreads) {
            testThread.start();
<<<<<<< HEAD
            if (testThreads.size() > 0) Thread.sleep(2000);
=======
            if (testThreads.size() > 0) Thread.sleep(getWaitBeforeInvokeTimeout());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }

        for (Thread testThread : testThreads)
Solution content
        for (Thread testThread : testThreads) {
            testThread.start();
            if (testThreads.size() > 0) Thread.sleep(getWaitBeforeInvokeTimeout());
        }

        for (Thread testThread : testThreads)
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
If statement
Chunk
Conflicting content
    }

    /**
<<<<<<< HEAD
     * Override this to provide configuration properties for Ode extensions like BpelEventListeners.
     * 
=======
     * Override this to provide configuration properties for Ode extensions 
     * like BpelEventListeners.
     *
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
     * @return
     */
    protected Properties getConfigProperties() {
Solution content
    }

    /**
     * Override this to provide configuration properties for Ode extensions 
     * like BpelEventListeners.
     *
     * @return
     */
    protected Properties getConfigProperties() {
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
        // could also return null, returning an empty properties
        // object is more fail-safe.
        Properties p = new Properties();
<<<<<<< HEAD
        p.setProperty("debugeventlistener.dumpToStdOut", SHOW_EVENTS_ON_CONSOLE);        
=======
        p.setProperty("debugeventlistener.dumpToStdOut", SHOW_EVENTS_ON_CONSOLE);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        return p;
    }
Solution content
        // could also return null, returning an empty properties
        // object is more fail-safe.
        Properties p = new Properties();
        p.setProperty("debugeventlistener.dumpToStdOut", SHOW_EVENTS_ON_CONSOLE);
        return p;
    }
File
BPELTestAbstract.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Chunk
Conflicting content
        public String toString() {
            StringBuffer sbuf = new StringBuffer(where + ": " + msg);
            if (ex != null) {
<<<<<<< HEAD
            	sbuf.append("; got exception:\n");
            	sbuf.append(ExceptionUtils.getFullStackTrace(ex));
=======
                sbuf.append("; got exception msg: " + ex.getMessage());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            }
            if (actual != null)
                sbuf.append("; got " + actual + ", expected " + expected);
Solution content
        public String toString() {
            StringBuffer sbuf = new StringBuffer(where + ": " + msg);
            if (ex != null) {
                sbuf.append("; got exception msg: " + ex.getMessage());
            }
            if (actual != null)
                sbuf.append("; got " + actual + ", expected " + expected);
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
                }
            }

<<<<<<< HEAD
=======
            scheduler.beginTransaction();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            try {
                mex = _server.createMessageExchange(InvocationStyle.UNRELIABLE, _invocation.target, _invocation.operation,
                        new GUID().toString());
Solution content
                }
            }

            scheduler.beginTransaction();
            try {
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
                    failure(_invocation, "Unexpected invocation exception.", _invocation.expectedInvokeException, ex.getClass());

                return;
<<<<<<< HEAD
=======
            } finally {
                scheduler.commitTransaction();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            }

            if (mex.getStatus() != Status.ACK)
Solution content
                    failure(_invocation, "Unexpected invocation exception.", _invocation.expectedInvokeException, ex.getClass());

                return;
            } finally {
                scheduler.commitTransaction();
            }
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
            if (isFailed())
                return;

<<<<<<< HEAD
            AckType finalstat = mex.getAckType();
            if (_invocation.expectedFinalStatus != null && _invocation.expectedFinalStatus != finalstat) {
                if (finalstat.equals(AckType.FAULT)) {
            	if (!matcher.matches())
            		&& !_invocation.expectedFinalCorrelationStatus.equals(mex.getCorrelationStatus())) {
            	failure(_invocation, "Unexpected final correlation status", _invocation.expectedFinalCorrelationStatus, mex
            			.getCorrelationStatus());
            }
            if (_invocation.expectedResponsePattern != null) {
            	if (mex.getResponse() == null)
            		failure(_invocation, "Expected response, but got none.", null);
            	String responseStr = DOMUtils.domToString(mex.getResponse().getMessage());
            	Matcher matcher = _invocation.expectedResponsePattern.matcher(responseStr);
                    failure(_invocation, "Unexpected final message exchange status", _invocation.expectedFinalStatus, "FAULT: "
                            + mex.getFault() + " | " + mex.getFaultExplanation());
                } else {
                    failure(_invocation, "Unexpected final message exchange status", _invocation.expectedFinalStatus, finalstat);
                }
            }

            if (_invocation.expectedFinalCorrelationStatus != null
            		failure(_invocation, "Response does not match expected pattern", _invocation.expectedResponsePattern,
            				responseStr);
=======
            if (_invocation.expectedResponsePattern != null) {
                scheduler.beginTransaction();
                try {
                    Status finalstat = mex.getStatus();
                    if (_invocation.expectedFinalStatus != null && !_invocation.expectedFinalStatus.equals(finalstat))
                        if (finalstat.equals(Status.FAULT)) {
                            failure(_invocation, "Unexpected final message exchange status", _invocation.expectedFinalStatus, "FAULT: "
                                    + mex.getFault() + " | " + mex.getFaultExplanation());
                        } else {
                            failure(_invocation, "Unexpected final message exchange status", _invocation.expectedFinalStatus, finalstat);
                        }

                    if (_invocation.expectedFinalCorrelationStatus != null
                            && !_invocation.expectedFinalCorrelationStatus.equals(mex.getCorrelationStatus())) {
                        failure(_invocation, "Unexpected final correlation status", _invocation.expectedFinalCorrelationStatus, mex
                                .getCorrelationStatus());
                    }
                    if (mex.getResponse() == null)
                        failure(_invocation, "Expected response, but got none.", null);
                    String responseStr = DOMUtils.domToString(mex.getResponse().getMessage());
                    //System.out.println("=>" + responseStr);
                    Matcher matcher = _invocation.expectedResponsePattern.matcher(responseStr);
                    if (!matcher.matches())
                        failure(_invocation, "Response does not match expected pattern", _invocation.expectedResponsePattern, responseStr);
                } finally {
                    scheduler.commitTransaction();
                }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            }
        }
    }
Solution content
            if (isFailed())
                return;

            if (_invocation.expectedResponsePattern != null) {
                scheduler.beginTransaction();
                try {
                    Status finalstat = mex.getStatus();
                    if (_invocation.expectedFinalStatus != null && !_invocation.expectedFinalStatus.equals(finalstat))
                        if (finalstat.equals(Status.FAULT)) {
                            failure(_invocation, "Unexpected final message exchange status", _invocation.expectedFinalStatus, "FAULT: "
                                    + mex.getFault() + " | " + mex.getFaultExplanation());
                        } else {
                            failure(_invocation, "Unexpected final message exchange status", _invocation.expectedFinalStatus, finalstat);
                        }

                    if (_invocation.expectedFinalCorrelationStatus != null
                            && !_invocation.expectedFinalCorrelationStatus.equals(mex.getCorrelationStatus())) {
                        failure(_invocation, "Unexpected final correlation status", _invocation.expectedFinalCorrelationStatus, mex
                                .getCorrelationStatus());
                    }
                    if (mex.getResponse() == null)
                        failure(_invocation, "Expected response, but got none.", null);
                    String responseStr = DOMUtils.domToString(mex.getResponse().getMessage());
                    //System.out.println("=>" + responseStr);
                    Matcher matcher = _invocation.expectedResponsePattern.matcher(responseStr);
                    if (!matcher.matches())
                        failure(_invocation, "Response does not match expected pattern", _invocation.expectedResponsePattern, responseStr);
                } finally {
                    scheduler.commitTransaction();
                }
            }
        }
    }
File
BPELTestAbstract.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Try statement
Variable
Chunk
Conflicting content
import javax.wsdl.PortType;
import javax.xml.namespace.QName;

<<<<<<< HEAD
import org.apache.ode.bpel.iapi.*;
=======
import org.apache.ode.bpel.iapi.BindingContext;
import org.apache.ode.bpel.iapi.Endpoint;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.PartnerRoleChannel;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.utils.DOMUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
Solution content
import javax.wsdl.PortType;
import javax.xml.namespace.QName;

import org.apache.ode.bpel.iapi.BindingContext;
import org.apache.ode.bpel.iapi.Endpoint;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.PartnerRoleChannel;
import org.apache.ode.utils.DOMUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
File
BindingContextImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
		return new PartnerRoleChannelImpl();
	}

<<<<<<< HEAD
    public void activateProvidedResource(Resource resource) {
        throw new UnsupportedOperationException();
    }

    public void deactivateProvidedResource(Resource resource) {
        throw new UnsupportedOperationException();
    }
=======
	public long calculateSizeofService(EndpointReference epr) {
		return 0;
	}

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
		return new PartnerRoleChannelImpl();
	}

	public long calculateSizeofService(EndpointReference epr) {
		return 0;
	}

}
File
BindingContextImpl.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
 * or more contributor license agreements.  See the NOTICE file
=======
/*
 * under the License.
 */

<<<<<<< HEAD
package org.apache.ode.test;

import java.io.IOException;
import java.util.Collections;
import java.util.Set;

import javax.xml.namespace.QName;

import org.apache.ode.bpel.iapi.*;
 * Licensed to the Apache Software Foundation (ASF) under one
 * 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
 * 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
 *
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.ode.test;

import java.io.IOException;

import javax.xml.namespace.QName;

import org.apache.ode.bpel.iapi.BpelEngineException;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchangeContext;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
import org.apache.ode.bpel.iapi.MessageExchange.Status;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.utils.DOMUtils;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
Solution content
 * under the License.
 */

/*
 * 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.test;

import java.io.IOException;

import javax.xml.namespace.QName;

import org.apache.ode.bpel.iapi.BpelEngineException;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchangeContext;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
import org.apache.ode.bpel.iapi.MessageExchange.Status;
import org.apache.ode.utils.DOMUtils;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
File
MessageExchangeContextImpl.java
Developer's decision
Version 2
Kind of conflict
Comment
Import
Package declaration
Chunk
Conflicting content
	// Probe Service is a simple concatination service
	private static final QName probePT = new QName(PROBE_NS,"probeMessagePT");
	private static final QName faultPT = new QName(FAULT_NS,"faultMessagePT");
<<<<<<< HEAD

	
	public void invokePartnerUnreliable(PartnerRoleMessageExchange mex)
=======
	
	private Message currentResponse;
	
	public void invokePartner(PartnerRoleMessageExchange mex)
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
			throws ContextException {
		QName calledPT = mex.getPortType().getQName();
		
Solution content
	// Probe Service is a simple concatination service
	private static final QName probePT = new QName(PROBE_NS,"probeMessagePT");
	private static final QName faultPT = new QName(FAULT_NS,"faultMessagePT");
	
	private Message currentResponse;
	
	public void invokePartner(PartnerRoleMessageExchange mex)
			throws ContextException {
		QName calledPT = mex.getPortType().getQName();
		
File
MessageExchangeContextImpl.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method signature
Chunk
Conflicting content
	}

<<<<<<< HEAD
	public void onMyRoleMessageExchangeStateChanged(MyRoleMessageExchange myRoleMex)
			throws BpelEngineException {

=======
	public void onAsyncReply(MyRoleMessageExchange myRoleMex)
			throws BpelEngineException {
		Status mStat = myRoleMex.getStatus();
        if ( mStat == Status.RESPONSE ) {
			currentResponse = myRoleMex.getResponse();
		}
		myRoleMex.complete();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
	}
	
	private void invokeProbeService(PartnerRoleMessageExchange prmx) {
Solution content
	}

	public void onAsyncReply(MyRoleMessageExchange myRoleMex)
			throws BpelEngineException {
		Status mStat = myRoleMex.getStatus();
        if ( mStat == Status.RESPONSE ) {
			currentResponse = myRoleMex.getResponse();
		}
		myRoleMex.complete();
	}
	
	private void invokeProbeService(PartnerRoleMessageExchange prmx) {
File
MessageExchangeContextImpl.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Method signature
Variable
Chunk
Conflicting content
		if ( elm1 != null && elm2 != null ) {
			String cat = elm2.getTextContent()+" -> "+elm1.getTextContent();
			elm2.setTextContent(cat);
<<<<<<< HEAD
            final Message response = prmx.createMessage(prmx.getOperation().getOutput().getMessage().getQName());
            response.setMessage(msg.getMessage());
            response.setPart("probeData", elm2);
=======
			msg.setPart("probeData", elm2);
            final Message response = prmx.createMessage(prmx.getOperation().getOutput().getMessage().getQName());

            response.setMessage(msg.getMessage());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
			prmx.reply(response);
		}
	}
Solution content
		if ( elm1 != null && elm2 != null ) {
			String cat = elm2.getTextContent()+" -> "+elm1.getTextContent();
			elm2.setTextContent(cat);
			msg.setPart("probeData", elm2);
            final Message response = prmx.createMessage(prmx.getOperation().getOutput().getMessage().getQName());

            response.setMessage(msg.getMessage());
			prmx.reply(response);
		}
	}
File
MessageExchangeContextImpl.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
	
	public Message getCurrentResponse() {
		}

	}
<<<<<<< HEAD


    public void cancel(PartnerRoleMessageExchange mex) throws ContextException {
        // TODO Auto-generated method stub
        
    }

    public Set getSupportedInvocationStyle(PartnerRoleChannel prc, EndpointReference partnerEpr) {
        return Collections.singleton(InvocationStyle.UNRELIABLE);
    }

        throw new UnsupportedOperationException("No support for RESTful invocations");
    }
=======
    public void invokePartnerReliable(PartnerRoleMessageExchange mex) throws ContextException {
        // TODO Auto-generated method stub
    }

    public void invokePartnerTransacted(PartnerRoleMessageExchange mex) throws ContextException {
        // TODO Auto-generated method stub
    }

    public void invokeRestful(RESTOutMessageExchange mex) throws ContextException {
		return currentResponse;
	}
	
	public void clearCurrentResponse() {
		currentResponse = null;
	}
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

}
Solution content
		}

	}
	
	public Message getCurrentResponse() {
		return currentResponse;
	}
	
	public void clearCurrentResponse() {
		currentResponse = null;
	}

}
File
MessageExchangeContextImpl.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
 * under the License.
 */

<<<<<<< HEAD
=======
/*
 * 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.
 */
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
package org.apache.ode.test;

import org.apache.ode.bpel.iapi.EndpointReference;
Solution content
 * under the License.
 */

/*
 * 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.test;

import org.apache.ode.bpel.iapi.EndpointReference;
File
PartnerRoleChannelImpl.java
Developer's decision
Version 2
Kind of conflict
Comment
Chunk
Conflicting content
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.MessageExchange;
<<<<<<< HEAD
import org.apache.ode.bpel.iapi.MessageExchange.AckType;
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.junit.Test;

public class BasicActivities20Test extends BPELTestAbstract {
Solution content
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.MessageExchange;
import org.junit.Test;

public class BasicActivities20Test extends BPELTestAbstract {
File
BasicActivities20Test.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
            "",
            null);
        inv.maximumWaitMs=2*1000L;
<<<<<<< HEAD
        inv.expectedFinalStatus = MessageExchange.AckType.RESPONSE;
=======
        inv.expectedStatus = MessageExchange.Status.ASYNC;
        inv.expectedFinalStatus = MessageExchange.Status.RESPONSE;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

        go();
    }
Solution content
            "",
            null);
        inv.maximumWaitMs=2*1000L;
        inv.expectedStatus = MessageExchange.Status.ASYNC;
        inv.expectedFinalStatus = MessageExchange.Status.RESPONSE;

        go();
    }
File
BasicActivities20Test.java
Developer's decision
Version 2
Kind of conflict
Variable
Chunk
Conflicting content
    }
    @Test public void testAssignActivity2() throws Throwable {
        go("/bpel/2.0/TestAssignActivity2");
    }
 */
package org.apache.ode.test;

<<<<<<< HEAD
import org.junit.Ignore;
import org.junit.Test;

public class DataHandling20Test extends BPELTestAbstract {

    @Test public void testComposeUrl() throws Throwable {
        go("/bpel/2.0/TestComposeUrl");
    }
    @Test public void testCombineUrl() throws Throwable {
        go("/bpel/2.0/TestCombineUrl");
    }
    @Test public void testExpandTemplate() throws Throwable {
        go("/bpel/2.0/TestExpandTemplate");
    }
    @Test public void testXPathNamespace1() throws Throwable {
        go("/bpel/2.0/TestXPathNamespace1");
    }
    @Test public void testXPathNamespace2() throws Throwable {
        go("/bpel/2.0/TestXPathNamespace2");
    }
    @Test public void testSubTreeAssign() throws Throwable {
        go("/bpel/2.0/TestSubTreeAssign");
    }
    @Test public void testAssignActivity1() throws Throwable {
        go("/bpel/2.0/TestAssignActivity1");
    @Test public void testAssignActivity3() throws Throwable {
        go("/bpel/2.0/TestAssignActivity3");
    }
        go("/bpel/2.0/TestXslTransform");
    }
    @Test public void testAssignComplex() throws Throwable {
        go("/bpel/2.0/TestAssignComplex");
    }
    @Test public void testSimpleTypeParts() throws Throwable {
        go("/bpel/2.0/TestSimpleTypeParts");
    }
    @Test public void testSimpleVariableType() throws Throwable {
        go("/bpel/2.0/TestSimpleVariableType");
    }
    @Test public void testXslTransform() throws Throwable {
    @Test public void testSplit() throws Throwable {
        go("/bpel/2.0/TestSplit");
    }
    @Test public void testCounter() throws Throwable {
=======
import org.junit.Test;

public class DataHandling20Test extends BPELTestAbstract {
    @Test
    public void testComposeUrl() throws Throwable {
        go("/bpel/2.0/TestComposeUrl");
    }

    @Test
    public void testCombineUrl() throws Throwable {
        go("/bpel/2.0/TestCombineUrl");
    }

    @Test
    public void testExpandTemplate() throws Throwable {
        go("/bpel/2.0/TestExpandTemplate");
    }

    @Test
    public void testXPathNamespace1() throws Throwable {
        go("/bpel/2.0/TestXPathNamespace1");
    }

    @Test
    public void testXPathNamespace2() throws Throwable {
        go("/bpel/2.0/TestXPathNamespace2");
    }

    @Test
    public void testToQuery() throws Throwable {
        go("/bpel/2.0/TestToQuery");
    }
    
    @Test
    public void testSubTreeAssign() throws Throwable {
        go("/bpel/2.0/TestSubTreeAssign");
    }

    @Test
    public void testAssignActivity1() throws Throwable {
        go("/bpel/2.0/TestAssignActivity1");
    }

    @Test
    public void testAssignActivity2() throws Throwable {
        go("/bpel/2.0/TestAssignActivity2");
    }

    @Test
    public void testAssignComplex() throws Throwable {
        go("/bpel/2.0/TestAssignComplex");
    }

    @Test
    public void testSimpleTypeParts() throws Throwable {
        go("/bpel/2.0/TestSimpleTypeParts");
    }

    @Test
    public void testSimpleVariableType() throws Throwable {
        go("/bpel/2.0/TestSimpleVariableType");
    }

    @Test
    public void testXslTransform() throws Throwable {
        go("/bpel/2.0/TestXslTransform");
    }

    @Test
    public void testSplit() throws Throwable {
        go("/bpel/2.0/TestSplit");
    }

    @Test
    public void testCounter() throws Throwable {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        go("/bpel/2.0/TestCounter");
    }
Solution content
 */
package org.apache.ode.test;

import org.junit.Test;

public class DataHandling20Test extends BPELTestAbstract {
    @Test
    public void testComposeUrl() throws Throwable {
        go("/bpel/2.0/TestComposeUrl");
    }

    @Test
    public void testCombineUrl() throws Throwable {
        go("/bpel/2.0/TestCombineUrl");
    }

    @Test
    public void testExpandTemplate() throws Throwable {
        go("/bpel/2.0/TestExpandTemplate");
    }

    @Test
    public void testXPathNamespace1() throws Throwable {
        go("/bpel/2.0/TestXPathNamespace1");
    }

    @Test
    public void testXPathNamespace2() throws Throwable {
        go("/bpel/2.0/TestXPathNamespace2");
    }

    @Test
    public void testToQuery() throws Throwable {
        go("/bpel/2.0/TestToQuery");
    }
    
    @Test
    public void testSubTreeAssign() throws Throwable {
        go("/bpel/2.0/TestSubTreeAssign");
    }

    @Test
    public void testAssignActivity1() throws Throwable {
        go("/bpel/2.0/TestAssignActivity1");
    }

    @Test
    public void testAssignActivity2() throws Throwable {
        go("/bpel/2.0/TestAssignActivity2");
    }

    @Test
    public void testAssignComplex() throws Throwable {
        go("/bpel/2.0/TestAssignComplex");
    }

    @Test
    public void testSimpleTypeParts() throws Throwable {
        go("/bpel/2.0/TestSimpleTypeParts");
    }

    @Test
    public void testSimpleVariableType() throws Throwable {
        go("/bpel/2.0/TestSimpleVariableType");
    }

    @Test
    public void testXslTransform() throws Throwable {
        go("/bpel/2.0/TestXslTransform");
    }

    @Test
    public void testSplit() throws Throwable {
        go("/bpel/2.0/TestSplit");
    }

    @Test
    public void testCounter() throws Throwable {
        go("/bpel/2.0/TestCounter");
    }
File
DataHandling20Test.java
Developer's decision
Version 2
Kind of conflict
Annotation
Class signature
Import
Method declaration
Method signature
Chunk
Conflicting content
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    @Test
<<<<<<< HEAD
    public void testAssignDate() throws Throwable {
        go("/bpel/2.0/TestAssignDate");
    }
    
    @Test
    public void testAssignDate2() throws Throwable {
        go("/bpel/2.0/TestAssignDate2");
    }
=======
    public void testDate() throws Throwable {
        go("/bpel/2.0/TestAssignDate");
    }

    @Test
    public void testMsgDate() throws Throwable {
Solution content
    }

    @Test
    public void testDate() throws Throwable {
        go("/bpel/2.0/TestAssignDate");
    }

    @Test
    public void testMsgDate() throws Throwable {
File
DataHandling20Test.java
Developer's decision
Version 2
Kind of conflict
Annotation
Method declaration
Chunk
Conflicting content
    @Test public void testAssignMissingData() throws Throwable {
        go("/bpel/2.0/TestAssignMissingData");
    }
    public void testMsgDate() throws Throwable {
        go("/bpel/2.0/TestMsgDate");
    }
<<<<<<< HEAD
    @Test public void testDuration() throws Throwable {
        go("/bpel/2.0/TestDuration");
    }
    @Test public void testXQueryExpression() throws Throwable {
        go("/bpel/2.0/TestXQueryExpression");
    }
    //madars.vitolins _at gmail.com  2009.04.11
    //Inline variable initialization test
    @Test public void testInlineVarInit() throws Throwable {
        go("/bpel/2.0/TestInlineVarInit");
=======

    @Test
    public void testDuration() throws Throwable {
        go("/bpel/2.0/TestDuration");
    }

    @Test
    public void testAssignMissingData() throws Throwable {
        go("/bpel/2.0/TestAssignMissingData");
    }

    @Test
    public void testXQueryExpression() throws Throwable {
        go("/bpel/2.0/TestXQueryExpression");
    }

    @Test
    public void testInsertMissingData() throws Throwable {
        go("/bpel/2.0/TestInsertMissingData");
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }
}
Solution content
    public void testMsgDate() throws Throwable {
        go("/bpel/2.0/TestMsgDate");
    }

    @Test
    public void testDuration() throws Throwable {
        go("/bpel/2.0/TestDuration");
    }

    @Test
    public void testAssignMissingData() throws Throwable {
        go("/bpel/2.0/TestAssignMissingData");
    }

    @Test
    public void testXQueryExpression() throws Throwable {
        go("/bpel/2.0/TestXQueryExpression");
    }

    @Test
    public void testInsertMissingData() throws Throwable {
        go("/bpel/2.0/TestInsertMissingData");
    }
}
File
DataHandling20Test.java
Developer's decision
Version 2
Kind of conflict
Annotation
Comment
Method declaration
Method invocation
Method signature
Chunk
Conflicting content
import org.junit.Test;

public class MessageRouting20Test extends BPELTestAbstract {
<<<<<<< HEAD
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
	@Test public void testCorrelation() throws Throwable {
		go("/bpel/2.0/TestCorrelation");
	}
Solution content
import org.junit.Test;

public class MessageRouting20Test extends BPELTestAbstract {

	@Test public void testCorrelation() throws Throwable {
		go("/bpel/2.0/TestCorrelation");
	}
File
MessageRouting20Test.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
		go("/bpel/2.0/TestCorrelation1");
	}

<<<<<<< HEAD
=======
	@Test public void testCorrelationJoin() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoin");
	}

	@Test public void testCorrelationJoinReceive() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoinReceive");
	}

	@Test public void testCorrelationJoinInvoke() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoinInvoke");
	}

	@Test public void testCorrelationJoinOnMessage() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoinOnMessage");
	}

	@Test public void testCorrelationJoinEvent() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoinEvent");
	}

	@Test public void testCorrelationJoinReply() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoinReply");
	}

	@Test public void testCorrelationMulti() throws Throwable {
		go("/bpel/2.0/TestCorrelationMulti");
	}

	@Test public void testCorrelationMultiNegative() throws Throwable {
		go("/bpel/2.0/TestCorrelationMultiNegative");
	}

	@Test public void testCorrelationMultiJoin() throws Throwable {
		go("/bpel/2.0/TestCorrelationMultiJoin");
	}

	@Test public void testCorrelationMultiComplex() throws Throwable {
		go("/bpel/2.0/TestCorrelationMultiComplex");
	}

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
	@Ignore("fix test bed for handling ASYNC mex") @Test public void testCorrelationOpaque() throws Throwable {
		//TODO Fix me, we need to capture the session id to send it in the second test message
		go("/bpel/2.0/TestCorrelationOpaque");
Solution content
		go("/bpel/2.0/TestCorrelation1");
	}

	@Test public void testCorrelationJoin() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoin");
	}

	@Test public void testCorrelationJoinReceive() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoinReceive");
	}

	@Test public void testCorrelationJoinInvoke() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoinInvoke");
	}

	@Test public void testCorrelationJoinOnMessage() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoinOnMessage");
	}

	@Test public void testCorrelationJoinEvent() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoinEvent");
	}

	@Test public void testCorrelationJoinReply() throws Throwable {
		go("/bpel/2.0/TestCorrelationJoinReply");
	}

	@Test public void testCorrelationMulti() throws Throwable {
		go("/bpel/2.0/TestCorrelationMulti");
	}

	@Test public void testCorrelationMultiNegative() throws Throwable {
		go("/bpel/2.0/TestCorrelationMultiNegative");
	}

	@Test public void testCorrelationMultiJoin() throws Throwable {
		go("/bpel/2.0/TestCorrelationMultiJoin");
	}

	@Test public void testCorrelationMultiComplex() throws Throwable {
		go("/bpel/2.0/TestCorrelationMultiComplex");
	}

	@Ignore("fix test bed for handling ASYNC mex") @Test public void testCorrelationOpaque() throws Throwable {
		//TODO Fix me, we need to capture the session id to send it in the second test message
		go("/bpel/2.0/TestCorrelationOpaque");
File
MessageRouting20Test.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
		 * See JIRA ODE-64
		 *
=======
		 * 
		 * See JIRA ODE-64
		 * 
		 *  and a subsequent  that does not define a correlation
		 * key. The BPEL compiler should throw an exception indicating
		 * the BPEL code error ( verify with spec ).
<<<<<<< HEAD
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
		 */
		 *
		// TODO fix the bug first
		negative("target/test-classes/bpel/2.0/NegativeCorrelationTest");
Solution content
		 *  and a subsequent  that does not define a correlation
		 * key. The BPEL compiler should throw an exception indicating
		 * the BPEL code error ( verify with spec ).
		 * 
		 * See JIRA ODE-64
		 * 
		 */
		// TODO fix the bug first
		negative("target/test-classes/bpel/2.0/NegativeCorrelationTest");
File
MessageRouting20Test.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
<<<<<<< HEAD
		 *
		 * See JIRA ODE-61.
		 *
		 * compiler should throw an exception indicating
		 * the BPEL error ( verify with spec ) or at runtime
		 * a clear initialization exception should be thrown.
		 * The message exchange should return with a Fault/Failure.
		 *
=======
		 * 
		 * See JIRA ODE-61.
		 * 
		 * The message exchange should return with a Fault/Failure.
		 * 
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
		 */
		// TODO fix the bug first
		negative("target/test-classes/bpel/2.0/NegativeInitializationTest");
Solution content
		 * compiler should throw an exception indicating
		 * the BPEL error ( verify with spec ) or at runtime
		 * a clear initialization exception should be thrown.
		 * 
		 * See JIRA ODE-61.
		 * 
		 * The message exchange should return with a Fault/Failure.
		 * 
		 */
		// TODO fix the bug first
		negative("target/test-classes/bpel/2.0/NegativeInitializationTest");
File
MessageRouting20Test.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
		negative("target/test-classes/bpel/2.0/NegativeInitializationTest");
	}

<<<<<<< HEAD
    @Test public void testCorrelationUnique() throws Throwable {
        go("/bpel/2.0/TestCorrelationUnique");
=======
    @Test public void testConcurrentSyncMex() throws Throwable {
        go("/bpel/2.0/TestConcurrentSyncMex");
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }
    
    @Test public void testIMA() throws Throwable {
Solution content
		negative("target/test-classes/bpel/2.0/NegativeInitializationTest");
	}

    @Test public void testConcurrentSyncMex() throws Throwable {
        go("/bpel/2.0/TestConcurrentSyncMex");
    }
    
    @Test public void testIMA() throws Throwable {
File
MessageRouting20Test.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Method signature
Chunk
Conflicting content
        // Test Flow with XPath10
        go("/bpel/2.0/TestFlowActivity2");
    }
<<<<<<< HEAD
 	@Test public void testFlowLinks() throws Throwable {
         // Test Flow with XPath10
         go("/bpel/2.0/TestFlowLinks");
     }
    @Test public void testIsolatedScopes1() throws Throwable {
        // Test Flow with XPath10
        go("/bpel/2.0/TestIsolatedScopes1");
    }
	@Ignore
    @Test public void testForEach() throws Throwable {
        go("/bpel/2.0/TestForEach");
    }
    @Test public void testPickOneWay() throws Throwable {
        // Test Flow with XPath10
        go("/bpel/2.0/TestPickOneWay");
    }
    @Override
    protected int getMaximumWaitInMillis() {
    	return 120 * 1000;
    }
=======
	@Test public void testFlowLinks() throws Throwable {
        // Test Flow with XPath10
        go("/bpel/2.0/TestFlowLinks");
    }
	@Test public void testForEach() throws Throwable {
        // Test Flow with XPath10
        go("/bpel/2.0/TestForEach");
    }
	@Test public void testPickOneWay() throws Throwable {
        // Test Flow with XPath10
        go("/bpel/2.0/TestPickOneWay");
    }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
        // Test Flow with XPath10
        go("/bpel/2.0/TestFlowActivity2");
    }
	@Test public void testFlowLinks() throws Throwable {
        // Test Flow with XPath10
        go("/bpel/2.0/TestFlowLinks");
    }
	@Test public void testForEach() throws Throwable {
        // Test Flow with XPath10
        go("/bpel/2.0/TestForEach");
    }
	@Test public void testPickOneWay() throws Throwable {
        // Test Flow with XPath10
        go("/bpel/2.0/TestPickOneWay");
    }
}
File
StructuredActivities20Test.java
Developer's decision
Version 2
Kind of conflict
Annotation
Method declaration
Chunk
Conflicting content
import org.w3c.dom.NodeList;

import java.util.Map;
<<<<<<< HEAD
=======
import java.util.HashMap;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

/**
 * Implementation of the ODE {@link org.apache.ode.bpel.iapi.EndpointReferenceContext}
Solution content
import org.w3c.dom.NodeList;

import java.util.Map;
import java.util.HashMap;

/**
 * Implementation of the ODE {@link org.apache.ode.bpel.iapi.EndpointReferenceContext}
File
EndpointReferenceContextImpl.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
  }

    public Map getConfigLookup(EndpointReference epr) {
<<<<<<< HEAD
        return ((MutableEndpoint)epr).toMap();
=======
        Map m = new HashMap();
        m.put("service", ((JbiEndpointReference)epr).getServiceEndpoint().getServiceName());
        return m;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }
}
Solution content
  }

    public Map getConfigLookup(EndpointReference epr) {
        Map m = new HashMap();
        m.put("service", ((JbiEndpointReference)epr).getServiceEndpoint().getServiceName());
        return m;
    }
}
File
EndpointReferenceContextImpl.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Return statement
Variable
Chunk
Conflicting content
     * 
    private OdeLifeCycle _lifeCycle;

    public OdeComponent() {
<<<<<<< HEAD
        _lifeCycle = new OdeLifeCycle();
    }

    public ComponentLifeCycle getLifeCycle() {
        return _lifeCycle;
    }

    public ServiceUnitManager getServiceUnitManager() {
        return _lifeCycle.getSUManager();
    }

    /**
     * 
     * @param ref ServiceEndpoint object
     * 
     * @return Descriptor Object implementing
     *         {@link javax.jbi.servicedesc.Descriptor} interface.
     */
    public Document getServiceDescription(ServiceEndpoint ref) {
        return  _lifeCycle.getOdeContext().getServiceDescription(ref.getServiceName());
    }

    /**
     * This method is called by JBI to check if this component, in the role of
     * provider of the service indicated by the given exchange, can actually
     * perform the operation desired. The consumer is described by the given
     * capabilities, and JBI has already ensured that a fit exists between the set
     * of required capabilities of the provider and the available capabilities of
     * the consumer, and vice versa. This matching consists of simple set matching
     * based on capability names only. 
*
* Note that JBI assures matches on capability names only; it is the * responsibility of this method to examine capability values to ensure a * match with the consumer. * * @param endpoint * the endpoint to be used by the consumer * @param exchange * the proposed message exchange to be performed * @return true if this provider component can perform the the given exchange * with the described consumer */ public boolean isExchangeWithConsumerOkay(ServiceEndpoint endpoint, MessageExchange exchange) { return true; ======= this(new OdeLifeCycle()); } public OdeComponent(OdeLifeCycle lifeCycle) { _lifeCycle = lifeCycle; } * @param ref ServiceEndpoint object public ComponentLifeCycle getLifeCycle() { return _lifeCycle; } public ServiceUnitManager getServiceUnitManager() { return _lifeCycle.getSUManager(); } /** * * @return Descriptor Object implementing * {@link javax.jbi.servicedesc.Descriptor} interface. */ public Document getServiceDescription(ServiceEndpoint ref) { return _lifeCycle.getOdeContext().getServiceDescription(ref.getServiceName()); >>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a } /**
Solution content
    private OdeLifeCycle _lifeCycle;

    public OdeComponent() {
        this(new OdeLifeCycle());        
    }

    public OdeComponent(OdeLifeCycle lifeCycle) {
        _lifeCycle = lifeCycle;
    }   

    public ComponentLifeCycle getLifeCycle() {
        return _lifeCycle;
    }

    public ServiceUnitManager getServiceUnitManager() {
        return _lifeCycle.getSUManager();
    }

    /**
     * 
     * @param ref ServiceEndpoint object
     * 
     * @return Descriptor Object implementing
     *         {@link javax.jbi.servicedesc.Descriptor} interface.
     */
    public Document getServiceDescription(ServiceEndpoint ref) {
        return  _lifeCycle.getOdeContext().getServiceDescription(ref.getServiceName());
    }

    /**
File
OdeComponent.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
Method declaration
Method invocation
Method signature
Return statement
Chunk
Conflicting content
    /**
     * This method is called by JBI to check if this component, in the role of
<<<<<<< HEAD
     * consumer of the service indicated by the given exchange, can actually
     * interact with the the provider completely. Ths provider is described by the
     * given capabilities, and JBI has already ensure that a fit exists between
     * the set of required capabilities of the consumer and the available
     * capabilities of the provider, and vice versa. This matching consists of
     * simple set matching based on capability names only. 
*
* Note that JBI assures matches on capability names only; it is the * responsibility of this method to examine capability values to ensure a * match with the provider. * * @param exchange * the proposed message exchange to be performed * @return true if this consumer component can interact with the described * provider to perform the given exchange */ public boolean isExchangeWithProviderOkay(ServiceEndpoint endpoint, MessageExchange exchange) { ======= * provider of the service indicated by the given exchange, can actually * perform the operation desired. The consumer is described by the given * capabilities, and JBI has already ensured that a fit exists between the set * of required capabilities of the provider and the available capabilities of * the consumer, and vice versa. This matching consists of simple set matching * based on capability names only.
*
* Note that JBI assures matches on capability names only; it is the * responsibility of this method to examine capability values to ensure a * match with the consumer. * * @param endpoint * the endpoint to be used by the consumer * @param exchange * the proposed message exchange to be performed * @return true if this provider component can perform the the given exchange * with the described consumer */ public boolean isExchangeWithConsumerOkay(ServiceEndpoint endpoint, MessageExchange exchange) { >>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a return true; }
Solution content
    /**
     * This method is called by JBI to check if this component, in the role of
     * provider of the service indicated by the given exchange, can actually
     * perform the operation desired. The consumer is described by the given
     * capabilities, and JBI has already ensured that a fit exists between the set
     * of required capabilities of the provider and the available capabilities of
     * the consumer, and vice versa. This matching consists of simple set matching
     * based on capability names only. 
*
* Note that JBI assures matches on capability names only; it is the * responsibility of this method to examine capability values to ensure a * match with the consumer. * * @param endpoint * the endpoint to be used by the consumer * @param exchange * the proposed message exchange to be performed * @return true if this provider component can perform the the given exchange * with the described consumer */ public boolean isExchangeWithConsumerOkay(ServiceEndpoint endpoint, MessageExchange exchange) { return true; }
File
OdeComponent.java
Developer's decision
Version 2
Kind of conflict
Comment
Method signature
Chunk
Conflicting content
    }

    /**
<<<<<<< HEAD
=======
     * This method is called by JBI to check if this component, in the role of
     * consumer of the service indicated by the given exchange, can actually
     * interact with the the provider completely. Ths provider is described by the
     * given capabilities, and JBI has already ensure that a fit exists between
     * the set of required capabilities of the consumer and the available
     * capabilities of the provider, and vice versa. This matching consists of
     * simple set matching based on capability names only. 
*
* Note that JBI assures matches on capability names only; it is the * responsibility of this method to examine capability values to ensure a * match with the provider. * * @param exchange * the proposed message exchange to be performed * @return true if this consumer component can interact with the described * provider to perform the given exchange */ public boolean isExchangeWithProviderOkay(ServiceEndpoint endpoint, MessageExchange exchange) { return true; * Resolve the given endpoint reference, given the capabilities of the given } /** >>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a * consumer. This is called by JBI when it is attempting to resolve the given * endpoint reference on behalf of a component.
Solution content
    }

    /**
     * This method is called by JBI to check if this component, in the role of
     * consumer of the service indicated by the given exchange, can actually
     * interact with the the provider completely. Ths provider is described by the
     * given capabilities, and JBI has already ensure that a fit exists between
     * the set of required capabilities of the consumer and the available
     * capabilities of the provider, and vice versa. This matching consists of
     * simple set matching based on capability names only. 
*
* Note that JBI assures matches on capability names only; it is the * responsibility of this method to examine capability values to ensure a * match with the provider. * * @param exchange * the proposed message exchange to be performed * @return true if this consumer component can interact with the described * provider to perform the given exchange */ public boolean isExchangeWithProviderOkay(ServiceEndpoint endpoint, MessageExchange exchange) { return true; } /** * Resolve the given endpoint reference, given the capabilities of the given * consumer. This is called by JBI when it is attempting to resolve the given * endpoint reference on behalf of a component.
File
OdeComponent.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
<<<<<<< HEAD
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
    // We are an engine, so we don't have to worry about this.
        return null;
    }
Solution content
    // We are an engine, so we don't have to worry about this.
        return null;
    }

}
File
OdeComponent.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
                NormalizedMessage nmsg = inonly.createMessage();
                mapper.toNMS(nmsg, odeMex.getRequest(), odeMex.getOperation().getInput().getMessage(), null);
                inonly.setInMessage(nmsg);
<<<<<<< HEAD
                doSendJBI(odeMex, inonly);
=======
                copyMexProperties(jbiMex, odeMex);
                _ode._scheduler.registerSynchronizer(new Scheduler.Synchronizer() {
                    public void afterCompletion(boolean success) {
                        if (success) {
                            doSendOneWay(odeMex, inonly);
                        }
                    }
                    public void beforeCompletion() {
                    }

                });
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                odeMex.replyOneWayOk();
            } else {
                final InOut inout = (InOut) jbiMex;
Solution content
                NormalizedMessage nmsg = inonly.createMessage();
                mapper.toNMS(nmsg, odeMex.getRequest(), odeMex.getOperation().getInput().getMessage(), null);
                inonly.setInMessage(nmsg);
                copyMexProperties(jbiMex, odeMex);
                _ode._scheduler.registerSynchronizer(new Scheduler.Synchronizer() {
                    public void afterCompletion(boolean success) {
                        if (success) {
                            doSendOneWay(odeMex, inonly);
                        }
                    }
                    public void beforeCompletion() {
                    }

                });
                odeMex.replyOneWayOk();
            } else {
                final InOut inout = (InOut) jbiMex;
File
OdeConsumer.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
                NormalizedMessage nmsg = inout.createMessage();
                mapper.toNMS(nmsg, odeMex.getRequest(), odeMex.getOperation().getInput().getMessage(), null);
                inout.setInMessage(nmsg);
<<<<<<< HEAD
                doSendJBI(odeMex, inout);
                odeMex.replyAsync(inout.getExchangeId());
=======
                copyMexProperties(jbiMex, odeMex);
                _ode._scheduler.registerSynchronizer(new Scheduler.Synchronizer() {
                    public void afterCompletion(boolean success) {
                        if (success) {
                            doSendTwoWay(odeMex, inout);
                        }
                    }

                    public void beforeCompletion() {
                    }

                });

                odeMex.replyAsync();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            }
        } catch (MessagingException me) {
            String errmsg = "JBI messaging error for ODE MEX " + odeMex;
Solution content
                NormalizedMessage nmsg = inout.createMessage();
                mapper.toNMS(nmsg, odeMex.getRequest(), odeMex.getOperation().getInput().getMessage(), null);
                inout.setInMessage(nmsg);
                copyMexProperties(jbiMex, odeMex);
                _ode._scheduler.registerSynchronizer(new Scheduler.Synchronizer() {
                    public void afterCompletion(boolean success) {
                        if (success) {
                            doSendTwoWay(odeMex, inout);
                        }
                    }

                    public void beforeCompletion() {
                    }

                });

                odeMex.replyAsync();
            }
        } catch (MessagingException me) {
            String errmsg = "JBI messaging error for ODE MEX " + odeMex;
File
OdeConsumer.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
            __log.warn("Received a response for unknown partner role message exchange " + jbiMex.getExchangeId());
            return;
        }
<<<<<<< HEAD
     
        String mapperName = pmex.getProperty(Mapper.class.getName());
        Mapper mapper = mapperName == null ? _ode.getDefaultMapper() : _ode.getMapper(mapperName);
        if (mapper == null) {
            String errmsg = "Mapper not found.";
            __log.error(errmsg);
            pmex.replyWithFailure(FailureType.FORMAT_ERROR, errmsg, null);
        } else {
            try {
                Fault jbiFlt = jbiMex.getFault();
                if (jbiFlt != null) {
                    javax.wsdl.Fault wsdlFlt = mapper.toFaultType(jbiFlt, (Collection) pmex
                            .getOperation().getFaults().values());
=======

        try {
            _ode._scheduler.execTransaction(new Callable() {
                @SuppressWarnings("unchecked")
                public Boolean call() throws Exception {
                    // need to reload mex since we're in a different transaction
                    PartnerRoleMessageExchange pmex = (PartnerRoleMessageExchange) _ode._server.getEngine().getMessageExchange(outstanding.getMessageExchangeId());
                    if (pmex == null) {
                        __log.warn("Received a response for unknown partner role message exchange " + outstanding.getMessageExchangeId());
                        return Boolean.FALSE;
                    }
                    String mapperName = pmex.getProperty(Mapper.class.getName());
                    Mapper mapper = mapperName == null ? _ode.getDefaultMapper() : _ode.getMapper(mapperName);
                    if (mapper == null) {
                        String errmsg = "Mapper not found.";
                        __log.error(errmsg);
                        pmex.replyWithFailure(FailureType.FORMAT_ERROR, errmsg, null);
                    } else {
                        try {
                            Fault jbiFlt = jbiMex.getFault();
                            if (jbiFlt != null) {
                                javax.wsdl.Fault wsdlFlt = mapper.toFaultType(jbiFlt, (Collection) pmex.getOperation().getFaults().values());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                                if (wsdlFlt == null) {
                                    pmex.replyWithFailure(FailureType.FORMAT_ERROR, "Unrecognized fault message.", null);
                                } else {
Solution content
            return;
        }

        try {
            _ode._scheduler.execTransaction(new Callable() {
                @SuppressWarnings("unchecked")
                public Boolean call() throws Exception {
                    // need to reload mex since we're in a different transaction
                    PartnerRoleMessageExchange pmex = (PartnerRoleMessageExchange) _ode._server.getEngine().getMessageExchange(outstanding.getMessageExchangeId());
                    if (pmex == null) {
                        __log.warn("Received a response for unknown partner role message exchange " + outstanding.getMessageExchangeId());
                        return Boolean.FALSE;
                    }
                    String mapperName = pmex.getProperty(Mapper.class.getName());
                    Mapper mapper = mapperName == null ? _ode.getDefaultMapper() : _ode.getMapper(mapperName);
                    if (mapper == null) {
                        String errmsg = "Mapper not found.";
                        __log.error(errmsg);
                        pmex.replyWithFailure(FailureType.FORMAT_ERROR, errmsg, null);
                    } else {
                        try {
                            Fault jbiFlt = jbiMex.getFault();
                            if (jbiFlt != null) {
                                javax.wsdl.Fault wsdlFlt = mapper.toFaultType(jbiFlt, (Collection) pmex.getOperation().getFaults().values());
                                if (wsdlFlt == null) {
                                    pmex.replyWithFailure(FailureType.FORMAT_ERROR, "Unrecognized fault message.", null);
                                } else {
File
OdeConsumer.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Try statement
Variable
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
    protected void doSendJBI(final PartnerRoleMessageExchange odeMex, final MessageExchange jbiMex) {
        try {
            _ode.getChannel().send(jbiMex);
        } catch (MessagingException e) {
            String errmsg = "Error sending request-only message to JBI for ODE mex " + odeMex;
            __log.error(errmsg, e);
        }
    }

=======
    public void setResponseTimeout(long timeout) {
        _responseTimeout = timeout;
    }

    public long getResponseTimeout() {
        return _responseTimeout;
    }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
        }
    }

    public void setResponseTimeout(long timeout) {
        _responseTimeout = timeout;
    }

    public long getResponseTimeout() {
        return _responseTimeout;
    }
}
File
OdeConsumer.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
<<<<<<< HEAD
import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
=======
import org.apache.ode.agents.memory.SizingAgent;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.ProcessAndInstanceManagementImpl;
import org.apache.ode.bpel.iapi.Endpoint;
Solution content
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.agents.memory.SizingAgent;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactory;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.ProcessAndInstanceManagementImpl;
import org.apache.ode.bpel.iapi.Endpoint;
File
OdeContext.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.ode.bpel.iapi.Endpoint;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.ProcessConf;
<<<<<<< HEAD
import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.ode.bpel.pmapi.InstanceManagement;
import org.apache.ode.bpel.pmapi.ProcessManagement;
import org.apache.ode.bpel.rapi.ProcessModel;
import org.apache.ode.bpel.rapi.PartnerLinkModel;
import org.apache.ode.bpel.rapi.Serializer;
import org.apache.ode.dao.scheduler.SchedulerDAOConnectionFactory;
import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
=======
import org.apache.ode.bpel.o.OPartnerLink;
import org.apache.ode.bpel.o.OProcess;
import org.apache.ode.bpel.o.Serializer;
import org.apache.ode.bpel.pmapi.InstanceManagement;
import org.apache.ode.bpel.pmapi.ProcessManagement;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.jbi.msgmap.Mapper;
import org.apache.ode.jbi.util.WSDLFlattener;
import org.apache.ode.store.ProcessStoreImpl;
Solution content
import org.apache.ode.bpel.iapi.Endpoint;
import org.apache.ode.bpel.iapi.EndpointReference;
import org.apache.ode.bpel.iapi.ProcessConf;
import org.apache.ode.bpel.o.OPartnerLink;
import org.apache.ode.bpel.o.OProcess;
import org.apache.ode.bpel.o.Serializer;
import org.apache.ode.bpel.pmapi.InstanceManagement;
import org.apache.ode.bpel.pmapi.ProcessManagement;
import org.apache.ode.jbi.msgmap.Mapper;
import org.apache.ode.jbi.util.WSDLFlattener;
import org.apache.ode.scheduler.simple.SimpleScheduler;
import org.apache.ode.store.ProcessStoreImpl;
File
OdeContext.java
Developer's decision
Manual
Kind of conflict
Import
Chunk
Conflicting content
        	service = new OdeService(this, endpoint);
        try {
            ProcessConf pc = _store.getProcessConfiguration(pid);
<<<<<<< HEAD
            ProcessModel compiledProcess = null;
            InputStream is = pc.getCBPInputStream();
            try {
                Serializer ofh = new Serializer(is);
                compiledProcess = ofh.readPModel();
=======
            InputStream is = pc.getCBPInputStream();
            OProcess compiledProcess = null;
            try {
                Serializer ofh = new Serializer(is);
                compiledProcess = ofh.readOProcess();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            } finally {
                is.close();            	
            }
Solution content
        	service = new OdeService(this, endpoint);
        try {
            ProcessConf pc = _store.getProcessConfiguration(pid);
            InputStream is = pc.getCBPInputStream();
            OProcess compiledProcess = null;
            try {
                Serializer ofh = new Serializer(is);
                compiledProcess = ofh.readOProcess();
            } finally {
                is.close();            	
            }
File
OdeContext.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Try statement
Variable
Chunk
Conflicting content
            }
        }
    }
<<<<<<< HEAD
=======
    
    public long calculateSizeOfService(EndpointReference epr) {
    	if (epr != null) {
	    	for (OdeService odeService : _serviceEprMap.keySet()) {
	    		EndpointReference serviceEpr = _serviceEprMap.get(odeService);
	    		if (serviceEpr != null && epr.equals(serviceEpr)) {
					return SizingAgent.deepSizeOf(odeService);
	    		}
	    	}
    	}
    	return 0;
    }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
            }
        }
    }
    
    public long calculateSizeOfService(EndpointReference epr) {
    	if (epr != null) {
	    	for (OdeService odeService : _serviceEprMap.keySet()) {
	    		EndpointReference serviceEpr = _serviceEprMap.get(odeService);
	    		if (serviceEpr != null && epr.equals(serviceEpr)) {
					return SizingAgent.deepSizeOf(odeService);
	    		}
	    	}
    	}
    	return 0;
    }
}
File
OdeContext.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
import java.util.Map;

import java.io.File;
import java.io.FileNotFoundException;
<<<<<<< HEAD
import java.util.HashMap;
import java.util.StringTokenizer;
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import java.util.concurrent.Executors;

import javax.jbi.JBIException;
Solution content
import java.io.File;
import java.io.FileNotFoundException;
import java.util.concurrent.Executors;

import javax.jbi.JBIException;
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import javax.jbi.component.ServiceUnitManager;
import javax.management.MBeanServer;
import javax.management.ObjectName;
<<<<<<< HEAD
import javax.naming.InitialContext;
import javax.xml.namespace.QName;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.extension.ExtensionValidator;
import org.apache.ode.bpel.extension.ExtensionBundleRuntime;
import org.apache.ode.bpel.extension.ExtensionBundleValidation;
import org.apache.ode.bpel.connector.BpelServerConnector;
import org.apache.ode.bpel.context.ContextInterceptor;
import org.apache.ode.dao.bpel.BpelDAOConnectionFactory;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.ProcessAndInstanceManagementMBean;
import org.apache.ode.bpel.evtproc.DebugBpelEventListener;
import org.apache.ode.bpel.iapi.BpelEventListener;
import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;
import org.apache.ode.dao.scheduler.SchedulerDAOConnectionFactory;
import org.apache.ode.dao.store.ConfStoreDAOConnectionFactory;
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.il.dbutil.DatabaseConfigException;
import org.apache.ode.jbi.msgmap.Mapper;
=======
import javax.transaction.TransactionManager;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.connector.BpelServerConnector;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.ProcessAndInstanceManagementMBean;
import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;

import org.apache.ode.bpel.iapi.BpelEventListener;
import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.il.dbutil.DatabaseConfigException;
import org.apache.ode.jbi.msgmap.Mapper;
import org.apache.ode.scheduler.simple.JdbcDelegate;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.scheduler.simple.SimpleScheduler;
import org.apache.ode.store.ProcessStoreImpl;
import org.apache.ode.utils.GUID;
Solution content
import javax.jbi.component.ServiceUnitManager;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.transaction.TransactionManager;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.connector.BpelServerConnector;
import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
import org.apache.ode.bpel.engine.BpelServerImpl;
import org.apache.ode.bpel.engine.ProcessAndInstanceManagementMBean;
import org.apache.ode.bpel.extvar.jdbc.JdbcExternalVariableModule;

import org.apache.ode.bpel.iapi.BpelEventListener;
import org.apache.ode.bpel.intercept.MessageExchangeInterceptor;
import org.apache.ode.il.dbutil.Database;
import org.apache.ode.il.dbutil.DatabaseConfigException;
import org.apache.ode.jbi.msgmap.Mapper;
import org.apache.ode.scheduler.simple.JdbcDelegate;
import org.apache.ode.scheduler.simple.SimpleScheduler;
import org.apache.ode.store.ProcessStoreImpl;
import org.apache.ode.utils.GUID;
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
    private BpelServerConnector _connector;

    private Database _db;
<<<<<<< HEAD
    
    private ObjectName _mbeanName;

=======

    private ObjectName _mbeanName;

    private OdeConfigProperties _config;

    public OdeLifeCycle() {
        
    }

    public OdeLifeCycle(OdeConfigProperties config) {
        _config = config;
    }

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    ServiceUnitManager getSUManager() {
        return _suManager;
    }
Solution content
    private Database _db;

    private ObjectName _mbeanName;

    private BpelServerConnector _connector;

    private OdeConfigProperties _config;

    public OdeLifeCycle() {
        
    }

    public OdeLifeCycle(OdeConfigProperties config) {
        _config = config;
    }

    ServiceUnitManager getSUManager() {
        return _suManager;
    }
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method declaration
Chunk
Conflicting content
        try {
            _ode = OdeContext.getInstance();
            _ode.setContext(context);
<<<<<<< HEAD
            
            _ode._consumer = new OdeConsumer(_ode);
            
            if (_ode.getContext().getWorkspaceRoot() != null)
                TempFileManager.setWorkingDirectory(new File(_ode.getContext().getWorkspaceRoot()));

            __log.debug("Loading properties.");
            initProperties();
=======

            // Use system property to determine if DeliveryChannel.sendSync or DeliveryChannel.send is used.
            if (Boolean.getBoolean("org.apache.ode.jbi.sendSynch"))
                _ode._consumer = new OdeConsumerSync(_ode);
            else
                _ode._consumer = new OdeConsumerAsync(_ode);
            if (_ode.getContext().getWorkspaceRoot() != null)
                TempFileManager.setWorkingDirectory(new File(_ode.getContext().getWorkspaceRoot()));

            if (_config == null) {
                __log.debug("Loading properties.");
                initProperties();
            } else {
                __log.debug("Applying properties.");
                _ode._config = _config;
            }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

            __log.debug("Initializing message mappers.");
            initMappers();
Solution content
        try {
            _ode = OdeContext.getInstance();
            _ode.setContext(context);

            // Use system property to determine if DeliveryChannel.sendSync or DeliveryChannel.send is used.
            if (Boolean.getBoolean("org.apache.ode.jbi.sendSynch"))
                _ode._consumer = new OdeConsumerSync(_ode);
            else
                _ode._consumer = new OdeConsumerAsync(_ode);

            if (_ode.getContext().getWorkspaceRoot() != null)
                TempFileManager.setWorkingDirectory(new File(_ode.getContext().getWorkspaceRoot()));

            if (_config == null) {
                __log.debug("Loading properties.");
                initProperties();
            } else {
                __log.debug("Applying properties.");
                _ode._config = _config;
            }

            __log.debug("Initializing message mappers.");
            initMappers();
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
If statement
Method invocation
Chunk
Conflicting content
            __log.debug("Starting Dao.");
            initDao();

<<<<<<< HEAD
            __log.info("Hibernate started.");

=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            __log.debug("Starting BPEL server.");
            initBpelServer();
Solution content
            __log.debug("Starting Dao.");
            initDao();

            __log.debug("Starting BPEL server.");
            initBpelServer();
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
            registerEventListeners();

            registerMexInterceptors();
<<<<<<< HEAD
            
            registerContextInterceptors();
            
            registerExtensionActivityBundles();
            
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            registerMBean();

            __log.debug("Starting JCA connector.");
Solution content
            registerEventListeners();

            registerMexInterceptors();

            registerMBean();

            __log.debug("Starting JCA connector.");
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
            __log.debug("Register ProcessManagement APIs");
            _ode.activatePMAPIs();

<<<<<<< HEAD

            _suManager = new OdeSUManager(_ode);
            _initSuccess = true;
            __log.info(__msgs.msgOdeInitialized());
        } finally {
            if (!_initSuccess) {
                // TODO ..then what? at least shutdown the scheduler
            }
        }
    }

    private void initMappers() throws JBIException {
        String[] mappers = _ode._config.getMessageMappers();
        Class mapperClass;
=======
            _suManager = new OdeSUManager(_ode);
            _initSuccess = true;
            __log.info(__msgs.msgOdeInitialized());
        } catch (Throwable t) {
            __log.fatal("", t);
            throw new JBIException("Fatal error", t);
        }
    }

    @SuppressWarnings("unchecked")
    private void initMappers() throws JBIException {
        String[] mappers = _ode._config.getMessageMappers();
        Class mapperClass;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        for (String className : mappers) {
            try {
                mapperClass = (Class) Class.forName(className);
Solution content
            __log.debug("Register ProcessManagement APIs");
            _ode.activatePMAPIs();

            _suManager = new OdeSUManager(_ode);
            _initSuccess = true;
            __log.info(__msgs.msgOdeInitialized());
        } catch (Throwable t) {
            __log.fatal("", t);
            throw new JBIException("Fatal error", t);
        }
    }

    @SuppressWarnings("unchecked")
    private void initMappers() throws JBIException {
        String[] mappers = _ode._config.getMessageMappers();
        Class mapperClass;
        for (String className : mappers) {
            try {
                mapperClass = (Class) Class.forName(className);
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Annotation
Attribute
Catch clause
If statement
Method invocation
Method signature
Variable
Chunk
Conflicting content
    }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                __log.error(errmsg);
                throw new JBIException(errmsg, t);
            }
<<<<<<< HEAD
         }
=======
        }

    private void initDataSource() throws JBIException {
Solution content
                __log.error(errmsg);
                throw new JBIException(errmsg, t);
            }
        }
    }

    private void initDataSource() throws JBIException {
File
OdeLifeCycle.java
Developer's decision
Version 1
Kind of conflict
Other
Chunk
Conflicting content
        _ode._dataSource = _db.getDataSource();
    }
<<<<<<< HEAD

=======
    
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    /**
     * Load the "ode-jbi.properties" file from the install directory.
     *
Solution content
        _ode._dataSource = _db.getDataSource();
    }
    
    /**
     * Load the "ode-jbi.properties" file from the install directory.
     *
File
OdeLifeCycle.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
            _ode._executorService = Executors.newCachedThreadPool();
        else
            _ode._executorService = Executors.newFixedThreadPool(_ode._config.getThreadPoolMaxSize());
<<<<<<< HEAD
        SimpleScheduler sched =new SimpleScheduler(new GUID().toString(), _ode._sdaocf, _ode.getTransactionManager(),  _ode._config.getProperties());
        sched.setJobProcessor(_ode._server);
        _ode._scheduler = sched;
        _ode._store = new ProcessStoreImpl(_ode._eprContext, _ode.getTransactionManager(), _ode._cdaocf);
        registerExternalVariableModules();
        _ode._store.loadAll();

        _ode._server.setDaoConnectionFactory(_ode._bdaocf);
=======
        _ode._scheduler = new SimpleScheduler(new GUID().toString(),new JdbcDelegate(_ode._dataSource), _ode._config.getProperties());
        _ode._scheduler.setJobProcessor(_ode._server);
        _ode._scheduler.setExecutorService(_ode._executorService);
        _ode._scheduler.setTransactionManager((TransactionManager) _ode.getContext().getTransactionManager());

        _ode._store = new ProcessStoreImpl(_ode._eprContext , _ode._dataSource, _ode._config.getDAOConnectionFactory(), _ode._config, false);
        registerExternalVariableModules();
        _ode._store.loadAll();

        _ode._server.setInMemDaoConnectionFactory(new org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl(
                _ode._scheduler, _ode._config.getInMemMexTtl()));
        _ode._server.setDaoConnectionFactory(_ode._daocf);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        _ode._server.setEndpointReferenceContext(_ode._eprContext);
        _ode._server.setMessageExchangeContext(_ode._mexContext);
        _ode._server.setBindingContext(new BindingContextImpl(_ode));
Solution content
            _ode._executorService = Executors.newCachedThreadPool();
        else
            _ode._executorService = Executors.newFixedThreadPool(_ode._config.getThreadPoolMaxSize());
        _ode._scheduler = new SimpleScheduler(new GUID().toString(),new JdbcDelegate(_ode._dataSource), _ode._config.getProperties());
        _ode._scheduler.setJobProcessor(_ode._server);
        _ode._scheduler.setExecutorService(_ode._executorService);
        _ode._scheduler.setTransactionManager((TransactionManager) _ode.getContext().getTransactionManager());

        _ode._store = new ProcessStoreImpl(_ode._eprContext , _ode._dataSource, _ode._config.getDAOConnectionFactory(), _ode._config, false);
        registerExternalVariableModules();
        _ode._store.loadAll();

        _ode._server.setInMemDaoConnectionFactory(new org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl(
                _ode._scheduler, _ode._config.getInMemMexTtl()));
        _ode._server.setDaoConnectionFactory(_ode._daocf);
        _ode._server.setEndpointReferenceContext(_ode._eprContext);
        _ode._server.setMessageExchangeContext(_ode._mexContext);
        _ode._server.setBindingContext(new BindingContextImpl(_ode));
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Variable
Chunk
Conflicting content
        _ode._server.setMessageExchangeContext(_ode._mexContext);
        _ode._server.setBindingContext(new BindingContextImpl(_ode));
        _ode._server.setScheduler(_ode._scheduler);
<<<<<<< HEAD
        _ode._server.setTransactionManager(_ode.getTransactionManager());
        _ode._server.setConfigProperties(_ode._config);
        _ode._server.registerBpelEventListener(new DebugBpelEventListener());

        _ode._server.init();

=======
    _ode._server.setConfigProperties(_ode._config.getProperties());

        _ode._server.init();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    private void registerExternalVariableModules() {
Solution content
        _ode._server.setMessageExchangeContext(_ode._mexContext);
        _ode._server.setBindingContext(new BindingContextImpl(_ode));
        _ode._server.setScheduler(_ode._scheduler);
    _ode._server.setConfigProperties(_ode._config.getProperties());

        _ode._server.init();
    }

    private void registerExternalVariableModules() {
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
     * @throws JBIException
     */
    private void initDao() throws JBIException {
<<<<<<< HEAD
        BpelDAOConnectionFactory bcf;
        ConfStoreDAOConnectionFactory ccf;
        SchedulerDAOConnectionFactory scf;
        try {
            bcf = _db.createDaoCF();
            ccf = _db.createDaoStoreCF();
            scf = _db.createDaoSchedulerCF();
=======
        BpelDAOConnectionFactoryJDBC cf;
        try {
            cf = _db.createDaoCF();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        } catch (DatabaseConfigException e) {
            String errmsg = __msgs.msgDAOInstantiationFailed(_ode._config.getDAOConnectionFactory());
            throw new JBIException(errmsg,e);
Solution content
     * @throws JBIException
     */
    private void initDao() throws JBIException {
        BpelDAOConnectionFactoryJDBC cf;
        try {
            cf = _db.createDaoCF();
        } catch (DatabaseConfigException e) {
            String errmsg = __msgs.msgDAOInstantiationFailed(_ode._config.getDAOConnectionFactory());
            throw new JBIException(errmsg,e);
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Try statement
Variable
Chunk
Conflicting content
            String errmsg = __msgs.msgDAOInstantiationFailed(_ode._config.getDAOConnectionFactory());
            throw new JBIException(errmsg,e);
        }
<<<<<<< HEAD
        _ode._bdaocf = bcf;
        _ode._sdaocf = scf;

=======
        _ode._daocf = cf;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    private void initConnector() throws JBIException {
Solution content
            String errmsg = __msgs.msgDAOInstantiationFailed(_ode._config.getDAOConnectionFactory());
            throw new JBIException(errmsg,e);
        }
        _ode._daocf = cf;
    }

    private void initConnector() throws JBIException {
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Attribute
Variable
Chunk
Conflicting content
            throw new JBIException(e);
        }
    }
<<<<<<< HEAD
    
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    private void unregisterMBean() throws JBIException {
        try {
            if (_mbeanName != null) {
Solution content
            throw new JBIException(e);
        }
    }

    private void unregisterMBean() throws JBIException {
        try {
            if (_mbeanName != null) {
File
OdeLifeCycle.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
            throw new JBIException(e);
        }
    }
<<<<<<< HEAD
    
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    private void registerEventListeners() {
        String listenersStr = _ode._config.getEventListeners();
        if (listenersStr != null) {
Solution content
            throw new JBIException(e);
        }
    }

    private void registerEventListeners() {
        String listenersStr = _ode._config.getEventListeners();
        if (listenersStr != null) {
File
OdeLifeCycle.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
    private void registerContextInterceptors() {
        String interceptorsStr = _ode._config.getContextInterceptors();
        if (interceptorsStr != null) {
            for (StringTokenizer tokenizer = new StringTokenizer(interceptorsStr, ",;"); tokenizer.hasMoreTokens();) {
                String interceptorCN = tokenizer.nextToken();
                try {
                    _ode._server.registerContextInterceptor((ContextInterceptor) Class.forName(interceptorCN).newInstance());
                    __log.info(__msgs.msgContextInterceptorRegistered(interceptorCN));
                } catch (Exception e) {
                    __log.warn("Couldn't register the context interceptor " + interceptorCN + ", the class couldn't be "
                            + "loaded properly: " + e);
                }
            }
        }
    }

    private void registerExtensionActivityBundles() {
        String extensionsRTStr = _ode._config.getExtensionActivityBundlesRT();
        String extensionsValStr = _ode._config.getExtensionActivityBundlesValidation();
        if (extensionsRTStr != null) {
            // TODO replace StringTokenizer by regex
            for (StringTokenizer tokenizer = new StringTokenizer(extensionsRTStr, ",;"); tokenizer.hasMoreTokens();) {
                String bundleCN = tokenizer.nextToken();
                try {
                    // instantiate bundle
                    ExtensionBundleRuntime bundleRT = (ExtensionBundleRuntime) Class.forName(bundleCN).newInstance();
                    // register extension bundle (BPEL server)
                    _ode._server.registerExtensionBundle(bundleRT);
                } catch (Exception e) {
                    __log.warn("Couldn't register the extension bundle runtime " + bundleCN + ", the class couldn't be " +
                            "loaded properly.");
                }
            }
        }
        if (extensionsValStr != null) {
            Map validators = new HashMap();
            for (StringTokenizer tokenizer = new StringTokenizer(extensionsValStr, ",;"); tokenizer.hasMoreTokens();) {
                String bundleCN = tokenizer.nextToken();
                try {
                    // instantiate bundle
                    ExtensionBundleValidation bundleVal = (ExtensionBundleValidation) Class.forName(bundleCN).newInstance();
                    //add validators
                    validators.putAll(bundleVal.getExtensionValidators());
                } catch (Exception e) {
                    __log.warn("Couldn't register the extension bundle validator " + bundleCN + ", the class couldn't be " +
                            "loaded properly.");
                }
            }
            // register extension bundle (BPEL store)
            _ode._store.setExtensionValidators(validators);
        }
    }

=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public synchronized void start() throws JBIException {
        if (_started)
            return;
Solution content
        }
    }

    public synchronized void start() throws JBIException {
        if (_started)
            return;
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
                throw new JBIException(errmsg, ex);
            }

<<<<<<< HEAD
=======
            _ode._scheduler.start();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            _receiver = new Receiver(_ode);
            _receiver.start();
            _started = true;
Solution content
                throw new JBIException(errmsg, ex);
            }

            _ode._scheduler.start();
            _receiver = new Receiver(_ode);
            _receiver.start();
            _started = true;
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
    public void shutDown() throws JBIException {
        ClassLoader old = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
<<<<<<< HEAD
        
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        unregisterMBean();

        _ode.deactivatePMAPIs();
Solution content
    public void shutDown() throws JBIException {
        ClassLoader old = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());

        unregisterMBean();

        _ode.deactivatePMAPIs();
File
OdeLifeCycle.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
            }

             try {
            }

            try {
<<<<<<< HEAD
                _ode._bdaocf.shutdown();
            } catch (Exception ex) {
                __log.debug("error shutting down bpel conn.", ex);
            } finally {
                 _ode._bdaocf = null;
                _ode._cdaocf.shutdown();
            } catch (Exception ex) {
                __log.debug("error shutting down conf store conn.", ex);
            } finally {
                 _ode._cdaocf = null;
            }

            try {
                _ode._sdaocf.shutdown();
            } catch (Exception ex) {
                __log.debug("error shutting down sched conn.", ex);
            } finally {
                 _ode._sdaocf = null;
            }

            try {
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                _db.shutdown();
            } catch (Exception ex) {
                __log.debug("error shutting down db.", ex);
Solution content
            }

            try {
                _db.shutdown();
            } catch (Exception ex) {
                __log.debug("error shutting down db.", ex);
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Attribute
Catch clause
Method invocation
Try statement
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD
    @SuppressWarnings("unchecked")
    private  T lookupInJndi(String objName) throws Exception {
        ClassLoader old = Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
        try {
            InitialContext ctx = null;
            try {
                ctx = new InitialContext();
                return (T) ctx.lookup(objName);
            } finally {
                if (ctx != null)
                    try {
                        ctx.close();
                    } catch (Exception ex1) {
                        ; // swallow
                        __log.error("Error closing JNDI connection.", ex1);
                    }
            }
        } finally {
            Thread.currentThread().setContextClassLoader(old);
        }

    }

}

=======
}
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
Solution content
        }
    }

}
File
OdeLifeCycle.java
Developer's decision
Version 2
Kind of conflict
Annotation
Method declaration
Chunk
Conflicting content
 */
package org.apache.ode.jbi;

<<<<<<< HEAD
=======
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.iapi.Endpoint;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchange;
import org.apache.ode.bpel.iapi.MessageExchange.Status;
import org.apache.ode.bpel.iapi.Scheduler.Synchronizer;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
import org.apache.ode.jbi.msgmap.Mapper;
import org.apache.ode.jbi.msgmap.MessageTranslationException;
import org.w3c.dom.Element;

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import javax.jbi.JBIException;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.Fault;
Solution content
 */
package org.apache.ode.jbi;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.iapi.Endpoint;
import org.apache.ode.bpel.iapi.Message;
import org.apache.ode.bpel.iapi.MessageExchange;
import org.apache.ode.bpel.iapi.MessageExchange.Status;
import org.apache.ode.bpel.iapi.Scheduler.Synchronizer;
import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
import org.apache.ode.jbi.msgmap.Mapper;
import org.apache.ode.jbi.msgmap.MessageTranslationException;
import org.w3c.dom.Element;

import javax.jbi.JBIException;
import javax.jbi.messaging.ExchangeStatus;
import javax.jbi.messaging.Fault;
File
OdeService.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
            } finally {
                // If we got an error that wasn't sent.
                if (jbiMex.getStatus() == ExchangeStatus.ACTIVE && !success) {
<<<<<<< HEAD
                    if (err != null && jbiMex.getError() == null) {
=======
                    if (err != null && jbiMex.getError() == null)  {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
                        jbiMex.setError(err);
                    }
                    jbiMex.setStatus(ExchangeStatus.ERROR);
Solution content
            } finally {
                // If we got an error that wasn't sent.  
                if (jbiMex.getStatus() == ExchangeStatus.ACTIVE && !success) {
                    if (err != null && jbiMex.getError() == null)  {
                        jbiMex.setError(err);
                    }
File
OdeService.java
Developer's decision
Version 1
Kind of conflict
If statement
Chunk
Conflicting content
    }

    /**
<<<<<<< HEAD
=======
     * Called from
     * {@link MessageExchangeContextImpl#onAsyncReply(MyRoleMessageExchange)}
     * 
     * @param mex
     *            message exchange
     */
    public void onResponse(MyRoleMessageExchange mex) {
        final String clientId = mex.getClientId();
        final String mexId = mex.getMessageExchangeId();
        __log.debug("Processing MEX tracker mexId: " + mexId + " clientId: " + clientId);
        final javax.jbi.messaging.MessageExchange jbiMex = _jbiMexTracker.peek(clientId);
        if (jbiMex == null) {
            __log.warn("Ignoring unknown async reply. mexId: " + mexId + " clientId: " + clientId);
            return;
        }

        try {
        switch (mex.getStatus()) {
        case FAULT:
            outResponseFault(mex, jbiMex);
            break;
        case RESPONSE:
            outResponse(mex, jbiMex);
            break;
        case FAILURE:
            outFailure(mex, jbiMex);
            break;
        default:
            __log.warn("Received ODE message exchange in unexpected state: " + mex.getStatus() + " mexId: " + mexId + " clientId: " + clientId);
        }
        
        mex.release(mex.getStatus() == MessageExchange.Status.RESPONSE);
        _ode._scheduler.registerSynchronizer(new Synchronizer() {
            public void afterCompletion(boolean success) {
                if (success) {
                    //Deliver reply to external world only if ODE scheduler's job has completed successfully
                    try {
                        _ode.getChannel().send(jbiMex);
                    __log.debug("Consuming MEX tracker mexId: " + mexId + " clientId: " + clientId);
                    _jbiMexTracker.consume(clientId);
                    } catch (MessagingException e) {
                        __log.error("Error delivering response from ODE to JBI mexId: " + mexId + " clientId: " + clientId, e);
                    }
                }
            }

            public void beforeCompletion() {
            }
        });
        } catch (MessagingException e) {
            __log.error("Error processing response from ODE to JBI mexId: " + mexId + " clientId: " + clientId, e);
        }
    }

    /**
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
     * Forward a JBI input message to ODE.
     * 
     * @param jbiMex
Solution content
    }

    /**
     * Called from
     * {@link MessageExchangeContextImpl#onAsyncReply(MyRoleMessageExchange)}
     * 
     * @param mex
     *            message exchange
     */
    public void onResponse(MyRoleMessageExchange mex) {
        final String clientId = mex.getClientId();
        final String mexId = mex.getMessageExchangeId();
        __log.debug("Processing MEX tracker mexId: " + mexId + " clientId: " + clientId);
        final javax.jbi.messaging.MessageExchange jbiMex = _jbiMexTracker.peek(clientId);
        if (jbiMex == null) {
            __log.warn("Ignoring unknown async reply. mexId: " + mexId + " clientId: " + clientId);
            return;
        }

        try {
        switch (mex.getStatus()) {
        case FAULT:
            outResponseFault(mex, jbiMex);
            break;
        case RESPONSE:
            outResponse(mex, jbiMex);
            break;
        case FAILURE:
            outFailure(mex, jbiMex);
            break;
        default:
            __log.warn("Received ODE message exchange in unexpected state: " + mex.getStatus() + " mexId: " + mexId + " clientId: " + clientId);
        }
        
        mex.release(mex.getStatus() == MessageExchange.Status.RESPONSE);
        _ode._scheduler.registerSynchronizer(new Synchronizer() {
            public void afterCompletion(boolean success) {
                if (success) {
                    //Deliver reply to external world only if ODE scheduler's job has completed successfully
                    try {
                        _ode.getChannel().send(jbiMex);
                    __log.debug("Consuming MEX tracker mexId: " + mexId + " clientId: " + clientId);
                    _jbiMexTracker.consume(clientId);
                    } catch (MessagingException e) {
                        __log.error("Error delivering response from ODE to JBI mexId: " + mexId + " clientId: " + clientId, e);
                    }
                }
            }

            public void beforeCompletion() {
            }
        });
        } catch (MessagingException e) {
            __log.error("Error processing response from ODE to JBI mexId: " + mexId + " clientId: " + clientId, e);
        }
    }

    /**
     * Forward a JBI input message to ODE.
     * 
     * @param jbiMex
File
OdeService.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
                    onResponse(odeMex);
            return;
        }

<<<<<<< HEAD
        copyMexProperties(odeMex, jbiMex);
        javax.wsdl.Message msgdef = odeMex.getOperation().getInput().getMessage();
        Message odeRequest = odeMex.createMessage(odeMex.getOperation().getInput().getMessage().getQName());
        Mapper mapper = _ode.findMapper(request, odeMex.getOperation());
        if (mapper == null) {
            String errmsg = "Could not find a mapper for request message for JBI MEX " + jbiMex.getExchangeId() + "; ODE MEX "
                    + odeMex.getMessageExchangeId() + " is failed. ";
            __log.error(errmsg);
            throw new MessageTranslationException(errmsg);
=======
                }
                odeMex.setProperty(Mapper.class.getName(), mapper.getClass().getName());
                mapper.toODE(odeRequest, request, msgdef);
                odeMex.invoke(odeRequest);

                // Handle the response if it is immediately available.
                if (odeMex.getStatus() != Status.ASYNC) {
                    __log.debug("ODE MEX " + odeMex + " completed SYNCHRONOUSLY.");
                    _jbiMexTracker.consume(jbiMex.getExchangeId());
                } else {
                    __log.debug("ODE MEX " + odeMex + " completed ASYNCHRONOUSLY.");
                }
            } else {
                __log.error("ODE MEX " + odeMex + " was unroutable.");
                setError(jbiMex, new IllegalArgumentException("Unroutable invocation."));
            }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

        }
        odeMex.setProperty(Mapper.class.getName(), mapper.getClass().getName());
Solution content
                }
                odeMex.setProperty(Mapper.class.getName(), mapper.getClass().getName());
                mapper.toODE(odeRequest, request, msgdef);
                odeMex.invoke(odeRequest);

                // Handle the response if it is immediately available.
                if (odeMex.getStatus() != Status.ASYNC) {
                    __log.debug("ODE MEX " + odeMex + " completed SYNCHRONOUSLY.");
                    onResponse(odeMex);
                    _jbiMexTracker.consume(jbiMex.getExchangeId());
                } else {
                    __log.debug("ODE MEX " + odeMex + " completed ASYNCHRONOUSLY.");
                }
            } else {
                __log.error("ODE MEX " + odeMex + " was unroutable.");
                setError(jbiMex, new IllegalArgumentException("Unroutable invocation."));
            }
File
OdeService.java
Developer's decision
Combination
Kind of conflict
Comment
If statement
Method invocation
Throw statement
Variable
Chunk
Conflicting content
            _ode.getChannel().send(jbiMex);
            // TODO: get failure codes out of the message.

    }

<<<<<<< HEAD
    private void outFailure(MyRoleMessageExchange odeMex, javax.jbi.messaging.MessageExchange jbiMex) {
        try {
            jbiMex.setError(new Exception("MEXFailure: " + odeMex.getFailureType()));
            jbiMex.setStatus(ExchangeStatus.ERROR);
        } catch (MessagingException ex) {
            __log.fatal("Error bridging ODE out response: ", ex);
        }
=======
    private void outFailure(MyRoleMessageExchange odeMex, javax.jbi.messaging.MessageExchange jbiMex) throws MessagingException {
        jbiMex.setError(new Exception("MEXFailure"));
        jbiMex.setStatus(ExchangeStatus.ERROR);
        // TODO: get failure codes out of the message.
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    private void outResponse(MyRoleMessageExchange mex, javax.jbi.messaging.MessageExchange jbiMex) throws MessagingException {
Solution content
    }

    private void outFailure(MyRoleMessageExchange odeMex, javax.jbi.messaging.MessageExchange jbiMex) throws MessagingException {
        jbiMex.setError(new Exception("MEXFailure"));
        jbiMex.setStatus(ExchangeStatus.ERROR);
        // TODO: get failure codes out of the message.
    }

    private void outResponse(MyRoleMessageExchange mex, javax.jbi.messaging.MessageExchange jbiMex) throws MessagingException {
File
OdeService.java
Developer's decision
Version 2
Kind of conflict
Comment
Method invocation
Method signature
Try statement
Chunk
Conflicting content
            QName fault = mex.getFault();
            javax.wsdl.Fault wsdlFault = mex.getOperation().getFault(fault.getLocalPart());
            if (wsdlFault == null) {
<<<<<<< HEAD
                sendError(jbiMex, new MessageTranslationException("Unmapped Fault : " + fault + ": " + mex.getFaultExplanation()));
=======
               setError(jbiMex, new MessageTranslationException("Unmapped Fault : " + fault + ": " + mex.getFaultExplanation()));
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            } else {
                mapper.toNMS(flt, mex.getFaultResponse(), wsdlFault.getMessage(), fault);
                inout.setFault(flt);
Solution content
               setError(jbiMex, new MessageTranslationException("Unmapped Fault : " + fault + ": " + mex.getFaultExplanation()));
            } else {
            QName fault = mex.getFault();
            javax.wsdl.Fault wsdlFault = mex.getOperation().getFault(fault.getLocalPart());
            if (wsdlFault == null) {
                mapper.toNMS(flt, mex.getFaultResponse(), wsdlFault.getMessage(), fault);
                inout.setFault(flt);
File
OdeService.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
            setError(jbiMex, mte);
        }
    }
<<<<<<< HEAD

    private void sendError(javax.jbi.messaging.MessageExchange jbiMex, Exception error) {
        try {
            jbiMex.setError(error);
            jbiMex.setStatus(ExchangeStatus.ERROR);
            _ode.getChannel().send(jbiMex);
        } catch (Exception e) {
            __log.error("Error sending ERROR status: ", e);
        }
=======
    
    private void setError(javax.jbi.messaging.MessageExchange jbiMex, Exception error) throws MessagingException {
        jbiMex.setError(error);
        jbiMex.setStatus(ExchangeStatus.ERROR);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    public Endpoint getEndpoint() {
Solution content
            setError(jbiMex, mte);
        }
    }
    
    private void setError(javax.jbi.messaging.MessageExchange jbiMex, Exception error) throws MessagingException {
        jbiMex.setError(error);
        jbiMex.setStatus(ExchangeStatus.ERROR);
    }

    public Endpoint getEndpoint() {
File
OdeService.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Method signature
Try statement
Chunk
Conflicting content
        return _endpoint;
    }

<<<<<<< HEAD
=======
    /**
     * Class for tracking outstanding message exchanges from JBI.
     */
    private static class JbiMexTracker {
        /**
         * Outstanding JBI-initiated exchanges: mapping for JBI MEX ID to JBI
         * MEX
         */
        private Map _outstandingJbiExchanges = new HashMap();

        synchronized boolean track(javax.jbi.messaging.MessageExchange jbiMex) {
            boolean found = _outstandingJbiExchanges.containsKey(jbiMex.getExchangeId());
            _outstandingJbiExchanges.put(jbiMex.getExchangeId(), jbiMex);
            return found;
        }

        synchronized javax.jbi.messaging.MessageExchange peek(String clientId) {
            return _outstandingJbiExchanges.get(clientId);
        }
        synchronized javax.jbi.messaging.MessageExchange consume(String clientId) {
            return _outstandingJbiExchanges.remove(clientId);
        }
    }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
        return _endpoint;
    }

    /**
     * Class for tracking outstanding message exchanges from JBI.
     */
    private static class JbiMexTracker {
        /**
         * Outstanding JBI-initiated exchanges: mapping for JBI MEX ID to JBI
         * MEX
         */
        private Map _outstandingJbiExchanges = new HashMap();

        synchronized boolean track(javax.jbi.messaging.MessageExchange jbiMex) {
            boolean found = _outstandingJbiExchanges.containsKey(jbiMex.getExchangeId());
            _outstandingJbiExchanges.put(jbiMex.getExchangeId(), jbiMex);
            return found;
        }

        synchronized javax.jbi.messaging.MessageExchange peek(String clientId) {
            return _outstandingJbiExchanges.get(clientId);
        }

        synchronized javax.jbi.messaging.MessageExchange consume(String clientId) {
            return _outstandingJbiExchanges.remove(clientId);
        }
    }
}
File
OdeService.java
Developer's decision
Version 2
Kind of conflict
Class declaration
Comment
Chunk
Conflicting content
    SchedulerThread(TaskRunner runner) {
        _todo = new PriorityBlockingQueue(TODO_QUEUE_INITIAL_CAPACITY,
<<<<<<< HEAD
                new TaskComparatorByDate());
=======
                new JobComparatorByDate());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        _taskrunner = runner;
    }
Solution content
    SchedulerThread(TaskRunner runner) {
        _todo = new PriorityBlockingQueue(TODO_QUEUE_INITIAL_CAPACITY,
                new JobComparatorByDate());
        _taskrunner = runner;
    }
File
SchedulerThread.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
    /**
     * Add a job to the todo queue.
<<<<<<< HEAD
     *
=======
     * 
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
     * @param job
     */
    void enqueue(Task task) {
Solution content
    /**
     * Add a job to the todo queue.
     * 
     * @param job
     */
    void enqueue(Task task) {
File
SchedulerThread.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
        }
    }

<<<<<<< HEAD

    /**
     * Get the size of the todo queue.
     *
=======
    /**
     * Get the size of the todo queue.
     * 
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
     * @return
     */
    public int size() {
Solution content
        }
    }

    /**
     * Get the size of the todo queue.
     * 
     * @return
     */
    public int size() {
File
SchedulerThread.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
    /**
     * Calculate the time until the next available job.
<<<<<<< HEAD
     *
=======
     * 
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
     * @return time until next job, 0 if one is one is scheduled to go, and some
     *         really large number if there are no jobs to speak of
     */
Solution content
    /**
     * Calculate the time until the next available job.
     * 
     * @return time until next job, 0 if one is one is scheduled to go, and some
     *         really large number if there are no jobs to speak of
     */
File
SchedulerThread.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
    }

    /**
<<<<<<< HEAD
     * Remove the tasks of a given type from the list.
=======
     * Remove the tasks of a given type from the list. 
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
     * @param tasktype type of task
     */
    public void clearTasks(final Class tasktype) {
Solution content
    }

    /**
     * Remove the tasks of a given type from the list. 
     * @param tasktype type of task
     */
    public void clearTasks(final Class tasktype) {
File
SchedulerThread.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import java.util.concurrent.Callable;
package org.apache.ode.scheduler.simple;

import java.util.*;
<<<<<<< HEAD
=======
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicLong;
Solution content
package org.apache.ode.scheduler.simple;

import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicLong;
File
SimpleScheduler.java
Developer's decision
Manual
Kind of conflict
Import
Chunk
Conflicting content
import org.apache.ode.bpel.common.CorrelationKey;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.Scheduler;
<<<<<<< HEAD
import org.apache.ode.dao.scheduler.JobDAO;
import org.apache.ode.dao.scheduler.SchedulerDAOConnection;
import org.apache.ode.dao.scheduler.SchedulerDAOConnectionFactory;

/**
 * A reliable and relatively simple scheduler that uses a database to persist information about scheduled tasks.
 *
 * The challange is to achieve high performance in a small memory footprint without loss of reliability while supporting
 * distributed/clustered configurations.
 *
 * The design is based around three time horizons: "immediate", "near future", and "everything else". Immediate jobs (i.e. jobs that
 * are about to be up) are written to the database and kept in an in-memory priority queue. When they execute, they are removed from
 * the database. Near future jobs are placed in the database and assigned to the current node, however they are not stored in
 * memory. Periodically jobs are "upgraded" from near-future to immediate status, at which point they get loaded into memory. Jobs
 * that are further out in time, are placed in the database without a node identifer; when they are ready to be "upgraded" to
 * near-future jobs they are assigned to one of the known live nodes. Recovery is rather straighforward, with stale node identifiers
 * being reassigned to known good nodes.
=======
import org.apache.log4j.helpers.AbsoluteTimeDateFormat;
import org.apache.ode.bpel.iapi.Scheduler.JobType;

/**
 * A reliable and relatively simple scheduler that uses a database to persist information about
 * scheduled tasks.
 *
 * The challenge is to achieve high performance in a small memory footprint without loss of reliability
 * while supporting distributed/clustered configurations.
 *
 * The design is based around three time horizons: "immediate", "near future", and "everything else".
 * Immediate jobs (i.e. jobs that are about to be up) are written to the database and kept in
 * an in-memory priority queue. When they execute, they are removed from the database. Near future
 * jobs are placed in the database and assigned to the current node, however they are not stored in
 * memory. Periodically jobs are "upgraded" from near-future to immediate status, at which point they
 * get loaded into memory. Jobs that are further out in time, are placed in the database without a
 * node identifer; when they are ready to be "upgraded" to near-future jobs they are assigned to one
 * of the known live nodes. Recovery is rather straighforward, with stale node identifiers being
 * reassigned to known good nodes.
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
 *
 * @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
 *
Solution content
import org.apache.ode.bpel.common.CorrelationKey;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.log4j.helpers.AbsoluteTimeDateFormat;
import org.apache.ode.bpel.iapi.Scheduler.JobType;

/**
 * A reliable and relatively simple scheduler that uses a database to persist information about
 * scheduled tasks.
 *
 * The challenge is to achieve high performance in a small memory footprint without loss of reliability
 * while supporting distributed/clustered configurations.
 *
 * The design is based around three time horizons: "immediate", "near future", and "everything else".
 * Immediate jobs (i.e. jobs that are about to be up) are written to the database and kept in
 * an in-memory priority queue. When they execute, they are removed from the database. Near future
 * jobs are placed in the database and assigned to the current node, however they are not stored in
 * memory. Periodically jobs are "upgraded" from near-future to immediate status, at which point they
 * get loaded into memory. Jobs that are further out in time, are placed in the database without a
 * node identifer; when they are ready to be "upgraded" to near-future jobs they are assigned to one
 * of the known live nodes. Recovery is rather straighforward, with stale node identifiers being
 * reassigned to known good nodes.
 *
 * @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
 *
File
SimpleScheduler.java
Developer's decision
Version 2
Kind of conflict
Comment
Import
Chunk
Conflicting content
 *
 */
public class SimpleScheduler implements Scheduler, TaskRunner {
<<<<<<< HEAD

  private static final Log __log = LogFactory.getLog(SimpleScheduler.class);
  /**
   * Jobs scheduled with a time that is between [now, now+immediateInterval] will be assigned to the current node, and placed
   * directly on the todo queue.
   */

  long _immediateInterval = 30000;
  /**
   * Jobs sccheduled with a time that is between (now+immediateInterval,now+nearFutureInterval) will be assigned to the current
   * node, but will not be placed on the todo queue (the promoter will pick them up).
   */
  long _nearFutureInterval = 10 * 60 * 1000;
  /** 10s of no communication and you are deemed dead. */
  long _staleInterval = 10000;
  String _nodeId;
  /** Maximum number of jobs in the "near future" / todo queue. */
  int _todoLimit = 10000;
  /** The object that actually handles the jobs. */
  volatile JobProcessor _jobProcessor;
  volatile JobProcessor _polledRunnableProcessor;
  private SchedulerThread _todo;
  private SchedulerDAOConnectionFactory _dbcf;
  private TransactionManager _txm;
  /** All the nodes we know about */
  private CopyOnWriteArraySet _knownNodes = new CopyOnWriteArraySet();
  /** When we last heard from our nodes. */
  private ConcurrentHashMap _lastHeartBeat = new ConcurrentHashMap();
  private boolean _running;
  /** Time for next upgrade. */
  private AtomicLong _nextUpgrade = new AtomicLong();
  /** Time for next job load */
  private AtomicLong _nextScheduleImmediate = new AtomicLong();
  private Random _random = new Random();

  public SimpleScheduler(String nodeId, SchedulerDAOConnectionFactory dbcf, TransactionManager mgr, Properties conf) {
    _nodeId = nodeId;
    _dbcf = dbcf;
    _txm = mgr;
    _todoLimit = Integer.parseInt(conf.getProperty("ode.scheduler.queueLength", "10000"));
    _todo = new SchedulerThread(this);
  }

  public void setNodeId(String nodeId) {
    _nodeId = nodeId;
  }

  public void setStaleInterval(long staleInterval) {
    _staleInterval = staleInterval;
  }

  public void setImmediateInterval(long immediateInterval) {
    _immediateInterval = immediateInterval;
  }

  public void setNearFutureInterval(long nearFutureInterval) {
    _nearFutureInterval = nearFutureInterval;
  }

  public void setSchedulerDAOConnectionFactory(SchedulerDAOConnectionFactory dbcf) {
    _dbcf = dbcf;
  }

  public void setPolledRunnableProcesser(JobProcessor polledRunnableProcessor) {
    _polledRunnableProcessor = polledRunnableProcessor;
  }

    public void cancelJob(final String jobId) throws ContextException {
        SchedulerDAOConnection conn = _dbcf.getConnection();
        _todo.dequeue(new JobDAOTask(jobId));
        if (!conn.deleteJob(jobId, _nodeId)) {
            __log.debug("Job removal failed.");
            throw new ContextException("Job removal failed.");
        }
    }

  public String schedulePersistedJob(final JobDetails jobDetail, Date when) throws ContextException {
    long ctime = System.currentTimeMillis();
    if (when == null) {
      when = new Date(ctime);
    }

    if (__log.isDebugEnabled()) {
      __log.debug("scheduling " + jobDetail + " for " + when);
    }

    return schedulePersistedJob(jobDetail, true, when, ctime);
  }

  public String scheduleMapSerializableRunnable(MapSerializableRunnable runnable, Date when) throws ContextException {
    long ctime = System.currentTimeMillis();
    if (when == null) {
      when = new Date(ctime);
    }

    JobDetails jobDetails = new JobDetails();
    jobDetails.getDetailsExt().put("runnable", runnable);
    runnable.storeToDetails(jobDetails);
=======
    private static final Log __log = LogFactory.getLog(SimpleScheduler.class);

    private static final int DEFAULT_TRANSACTION_TIMEOUT = 60 * 1000;

    /**
    /** Maximum number of jobs in the "near future" / todo queue. */
     * Jobs scheduled with a time that is between [now, now+immediateInterval] will be assigned to the current node, and placed
     * directly on the todo queue.
     */
    long _immediateInterval = 30000;

    /**
     * Jobs scheduled with a time that is between (now+immediateInterval,now+nearFutureInterval) will be assigned to the current
     * node, but will not be placed on the todo queue (the promoter will pick them up).
     */
    long _nearFutureInterval = 10 * 60 * 1000;

    /** 10s of no communication and you are deemed dead. */
    long _staleInterval = 10000;

    /** Duration used to log a warning if a job scheduled at a date D is queued at D'>D+_warningDelay */
    long _warningDelay = 5*60*1000;

    /**
     * Estimated sustained transaction per second capacity of the system.
     * e.g. 100 means the system can process 100 jobs per seconds, on average
     * This number is used to determine how many jobs to load from the database at once.
     */
    int _tps = 100;

    TransactionManager _txm;

    ExecutorService _exec;

    String _nodeId;
    int _todoLimit = 10000;

    /** The object that actually handles the jobs. */
    volatile JobProcessor _jobProcessor;

    volatile JobProcessor _polledRunnableProcessor;

    private SchedulerThread _todo;

    private DatabaseDelegate _db;

    /** All the nodes we know about */
    private CopyOnWriteArraySet _knownNodes = new CopyOnWriteArraySet();

    /** When we last heard from our nodes. */
    private ConcurrentHashMap _lastHeartBeat = new ConcurrentHashMap();

    /** Set of outstanding jobs, i.e., jobs that have been enqueued but not dequeued or dispatched yet.
        Used to avoid cases where a job would be dispatched twice if the server is under high load and
        does not fully process a job before it is reloaded from the database. */
    private ConcurrentHashMap _outstandingJobs = new ConcurrentHashMap();
    /** Set of Jobs processed since the last LoadImmediate task.
        This prevents a race condition where a job is processed twice. This could happen if a LoadImediate tasks loads a job
        from the db before the job is processed but puts it in the _outstandingJobs map after the job was processed .
        In such a case the job is no longer in the _outstandingJobs map, and so it's queued again. */
    private ConcurrentHashMap _processedSinceLastLoadTask = new ConcurrentHashMap();

    private boolean _running;

    /** Time for next upgrade. */
    private AtomicLong _nextUpgrade = new AtomicLong();

    private Random _random = new Random();

    private long _pollIntervalForPolledRunnable = Long.getLong("org.apache.ode.polledRunnable.pollInterval", 10 * 60 * 1000);

    /** Number of immediate retries when the transaction fails **/
    private int _immediateTransactionRetryLimit = 3;

    /** Interval between immediate retries when the transaction fails **/
    private long _immediateTransactionRetryInterval = 1000;

    public SimpleScheduler(String nodeId, DatabaseDelegate del, Properties conf) {
        _nodeId = nodeId;
        _db = del;
        _todoLimit = getIntProperty(conf, "ode.scheduler.queueLength", _todoLimit);
        _immediateInterval = getLongProperty(conf, "ode.scheduler.immediateInterval", _immediateInterval);
        _nearFutureInterval = getLongProperty(conf, "ode.scheduler.nearFutureInterval", _nearFutureInterval);
        _staleInterval = getLongProperty(conf, "ode.scheduler.staleInterval", _staleInterval);
        _tps = getIntProperty(conf, "ode.scheduler.transactionsPerSecond", _tps);
        _warningDelay =  getLongProperty(conf, "ode.scheduler.warningDelay", _warningDelay);

        _immediateTransactionRetryLimit = getIntProperty(conf, "ode.scheduler.immediateTransactionRetryLimit", _immediateTransactionRetryLimit);
        _immediateTransactionRetryInterval = getLongProperty(conf, "ode.scheduler.immediateTransactionRetryInterval", _immediateTransactionRetryInterval);

        _todo = new SchedulerThread(this);
    }

    public void setPollIntervalForPolledRunnable(long pollIntervalForPolledRunnable) {
    if (__log.isDebugEnabled()) {
      __log.debug("scheduling " + jobDetails + " for " + when);
        _pollIntervalForPolledRunnable = pollIntervalForPolledRunnable;
    }

    private int getIntProperty(Properties props, String propName, int defaultValue) {
        String s = props.getProperty(propName);
        if (s != null) return Integer.parseInt(s);
        else return defaultValue;
    }

    private long getLongProperty(Properties props, String propName, long defaultValue) {
        String s = props.getProperty(propName);
        if (s != null) return Long.parseLong(s);
        else return defaultValue;
    }

    public void setNodeId(String nodeId) {
        _nodeId = nodeId;
    }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
Solution content
 *
 */
public class SimpleScheduler implements Scheduler, TaskRunner {
    private static final Log __log = LogFactory.getLog(SimpleScheduler.class);

    private static final int DEFAULT_TRANSACTION_TIMEOUT = 60 * 1000;

    /**
     * Jobs scheduled with a time that is between [now, now+immediateInterval] will be assigned to the current node, and placed
     * directly on the todo queue.
     */
    long _immediateInterval = 30000;

    /**
     * Jobs scheduled with a time that is between (now+immediateInterval,now+nearFutureInterval) will be assigned to the current
     * node, but will not be placed on the todo queue (the promoter will pick them up).
     */
    long _nearFutureInterval = 10 * 60 * 1000;

    /** 10s of no communication and you are deemed dead. */
    long _staleInterval = 10000;

    /** Duration used to log a warning if a job scheduled at a date D is queued at D'>D+_warningDelay */
    long _warningDelay = 5*60*1000;

    /**
     * Estimated sustained transaction per second capacity of the system.
     * e.g. 100 means the system can process 100 jobs per seconds, on average
     * This number is used to determine how many jobs to load from the database at once.
     */
    int _tps = 100;

    TransactionManager _txm;

    ExecutorService _exec;

    String _nodeId;

    /** Maximum number of jobs in the "near future" / todo queue. */
    int _todoLimit = 10000;

    /** The object that actually handles the jobs. */
    volatile JobProcessor _jobProcessor;

    volatile JobProcessor _polledRunnableProcessor;

    private SchedulerThread _todo;

    private DatabaseDelegate _db;

    /** All the nodes we know about */
    private CopyOnWriteArraySet _knownNodes = new CopyOnWriteArraySet();

    /** When we last heard from our nodes. */
    private ConcurrentHashMap _lastHeartBeat = new ConcurrentHashMap();

    /** Set of outstanding jobs, i.e., jobs that have been enqueued but not dequeued or dispatched yet.
        Used to avoid cases where a job would be dispatched twice if the server is under high load and
        does not fully process a job before it is reloaded from the database. */
    private ConcurrentHashMap _outstandingJobs = new ConcurrentHashMap();
    /** Set of Jobs processed since the last LoadImmediate task.
        This prevents a race condition where a job is processed twice. This could happen if a LoadImediate tasks loads a job
        from the db before the job is processed but puts it in the _outstandingJobs map after the job was processed .
        In such a case the job is no longer in the _outstandingJobs map, and so it's queued again. */
    private ConcurrentHashMap _processedSinceLastLoadTask = new ConcurrentHashMap();

    private boolean _running;

    /** Time for next upgrade. */
    private AtomicLong _nextUpgrade = new AtomicLong();

    private Random _random = new Random();

    private long _pollIntervalForPolledRunnable = Long.getLong("org.apache.ode.polledRunnable.pollInterval", 10 * 60 * 1000);

    /** Number of immediate retries when the transaction fails **/
    private int _immediateTransactionRetryLimit = 3;

    /** Interval between immediate retries when the transaction fails **/
    private long _immediateTransactionRetryInterval = 1000;

    public SimpleScheduler(String nodeId, DatabaseDelegate del, Properties conf) {
        _nodeId = nodeId;
        _db = del;
        _todoLimit = getIntProperty(conf, "ode.scheduler.queueLength", _todoLimit);
        _immediateInterval = getLongProperty(conf, "ode.scheduler.immediateInterval", _immediateInterval);
        _nearFutureInterval = getLongProperty(conf, "ode.scheduler.nearFutureInterval", _nearFutureInterval);
        _staleInterval = getLongProperty(conf, "ode.scheduler.staleInterval", _staleInterval);
        _tps = getIntProperty(conf, "ode.scheduler.transactionsPerSecond", _tps);
        _warningDelay =  getLongProperty(conf, "ode.scheduler.warningDelay", _warningDelay);

        _immediateTransactionRetryLimit = getIntProperty(conf, "ode.scheduler.immediateTransactionRetryLimit", _immediateTransactionRetryLimit);
        _immediateTransactionRetryInterval = getLongProperty(conf, "ode.scheduler.immediateTransactionRetryInterval", _immediateTransactionRetryInterval);

        _todo = new SchedulerThread(this);
    }

    public void setPollIntervalForPolledRunnable(long pollIntervalForPolledRunnable) {
        _pollIntervalForPolledRunnable = pollIntervalForPolledRunnable;
    }

    private int getIntProperty(Properties props, String propName, int defaultValue) {
        String s = props.getProperty(propName);
        if (s != null) return Integer.parseInt(s);
        else return defaultValue;
    }

    private long getLongProperty(Properties props, String propName, long defaultValue) {
        String s = props.getProperty(propName);
        if (s != null) return Long.parseLong(s);
        else return defaultValue;
    }

    public void setNodeId(String nodeId) {
        _nodeId = nodeId;
    }
File
SimpleScheduler.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
If statement
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
        return job;
    }

<<<<<<< HEAD
  public String schedulePersistedJob(JobDetails jobDetails, boolean transacted, Date when, long ctime) throws ContextException {
    boolean immediate = when.getTime() <= ctime + _immediateInterval;
    boolean nearfuture = !immediate && when.getTime() <= ctime + _nearFutureInterval;
    JobDAO job;

    if (immediate) {
      // If we have too many jobs in the queue, we don't allow any new ones
      if (_todo.size() > _todoLimit) {
        __log.error("The execution queue is backed up, the engine can't keep up with the load. Either "
                + "increase the queue size or regulate the flow.");
        return null;
      }
      job = insertJob(transacted, jobDetails, when.getTime(), _nodeId, true, true);
      __log.debug("scheduled immediate job: " + job.getJobId());
    } else if (nearfuture) {
      // Near future, assign the job to ourselves (why? -- this makes it very unlikely that we
      // would get two nodes trying to process the same instance, which causes unsightly rollbacks).
      job = insertJob(transacted, jobDetails, when.getTime(), _nodeId, false, false);
      __log.debug("scheduled near-future job: " + job.getJobId());
    } else /* far future */ {
      // Not the near future, we don't assign a node-id, we'll assign it later.
      job = insertJob(transacted, jobDetails, when.getTime(), null, false, false);
      __log.debug("scheduled far-future job: " + job.getJobId());
=======
    public void setTransactionsPerSecond(int tps) {
        _tps = tps;
    }

    public void setTransactionManager(TransactionManager txm) {
        _txm = txm;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }
    return job.getJobId();
  }
Solution content
    }

    public void setTransactionsPerSecond(int tps) {
        _tps = tps;
    }

    public void setTransactionManager(TransactionManager txm) {
        _txm = txm;
    }
File
SimpleScheduler.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
If statement
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
    _jobProcessor = processor;
  }

<<<<<<< HEAD
  public void shutdown() {
    stop();
    _jobProcessor = null;
    _todo = null;
  }

  public synchronized void start() {
    if (_running) {
      return;
    }

    _todo.clearTasks(UpgradeJobsTask.class);
    _todo.clearTasks(LoadImmediateTask.class);
    _todo.clearTasks(CheckStaleNodes.class);

    _knownNodes.clear();
=======
    public void setPolledRunnableProcesser(JobProcessor polledRunnableProcessor) {
        _polledRunnableProcessor = polledRunnableProcessor;
    }

    public void cancelJob(String jobId) throws ContextException {
        _todo.dequeue(new Job(0, jobId, false, null));
        _outstandingJobs.remove(jobId);
        try {
            _db.deleteJob(jobId, _nodeId);
        } catch (DatabaseException e) {
            __log.debug("Job removal failed.", e);
            throw new ContextException("Job removal failed.", e);
        }
    }

    public  Future execIsolatedTransaction(final Callable transaction) throws Exception, ContextException {
        return _exec.submit(new Callable() {
            public T call() throws Exception {
                try {
                    return execTransaction(transaction);
                } catch (Exception e) {
                    __log.error("An exception occured while executing an isolated transaction, " +
                            "the transaction is going to be abandoned.", e);
                    return null;
                }
            }
        });
    }

    public  T execTransaction(Callable transaction) throws Exception, ContextException {
        return execTransaction(transaction, 0);
    }

    public  T execTransaction(Callable transaction, int timeout) throws Exception, ContextException {
        TransactionManager txm = _txm;
        if( txm == null ) {
            throw new ContextException("Cannot locate the transaction manager; the server might be shutting down.");
        }

        // The value of the timeout is in seconds. If the value is zero, the transaction service restores the default value.
        if (timeout < 0) {
           throw new IllegalArgumentException("Timeout must be positive, received: "+timeout);
        }
        
        boolean existingTransaction = false;
        try {
            existingTransaction = txm.getTransaction() != null;
        } catch (Exception ex) {
            String errmsg = "Internal Error, could not get current transaction.";
            throw new ContextException(errmsg, ex);
        }

        // already in transaction, execute and return directly
        if (existingTransaction) {
            return transaction.call();
        }

        // run in new transaction
        Exception ex = null;
        int immediateRetryCount = _immediateTransactionRetryLimit;
        
        _txm.setTransactionTimeout(timeout);
        if(__log.isDebugEnabled() && timeout!=0) __log.debug("Custom transaction timeout: "+timeout);
        try {
            do {
                try {
                    if (__log.isDebugEnabled()) __log.debug("Beginning a new transaction");
                    txm.begin();
                } catch (Exception e) {
                    String errmsg = "Internal Error, could not begin transaction.";
                    throw new ContextException(errmsg, e);
                }
    
                try {
                    ex = null;
                    return transaction.call();
                } catch (Exception e) {
                    ex = e;
                } finally {
                    if (ex == null) {
                        if (__log.isDebugEnabled()) __log.debug("Commiting on " + txm + "...");
                        try {
                            txm.commit();
                        } catch( Exception e2 ) {
                            ex = e2;
                        }
                    } else {
                        if (__log.isDebugEnabled()) __log.debug("Rollbacking on " + txm + "...");
                        txm.rollback();
                    }
                    
                    if( ex != null && immediateRetryCount > 0 ) {
                        if (__log.isDebugEnabled())  __log.debug("Will retry the transaction in " + _immediateTransactionRetryInterval + " msecs on " + _txm + " for error: ", ex);
                        Thread.sleep(_immediateTransactionRetryInterval);
                    }
                }
            } while( immediateRetryCount-- > 0 );
        } finally {
            // 0 restores the default value
            _txm.setTransactionTimeout(0);
        }
        
        throw ex;
    }

    public void setRollbackOnly() throws Exception {
        TransactionManager txm = _txm;
        if( txm == null ) {
            throw new ContextException("Cannot locate the transaction manager; the server might be shutting down.");
        }
        
        txm.setRollbackOnly();
    }

    public void registerSynchronizer(final Synchronizer synch) throws ContextException {
        TransactionManager txm = _txm;
        if( txm == null ) {
            throw new ContextException("Cannot locate the transaction manager; the server might be shutting down.");
        }
        
        try {
            txm.getTransaction().registerSynchronization(new Synchronization() {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

      exec(new Callable() {
Solution content
    }

            try {

    public void setDatabaseDelegate(DatabaseDelegate dbd) {
        _db = dbd;
    }

    public void setExecutorService(ExecutorService executorService) {
        _exec = executorService;
    }

    public void setPolledRunnableProcesser(JobProcessor polledRunnableProcessor) {
        _polledRunnableProcessor = polledRunnableProcessor;
    }

    public void cancelJob(String jobId) throws ContextException {
        _outstandingJobs.remove(jobId);
        try {
            _db.deleteJob(jobId, _nodeId);
        } catch (DatabaseException e) {
        _todo.dequeue(new Job(0, jobId, false, null));
        }
        
        throw ex;
            __log.debug("Job removal failed.", e);
            throw new ContextException("Job removal failed.", e);
        }
    }

    public  Future execIsolatedTransaction(final Callable transaction) throws Exception, ContextException {
        return _exec.submit(new Callable() {
            public T call() throws Exception {
                try {
                    return execTransaction(transaction);
                } catch (Exception e) {
                    __log.error("An exception occured while executing an isolated transaction, " +
                            "the transaction is going to be abandoned.", e);
                    return null;
                }
            }
        });
    }

    public  T execTransaction(Callable transaction) throws Exception, ContextException {
        return execTransaction(transaction, 0);
    }

    public  T execTransaction(Callable transaction, int timeout) throws Exception, ContextException {
        TransactionManager txm = _txm;
        if( txm == null ) {
            throw new ContextException("Cannot locate the transaction manager; the server might be shutting down.");
        }

        // The value of the timeout is in seconds. If the value is zero, the transaction service restores the default value.
        if (timeout < 0) {
           throw new IllegalArgumentException("Timeout must be positive, received: "+timeout);
        }
        
        boolean existingTransaction = false;
        try {
            existingTransaction = txm.getTransaction() != null;
        } catch (Exception ex) {
            String errmsg = "Internal Error, could not get current transaction.";
            throw new ContextException(errmsg, ex);
        }

        // already in transaction, execute and return directly
        if (existingTransaction) {
            return transaction.call();
        }

        // run in new transaction
        Exception ex = null;
        int immediateRetryCount = _immediateTransactionRetryLimit;
        
        _txm.setTransactionTimeout(timeout);
        if(__log.isDebugEnabled() && timeout!=0) __log.debug("Custom transaction timeout: "+timeout);
        try {
            do {
                try {
                    if (__log.isDebugEnabled()) __log.debug("Beginning a new transaction");
                    txm.begin();
                } catch (Exception e) {
                    String errmsg = "Internal Error, could not begin transaction.";
                    throw new ContextException(errmsg, e);
                }
    
                try {
                    ex = null;
                    return transaction.call();
                } catch (Exception e) {
                    ex = e;
                } finally {
                    if (ex == null) {
                        if (__log.isDebugEnabled()) __log.debug("Commiting on " + txm + "...");
                        try {
                            txm.commit();
                        } catch( Exception e2 ) {
                            ex = e2;
                        }
                    } else {
                        if (__log.isDebugEnabled()) __log.debug("Rollbacking on " + txm + "...");
                        txm.rollback();
                    }
                    
                    if( ex != null && immediateRetryCount > 0 ) {
                        if (__log.isDebugEnabled())  __log.debug("Will retry the transaction in " + _immediateTransactionRetryInterval + " msecs on " + _txm + " for error: ", ex);
                        Thread.sleep(_immediateTransactionRetryInterval);
                    }
                }
            } while( immediateRetryCount-- > 0 );
        } finally {
            // 0 restores the default value
            _txm.setTransactionTimeout(0);
                final Scheduler.JobInfo jobInfo = new Scheduler.JobInfo(job.jobId, job.detail,
                        job.detail.getRetryCount());
                if (job.transacted) {
    public void setRollbackOnly() throws Exception {
        TransactionManager txm = _txm;
        if( txm == null ) {
            throw new ContextException("Cannot locate the transaction manager; the server might be shutting down.");
        }
        
        txm.setRollbackOnly();
    }

    public void registerSynchronizer(final Synchronizer synch) throws ContextException {
        TransactionManager txm = _txm;
        if( txm == null ) {
            throw new ContextException("Cannot locate the transaction manager; the server might be shutting down.");
        }
        
        try {
            txm.getTransaction().registerSynchronization(new Synchronization() {

                public void beforeCompletion() {
                    synch.beforeCompletion();
                }

                public void afterCompletion(int status) {
                    synch.afterCompletion(status == Status.STATUS_COMMITTED);
                }

            });
        } catch (Exception e) {
            throw new ContextException("Unable to register synchronizer.", e);
        }
    }

    public String schedulePersistedJob(final JobDetails jobDetail, Date when) throws ContextException {
        long ctime = System.currentTimeMillis();
        if (when == null)
            when = new Date(ctime);

        if (__log.isDebugEnabled())
            __log.debug("scheduling " + jobDetail + " for " + when);

        return schedulePersistedJob(new Job(when.getTime(), true, jobDetail), when, ctime);
    }

    public String scheduleMapSerializableRunnable(MapSerializableRunnable runnable, Date when) throws ContextException {
        long ctime = System.currentTimeMillis();
        if (when == null)
            when = new Date(ctime);

        JobDetails jobDetails = new JobDetails();
        jobDetails.getDetailsExt().put("runnable", runnable);
        runnable.storeToDetails(jobDetails);
        
        if (__log.isDebugEnabled())
            __log.debug("scheduling " + jobDetails + " for " + when);

        return schedulePersistedJob(new Job(when.getTime(), true, jobDetails), when, ctime);
    }

    private String schedulePersistedJob(Job job, Date when, long ctime) throws ContextException {
        boolean immediate = when.getTime() <= ctime + _immediateInterval;
        boolean nearfuture = !immediate && when.getTime() <= ctime + _nearFutureInterval;
        try {
            if (immediate) {
                // Immediate scheduling means we put it in the DB for safe keeping
                _db.insertJob(job, _nodeId, true);

                // And add it to our todo list .
                if (_outstandingJobs.size() < _todoLimit) {
                    addTodoOnCommit(job);
                }
                __log.debug("scheduled immediate job: " + job.jobId);
            } else if (nearfuture) {
                // Near future, assign the job to ourselves (why? -- this makes it very unlikely that we
                // would get two nodes trying to process the same instance, which causes unsightly rollbacks).
                _db.insertJob(job, _nodeId, false);
                __log.debug("scheduled near-future job: " + job.jobId);
            } else /* far future */ {
                // Not the near future, we don't assign a node-id, we'll assign it later.
                _db.insertJob(job, null, false);
                __log.debug("scheduled far-future job: " + job.jobId);
            }
        } catch (DatabaseException dbe) {
            __log.error("Database error.", dbe);
            throw new ContextException("Database error.", dbe);
        }
        return job.jobId;
    }

    public String scheduleVolatileJob(boolean transacted, JobDetails jobDetail) throws ContextException {
                                if (job.persisted)
        return scheduleVolatileJob(transacted, jobDetail, null);
    }

    public String scheduleVolatileJob(boolean transacted, JobDetails jobDetail, Date when) throws ContextException {
        long ctime = System.currentTimeMillis();
        if (when == null)
            when = new Date(ctime);
        Job job = new Job(when.getTime(), transacted, jobDetail);
        job.persisted = false;
        addTodoOnCommit(job);
        return job.toString();
    }

    public void setJobProcessor(JobProcessor processor) throws ContextException {
        _jobProcessor = processor;
    }

    public void shutdown() {
        stop();
        _jobProcessor = null;
        _txm = null;
        _todo = null;
    }

    public synchronized void start() {
        if (_running)
            return;

        if (_exec == null)
            _exec = Executors.newCachedThreadPool();

        _todo.clearTasks(UpgradeJobsTask.class);
        _todo.clearTasks(LoadImmediateTask.class);
        _todo.clearTasks(CheckStaleNodes.class);
        _processedSinceLastLoadTask.clear();
        _outstandingJobs.clear();

        _knownNodes.clear();

        try {
            execTransaction(new Callable() {

                public Void call() throws Exception {
                    _knownNodes.addAll(_db.getNodeIds());
                    return null;
                }

            });
        } catch (Exception ex) {
            __log.error("Error retrieving node list.", ex);
            throw new ContextException("Error retrieving node list.", ex);
        }

        long now = System.currentTimeMillis();

        // Pretend we got a heartbeat...
        for (String s : _knownNodes) _lastHeartBeat.put(s, now);

        // schedule immediate job loading for now!
        _todo.enqueue(new LoadImmediateTask(now));

        // schedule check for stale nodes, make it random so that the nodes don't overlap.
        _todo.enqueue(new CheckStaleNodes(now + randomMean(_staleInterval)));

        // do the upgrade sometime (random) in the immediate interval.
        _todo.enqueue(new UpgradeJobsTask(now + randomMean(_immediateInterval)));

        _todo.start();
        _running = true;
    }

    private long randomMean(long mean) {
        return (long) _random.nextDouble() * mean + (mean/2);
    }

    public synchronized void stop() {
        if (!_running)
            return;

        _todo.stop();
        _todo.clearTasks(UpgradeJobsTask.class);
        _todo.clearTasks(LoadImmediateTask.class);
        _todo.clearTasks(CheckStaleNodes.class);
        _processedSinceLastLoadTask.clear();
        _outstandingJobs.clear();

        // disable because this is not the right way to do it
        // will be fixed by ODE-595
        // graceful shutdown; any new submits will throw RejectedExecutionExceptions
//        _exec.shutdown();
        _running = false;
    }

    class RunJob implements Callable {
        final Job job;
        final JobProcessor processor;

        RunJob(Job job, JobProcessor processor) {
            this.job = job;
            this.processor = processor;
        }

        public Void call() throws Exception {
                    final boolean[] needRetry = new boolean[]{true};
                    try {
                        execTransaction(new Callable() {
                            public Void call() throws Exception {
    }

     /**
                                    if (!_db.deleteJob(job.jobId, _nodeId))
                                        throw new JobNoLongerInDbException(job.jobId, _nodeId);
                                try {
                                    processor.onScheduledJob(jobInfo);
                                    // If the job is a "runnable" job, schedule the next job occurence
                                    if (job.detail.getDetailsExt().get("runnable") != null && !"COMPLETED".equals(String.valueOf(jobInfo.jobDetail.getDetailsExt().get("runnable_status")))) {
                                        // the runnable is still in progress, schedule checker to 10 mins later
                                        if (_pollIntervalForPolledRunnable < 0) {
                                            if (__log.isWarnEnabled())
                                                __log.warn("The poll interval for polled runnables is negative; setting it to 1000ms");
                                            _pollIntervalForPolledRunnable = 1000;
                                        }
                                        job.schedDate = System.currentTimeMillis() + _pollIntervalForPolledRunnable;
                                        _db.insertJob(job, _nodeId, false);
                                    }
                                } catch (JobProcessorException jpe) {
                                    if (!jpe.retry) {
                                        needRetry[0] = false;
                                    }
                                    // Let execTransaction know that shit happened.
                                    throw jpe;
                                }
                                return null;
                            }
                        });
                    } catch (JobNoLongerInDbException jde) {
                        // This may happen if two node try to do the same job... we try to avoid
                        // it the synchronization is a best-effort but not perfect.
                        __log.debug("job no longer in db forced rollback: "+job);
                    } catch (final Exception ex) {
                        __log.error("Error while processing a "+(job.persisted?"":"non-")+"persisted job"+(needRetry[0] && job.persisted?": ":", no retry: ")+job, ex);

                        // We only get here if the above execTransaction fails, so that transaction got
                        // rollbacked already
                        if (job.persisted) {
                            execTransaction(new Callable() {
                                public Void call() throws Exception {
                                    if (needRetry[0]) {
                                        int retry = job.detail.getRetryCount() + 1;
                                        if (retry <= 10) {
                                            job.detail.setRetryCount(retry);
                                            long delay = (long)(Math.pow(5, retry));
                                            job.schedDate = System.currentTimeMillis() + delay*1000;
                                            _db.updateJob(job);
                                            __log.error("Error while processing job, retrying in " + delay + "s");
                                        } else {
                                            _db.deleteJob(job.jobId, _nodeId);
                                            __log.error("Error while processing job after 10 retries, no more retries:" + job);
                                        }
                                    } else {
                                        _db.deleteJob(job.jobId, _nodeId);
                                    }
                                    return null;
                                }
                            });
                        }
                    }
                } else {
                    processor.onScheduledJob(jobInfo);
                }
                return null;
            } finally {
                // the order of these 2 actions is crucial to avoid a race condition.
                _processedSinceLastLoadTask.put(job.jobId, job.schedDate);
                _outstandingJobs.remove(job.jobId);
            }
        }
    }
    
    /**
     * Run a job in the current thread.
     *
     * @param job job to run.
     */
    protected void runJob(final Job job) {
        _exec.submit(new RunJob(job, _jobProcessor));
     * Run a job from a polled runnable thread. The runnable is not persistent,
     * however, the poller is persistent and wakes up every given interval to
     * check the status of the runnable.
     * 
    *
  • 1. The runnable is being scheduled; the poller persistent job dispatches * the runnable to a runnable delegate thread and schedules itself to a later time.
  • *
  • 2. The runnable is running; the poller job re-schedules itself every time it * sees the runnable is not completed.
  • *
  • 3. The runnable failed; the poller job passes the exception thrown on the runnable * down, and the standard scheduler retries happen.
  • *
  • 4. The runnable completes; the poller persistent does not re-schedule itself.
  • *
  • 5. System powered off and restarts; the poller job does not know what the status * of the runnable. This is handled just like the case #1.
  • *
*

* There is at least one re-scheduling of the poller job. Since, the runnable's state is * not persisted, and the same runnable may be tried again after system failure, * the runnable that's used with this polling should be repeatable. * * @param job job to run. */ protected void runPolledRunnable(final Job job) { _exec.submit(new RunJob(job, _polledRunnableProcessor)); } private void addTodoOnCommit(final Job job) { registerSynchronizer(new Synchronizer() { public void afterCompletion(boolean success) { if (success) { enqueue(job); } } public void beforeCompletion() { } }); } public boolean isTransacted() { TransactionManager txm = _txm; if( txm == null ) { throw new ContextException("Cannot locate the transaction manager; the server might be shutting down."); } try { Transaction tx = txm.getTransaction(); return (tx != null && tx.getStatus() != Status.STATUS_NO_TRANSACTION); } catch (SystemException e) { throw new ContextException("Internal Error: Could not obtain transaction status."); } } public void runTask(final Task task) { if (task instanceof Job) { Job job = (Job)task; if( job.detail.getDetailsExt().get("runnable") != null ) { runPolledRunnable(job); } else { runJob(job); } } else if (task instanceof SchedulerTask) { _exec.submit(new Callable() { public Void call() throws Exception { try { ((SchedulerTask) task).run(); } catch (Exception ex) { __log.error("Error during SchedulerTask execution", ex); } return null; } }); } } public void updateHeartBeat(String nodeId) { if (nodeId == null) return; if (_nodeId.equals(nodeId)) return; _lastHeartBeat.put(nodeId, System.currentTimeMillis()); _knownNodes.add(nodeId); } boolean doLoadImmediate() { __log.debug("LOAD IMMEDIATE started"); // don't load anything if we're already half-full; we've got plenty to do already if (_outstandingJobs.size() > _todoLimit/2) return true; List jobs; try { // don't load more than we can chew final int batch = Math.min((int) (_immediateInterval * _tps / 1000), _todoLimit-_outstandingJobs.size()); // jobs might have been enqueued by #addTodoOnCommit meanwhile if (batch<=0) { if (__log.isDebugEnabled()) __log.debug("Max capacity reached: "+_outstandingJobs.size()+" jobs dispacthed i.e. queued or being executed"); return true; } if (__log.isDebugEnabled()) __log.debug("loading "+batch+" jobs from db"); jobs = execTransaction(new Callable>() { public List call() throws Exception { return _db.dequeueImmediate(_nodeId, System.currentTimeMillis() + _immediateInterval, batch); } }); if (__log.isDebugEnabled()) __log.debug("loaded "+jobs.size()+" jobs from db"); long delayedTime = System.currentTimeMillis() - _warningDelay; int delayedCount = 0; boolean runningLate; AbsoluteTimeDateFormat f = new AbsoluteTimeDateFormat(); for (Job j : jobs) { // jobs might have been enqueued by #addTodoOnCommit meanwhile if (_outstandingJobs.size() >= _todoLimit){ if (__log.isDebugEnabled()) __log.debug("Max capacity reached: "+_outstandingJobs.size()+" jobs dispacthed i.e. queued or being executed"); break; } runningLate = j.schedDate <= delayedTime; if (runningLate) { delayedCount++; } if (__log.isDebugEnabled()) __log.debug("todo.enqueue job from db: " + j.jobId.trim() + " for " + j.schedDate + "(" + f.format(j.schedDate)+") "+(runningLate?" delayed=true":"")); enqueue(j); } if (delayedCount > 0) { __log.warn("Dispatching jobs with more than "+(_warningDelay/60000)+" minutes delay. Either the server was down for some time or the job load is greater than available capacity"); } // clear only if the batch succeeded _processedSinceLastLoadTask.clear(); return true; } catch (Exception ex) { __log.error("Error loading immediate jobs from database.", ex); return false; } finally { __log.debug("LOAD IMMEDIATE complete"); } } void enqueue(Job job) { if (_processedSinceLastLoadTask.get(job.jobId) == null) { if (_outstandingJobs.putIfAbsent(job.jobId, job.schedDate) == null) { if (job.schedDate <= System.currentTimeMillis()) { runJob(job); } else { _todo.enqueue(job); } } else { if (__log.isDebugEnabled()) __log.debug("Job "+job.jobId+" is being processed (outstanding job)"); } } else { if (__log.isDebugEnabled()) __log.debug("Job "+job.jobId+" is being processed (processed since last load)"); } } boolean doUpgrade() { __log.debug("UPGRADE started"); final ArrayList knownNodes = new ArrayList(_knownNodes); // Don't forget about self. knownNodes.add(_nodeId); Collections.sort(knownNodes); // We're going to try to upgrade near future jobs using the db only. // We assume that the distribution of the trailing digits in the // scheduled time are uniformly distributed, and use modular division // of the time by the number of nodes to create the node assignment. // This can be done in a single update statement. final long maxtime = System.currentTimeMillis() + _nearFutureInterval; try { return execTransaction(new Callable() { public Boolean call() throws Exception { int numNodes = knownNodes.size(); for (int i = 0; i < numNodes; ++i) { String node = knownNodes.get(i); _db.updateAssignToNode(node, i, numNodes, maxtime); } return true; } }); } catch (Exception ex) { __log.error("Database error upgrading jobs.", ex); return false; } finally { __log.debug("UPGRADE complete"); } } /** * Re-assign stale node's jobs to self. * @param nodeId */ void recoverStaleNode(final String nodeId) { __log.debug("recovering stale node " + nodeId); try { int numrows = execTransaction(new Callable() { public Integer call() throws Exception { return _db.updateReassign(nodeId, _nodeId); } }); __log.debug("reassigned " + numrows + " jobs to self. "); // We can now forget about this node, if we see it again, it will be // "new to us" _knownNodes.remove(nodeId); _lastHeartBeat.remove(nodeId); // Force a load-immediate to catch anything new from the recovered node. doLoadImmediate(); } catch (Exception ex) { __log.error("Database error reassigning node.", ex); } finally { __log.debug("node recovery complete"); } } // private long doRetry(Job job) throws DatabaseException { // int retry = job.detail.getRetryCount() + 1; // job.detail.setRetryCount(retry); // long delay = (long)(Math.pow(5, retry - 1)); // Job jobRetry = new Job(System.currentTimeMillis() + delay*1000, true, job.detail); // _db.insertJob(jobRetry, _nodeId, false); // return delay; // } private abstract class SchedulerTask extends Task implements Runnable { SchedulerTask(long schedDate) { super(schedDate); } } private class LoadImmediateTask extends SchedulerTask { LoadImmediateTask(long schedDate) { super(schedDate); } public void run() { boolean success = false; try { success = doLoadImmediate(); } finally { if (success) _todo.enqueue(new LoadImmediateTask(System.currentTimeMillis() + (long) (_immediateInterval * .90))); else _todo.enqueue(new LoadImmediateTask(System.currentTimeMillis() + 1000)); } } } /** * Upgrade jobs from far future to immediate future (basically, assign them to a node). * @author mszefler * */ private class UpgradeJobsTask extends SchedulerTask { UpgradeJobsTask(long schedDate) { super(schedDate); } public void run() { long ctime = System.currentTimeMillis(); long ntime = _nextUpgrade.get(); __log.debug("UPGRADE task for " + schedDate + " fired at " + ctime); // We could be too early, this can happen if upgrade gets delayed due to another // node if (_nextUpgrade.get() > System.currentTimeMillis()) { __log.debug("UPGRADE skipped -- wait another " + (ntime - ctime) + "ms"); _todo.enqueue(new UpgradeJobsTask(ntime)); return; } boolean success = false; try { success = doUpgrade(); } finally { long future = System.currentTimeMillis() + (success ? (long) (_nearFutureInterval * .50) : 1000); _nextUpgrade.set(future); _todo.enqueue(new UpgradeJobsTask(future)); __log.debug("UPGRADE completed, success = " + success + "; next time in " + (future - ctime) + "ms"); } } } /** * Check if any of the nodes in our cluster are stale. */ private class CheckStaleNodes extends SchedulerTask { CheckStaleNodes(long schedDate) { super(schedDate); } public void run() { _todo.enqueue(new CheckStaleNodes(System.currentTimeMillis() + _staleInterval)); __log.debug("CHECK STALE NODES started"); for (String nodeId : _knownNodes) { Long lastSeen = _lastHeartBeat.get(nodeId); if ((lastSeen == null || (System.currentTimeMillis() - lastSeen) > _staleInterval) && !_nodeId.equals(nodeId)) { recoverStaleNode(nodeId); } } } } }

File
SimpleScheduler.java
Developer's decision
Manual
Kind of conflict
Attribute
If statement
Method declaration
Method invocation
Method signature
Try statement
Variable
Chunk
Conflicting content
<<<<<<< HEAD
    // schedule immediate job loading for now!
    _todo.enqueue(new LoadImmediateTask(System.currentTimeMillis()));

      _lastHeartBeat.put(s, System.currentTimeMillis());
    }

    // schedule check for stale nodes, make it random so that the nodes don't overlap.
    _todo.enqueue(new CheckStaleNodes(System.currentTimeMillis() + (long) (_random.nextDouble() * _staleInterval)));

    // do the upgrade sometime (random) in the immediate interval.
    _todo.enqueue(new UpgradeJobsTask(System.currentTimeMillis() + (long) (_random.nextDouble() * _immediateInterval)));

    _todo.start();
    _running = true;
  }

  public synchronized void stop() {
    if (!_running) {
      return;
=======
    public String schedulePersistedJob(final JobDetails jobDetail, Date when) throws ContextException {
        long ctime = System.currentTimeMillis();
        if (when == null)
            when = new Date(ctime);

        if (__log.isDebugEnabled())
            __log.debug("scheduling " + jobDetail + " for " + when);

        return schedulePersistedJob(new Job(when.getTime(), true, jobDetail), when, ctime);
    }

    public String scheduleMapSerializableRunnable(MapSerializableRunnable runnable, Date when) throws ContextException {
        long ctime = System.currentTimeMillis();
        if (when == null)
            when = new Date(ctime);

        JobDetails jobDetails = new JobDetails();
        jobDetails.getDetailsExt().put("runnable", runnable);
        runnable.storeToDetails(jobDetails);
        
        if (__log.isDebugEnabled())
            __log.debug("scheduling " + jobDetails + " for " + when);

        return schedulePersistedJob(new Job(when.getTime(), true, jobDetails), when, ctime);
    }

    private String schedulePersistedJob(Job job, Date when, long ctime) throws ContextException {
        boolean immediate = when.getTime() <= ctime + _immediateInterval;
        boolean nearfuture = !immediate && when.getTime() <= ctime + _nearFutureInterval;
        try {
            if (immediate) {
                // Immediate scheduling means we put it in the DB for safe keeping
                _db.insertJob(job, _nodeId, true);

                // And add it to our todo list .
                if (_outstandingJobs.size() < _todoLimit) {
                    addTodoOnCommit(job);
                }
                __log.debug("scheduled immediate job: " + job.jobId);
            } else if (nearfuture) {
                // Near future, assign the job to ourselves (why? -- this makes it very unlikely that we
                // would get two nodes trying to process the same instance, which causes unsightly rollbacks).
                _db.insertJob(job, _nodeId, false);
                __log.debug("scheduled near-future job: " + job.jobId);
            } else /* far future */ {
                // Not the near future, we don't assign a node-id, we'll assign it later.
                _db.insertJob(job, null, false);
                __log.debug("scheduled far-future job: " + job.jobId);
            }
        } catch (DatabaseException dbe) {
            __log.error("Database error.", dbe);
            throw new ContextException("Database error.", dbe);
        }
        return job.jobId;
    }

    public String scheduleVolatileJob(boolean transacted, JobDetails jobDetail) throws ContextException {
        return scheduleVolatileJob(transacted, jobDetail, null);
    }

    public String scheduleVolatileJob(boolean transacted, JobDetails jobDetail, Date when) throws ContextException {
        long ctime = System.currentTimeMillis();
        if (when == null)
            when = new Date(ctime);
        Job job = new Job(when.getTime(), transacted, jobDetail);
        job.persisted = false;
        addTodoOnCommit(job);
        return job.toString();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    _todo.stop();
Solution content
                public void beforeCompletion() {
                    synch.beforeCompletion();
                }

                public void afterCompletion(int status) {
                    synch.afterCompletion(status == Status.STATUS_COMMITTED);
                }

            });
        } catch (Exception e) {
            throw new ContextException("Unable to register synchronizer.", e);
        }
    }

    public String schedulePersistedJob(final JobDetails jobDetail, Date when) throws ContextException {
        long ctime = System.currentTimeMillis();
        if (when == null)
            when = new Date(ctime);

        if (__log.isDebugEnabled())
            __log.debug("scheduling " + jobDetail + " for " + when);

        return schedulePersistedJob(new Job(when.getTime(), true, jobDetail), when, ctime);
    }

    public String scheduleMapSerializableRunnable(MapSerializableRunnable runnable, Date when) throws ContextException {
        long ctime = System.currentTimeMillis();
        if (when == null)
            when = new Date(ctime);

        JobDetails jobDetails = new JobDetails();
        jobDetails.getDetailsExt().put("runnable", runnable);
        runnable.storeToDetails(jobDetails);
        
        if (__log.isDebugEnabled())
            __log.debug("scheduling " + jobDetails + " for " + when);

        return schedulePersistedJob(new Job(when.getTime(), true, jobDetails), when, ctime);
    }

    private String schedulePersistedJob(Job job, Date when, long ctime) throws ContextException {
        boolean immediate = when.getTime() <= ctime + _immediateInterval;
        boolean nearfuture = !immediate && when.getTime() <= ctime + _nearFutureInterval;
        try {
            if (immediate) {
                // Immediate scheduling means we put it in the DB for safe keeping
                _db.insertJob(job, _nodeId, true);

                // And add it to our todo list .
                if (_outstandingJobs.size() < _todoLimit) {
                    addTodoOnCommit(job);
                }
                __log.debug("scheduled immediate job: " + job.jobId);
            } else if (nearfuture) {
                // Near future, assign the job to ourselves (why? -- this makes it very unlikely that we
                _db.insertJob(job, _nodeId, false);
                // would get two nodes trying to process the same instance, which causes unsightly rollbacks).
                __log.debug("scheduled near-future job: " + job.jobId);
            } else /* far future */ {
                // Not the near future, we don't assign a node-id, we'll assign it later.
                _db.insertJob(job, null, false);
                __log.debug("scheduled far-future job: " + job.jobId);
            }
        } catch (DatabaseException dbe) {
            __log.error("Database error.", dbe);
            throw new ContextException("Database error.", dbe);
        }
        return job.jobId;
    }

    public String scheduleVolatileJob(boolean transacted, JobDetails jobDetail) throws ContextException {
        return scheduleVolatileJob(transacted, jobDetail, null);
    }

    public String scheduleVolatileJob(boolean transacted, JobDetails jobDetail, Date when) throws ContextException {
        long ctime = System.currentTimeMillis();
        if (when == null)
            when = new Date(ctime);
        Job job = new Job(when.getTime(), transacted, jobDetail);
        job.persisted = false;
        addTodoOnCommit(job);
        return job.toString();
    }
File
SimpleScheduler.java
Developer's decision
Manual
Kind of conflict
Attribute
Comment
If statement
Method declaration
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
        if (_running)
            return;

        if (_exec == null)
            _exec = Executors.newCachedThreadPool();

      __log.error("Error in scheduler processor.", ex);
    }

<<<<<<< HEAD
  }
=======
    public synchronized void start() {
        _todo.clearTasks(UpgradeJobsTask.class);
        _todo.clearTasks(LoadImmediateTask.class);
        _todo.clearTasks(CheckStaleNodes.class);
        _processedSinceLastLoadTask.clear();
        _outstandingJobs.clear();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

    private void addTodoOnCommit(final JobDAOTask job) {
Solution content
    }

    public synchronized void start() {
        if (_running)
            return;

        if (_exec == null)
            _exec = Executors.newCachedThreadPool();

        _todo.clearTasks(UpgradeJobsTask.class);
        _todo.clearTasks(LoadImmediateTask.class);
        _todo.clearTasks(CheckStaleNodes.class);
        _processedSinceLastLoadTask.clear();
        _outstandingJobs.clear();

        _knownNodes.clear();
File
SimpleScheduler.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Method signature
Chunk
Conflicting content
            throw new ContextException(errmsg, ex);
        }

<<<<<<< HEAD
        if (tx == null) {
            _todo.enqueue(job);
        } else {
            try {
                tx.registerSynchronization(new Synchronization() {

                    public void afterCompletion(int status) {
                        if (status == Status.STATUS_COMMITTED) {
                            _todo.enqueue(job);
                        }
                    }

                    public void beforeCompletion() {
                    }
                });
            } catch (Exception e) {
                String errmsg = "Unable to registrer synchronizer. ";
                __log.error(errmsg, e);
                throw new ContextException(errmsg, e);
            }
        }
    }

  public void runTask(Task task) {
    if (task instanceof JobDAOTask) {
      runJob(((JobDAOTask) task).dao);
    }
    if (task instanceof SchedulerTask) {
      ((SchedulerTask) task).run();
=======
        long now = System.currentTimeMillis();

        // Pretend we got a heartbeat...
        for (String s : _knownNodes) _lastHeartBeat.put(s, now);

        // schedule immediate job loading for now!
        _todo.enqueue(new LoadImmediateTask(now));

        // schedule check for stale nodes, make it random so that the nodes don't overlap.
        _todo.enqueue(new CheckStaleNodes(now + randomMean(_staleInterval)));

        // do the upgrade sometime (random) in the immediate interval.
        _todo.enqueue(new UpgradeJobsTask(now + randomMean(_immediateInterval)));

        _todo.start();
        _running = true;
    }

    private long randomMean(long mean) {
        return (long) _random.nextDouble() * mean + (mean/2);
    }

    public synchronized void stop() {
        if (!_running)
            return;

        _todo.stop();
        _todo.clearTasks(UpgradeJobsTask.class);
        _todo.clearTasks(LoadImmediateTask.class);
        _todo.clearTasks(CheckStaleNodes.class);
        _processedSinceLastLoadTask.clear();
        _outstandingJobs.clear();

        // disable because this is not the right way to do it
     * @param job job to run.
     */
                final Scheduler.JobInfo jobInfo = new Scheduler.JobInfo(job.jobId, job.detail,
                        job.detail.getRetryCount());
        // will be fixed by ODE-595
                if (job.transacted) {
                    final boolean[] needRetry = new boolean[]{true};
                    try {
        // graceful shutdown; any new submits will throw RejectedExecutionExceptions
//        _exec.shutdown();
        _running = false;
    }

    class RunJob implements Callable {
        final Job job;
        final JobProcessor processor;

        RunJob(Job job, JobProcessor processor) {
            this.job = job;
            this.processor = processor;
        }

        public Void call() throws Exception {
            try {
    /**
                        execTransaction(new Callable() {
                            public Void call() throws Exception {
                                if (job.persisted)
                                    if (!_db.deleteJob(job.jobId, _nodeId))
                                        throw new JobNoLongerInDbException(job.jobId, _nodeId);
                                try {
                                    processor.onScheduledJob(jobInfo);
                                    // If the job is a "runnable" job, schedule the next job occurence
                                    if (job.detail.getDetailsExt().get("runnable") != null && !"COMPLETED".equals(String.valueOf(jobInfo.jobDetail.getDetailsExt().get("runnable_status")))) {
                                        // the runnable is still in progress, schedule checker to 10 mins later
                                        if (_pollIntervalForPolledRunnable < 0) {
                                            if (__log.isWarnEnabled())
                                                __log.warn("The poll interval for polled runnables is negative; setting it to 1000ms");
                                            _pollIntervalForPolledRunnable = 1000;
                                        }
                                        job.schedDate = System.currentTimeMillis() + _pollIntervalForPolledRunnable;
                                        _db.insertJob(job, _nodeId, false);
                                    }
                                } catch (JobProcessorException jpe) {
                                    if (!jpe.retry) {
                                        needRetry[0] = false;
                                    }
                                    // Let execTransaction know that shit happened.
                                    throw jpe;
                                }
                                return null;
                            }
                        });
                    } catch (JobNoLongerInDbException jde) {
                        // This may happen if two node try to do the same job... we try to avoid
                        // it the synchronization is a best-effort but not perfect.
                        __log.debug("job no longer in db forced rollback: "+job);
                    } catch (final Exception ex) {
                        __log.error("Error while processing a "+(job.persisted?"":"non-")+"persisted job"+(needRetry[0] && job.persisted?": ":", no retry: ")+job, ex);

                        // We only get here if the above execTransaction fails, so that transaction got
                        // rollbacked already
                        if (job.persisted) {
                            execTransaction(new Callable() {
                                public Void call() throws Exception {
                                    if (needRetry[0]) {
                                        int retry = job.detail.getRetryCount() + 1;
                                        if (retry <= 10) {
                                            job.detail.setRetryCount(retry);
                                            long delay = (long)(Math.pow(5, retry));
                                            job.schedDate = System.currentTimeMillis() + delay*1000;
                                            _db.updateJob(job);
                                            __log.error("Error while processing job, retrying in " + delay + "s");
                                        } else {
                                            _db.deleteJob(job.jobId, _nodeId);
                                            __log.error("Error while processing job after 10 retries, no more retries:" + job);
                                        }
                                    } else {
     * Run a job in the current thread.
     *
                                        _db.deleteJob(job.jobId, _nodeId);
                                    }
                                    return null;
                                }
                            });
                        }
                    }
                } else {
                    processor.onScheduledJob(jobInfo);
                }
                return null;
            } finally {
                // the order of these 2 actions is crucial to avoid a race condition.
                _processedSinceLastLoadTask.put(job.jobId, job.schedDate);
                _outstandingJobs.remove(job.jobId);
            }
        }
    }
    
    protected void runJob(final Job job) {
        _exec.submit(new RunJob(job, _jobProcessor));
    }

     /**
     * Run a job from a polled runnable thread. The runnable is not persistent,
     * however, the poller is persistent and wakes up every given interval to
     * check the status of the runnable.
     * 
    *
  • 1. The runnable is being scheduled; the poller persistent job dispatches * the runnable to a runnable delegate thread and schedules itself to a later time.
  • *
  • 2. The runnable is running; the poller job re-schedules itself every time it * sees the runnable is not completed.
  • *
  • 3. The runnable failed; the poller job passes the exception thrown on the runnable * down, and the standard scheduler retries happen.
  • *
  • 4. The runnable completes; the poller persistent does not re-schedule itself.
  • *
  • 5. System powered off and restarts; the poller job does not know what the status * of the runnable. This is handled just like the case #1.
  • *
*

* There is at least one re-scheduling of the poller job. Since, the runnable's state is * not persisted, and the same runnable may be tried again after system failure, * the runnable that's used with this polling should be repeatable. * * @param job job to run. */ protected void runPolledRunnable(final Job job) { _exec.submit(new RunJob(job, _polledRunnableProcessor)); } private void addTodoOnCommit(final Job job) { registerSynchronizer(new Synchronizer() { public void afterCompletion(boolean success) { if (success) { enqueue(job); } } public void beforeCompletion() { } }); } public boolean isTransacted() { TransactionManager txm = _txm; if( txm == null ) { throw new ContextException("Cannot locate the transaction manager; the server might be shutting down."); } try { Transaction tx = txm.getTransaction(); return (tx != null && tx.getStatus() != Status.STATUS_NO_TRANSACTION); } catch (SystemException e) { throw new ContextException("Internal Error: Could not obtain transaction status."); } >>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a } }

Solution content
        RunJob(Job job, JobProcessor processor) {
            this.job = job;
            this.processor = processor;
        }

                public Void call() throws Exception {
                    _knownNodes.addAll(_db.getNodeIds());
                    return null;
                }

            });
        } catch (Exception ex) {
            __log.error("Error retrieving node list.", ex);
            throw new ContextException("Error retrieving node list.", ex);
        }

        long now = System.currentTimeMillis();

        // Pretend we got a heartbeat...
        for (String s : _knownNodes) _lastHeartBeat.put(s, now);

        // schedule immediate job loading for now!
        _todo.enqueue(new LoadImmediateTask(now));

        // schedule check for stale nodes, make it random so that the nodes don't overlap.
        _todo.enqueue(new CheckStaleNodes(now + randomMean(_staleInterval)));

        // do the upgrade sometime (random) in the immediate interval.
        _todo.enqueue(new UpgradeJobsTask(now + randomMean(_immediateInterval)));

        _todo.start();
        _running = true;
    }

    private long randomMean(long mean) {
        return (long) _random.nextDouble() * mean + (mean/2);
    }

    public synchronized void stop() {
        if (!_running)
            return;

        _todo.stop();
        _todo.clearTasks(UpgradeJobsTask.class);
        _todo.clearTasks(LoadImmediateTask.class);
        _todo.clearTasks(CheckStaleNodes.class);
        _processedSinceLastLoadTask.clear();
        _outstandingJobs.clear();

        // disable because this is not the right way to do it
        // will be fixed by ODE-595
        // graceful shutdown; any new submits will throw RejectedExecutionExceptions
//        _exec.shutdown();
        _running = false;
    }

    class RunJob implements Callable {
        final Job job;
        final JobProcessor processor;


        public Void call() throws Exception {
            try {
                final Scheduler.JobInfo jobInfo = new Scheduler.JobInfo(job.jobId, job.detail,
                        job.detail.getRetryCount());
                if (job.transacted) {
                    final boolean[] needRetry = new boolean[]{true};
                    try {
                        execTransaction(new Callable() {
                            public Void call() throws Exception {
                                if (job.persisted)
                                    if (!_db.deleteJob(job.jobId, _nodeId))
                                        throw new JobNoLongerInDbException(job.jobId, _nodeId);
                                try {
                                    processor.onScheduledJob(jobInfo);
                                    // If the job is a "runnable" job, schedule the next job occurence
                                    if (job.detail.getDetailsExt().get("runnable") != null && !"COMPLETED".equals(String.valueOf(jobInfo.jobDetail.getDetailsExt().get("runnable_status")))) {
                                        // the runnable is still in progress, schedule checker to 10 mins later
                                        if (_pollIntervalForPolledRunnable < 0) {
                                            if (__log.isWarnEnabled())
                                                __log.warn("The poll interval for polled runnables is negative; setting it to 1000ms");
                                            _pollIntervalForPolledRunnable = 1000;
                                        }
                                        job.schedDate = System.currentTimeMillis() + _pollIntervalForPolledRunnable;
                                        _db.insertJob(job, _nodeId, false);
                                    }
                                } catch (JobProcessorException jpe) {
                                    if (!jpe.retry) {
                                        needRetry[0] = false;
                                    }
                                    // Let execTransaction know that shit happened.
                                    throw jpe;
                                }
                                return null;
                            }
                        });
                    } catch (JobNoLongerInDbException jde) {
                        // This may happen if two node try to do the same job... we try to avoid
                        // it the synchronization is a best-effort but not perfect.
                        __log.debug("job no longer in db forced rollback: "+job);
                    } catch (final Exception ex) {
                        __log.error("Error while processing a "+(job.persisted?"":"non-")+"persisted job"+(needRetry[0] && job.persisted?": ":", no retry: ")+job, ex);

                        // We only get here if the above execTransaction fails, so that transaction got
                        // rollbacked already
                        if (job.persisted) {
                            execTransaction(new Callable() {
                                public Void call() throws Exception {
                                    if (needRetry[0]) {
                                        int retry = job.detail.getRetryCount() + 1;
                                        if (retry <= 10) {
                                            job.detail.setRetryCount(retry);
                                            long delay = (long)(Math.pow(5, retry));
                                            job.schedDate = System.currentTimeMillis() + delay*1000;
                                            _db.updateJob(job);
                                            __log.error("Error while processing job, retrying in " + delay + "s");
                                        } else {
                                            _db.deleteJob(job.jobId, _nodeId);
                                            __log.error("Error while processing job after 10 retries, no more retries:" + job);
                                        }
                                    } else {
                                        _db.deleteJob(job.jobId, _nodeId);
                                    }
                                    return null;
                                }
                            });
                        }
                    }
                } else {
                    processor.onScheduledJob(jobInfo);
                }
                return null;
            } finally {
                // the order of these 2 actions is crucial to avoid a race condition.
                _processedSinceLastLoadTask.put(job.jobId, job.schedDate);
                _outstandingJobs.remove(job.jobId);
            }
        }
    }
    
    /**
     * Run a job in the current thread.
     *
     * @param job job to run.
     */
    protected void runJob(final Job job) {
        _exec.submit(new RunJob(job, _jobProcessor));
    }

     /**
     * Run a job from a polled runnable thread. The runnable is not persistent,
     * however, the poller is persistent and wakes up every given interval to
     * check the status of the runnable.
     * 
    *
  • 1. The runnable is being scheduled; the poller persistent job dispatches * the runnable to a runnable delegate thread and schedules itself to a later time.
  • *
  • 2. The runnable is running; the poller job re-schedules itself every time it * sees the runnable is not completed.
  • *
  • 3. The runnable failed; the poller job passes the exception thrown on the runnable * down, and the standard scheduler retries happen.
  • *
  • 4. The runnable completes; the poller persistent does not re-schedule itself.
  • *
  • 5. System powered off and restarts; the poller job does not know what the status * of the runnable. This is handled just like the case #1.
  • *
*

* There is at least one re-scheduling of the poller job. Since, the runnable's state is * not persisted, and the same runnable may be tried again after system failure, * the runnable that's used with this polling should be repeatable. * * @param job job to run. */ protected void runPolledRunnable(final Job job) { _exec.submit(new RunJob(job, _polledRunnableProcessor)); } private void addTodoOnCommit(final Job job) { registerSynchronizer(new Synchronizer() { public void afterCompletion(boolean success) { if (success) { enqueue(job); } } public void beforeCompletion() { } }); } public boolean isTransacted() { TransactionManager txm = _txm; if( txm == null ) { throw new ContextException("Cannot locate the transaction manager; the server might be shutting down."); } try { Transaction tx = txm.getTransaction(); return (tx != null && tx.getStatus() != Status.STATUS_NO_TRANSACTION); } catch (SystemException e) { throw new ContextException("Internal Error: Could not obtain transaction status."); } }

File
SimpleScheduler.java
Developer's decision
Manual
Kind of conflict
Attribute
Class declaration
Comment
For statement
If statement
Method declaration
Method invocation
Method signature
Try statement
Variable
Chunk
Conflicting content
                runJob(job);
            }
    }
  }

<<<<<<< HEAD
  public void updateHeartBeat(String nodeId) {
    if (nodeId == null) {
      return;
=======
    public void runTask(final Task task) {
        if (task instanceof Job) {
            Job job = (Job)task;
            if( job.detail.getDetailsExt().get("runnable") != null ) {
                runPolledRunnable(job);
            } else {
        } else if (task instanceof SchedulerTask) {
            _exec.submit(new Callable() {
                public Void call() throws Exception {
                    try {
                        ((SchedulerTask) task).run();
                    } catch (Exception ex) {
                        __log.error("Error during SchedulerTask execution", ex);
                    }
                    return null;
                }
            });
        }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    if (_nodeId.equals(nodeId)) {
Solution content
    }

    public void runTask(final Task task) {
        if (task instanceof Job) {
            Job job = (Job)task;
            if( job.detail.getDetailsExt().get("runnable") != null ) {
                runPolledRunnable(job);
            } else {
                runJob(job);
            }
        } else if (task instanceof SchedulerTask) {
            _exec.submit(new Callable() {
                public Void call() throws Exception {
                    try {
                        ((SchedulerTask) task).run();
                    } catch (Exception ex) {
                        __log.error("Error during SchedulerTask execution", ex);
                    }
                    return null;
                }
            });
        }
    }
File
SimpleScheduler.java
Developer's decision
Combination
Kind of conflict
If statement
Method signature
Return statement
Chunk
Conflicting content
            jobs = exec(new Callable>() {

    boolean doLoadImmediate() {
        __log.debug("LOAD IMMEDIATE started");
<<<<<<< HEAD

        List jobs;
        do {
                public List call(SchedulerDAOConnection conn) throws ContextException {
                    return conn.dequeueImmediate(_nodeId, System.currentTimeMillis() + _immediateInterval, 10);
                }
            });
            if (jobs == null) {
                __log.error("Error loading immediate jobs from database.");
                return false;
            }
            for (JobDAO j : jobs) {
                if (__log.isDebugEnabled()) {
                    __log.debug("todo.enqueue job from db: " + j.getJobId() + " for " + j.getScheduledDate());
                }
                _todo.enqueue(new JobDAOTask(j));
            }

        } while (jobs.size() == 10);
        __log.debug("LOAD IMMEDIATE complete");
        return true;
=======

        // don't load anything if we're already half-full;  we've got plenty to do already
        if (_outstandingJobs.size() > _todoLimit/2) return true;

        List jobs;
        try {
            // don't load more than we can chew
            final int batch = Math.min((int) (_immediateInterval * _tps / 1000), _todoLimit-_outstandingJobs.size());

            // jobs might have been enqueued by #addTodoOnCommit meanwhile
            if (batch<=0) {
                if (__log.isDebugEnabled()) __log.debug("Max capacity reached: "+_outstandingJobs.size()+" jobs dispacthed i.e. queued or being executed");
                return true;
            }

            if (__log.isDebugEnabled()) __log.debug("loading "+batch+" jobs from db");
            jobs = execTransaction(new Callable>() {
                public List call() throws Exception {
                    return _db.dequeueImmediate(_nodeId, System.currentTimeMillis() + _immediateInterval, batch);
                }
            });
            if (__log.isDebugEnabled()) __log.debug("loaded "+jobs.size()+" jobs from db");

            long delayedTime = System.currentTimeMillis() - _warningDelay;
            int delayedCount = 0;
            boolean runningLate;
            AbsoluteTimeDateFormat f = new AbsoluteTimeDateFormat();
            for (Job j : jobs) {
                // jobs might have been enqueued by #addTodoOnCommit meanwhile
                if (_outstandingJobs.size() >= _todoLimit){
                    if (__log.isDebugEnabled()) __log.debug("Max capacity reached: "+_outstandingJobs.size()+" jobs dispacthed i.e. queued or being executed");
                    break;
                }
                runningLate = j.schedDate <= delayedTime;
                if (runningLate) {
                    delayedCount++;
                }
                if (__log.isDebugEnabled())
                    __log.debug("todo.enqueue job from db: " + j.jobId.trim() + " for " + j.schedDate + "(" + f.format(j.schedDate)+") "+(runningLate?" delayed=true":""));
                enqueue(j);
            }
            if (delayedCount > 0) {
                __log.warn("Dispatching jobs with more than "+(_warningDelay/60000)+" minutes delay. Either the server was down for some time or the job load is greater than available capacity");
            }

            // clear only if the batch succeeded
            _processedSinceLastLoadTask.clear();
            return true;
        } catch (Exception ex) {
            __log.error("Error loading immediate jobs from database.", ex);
            return false;
        } finally {
            __log.debug("LOAD IMMEDIATE complete");
        }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

    void enqueue(Job job) {
Solution content
        // don't load anything if we're already half-full;  we've got plenty to do already

    boolean doLoadImmediate() {
        __log.debug("LOAD IMMEDIATE started");

        if (_outstandingJobs.size() > _todoLimit/2) return true;

        List jobs;
        try {
            // don't load more than we can chew
            final int batch = Math.min((int) (_immediateInterval * _tps / 1000), _todoLimit-_outstandingJobs.size());

            // jobs might have been enqueued by #addTodoOnCommit meanwhile
            if (batch<=0) {
                if (__log.isDebugEnabled()) __log.debug("Max capacity reached: "+_outstandingJobs.size()+" jobs dispacthed i.e. queued or being executed");
                return true;
            }

            if (__log.isDebugEnabled()) __log.debug("loading "+batch+" jobs from db");
            jobs = execTransaction(new Callable>() {
                public List call() throws Exception {
                    return _db.dequeueImmediate(_nodeId, System.currentTimeMillis() + _immediateInterval, batch);
                }
            });
            if (__log.isDebugEnabled()) __log.debug("loaded "+jobs.size()+" jobs from db");

            long delayedTime = System.currentTimeMillis() - _warningDelay;
            int delayedCount = 0;
            boolean runningLate;
            AbsoluteTimeDateFormat f = new AbsoluteTimeDateFormat();
            for (Job j : jobs) {
                // jobs might have been enqueued by #addTodoOnCommit meanwhile
                if (_outstandingJobs.size() >= _todoLimit){
                    if (__log.isDebugEnabled()) __log.debug("Max capacity reached: "+_outstandingJobs.size()+" jobs dispacthed i.e. queued or being executed");
                    break;
                }
                runningLate = j.schedDate <= delayedTime;
                if (runningLate) {
                    delayedCount++;
                }
                if (__log.isDebugEnabled())
                    __log.debug("todo.enqueue job from db: " + j.jobId.trim() + " for " + j.schedDate + "(" + f.format(j.schedDate)+") "+(runningLate?" delayed=true":""));
                enqueue(j);
            }
            if (delayedCount > 0) {
                __log.warn("Dispatching jobs with more than "+(_warningDelay/60000)+" minutes delay. Either the server was down for some time or the job load is greater than available capacity");
            }

            // clear only if the batch succeeded
            _processedSinceLastLoadTask.clear();
            return true;
        } catch (Exception ex) {
            __log.error("Error loading immediate jobs from database.", ex);
            return false;
        } finally {
            __log.debug("LOAD IMMEDIATE complete");
        }
    }

    void enqueue(Job job) {
File
SimpleScheduler.java
Developer's decision
Version 2
Kind of conflict
Comment
Do statement
If statement
Method invocation
Return statement
Try statement
Variable
Chunk
Conflicting content
   */
    void recoverStaleNode(final String nodeId) {
        __log.debug("recovering stale node " + nodeId);
<<<<<<< HEAD
        int numrows = exec(new Callable() {

            public Integer call(SchedulerDAOConnection conn) throws ContextException {
                int numrows = conn.updateReassign(nodeId, _nodeId);
                if (numrows == -1) {
                    __log.error("Database error reassigning node.");
                    throw new ContextException("Database error reassigning node.");
                }
                __log.debug("reassigned " + numrows + " jobs to self. ");
                return numrows;

            }
        });

        // We can now forget about this node, if we see it again, it will be
        // "new to us"
        _knownNodes.remove(nodeId);
        _lastHeartBeat.remove(nodeId);

        // Force a load-immediate to catch anything new from the recovered node.
        doLoadImmediate();
        __log.debug("node recovery complete");
    }

    private long doRetry(final JobDAO job) {
        final int retry = job.getDetails().getRetryCount() + 1;
        final long delay = (long) (Math.pow(5, retry - 1));

        /*even though the JobDetails property is marked with Transient Hibernate
        still treats any changes to it as a modification and will attempt to persist it.
        for the new Job we will clone the existing details.*/

        Scheduler.JobDetails newJobDetails;
        try {
            newJobDetails = job.getDetails().clone();
        } catch (CloneNotSupportedException ce) {
            __log.error("Unable to clone job details", ce);
            return -1L;
        }
        newJobDetails.setRetryCount(newJobDetails.getRetryCount() + 1);
        SchedulerDAOConnection conn = _dbcf.getConnection();
        JobDAO jobRetry = conn.createJob(job.isTransacted(), newJobDetails, job.isPersisted(), System.currentTimeMillis() + delay * 1000);
        if (!conn.insertJob(jobRetry, _nodeId, false)) {
            __log.debug("retry failed for Job " + jobRetry.getJobId());
            return -1L;
=======
        try {
            int numrows = execTransaction(new Callable() {
                public Integer call() throws Exception {
                    return _db.updateReassign(nodeId, _nodeId);
                }
            });

            __log.debug("reassigned " + numrows + " jobs to self. ");

            // We can now forget about this node, if we see it again, it will be
            // "new to us"
            _knownNodes.remove(nodeId);
            _lastHeartBeat.remove(nodeId);

            // Force a load-immediate to catch anything new from the recovered node.
            doLoadImmediate();

        } catch (Exception ex) {
            __log.error("Database error reassigning node.", ex);
        } finally {
            __log.debug("node recovery complete");
        }
    }

//    private long doRetry(Job job) throws DatabaseException {
//        int retry = job.detail.getRetryCount() + 1;
//        job.detail.setRetryCount(retry);
//        long delay = (long)(Math.pow(5, retry - 1));
//        Job jobRetry = new Job(System.currentTimeMillis() + delay*1000, true, job.detail);
//        _db.insertJob(jobRetry, _nodeId, false);
//        return delay;
//    }

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }
    private abstract class SchedulerTask extends Task implements Runnable {
        SchedulerTask(long schedDate) {
            super(schedDate);
        }
    }

    private class LoadImmediateTask extends SchedulerTask {
        LoadImmediateTask(long schedDate) {
            super(schedDate);
        }

        public void run() {
            boolean success = false;
            try {
                success = doLoadImmediate();
            } finally {
                if (success)
                    _todo.enqueue(new LoadImmediateTask(System.currentTimeMillis() + (long) (_immediateInterval * .90)));
                else
                    _todo.enqueue(new LoadImmediateTask(System.currentTimeMillis() + 1000));
            }
        __log.debug("added retry for Job " + job.getJobId() + " at " + job.getScheduledDate() + " new Job: " + jobRetry.getJobId() + " at " + jobRetry.getScheduledDate());
        return delay;
Solution content
                }

            });

        } catch (Exception ex) {
            __log.error("Database error upgrading jobs.", ex);
            return false;
        } finally {
            __log.debug("UPGRADE complete");
        }

    }

    /**
     * Re-assign stale node's jobs to self.
     * @param nodeId
     */
    void recoverStaleNode(final String nodeId) {
        __log.debug("recovering stale node " + nodeId);
        try {
            int numrows = execTransaction(new Callable() {
                public Integer call() throws Exception {
                    return _db.updateReassign(nodeId, _nodeId);
                }
            });

            __log.debug("reassigned " + numrows + " jobs to self. ");

            // We can now forget about this node, if we see it again, it will be
            // "new to us"
            _knownNodes.remove(nodeId);
            _lastHeartBeat.remove(nodeId);

            // Force a load-immediate to catch anything new from the recovered node.
            doLoadImmediate();

        } catch (Exception ex) {
            __log.error("Database error reassigning node.", ex);
        } finally {
            __log.debug("node recovery complete");
        }
    }

//    private long doRetry(Job job) throws DatabaseException {
//        int retry = job.detail.getRetryCount() + 1;
//        job.detail.setRetryCount(retry);
//        long delay = (long)(Math.pow(5, retry - 1));
//        Job jobRetry = new Job(System.currentTimeMillis() + delay*1000, true, job.detail);
//        _db.insertJob(jobRetry, _nodeId, false);
//        return delay;
//    }

    private abstract class SchedulerTask extends Task implements Runnable {
        SchedulerTask(long schedDate) {
            super(schedDate);
        }
    }

    private class LoadImmediateTask extends SchedulerTask {
        LoadImmediateTask(long schedDate) {
            super(schedDate);
        }

        public void run() {
            boolean success = false;
            try {
                success = doLoadImmediate();
            } finally {
                if (success)
                    _todo.enqueue(new LoadImmediateTask(System.currentTimeMillis() + (long) (_immediateInterval * .90)));
                else
                    _todo.enqueue(new LoadImmediateTask(System.currentTimeMillis() + 1000));
            }
        }
File
SimpleScheduler.java
Developer's decision
Manual
Kind of conflict
Cast expression
Class declaration
Class signature
Comment
If statement
Method declaration
Method invocation
Method signature
Return statement
Try statement
Variable
Chunk
Conflicting content
     * @param 
     *            return type
     */
<<<<<<< HEAD
    abstract class Callable implements java.util.concurrent.Callable {
=======
    private class UpgradeJobsTask extends SchedulerTask {
        UpgradeJobsTask(long schedDate) {
            super(schedDate);
        }

        public void run() {
            long ctime = System.currentTimeMillis();
            long ntime = _nextUpgrade.get();
            __log.debug("UPGRADE task for " + schedDate + " fired at " + ctime);

            // We could be too early, this can happen if upgrade gets delayed due to another
            // node
            if (_nextUpgrade.get() > System.currentTimeMillis()) {
                __log.debug("UPGRADE skipped -- wait another " + (ntime - ctime) + "ms");
                _todo.enqueue(new UpgradeJobsTask(ntime));
                return;
            }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

        public V call() throws ContextException {
            boolean success = false;
Solution content
     */
    private class UpgradeJobsTask extends SchedulerTask {
        UpgradeJobsTask(long schedDate) {
            super(schedDate);
        }

        public void run() {
            long ctime = System.currentTimeMillis();
            long ntime = _nextUpgrade.get();
            __log.debug("UPGRADE task for " + schedDate + " fired at " + ctime);

            // We could be too early, this can happen if upgrade gets delayed due to another
            // node
            if (_nextUpgrade.get() > System.currentTimeMillis()) {
                __log.debug("UPGRADE skipped -- wait another " + (ntime - ctime) + "ms");
                _todo.enqueue(new UpgradeJobsTask(ntime));
                return;
            }

            boolean success = false;
File
SimpleScheduler.java
Developer's decision
Version 2
Kind of conflict
Class signature
Comment
If statement
Method declaration
Method invocation
Method signature
Variable
Chunk
Conflicting content
            } catch (Exception e) {
                throw new ContextException("TxError", e);
            } finally {
<<<<<<< HEAD

                try {
                    if (!success && _txm != null ) {
                        _txm.rollback();
                    }
                } catch (Exception ex) {
                    __log.error("TxError", ex);
                }
                conn.close();
=======
                long future = System.currentTimeMillis() + (success ? (long) (_nearFutureInterval * .50) : 1000);
                _nextUpgrade.set(future);
                _todo.enqueue(new UpgradeJobsTask(future));
                __log.debug("UPGRADE completed, success = " + success + "; next time in " + (future - ctime) + "ms");
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            }

        }
Solution content
            } finally {
                long future = System.currentTimeMillis() + (success ? (long) (_nearFutureInterval * .50) : 1000);
                _nextUpgrade.set(future);
                _todo.enqueue(new UpgradeJobsTask(future));
                __log.debug("UPGRADE completed, success = " + success + "; next time in " + (future - ctime) + "ms");
            }
        }
File
SimpleScheduler.java
Developer's decision
Version 2
Kind of conflict
Cast expression
Method invocation
Try statement
Variable
Chunk
Conflicting content
  }

  /**
      } finally {
            }

        }
<<<<<<< HEAD

        abstract V call(SchedulerDAOConnection conn) throws ContextException;
    }

  private abstract class SchedulerTask extends Task implements Runnable {

    SchedulerTask(long schedDate) {
      super(schedDate);
    }
  }

  private class LoadImmediateTask extends SchedulerTask {

    LoadImmediateTask(long schedDate) {
      super(schedDate);
    }

    public void run() {
      boolean success = false;
      try {
        success = doLoadImmediate();
      } finally {
        if (success) {
          _todo.enqueue(new LoadImmediateTask(System.currentTimeMillis() + (long) (_immediateInterval * .75)));
      boolean success = false;
      try {
        success = doUpgrade();
        } else {
          _todo.enqueue(new LoadImmediateTask(System.currentTimeMillis() + 100));
        }
      }
    }
        return;
      }

   * Upgrade jobs from far future to immediate future (basically, assign them to a node).
   *
   * @author mszefler
   *
   */
  private class UpgradeJobsTask extends SchedulerTask {

    UpgradeJobsTask(long schedDate) {
      super(schedDate);
    }

    public void run() {
      long ctime = System.currentTimeMillis();
      long ntime = _nextUpgrade.get();
      __log.debug("UPGRADE task for " + schedDate + " fired at " + ctime);

      // We could be too early, this can happen if upgrade gets delayed due to another
      // node
      if (_nextUpgrade.get() > System.currentTimeMillis()) {
        __log.debug("UPGRADE skipped -- wait another " + (ntime - ctime) + "ms");
        _todo.enqueue(new UpgradeJobsTask(ntime));
        long future = System.currentTimeMillis() + (success ? (long) (_nearFutureInterval * .50) : 100);
        _nextUpgrade.set(future);
        _todo.enqueue(new UpgradeJobsTask(future));
        __log.debug("UPGRADE completed, success = " + success + "; next time in " + (future - ctime) + "ms");
      }
    }
  }

  /**
   * Check if any of the nodes in our cluster are stale.
   */
  private class CheckStaleNodes extends SchedulerTask {

    CheckStaleNodes(long schedDate) {
      super(schedDate);
    }

    public void run() {
      _todo.enqueue(new CheckStaleNodes(System.currentTimeMillis() + _staleInterval));
      __log.debug("CHECK STALE NODES started");
      for (String nodeId : _knownNodes) {
        Long lastSeen = _lastHeartBeat.get(nodeId);
        if (lastSeen == null || (System.currentTimeMillis() - lastSeen) > _staleInterval) {
          recoverStaleNode(nodeId);
        }
      }
    }
  }
=======
    }

    /**
     * Check if any of the nodes in our cluster are stale.
     */
    private class CheckStaleNodes extends SchedulerTask {
        CheckStaleNodes(long schedDate) {
            super(schedDate);
        }

        public void run() {
            _todo.enqueue(new CheckStaleNodes(System.currentTimeMillis() + _staleInterval));
            __log.debug("CHECK STALE NODES started");
            for (String nodeId : _knownNodes) {
                Long lastSeen = _lastHeartBeat.get(nodeId);
                if ((lastSeen == null || (System.currentTimeMillis() - lastSeen) > _staleInterval)
                    && !_nodeId.equals(nodeId))
                {
                    recoverStaleNode(nodeId);
                }
            }
        }
    }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
            }
        }
    }

    /**
     * Check if any of the nodes in our cluster are stale.
     */
    private class CheckStaleNodes extends SchedulerTask {
        CheckStaleNodes(long schedDate) {
            super(schedDate);
        }

        public void run() {
            _todo.enqueue(new CheckStaleNodes(System.currentTimeMillis() + _staleInterval));
            __log.debug("CHECK STALE NODES started");
            for (String nodeId : _knownNodes) {
                Long lastSeen = _lastHeartBeat.get(nodeId);
                if ((lastSeen == null || (System.currentTimeMillis() - lastSeen) > _staleInterval)
                    && !_nodeId.equals(nodeId))
                {
                    recoverStaleNode(nodeId);
                }
            }
        }
    }
}
File
SimpleScheduler.java
Developer's decision
Combination
Kind of conflict
Class declaration
Comment
Method interface
Chunk
Conflicting content
package org.apache.ode.scheduler.simple;

import java.util.*;
<<<<<<< HEAD

=======

import javax.transaction.RollbackException;
import javax.transaction.Status;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;

import junit.framework.TestCase;

import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.ode.bpel.iapi.Scheduler.JobInfo;
import org.apache.ode.bpel.iapi.Scheduler.JobProcessor;
Solution content
package org.apache.ode.scheduler.simple;

import java.util.*;

import javax.transaction.RollbackException;
import javax.transaction.Status;
import javax.transaction.Synchronization;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;

import junit.framework.TestCase;
import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
import org.apache.ode.bpel.iapi.Scheduler;
import org.apache.ode.bpel.iapi.Scheduler.JobInfo;
import org.apache.ode.bpel.iapi.Scheduler.JobProcessor;
File
SimpleSchedulerTest.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
    assertEquals(1, _jobs.size());
  }

    } finally {
      _txm.commit();
    }
<<<<<<< HEAD
    Thread.sleep(100);
                // assertEquals(jobs, _jobs.size());            
            } finally {
                _txm.commit();
  public void testStartStop() throws Exception {
    _scheduler.start();
    _txm.begin();
    try {
      for (int i = 0; i < 10; ++i) {
        _scheduler.schedulePersistedJob(newDetail("123"), new Date(System.currentTimeMillis() + (i * 100)));
      }
    } finally {
      _txm.commit();
=======

    public void testConcurrentExec() throws Exception  {
        _scheduler.start();
        for (int i=0; i<10; i++) {
            _txm.begin();
            String jobId;
            try {
                int jobs = _jobs.size();
                jobId = _scheduler.schedulePersistedJob(newDetail("123"), new Date(System.currentTimeMillis() + 200));
                Thread.sleep(100);
                // we're using transacted jobs which means it will commit at the end
                // if the job is scheduled, the following assert is not valid @seanahn
            }
            // Delete from DB
            assertEquals(true,_ds.delegate().deleteJob(jobId, "n1"));
            // Wait for the job to be execed.
            Thread.sleep(250);
            // We should always have same number of jobs/commits
            assertEquals(_jobs.size(), _commit.size());
        }
    }
    
    public void testImmediateScheduling() throws Exception {
        _scheduler.start();
        _txm.begin();
        try {
            _scheduler.schedulePersistedJob(newDetail("123"), new Date());
            Thread.sleep(100);
            // we're using transacted jobs which means it will commit at the end
            // if the job is scheduled, the following assert is not valid @seanahn
            // assertEquals(jobs, _jobs.size());        
        } finally {
            _txm.commit();
        }
        Thread.sleep(100);
        assertEquals(1, _jobs.size());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }
    Thread.sleep(100);
    _scheduler.stop();
Solution content
        assertEquals(1, _jobs.size());
    }

    public void testRecovery() throws Exception {
        return scheduler;
    }
    
    }

    public void testConcurrentExec() throws Exception  {
        _scheduler.start();
        for (int i=0; i<10; i++) {
            _txm.begin();
            String jobId;
            try {
                int jobs = _jobs.size();
                jobId = _scheduler.schedulePersistedJob(newDetail("123"), new Date(System.currentTimeMillis() + 200));
                Thread.sleep(100);
                // we're using transacted jobs which means it will commit at the end
                // if the job is scheduled, the following assert is not valid @seanahn
                // assertEquals(jobs, _jobs.size());            
            } finally {
                _txm.commit();
            }
            // Delete from DB
            assertEquals(true,_ds.delegate().deleteJob(jobId, "n1"));
            // Wait for the job to be execed.
            Thread.sleep(250);
            // We should always have same number of jobs/commits
            assertEquals(_jobs.size(), _commit.size());
        }
    }
    
    public void testImmediateScheduling() throws Exception {
        _scheduler.start();
        _txm.begin();
        try {
            _scheduler.schedulePersistedJob(newDetail("123"), new Date());
            Thread.sleep(100);
            // we're using transacted jobs which means it will commit at the end
            // if the job is scheduled, the following assert is not valid @seanahn
            // assertEquals(jobs, _jobs.size());        
        } finally {
            _txm.commit();
        }
        Thread.sleep(100);
        assertEquals(1, _jobs.size());
    }

    public void testStartStop() throws Exception {
        _scheduler.start();
        _txm.begin();
        try {
            for (int i = 0; i < 10; ++i)
                _scheduler.schedulePersistedJob(newDetail("123"), new Date(System.currentTimeMillis() + (i * 100)));
        } finally {
            _txm.commit();
        }
        Thread.sleep(100);
        _scheduler.stop();
        int jobs = _jobs.size();
        assertTrue(jobs > 0);
        assertTrue(jobs < 10);
        Thread.sleep(200);
        assertEquals(jobs, _jobs.size());
        _scheduler.start();
        Thread.sleep(1000);
        assertEquals(10, _jobs.size());
    }

    public void testNearFutureScheduling() throws Exception {
        // speed things up a bit to hit the right code paths
        _scheduler.setNearFutureInterval(10000);
        _scheduler.setImmediateInterval(5000);
        _scheduler.start();

        _txm.begin();
        try {
            _scheduler.schedulePersistedJob(newDetail("123"), new Date(System.currentTimeMillis() + 7500));
        } finally {
            _txm.commit();
        }

        Thread.sleep(8500);
        assertEquals(1, _jobs.size());
    }

    public void testFarFutureScheduling() throws Exception {
        // speed things up a bit to hit the right code paths
        _scheduler.setNearFutureInterval(7000);
        _scheduler.setImmediateInterval(3000);
        _scheduler.start();

        _txm.begin();
        try {
            _scheduler.schedulePersistedJob(newDetail("123"), new Date(System.currentTimeMillis() + 7500));
        } finally {
            _txm.commit();
        }

        Thread.sleep(8500);
}
        // speed things up a bit to hit the right code paths
        _scheduler.setNearFutureInterval(2000);
        _scheduler.setImmediateInterval(1000);
        _scheduler.setStaleInterval(500);

        _txm.begin();
        try {
            _scheduler.schedulePersistedJob(newDetail("immediate"), new Date(System.currentTimeMillis()));
            _scheduler.schedulePersistedJob(newDetail("near"), new Date(System.currentTimeMillis() + 1100));
            _scheduler.schedulePersistedJob(newDetail("far"), new Date(System.currentTimeMillis() + 2500));
        } finally {
            _txm.commit();
        }

        _scheduler = newScheduler("n3");
        _scheduler.setNearFutureInterval(2000);
        _scheduler.setImmediateInterval(1000);
        _scheduler.setStaleInterval(1000);
        _scheduler.start();
        Thread.sleep(4000);
        assertEquals(3, _jobs.size());
    }

    public void testRecoverySuppressed() throws Exception {
        // speed things up a bit to hit the right code paths
        _scheduler.setNearFutureInterval(2000);
        _scheduler.setImmediateInterval(1000);
        _scheduler.setStaleInterval(500);

        _txm.begin();
        try {
            _scheduler.schedulePersistedJob(newDetail("immediate"), new Date(System.currentTimeMillis()));
            _scheduler.schedulePersistedJob(newDetail("near"), new Date(System.currentTimeMillis() + 1100));
            _scheduler.schedulePersistedJob(newDetail("far"), new Date(System.currentTimeMillis() + 15000));
        } finally {
            _txm.commit();
        }
        _scheduler.stop();

        _scheduler = newScheduler("n3");
        _scheduler.setNearFutureInterval(2000);
        _scheduler.setImmediateInterval(1000);
        _scheduler.setStaleInterval(1000);
        _scheduler.start();
        for (int i = 0; i < 40; ++i) {
            _scheduler.updateHeartBeat("n1");
            Thread.sleep(100);
        }

        _scheduler.stop();
        Thread.sleep(1000);

        assertEquals(0, _jobs.size());
    }

    public void onScheduledJob(final JobInfo jobInfo) throws JobProcessorException {
        synchronized (_jobs) {
            _jobs.add(jobInfo);
        }
        
        try {
            _txm.getTransaction().registerSynchronization(new Synchronization() {

                public void afterCompletion(int arg0) {
                    if (arg0 == Status.STATUS_COMMITTED) 
                        _commit.add(jobInfo);
                }

                public void beforeCompletion() {
                    // TODO Auto-generated method stub
                    
                }
                
            });
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (RollbackException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SystemException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    Scheduler.JobDetails newDetail(String x) {
        Scheduler.JobDetails jd = new Scheduler.JobDetails();
        jd.getDetailsExt().put("foo", x);
        return jd;
    }

    private SimpleScheduler newScheduler(String nodeId) {
        SimpleScheduler scheduler = new SimpleScheduler(nodeId, _ds.delegate(), new Properties());
        scheduler.setJobProcessor(this);
        scheduler.setTransactionManager(_txm);
File
SimpleSchedulerTest.java
Developer's decision
Manual
Kind of conflict
For statement
Method declaration
Method invocation
Method signature
Try statement
Chunk
Conflicting content
    }
  }

<<<<<<< HEAD
  public void onScheduledJob(final JobInfo jobInfo) throws JobProcessorException {
    synchronized (_jobs) {
      _jobs.add(jobInfo);
    }
  }

  Scheduler.JobDetails newDetail(String x) {
    Scheduler.JobDetails jd = new Scheduler.JobDetails();
    jd.getDetailsExt().put("foo", x);
    return jd;
  }

  private SimpleScheduler newScheduler(String nodeId) {
    SimpleScheduler scheduler = new SimpleScheduler(nodeId, _factory, _txm, new Properties());
    scheduler.setJobProcessor(this);
    return scheduler;
  }
=======
    Scheduler.JobDetails newDetail(String x) {
        Scheduler.JobDetails jd = new Scheduler.JobDetails();
        jd.getDetailsExt().put("foo", x);
        return jd;
    }

    private SimpleScheduler newScheduler(String nodeId) {
        SimpleScheduler scheduler = new SimpleScheduler(nodeId, _ds.delegate(), new Properties());
        scheduler.setJobProcessor(this);
        scheduler.setTransactionManager(_txm);
        return scheduler;
    }
    
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
}
Solution content
        }
        
        try {
    }

    public void onScheduledJob(final JobInfo jobInfo) throws JobProcessorException {
        synchronized (_jobs) {
            _jobs.add(jobInfo);
            _txm.getTransaction().registerSynchronization(new Synchronization() {

                public void afterCompletion(int arg0) {
                    if (arg0 == Status.STATUS_COMMITTED) 
                        _commit.add(jobInfo);
                }

                public void beforeCompletion() {
                    // TODO Auto-generated method stub
                    
                }
                
            });
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (RollbackException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SystemException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    Scheduler.JobDetails newDetail(String x) {
        Scheduler.JobDetails jd = new Scheduler.JobDetails();
        jd.getDetailsExt().put("foo", x);
        return jd;
    }

    private SimpleScheduler newScheduler(String nodeId) {
        SimpleScheduler scheduler = new SimpleScheduler(nodeId, _ds.delegate(), new Properties());
        scheduler.setJobProcessor(this);
        scheduler.setTransactionManager(_txm);
        return scheduler;
    }
    
}
File
SimpleSchedulerTest.java
Developer's decision
Manual
Kind of conflict
Method declaration
Chunk
Conflicting content
<<<<<<< HEAD
    /**
        return builder;
    }

     * Somewhat eases the pain of dealing with both Lists and Nodelists by converting either
     * passed as parameter to a List.
     * @param nl a NodeList or a List
     * @return a List
     */
    public static List toList(Object nl) {
        if (nl == null) return null;
        if (nl instanceof List) return (List) nl;

        NodeList cnl = (NodeList) nl;
        LinkedList ll = new LinkedList();
        for (int m = 0; m < cnl.getLength(); m++) ll.add(cnl.item(m));
        return ll;
    }

=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public static List findChildrenByName(Element parent, QName name) {
        if (parent == null)
            throw new IllegalArgumentException("null parent");
Solution content
        return builder;
    }

    public static List findChildrenByName(Element parent, QName name) {
        if (parent == null)
            throw new IllegalArgumentException("null parent");
File
DOMUtils.java
Developer's decision
Version 2
Kind of conflict
Comment
Method declaration
Chunk
Conflicting content
        return ret;
    }

<<<<<<< HEAD
    public static QName getNodeQName(String qualifiedName) {
    	int index = qualifiedName.indexOf(":");
    	if (index >= 0) {
    		return new QName(qualifiedName.substring(0, index), qualifiedName.substring(index + 1));
    	} else {
    		return new QName(qualifiedName);
    	}
=======
    /**
     * Somewhat eases the pain of dealing with both Lists and Nodelists by converting either
     * passed as parameter to a List.
     * @param nl a NodeList or a List
     * @return a List
     */
    public static List toList(Object nl) {
        if (nl == null) return null;
        if (nl instanceof List) return (List) nl;

        NodeList cnl = (NodeList) nl;
        List ll = new ArrayList();
        for (int m = 0; m < cnl.getLength(); m++) ll.add(cnl.item(m));
        return ll;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }

	public static Document getDocument(Node contextNode) {
Solution content
        return ret;
    }

    /**
     * Somewhat eases the pain of dealing with both Lists and Nodelists by converting either
     * passed as parameter to a List.
     * @param nl a NodeList or a List
     * @return a List
     */
    public static List toList(Object nl) {
        if (nl == null) return null;
        if (nl instanceof List) return (List) nl;

        NodeList cnl = (NodeList) nl;
        List ll = new ArrayList();
        for (int m = 0; m < cnl.getLength(); m++) ll.add(cnl.item(m));
        return ll;
    }

	public static Document getDocument(Node contextNode) {
File
DOMUtils.java
Developer's decision
Version 2
Kind of conflict
Cast expression
Comment
For statement
If statement
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
	public static Document getDocument(Node contextNode) {
		return (contextNode == null) ? DOMUtils.newDocument() : contextNode.getOwnerDocument();
    }
<<<<<<< HEAD
	
=======

>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public static String getQualifiedName(QName qName) {
    	String prefix = qName.getPrefix(), localPart = qName.getLocalPart();
    	return (prefix == null || "".equals(prefix)) ? localPart : (prefix + ":" + localPart);
Solution content
	public static Document getDocument(Node contextNode) {
		return (contextNode == null) ? DOMUtils.newDocument() : contextNode.getOwnerDocument();
    }

    public static String getQualifiedName(QName qName) {
    	String prefix = qName.getPrefix(), localPart = qName.getLocalPart();
    	return (prefix == null || "".equals(prefix)) ? localPart : (prefix + ":" + localPart);
File
DOMUtils.java
Developer's decision
Version 1
Kind of conflict
Blank
Chunk
Conflicting content
    	String prefix = qName.getPrefix(), localPart = qName.getLocalPart();
    	return (prefix == null || "".equals(prefix)) ? localPart : (prefix + ":" + localPart);
    }
<<<<<<< HEAD

    public static Node cloneNode(Document document, Node node) {
    	Node clone = null;
    	String namespaceURI = node.getNamespaceURI();
    	String localName = node.getLocalName();
    	switch (node.getNodeType()) {
    	case Node.ATTRIBUTE_NODE:
    		if (namespaceURI == null) {
    		}
    		// attributes are not treated as child nodes, so copy them explicitly
    			clone = document.createAttribute(localName);
    		} else {
        		clone = document.createAttributeNS(namespaceURI, localName);
    		}
			break;
    	case Node.CDATA_SECTION_NODE:
    		clone = document.createCDATASection(((CDATASection) node).getData());
			break;
    	case Node.COMMENT_NODE:
    		clone = document.createComment(((Comment) node).getData());
			break;
    	case Node.DOCUMENT_FRAGMENT_NODE:
    		clone = document.createDocumentFragment();
			break;
    	case Node.DOCUMENT_NODE:
    		clone = document;
			break;
    	case Node.ELEMENT_NODE:
    		if (namespaceURI == null) {
	    		clone = document.createElement(localName);
    		} else {
    			clone = document.createElementNS(namespaceURI, localName);
=======
    
    /**
     * Deep clone, but don't fry, the given node in the context of the given document. 
     * For all intents and purposes, the clone is the exact same copy of the node, 
     * except that it might have a different owner document. 
     * 
     * This method is fool-proof, unlike the adoptNode or adoptNode methods,
     * in that it doesn't assume that the given node has a parent or a owner document.
     * 
     * @param document
     * @param sourceNode
     * @return a clone of node 
     */
    public static Node cloneNode(Document document, Node sourceNode) {
    	Node clonedNode = null;

    	// what is my name?
    	QName sourceQName = getNodeQName(sourceNode);
    	String nodeName = sourceQName.getLocalPart();
    	String namespaceURI = sourceQName.getNamespaceURI();
    	
    	// if the node is unqualified, don't assume that it inherits the WS-BPEL target namespace
    	if (Namespaces.WSBPEL2_0_FINAL_EXEC.equals(namespaceURI)) {
    		namespaceURI = null;
    	}
    	
    	switch (sourceNode.getNodeType()) {
    	case Node.ATTRIBUTE_NODE:
    		if (namespaceURI == null) {
    			clonedNode = document.createAttribute(nodeName);
    		} else {
    			String prefix = ((Attr) sourceNode).lookupPrefix(namespaceURI);
    			// the prefix for the XML namespace can't be looked up, hence this...
    			if (prefix == null && namespaceURI.equals(NS_URI_XMLNS)) {
    				prefix = "xmlns";
    			}
    			// if a prefix exists, qualify the name with it
    			if (prefix != null && !"".equals(prefix)) {
        			nodeName = prefix + ":" + nodeName;
    			}
    			// create the appropriate type of attribute
    			if (prefix != null) {
	        		clonedNode = document.createAttributeNS(namespaceURI, nodeName);
    			} else {
    				clonedNode = document.createAttribute(nodeName);
    			}
    		}
			break;
    	case Node.CDATA_SECTION_NODE:
    		clonedNode = document.createCDATASection(((CDATASection) sourceNode).getData());
			break;
    	case Node.COMMENT_NODE:
    		clonedNode = document.createComment(((Comment) sourceNode).getData());
			break;
    	case Node.DOCUMENT_FRAGMENT_NODE:
    		clonedNode = document.createDocumentFragment();
			break;
    	case Node.DOCUMENT_NODE:
    		clonedNode = document;
			break;
    	case Node.ELEMENT_NODE:
    		// create the appropriate type of element
    		if (namespaceURI == null) {
	    		clonedNode = document.createElement(nodeName);
    		} else {
    			String prefix = namespaceURI.equals(Namespaces.XMLNS_URI) ? 
    					"xmlns" : ((Element) sourceNode).lookupPrefix(namespaceURI);
    			if (prefix != null && !"".equals(prefix)) {
        			nodeName = prefix + ":" + nodeName;
        			clonedNode = document.createElementNS(namespaceURI, nodeName);
    			} else {
    	    		clonedNode = document.createElement(nodeName);
    			}
    		NamedNodeMap attributes = ((Element) sourceNode).getAttributes();
    		for (int i = 0; i < attributes.getLength(); i++) {
    			Attr attributeClone = (Attr) cloneNode(document, attributes.item(i));
    			if (attributeClone.getNamespaceURI() == null) {
    				((Element) clonedNode).setAttributeNode(attributeClone);
    			} else {
    				((Element) clonedNode).setAttributeNodeNS(attributeClone);
    			}
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    		}
			break;
    	case Node.ENTITY_NODE:
Solution content
    
    /**
    	String prefix = qName.getPrefix(), localPart = qName.getLocalPart();
    	return (prefix == null || "".equals(prefix)) ? localPart : (prefix + ":" + localPart);
    }
     * Deep clone, but don't fry, the given node in the context of the given document. 
     * For all intents and purposes, the clone is the exact same copy of the node, 
     * except that it might have a different owner document. 
     * 
     * This method is fool-proof, unlike the adoptNode or adoptNode methods,
     * in that it doesn't assume that the given node has a parent or a owner document.
     * 
     * @param document
     * @param sourceNode
     * @return a clone of node 
     */
    public static Node cloneNode(Document document, Node sourceNode) {
    	Node clonedNode = null;

    	// what is my name?
    	QName sourceQName = getNodeQName(sourceNode);
    	String nodeName = sourceQName.getLocalPart();
    	String namespaceURI = sourceQName.getNamespaceURI();
    	
    	// if the node is unqualified, don't assume that it inherits the WS-BPEL target namespace
    	if (Namespaces.WSBPEL2_0_FINAL_EXEC.equals(namespaceURI)) {
    		namespaceURI = null;
    	}
    	
    	switch (sourceNode.getNodeType()) {
    	case Node.ATTRIBUTE_NODE:
    		if (namespaceURI == null) {
    			clonedNode = document.createAttribute(nodeName);
    		} else {
    			String prefix = ((Attr) sourceNode).lookupPrefix(namespaceURI);
    			// the prefix for the XML namespace can't be looked up, hence this...
    			if (prefix == null && namespaceURI.equals(NS_URI_XMLNS)) {
    				prefix = "xmlns";
    			}
    			// if a prefix exists, qualify the name with it
    			if (prefix != null && !"".equals(prefix)) {
        			nodeName = prefix + ":" + nodeName;
    			}
    			// create the appropriate type of attribute
    			if (prefix != null) {
	        		clonedNode = document.createAttributeNS(namespaceURI, nodeName);
    			} else {
    				clonedNode = document.createAttribute(nodeName);
    			}
    		}
			break;
    	case Node.CDATA_SECTION_NODE:
    		clonedNode = document.createCDATASection(((CDATASection) sourceNode).getData());
			break;
    	case Node.COMMENT_NODE:
    		clonedNode = document.createComment(((Comment) sourceNode).getData());
			break;
    	case Node.DOCUMENT_FRAGMENT_NODE:
    		clonedNode = document.createDocumentFragment();
			break;
    	case Node.DOCUMENT_NODE:
    		clonedNode = document;
			break;
    	case Node.ELEMENT_NODE:
    		// create the appropriate type of element
    		if (namespaceURI == null) {
	    		clonedNode = document.createElement(nodeName);
    		} else {
    			String prefix = namespaceURI.equals(Namespaces.XMLNS_URI) ? 
    					"xmlns" : ((Element) sourceNode).lookupPrefix(namespaceURI);
    			if (prefix != null && !"".equals(prefix)) {
        			nodeName = prefix + ":" + nodeName;
        			clonedNode = document.createElementNS(namespaceURI, nodeName);
    			} else {
    	    		clonedNode = document.createElement(nodeName);
    			}
    		}
    		// attributes are not treated as child nodes, so copy them explicitly
    		NamedNodeMap attributes = ((Element) sourceNode).getAttributes();
    		for (int i = 0; i < attributes.getLength(); i++) {
    			Attr attributeClone = (Attr) cloneNode(document, attributes.item(i));
    			if (attributeClone.getNamespaceURI() == null) {
    				((Element) clonedNode).setAttributeNode(attributeClone);
    			} else {
    				((Element) clonedNode).setAttributeNodeNS(attributeClone);
    			}
    		}
			break;
    	case Node.ENTITY_NODE:
File
DOMUtils.java
Developer's decision
Version 2
Kind of conflict
Break statement
Case statement
Cast expression
Comment
For statement
If statement
Method invocation
Method signature
Switch statement
Variable
Chunk
Conflicting content
    		// TODO
			break;
    	case Node.ENTITY_REFERENCE_NODE:
<<<<<<< HEAD
    		clone = document.createEntityReference(localName);
=======
    		clonedNode = document.createEntityReference(nodeName);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    		// TODO
			break;
    	case Node.NOTATION_NODE:
Solution content
    		// TODO
			break;
    	case Node.ENTITY_REFERENCE_NODE:
    		clonedNode = document.createEntityReference(nodeName);
    		// TODO
			break;
    	case Node.NOTATION_NODE:
File
DOMUtils.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
    	case Node.PROCESSING_INSTRUCTION_NODE:
<<<<<<< HEAD
    		// TODO
			break;
    		clone = document.createProcessingInstruction(((ProcessingInstruction) node).getData(), localName);
			break;
    	case Node.TEXT_NODE:
    		clone = document.createTextNode(((Text) node ).getData());
=======
    		clonedNode = document.createProcessingInstruction(((ProcessingInstruction) sourceNode).getData(), nodeName);
			break;
    	case Node.TEXT_NODE:
    		clonedNode = document.createTextNode(((Text) sourceNode ).getData());
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
			break;
		default:
			break;
Solution content
			break;
		default:
			break;
    		// TODO
			break;
    	case Node.PROCESSING_INSTRUCTION_NODE:
    		clonedNode = document.createProcessingInstruction(((ProcessingInstruction) sourceNode).getData(), nodeName);
			break;
    	case Node.TEXT_NODE:
    		clonedNode = document.createTextNode(((Text) sourceNode ).getData());
File
DOMUtils.java
Developer's decision
Version 2
Kind of conflict
Break statement
Case statement
Method invocation
Variable
Chunk
Conflicting content
		default:
			break;
    	}
<<<<<<< HEAD

    	NodeList children = node.getChildNodes();
    	if (children != null) {
	    	for (int i = 0; i < children.getLength(); i++) {
	    		clone.appendChild(cloneNode(document, children.item(i)));
	    	}
    	}
	    		
    	return clone;
=======
	    		
    	// clone children of element and attribute nodes
    	NodeList sourceChildren = sourceNode.getChildNodes();
    	if (sourceChildren != null) {
	    	for (int i = 0; i < sourceChildren.getLength(); i++) {
	    		Node sourceChild = sourceChildren.item(i);
	    		Node clonedChild = cloneNode(document, sourceChild);
	    		clonedNode.appendChild(clonedChild);
	    		// if the child has a textual value, parse it for any embedded prefixes
	    		if (clonedChild.getNodeType() == Node.TEXT_NODE || 
	    				clonedChild.getNodeType() == Node.CDATA_SECTION_NODE) {
	    			parseEmbeddedPrefixes(sourceNode, clonedNode, clonedChild);
	    		}
	    	}
    	}
    	return clonedNode;
    }

    /**
     * Parse the text in the cloneChild for any embedded prefixes, and define it in it's parent element
     *  
     * @param sourceNode
     * @param clonedNode
     * @param clonedChild
     */
    private static void parseEmbeddedPrefixes(Node sourceNode, Node clonedNode, Node clonedChild) {
    	Element clonedElement = null;
		if (clonedNode instanceof Attr) {
			clonedElement = ((Attr) clonedNode).getOwnerElement();
		} else if (clonedNode instanceof Element) {
			clonedElement = (Element) clonedNode;
		}
		if (clonedElement == null) {
			// couldn't find an element to set prefixes on, so bail out
			return;
		}
		
		String text = ((Text) clonedChild).getNodeValue();
		if (text != null && text.indexOf(":") > 0) {
			Name11Checker nameChecker = Name11Checker.getInstance();
			for (int colonIndex = text.indexOf(":"); colonIndex != -1 && colonIndex < text.length(); colonIndex = text.indexOf(":", colonIndex +  1)) {
				StringBuffer prefixString = new StringBuffer();
				for (int prefixIndex = colonIndex - 1; 
						prefixIndex >= 0 && nameChecker.isNCNameChar(text.charAt(prefixIndex)); 
						prefixIndex--) {
					prefixString.append(text.charAt(prefixIndex));
				}
				prefixString.reverse();
				if (prefixString.length() > 0) {
					String uri = sourceNode.lookupNamespaceURI(prefixString.toString());
					if (uri != null) {
						clonedElement.setAttributeNS(NS_URI_XMLNS, "xmlns:" + prefixString, uri);
					}
				}
			}
		}
    }

    public static Element stringToDOM(byte[] bytes) throws SAXException, IOException {
        return stringToDOM(new String(bytes));
    }

    public static byte[] domToBytes(Element element) {
        String stringifiedElement = domToString(element);
        return (stringifiedElement != null) ? stringifiedElement.getBytes() : null;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }
}
Solution content
		default:
			break;
    	}
	    		
    	// clone children of element and attribute nodes
    	NodeList sourceChildren = sourceNode.getChildNodes();
    	if (sourceChildren != null) {
	    	for (int i = 0; i < sourceChildren.getLength(); i++) {
	    		Node sourceChild = sourceChildren.item(i);
	    		Node clonedChild = cloneNode(document, sourceChild);
	    		clonedNode.appendChild(clonedChild);
	    		// if the child has a textual value, parse it for any embedded prefixes
	    		if (clonedChild.getNodeType() == Node.TEXT_NODE || 
	    				clonedChild.getNodeType() == Node.CDATA_SECTION_NODE) {
	    			parseEmbeddedPrefixes(sourceNode, clonedNode, clonedChild);
	    		}
	    	}
    	}
    	return clonedNode;
    }

    /**
     * Parse the text in the cloneChild for any embedded prefixes, and define it in it's parent element
     *  
     * @param sourceNode
     * @param clonedNode
     * @param clonedChild
     */
    private static void parseEmbeddedPrefixes(Node sourceNode, Node clonedNode, Node clonedChild) {
    	Element clonedElement = null;
		if (clonedNode instanceof Attr) {
			clonedElement = ((Attr) clonedNode).getOwnerElement();
		} else if (clonedNode instanceof Element) {
			clonedElement = (Element) clonedNode;
		}
		if (clonedElement == null) {
			// couldn't find an element to set prefixes on, so bail out
			return;
		}
		
		String text = ((Text) clonedChild).getNodeValue();
		if (text != null && text.indexOf(":") > 0) {
			Name11Checker nameChecker = Name11Checker.getInstance();
			for (int colonIndex = text.indexOf(":"); colonIndex != -1 && colonIndex < text.length(); colonIndex = text.indexOf(":", colonIndex +  1)) {
				StringBuffer prefixString = new StringBuffer();
				for (int prefixIndex = colonIndex - 1; 
						prefixIndex >= 0 && nameChecker.isNCNameChar(text.charAt(prefixIndex)); 
						prefixIndex--) {
					prefixString.append(text.charAt(prefixIndex));
				}
				prefixString.reverse();
				if (prefixString.length() > 0) {
					String uri = sourceNode.lookupNamespaceURI(prefixString.toString());
					if (uri != null) {
						clonedElement.setAttributeNS(NS_URI_XMLNS, "xmlns:" + prefixString, uri);
					}
				}
			}
		}
    }

    public static Element stringToDOM(byte[] bytes) throws SAXException, IOException {
        return stringToDOM(new String(bytes));
    }

    public static byte[] domToBytes(Element element) {
        String stringifiedElement = domToString(element);
        return (stringifiedElement != null) ? stringifiedElement.getBytes() : null;
    }
}
File
DOMUtils.java
Developer's decision
Version 2
Kind of conflict
Comment
If statement
Method declaration
Method invocation
Method signature
Return statement
Variable
Chunk
Conflicting content
    public static final String BPEL11_NS = "http://schemas.xmlsoap.org/ws/2003/03/business-process/".intern();

    /** Diverse WS-* stuff */
<<<<<<< HEAD
    public static final String WS_ADDRESSING_NS = "http://www.w3.org/2005/08/addressing";
    public static final String WS_ADDRESSING_WSDL_NS = "http://www.w3.org/2006/05/addressing/wsdl";
    public static final String WS_ADDRESSING_ANON_URI = "http://www.w3.org/2005/08/addressing/anonymous";
    public static final String HTTP_NS = "http://schemas.xmlsoap.org/wsdl/http/";
    public static final String SOAP_NS = "http://schemas.xmlsoap.org/wsdl/soap/";
    public static final String SOAP_ENV_NS = "http://schemas.xmlsoap.org/soap/envelope/";
    public static final String WSDL_11 = "http://schemas.xmlsoap.org/wsdl/";
    public static final String WSDL_20 = "http://www.w3.org/2006/01/wsdl";
    public static final String XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
    public static final String XML_INSTANCE = "http://www.w3. org/2001/XMLSchema-instance";
    public static final String XPATH_FUNCTIONS = "http://www.w3.org/2005/xpath-functions";
    public static final String JBI_END_POINT_REFERENCE = "http://java.sun.com/jbi/end-point-reference";
=======
    public static final String WS_ADDRESSING_NS = "http://www.w3.org/2005/08/addressing".intern();
    public static final String WS_ADDRESSING_WSDL_NS = "http://www.w3.org/2006/05/addressing/wsdl".intern();
    public static final String WS_ADDRESSING_ANON_URI = "http://www.w3.org/2005/08/addressing/anonymous".intern();
    public static final String HTTP_NS = "http://schemas.xmlsoap.org/wsdl/http/".intern();
    public static final String SOAP_NS = "http://schemas.xmlsoap.org/wsdl/soap/".intern();
    public static final String SOAP_ENV_NS = "http://schemas.xmlsoap.org/soap/envelope/".intern();
    public static final String WSDL_11 = "http://schemas.xmlsoap.org/wsdl/".intern();
    public static final String WSDL_20 = "http://www.w3.org/2006/01/wsdl".intern();
    public static final String XML_SCHEMA = "http://www.w3.org/2001/XMLSchema".intern();
    public static final String XML_INSTANCE = "http://www.w3. org/2001/XMLSchema-instance".intern();
    public static final String XPATH_FUNCTIONS = "http://www.w3.org/2005/xpath-functions".intern();
    public static final String JBI_END_POINT_REFERENCE = "http://java.sun.com/jbi/end-point-reference".intern();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    public static final QName WS_ADDRESSING_ENDPOINT = new QName(WS_ADDRESSING_NS, "EndpointReference");
    public static final QName WS_ADDRESSING_USINGADDRESSING = new QName(WS_ADDRESSING_WSDL_NS, "UsingAddressing");
Solution content
    public static final String BPEL11_NS = "http://schemas.xmlsoap.org/ws/2003/03/business-process/".intern();

    /** Diverse WS-* stuff */
    public static final String WS_ADDRESSING_NS = "http://www.w3.org/2005/08/addressing".intern();
    public static final String WS_ADDRESSING_WSDL_NS = "http://www.w3.org/2006/05/addressing/wsdl".intern();
    public static final String WS_ADDRESSING_ANON_URI = "http://www.w3.org/2005/08/addressing/anonymous".intern();
    public static final String HTTP_NS = "http://schemas.xmlsoap.org/wsdl/http/".intern();
    public static final String SOAP_NS = "http://schemas.xmlsoap.org/wsdl/soap/".intern();
    public static final String SOAP_ENV_NS = "http://schemas.xmlsoap.org/soap/envelope/".intern();
    public static final String WSDL_11 = "http://schemas.xmlsoap.org/wsdl/".intern();
    public static final String WSDL_20 = "http://www.w3.org/2006/01/wsdl".intern();
    public static final String XML_SCHEMA = "http://www.w3.org/2001/XMLSchema".intern();
    public static final String XML_INSTANCE = "http://www.w3. org/2001/XMLSchema-instance".intern();
    public static final String XPATH_FUNCTIONS = "http://www.w3.org/2005/xpath-functions".intern();
    public static final String JBI_END_POINT_REFERENCE = "http://java.sun.com/jbi/end-point-reference".intern();
    public static final QName WS_ADDRESSING_ENDPOINT = new QName(WS_ADDRESSING_NS, "EndpointReference");
    public static final QName WS_ADDRESSING_USINGADDRESSING = new QName(WS_ADDRESSING_WSDL_NS, "UsingAddressing");
File
Namespaces.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
    /* ODE stuff */
    /**
<<<<<<< HEAD
     * @deprecated use #ODE_PMAPI_TYPES_NS
=======
     * @deprecated use #ODE_PMAPI_TYPES_NS 
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
     */
    public static final String ODE_PMAPI = "http://www.apache.org/ode/pmapi/types/2006/08/02/".intern();
    public static final String ODE_PMAPI_TYPES_NS = "http://www.apache.org/ode/pmapi/types/2006/08/02/".intern();
Solution content
     * @deprecated use #ODE_PMAPI_TYPES_NS 
     */

    /* ODE stuff */
    /**
    public static final String ODE_PMAPI = "http://www.apache.org/ode/pmapi/types/2006/08/02/".intern();
    public static final String ODE_PMAPI_TYPES_NS = "http://www.apache.org/ode/pmapi/types/2006/08/02/".intern();
File
Namespaces.java
Developer's decision
Version 1
Kind of conflict
Comment
Chunk
Conflicting content
    public static final String ODE_PMAPI_TYPES_NS = "http://www.apache.org/ode/pmapi/types/2006/08/02/".intern();
    public static final String ODE_PMAPI_NS = "http://www.apache.org/ode/pmapi".intern();
    public static final String ODE_DEPLOYAPI_NS = "http://www.apache.org/ode/deployapi".intern();
<<<<<<< HEAD
    public static final String ODE_EXTENSION_NS = "http://www.apache.org/ode/type/extension";
    public static final String ODE_HTTP_EXTENSION_NS = "http://www.apache.org/ode/type/extension/http";
    public static final String ODE_SESSION_NS = "http://www.intalio.com/type/session";
    public static final String INTALIO_SESSION_NS = "http://www.intalio.com/type/session";
=======
    public static final String ODE_EXTENSION_NS = "http://www.apache.org/ode/type/extension".intern();
    public static final String ODE_HTTP_EXTENSION_NS = "http://www.apache.org/ode/type/extension/http".intern();
    public static final String INTALIO_SESSION_NS = "http://www.intalio.com/type/session".intern();
    public static final String ODE_SESSION_NS = "http://www.apache.org/ode/type/session".intern();
    public static final String DEPRECATED_XDT_NS = "http://www.w3.org/2003/11/xpath-datatypes".intern();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

}
Solution content
    public static final String ODE_PMAPI_TYPES_NS = "http://www.apache.org/ode/pmapi/types/2006/08/02/".intern();
    public static final String ODE_PMAPI_NS = "http://www.apache.org/ode/pmapi".intern();
    public static final String ODE_DEPLOYAPI_NS = "http://www.apache.org/ode/deployapi".intern();
    public static final String ODE_EXTENSION_NS = "http://www.apache.org/ode/type/extension".intern();
    public static final String ODE_HTTP_EXTENSION_NS = "http://www.apache.org/ode/type/extension/http".intern();
    public static final String INTALIO_SESSION_NS = "http://www.intalio.com/type/session".intern();
    public static final String ODE_SESSION_NS = "http://www.apache.org/ode/type/session".intern();
    public static final String DEPRECATED_XDT_NS = "http://www.w3.org/2003/11/xpath-datatypes".intern();

}
File
Namespaces.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
        } catch (Exception e) {
        try {
            ObjectInputStream ois = new ObjectInputStream(binaryStream) {

<<<<<<< HEAD
                protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
                    String name = desc.getName();
                    try {
                        return Class.forName(name, false, cl);
                    } catch (ClassNotFoundException ex) {
                        return super.resolveClass(desc);
                    }
                }
            };
            return ois.readObject();
            throw new RuntimeException(e);
=======
        protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
          String name = desc.getName();
          try {
              return Class.forName(name, false, cl);
          } catch (ClassNotFoundException ex) {
              return super.resolveClass(desc);
          }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }
    }
Solution content
        protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
          String name = desc.getName();
          try {
              return Class.forName(name, false, cl);
          } catch (ClassNotFoundException ex) {
              return super.resolveClass(desc);
          }
        }
      };
      return ois.readObject();
    }
File
SerializableUtils.java
Developer's decision
Combination
Kind of conflict
Catch clause
Method declaration
Method invocation
Method signature
Return statement
Throw statement
Try statement
Variable
Chunk
Conflicting content
        File[] allFiles = parentDir.listFiles();
        if (allFiles != null) {
            TreeSet dirs = new TreeSet();
<<<<<<< HEAD
                TreeSet acceptedFiles = new TreeSet();
=======
            TreeSet acceptedFiles = new TreeSet();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            for (File f : allFiles) {
                if (f.isDirectory()) {
                    dirs.add(f);
Solution content
        File[] allFiles = parentDir.listFiles();
        if (allFiles != null) {
            TreeSet dirs = new TreeSet();
            TreeSet acceptedFiles = new TreeSet();
            for (File f : allFiles) {
                if (f.isDirectory()) {
                    dirs.add(f);
File
FileUtils.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
    private static class SchemaErrorHandler implements DOMErrorHandler {
        public boolean handleError(DOMError error) {
<<<<<<< HEAD
=======
            boolean isWarning = (error.getSeverity() == DOMError.SEVERITY_WARNING);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
            __log.warn("Schema error", ((Exception)error.getRelatedException()));
            __log.warn(error.getLocation().getUri() + ":" + error.getLocation().getLineNumber());
            __log.warn(error.getRelatedData());
Solution content
    private static class SchemaErrorHandler implements DOMErrorHandler {
        public boolean handleError(DOMError error) {
            boolean isWarning = (error.getSeverity() == DOMError.SEVERITY_WARNING);
            __log.warn("Schema error", ((Exception)error.getRelatedException()));
            __log.warn(error.getLocation().getUri() + ":" + error.getLocation().getLineNumber());
            __log.warn(error.getRelatedData());
File
SchemaModelImpl.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Variable
Chunk
Conflicting content
            __log.warn(error.getLocation().getUri() + ":" + error.getLocation().getLineNumber());
            __log.warn(error.getRelatedData());
            __log.warn(error.getRelatedException());
<<<<<<< HEAD
            return true;
=======
            return isWarning;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
        }
    }
Solution content
            __log.warn(error.getLocation().getUri() + ":" + error.getLocation().getLineNumber());
            __log.warn(error.getRelatedData());
            __log.warn(error.getRelatedException());
            return isWarning;
        }
    }
File
SchemaModelImpl.java
Developer's decision
Version 2
Kind of conflict
Return statement
Variable
Chunk
Conflicting content
                location = resourceIdentifier.getNamespace();
            else if (resourceIdentifier.getLiteralSystemId() != null && _schemas.get(resourceIdentifier.getLiteralSystemId()) != null)
                location = resourceIdentifier.getLiteralSystemId();
<<<<<<< HEAD
            else if (resourceIdentifier.getBaseSystemId() != null && _schemas.get(resourceIdentifier.getBaseSystemId()) != null)
                location = resourceIdentifier.getBaseSystemId();
=======
            else if (resourceIdentifier.getExpandedSystemId() != null && _schemas.get(resourceIdentifier.getExpandedSystemId()) != null)
                location = resourceIdentifier.getExpandedSystemId();
            else {
                if (__log.isDebugEnabled()) {
                    __log.debug("Available schemas " + _schemas.keySet());
                }
                throw new IllegalStateException("Schema " + resourceIdentifier + " not captured");
            }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

            src.setByteStream(new ByteArrayInputStream(_schemas.get(location)));
            return src;
Solution content
                location = resourceIdentifier.getNamespace();
            else if (resourceIdentifier.getLiteralSystemId() != null && _schemas.get(resourceIdentifier.getLiteralSystemId()) != null)
                location = resourceIdentifier.getLiteralSystemId();
            else if (resourceIdentifier.getExpandedSystemId() != null && _schemas.get(resourceIdentifier.getExpandedSystemId()) != null)
                location = resourceIdentifier.getExpandedSystemId();
            else {
                if (__log.isDebugEnabled()) {
                    __log.debug("Available schemas " + _schemas.keySet());
                }
                throw new IllegalStateException("Schema " + resourceIdentifier + " not captured");
            }

            src.setByteStream(new ByteArrayInputStream(_schemas.get(location)));
            return src;
File
SchemaModelImpl.java
Developer's decision
Version 2
Kind of conflict
If statement
Chunk
Conflicting content
import java.io.StringWriter;
import java.io.StringReader;
import java.net.URI;
<<<<<<< HEAD
import java.util.HashMap;
=======
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import java.util.Map;

import javax.xml.namespace.QName;
Solution content
import java.io.StringReader;
import java.io.StringWriter;
import java.net.URI;
import java.util.Map;

import javax.xml.namespace.QName;
File
XslTransformHandler.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

<<<<<<< HEAD
import org.apache.commons.collections.keyvalue.MultiKey;
=======
import org.apache.commons.collections.map.MultiKeyMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.utils.DOMUtils;
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
import org.w3c.dom.Document;
import org.w3c.dom.Node;
Solution content
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;

import org.apache.commons.collections.map.MultiKeyMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.utils.DOMUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
File
XslTransformHandler.java
Developer's decision
Version 2
Kind of conflict
Import
Chunk
Conflicting content
=======
  private static XslTransformHandler __singleton;

  private TransformerFactory _transformerFactory = null;
<<<<<<< HEAD
  private final HashMap _templateCache = new HashMap();
  private final MultiKeyMap _templateCache = new MultiKeyMap();
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a

  /**
   * Singleton access.
Solution content
  private static XslTransformHandler __singleton;

  private TransformerFactory _transformerFactory = null;
  private final MultiKeyMap _templateCache = new MultiKeyMap();

  /**
   * Singleton access.
File
XslTransformHandler.java
Developer's decision
Version 2
Kind of conflict
Attribute
Method invocation
Chunk
Conflicting content
   * @param body of the XSL document
   * @param resolver used to resolve includes and imports
   */
<<<<<<< HEAD
  public void parseXSLSheet(URI baseUri, URI uri, String body, URIResolver resolver) {
=======
  public void parseXSLSheet(QName processQName, URI uri, String body, URIResolver resolver) {
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    Templates tm;
    try {
      _transformerFactory.setURIResolver(resolver);
Solution content
   * @param body of the XSL document
   * @param resolver used to resolve includes and imports
   */
  public void parseXSLSheet(QName processQName, URI uri, String body, URIResolver resolver) {
    Templates tm;
    try {
      _transformerFactory.setURIResolver(resolver);
File
XslTransformHandler.java
Developer's decision
Version 2
Kind of conflict
Method signature
Chunk
Conflicting content
      throw new XslTransformException(e);
    }
    synchronized(_templateCache) {
<<<<<<< HEAD
      _templateCache.put(new MultiKey(baseUri, uri), tm);
=======
      _templateCache.put(processQName, uri, tm);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }
  }
Solution content
    synchronized(_templateCache) {
      _templateCache.put(processQName, uri, tm);
    }
  }

      throw new XslTransformException(e);
    }
File
XslTransformHandler.java
Developer's decision
Version 2
Kind of conflict
Method invocation
Chunk
Conflicting content
   * @param body of the XSL document
   * @param resolver used to resolve includes and imports
   */
<<<<<<< HEAD
  public void cacheXSLSheet(URI baseUri, URI uri, String body, URIResolver resolver) {
    Templates tm;
    synchronized (_templateCache) {
      tm = _templateCache.get(new MultiKey(baseUri, uri));
    }
    if (tm == null) parseXSLSheet(baseUri, uri, body, resolver);
=======
  public void cacheXSLSheet(QName processQName, URI uri, String body, URIResolver resolver) {
    Templates tm;
    synchronized (_templateCache) {
      tm = (Templates) _templateCache.get(processQName, uri);
    }
    if (tm == null) parseXSLSheet(processQName, uri, body, resolver);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
  }

  /**
Solution content
    Templates tm;
   * @param body of the XSL document
   * @param resolver used to resolve includes and imports
   */
  public void cacheXSLSheet(QName processQName, URI uri, String body, URIResolver resolver) {
    synchronized (_templateCache) {
      tm = (Templates) _templateCache.get(processQName, uri);
    }
    if (tm == null) parseXSLSheet(processQName, uri, body, resolver);
  }

  /**
File
XslTransformHandler.java
Developer's decision
Version 2
Kind of conflict
If statement
Method signature
Synchronized statement
Variable
Chunk
Conflicting content
   * @param resolver used to resolve includes and imports
   * @return result of the transformation (XSL, HTML or text depending of the output method specified in stylesheet.
   */
<<<<<<< HEAD
  public Object transform(URI baseUri, URI uri, Source source,
                        Map parameters, URIResolver resolver) {
    Templates tm;
    synchronized (_templateCache) {
      tm = _templateCache.get(new MultiKey(baseUri, uri));
=======
  public Object transform(QName processQName, URI uri, Source source,
                        Map parameters, URIResolver resolver) {
    Templates tm;
    synchronized (_templateCache) {
      tm = (Templates) _templateCache.get(processQName, uri);
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    }
    if (tm == null)
      throw new XslTransformException("XSL sheet" + uri + " has not been parsed before transformation!");
Solution content
   * @param resolver used to resolve includes and imports
   * @return result of the transformation (XSL, HTML or text depending of the output method specified in stylesheet.
   */
  public Object transform(QName processQName, URI uri, Source source,
                        Map parameters, URIResolver resolver) {
    Templates tm;
    synchronized (_templateCache) {
      tm = (Templates) _templateCache.get(processQName, uri);
    }
    if (tm == null)
      throw new XslTransformException("XSL sheet" + uri + " has not been parsed before transformation!");
File
XslTransformHandler.java
Developer's decision
Version 2
Kind of conflict
Method signature
Synchronized statement
Variable
Chunk
Conflicting content
          tf.setParameter(param.getKey().getLocalPart(), param.getValue());
        }
      }
<<<<<<< HEAD
        String method = tf.getOutputProperties().getProperty("method");
    	  Node node = result.getNode();
    	  if(node.getNodeType() == Node.DOCUMENT_NODE)
    		  node = ((Document)node).getDocumentElement();
      if (method == null || "xml".equals(method)) {
    	  DOMResult result = new DOMResult();
    	  tf.transform(source, result);
        if (method == null || method.equals("xml") || method.equals("html")) {
            DOMResult result = new DOMResult();
            tf.transform(source, result);
            Node node = result.getNode();
            if(node.getNodeType() == Node.DOCUMENT_NODE)
                node = ((Document)node).getDocumentElement();
            return node;
        } else {
            StringWriter writerResult = new StringWriter();
            StreamResult result = new StreamResult(writerResult);
            tf.transform(source, result);
            writerResult.flush();
            return writerResult.toString();
        }
=======
      String method = tf.getOutputProperties().getProperty("method");
          if(__log.isDebugEnabled()) __log.debug("Returned node: type="+node.getNodeType()+", "+ DOMUtils.domToString(node));
    	  return node;
      } else {
          // text and html outputs are handled the same way
          StringWriter writerResult = new StringWriter();
          StreamResult result = new StreamResult(writerResult);
    	  tf.transform(source, result);
          writerResult.flush();
          String output = writerResult.toString();
          if(__log.isDebugEnabled()) __log.debug("Returned string: "+output);
          return output;
      }
>>>>>>> 90d713417eb2cbf0b8f4ec83ebec5043d33aed4a
    } catch (TransformerConfigurationException e) {
      throw new XslTransformException(e);
    } catch (TransformerException e) {
Solution content
          tf.setParameter(param.getKey().getLocalPart(), param.getValue());
        }
      }
      String method = tf.getOutputProperties().getProperty("method");
      if (method == null || "xml".equals(method)) {
    	  DOMResult result = new DOMResult();
    	  tf.transform(source, result);
    	  Node node = result.getNode();
    	  if(node.getNodeType() == Node.DOCUMENT_NODE)
    		  node = ((Document)node).getDocumentElement();
          if(__log.isDebugEnabled()) __log.debug("Returned node: type="+node.getNodeType()+", "+ DOMUtils.domToString(node));
    	  return node;
      } else {
          // text and html outputs are handled the same way
          StringWriter writerResult = new StringWriter();
          StreamResult result = new StreamResult(writerResult);
    	  tf.transform(source, result);
          writerResult.flush();
          String output = writerResult.toString();
          if(__log.isDebugEnabled()) __log.debug("Returned string: "+output);
          return output;
      }
    } catch (TransformerConfigurationException e) {
      throw new XslTransformException(e);
    } catch (TransformerException e) {
File
XslTransformHandler.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Variable