| 
  |||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ProcessImplFactory.java | 75% | 100% | 100% | 95.5% | 
             | 
  ||||||||||||||
| 1 | 
       /*
 | 
|
| 2 | 
        * $Id: ProcessImplFactory.java,v 1.1 2004/12/15 14:18:09 patforna Exp $
 | 
|
| 3 | 
        *
 | 
|
| 4 | 
        * Copyright (c) 2004 Patric Fornasier, Pawel Kowalski
 | 
|
| 5 | 
        * Berne University of Applied Sciences
 | 
|
| 6 | 
        * School of Engineering and Information Technology
 | 
|
| 7 | 
        * All rights reserved.
 | 
|
| 8 | 
        */
 | 
|
| 9 | 
       package bexee.model.xmltobpel;
 | 
|
| 10 | 
       | 
|
| 11 | 
       import java.util.Hashtable;
 | 
|
| 12 | 
       import java.util.Map;
 | 
|
| 13 | 
       | 
|
| 14 | 
       import org.xml.sax.Attributes;
 | 
|
| 15 | 
       | 
|
| 16 | 
       import bexee.model.process.Process;
 | 
|
| 17 | 
       | 
|
| 18 | 
       /**
 | 
|
| 19 | 
        * This class is used by the <a
 | 
|
| 20 | 
        * href="http://jakarta.apache.org/commons/digester/">Digester </a> for the
 | 
|
| 21 | 
        * transformation of a process from a BPEL document into a
 | 
|
| 22 | 
        * <code>ProcessImpl</code> object. The creation of a process object is
 | 
|
| 23 | 
        * delegated to the <code>BPELElementFactory</code>.
 | 
|
| 24 | 
        * 
 | 
|
| 25 | 
        * @author Pawel Kowalski
 | 
|
| 26 | 
        * @version $Revision: 1.1 $, $Date: 2004/12/15 14:18:09 $
 | 
|
| 27 | 
        */
 | 
|
| 28 | 
      public class ProcessImplFactory extends AbstractObjectCreationFactory {  | 
|
| 29 | 
       | 
|
| 30 | 
           //**************************************************/
 | 
|
| 31 | 
           // create object
 | 
|
| 32 | 
           //**************************************************/
 | 
|
| 33 | 
       | 
|
| 34 | 
           /**
 | 
|
| 35 | 
            * Create a <code>ProcessImpl</code> activity instance using delegation to
 | 
|
| 36 | 
            * a <code>BPELElementFactory</code>.
 | 
|
| 37 | 
            * 
 | 
|
| 38 | 
            * @param attributes
 | 
|
| 39 | 
            *            an <code>Attributes</code> value
 | 
|
| 40 | 
            * @return an <code>ProcessImpl</code> value
 | 
|
| 41 | 
            * @exception Exception
 | 
|
| 42 | 
            *                if an error occurs
 | 
|
| 43 | 
            */
 | 
|
| 44 | 32 | 
   public Object createObject(Attributes attributes) throws Exception {  | 
| 45 | 
       | 
|
| 46 | 32 | 
   String name = attributes.getValue(NAME);  | 
| 47 | 32 | 
   String targetNamespace = attributes.getValue(TARGET_NAMESPACE);  | 
| 48 | 32 | 
   String queryLanguage = attributes.getValue(QUERY_LANGUAGE);  | 
| 49 | 32 | 
   String expressionLanguage = attributes.getValue(EXPRESSION_LANGUAGE);  | 
| 50 | 32 | 
   String suppressJoinFailure = attributes.getValue(SUPPRESS_JOIN_FAILURE);  | 
| 51 | 32 | 
   String enableInstanceCompensation = attributes  | 
| 52 | 
      .getValue(ENABLE_INSTANCE_COMPESATION);  | 
|
| 53 | 32 | 
   String abstractProcess = attributes.getValue(ABSTRACT_PROCESS);  | 
| 54 | 32 | 
   String xmlns = attributes.getValue(XMLNS);  | 
| 55 | 
       | 
|
| 56 | 32 | 
            Map nameSpaces = new Hashtable();
 | 
| 57 | 32 | 
   String currentQName;  | 
| 58 | 32 | 
   for (int i = 0; i < attributes.getLength(); i++) {  | 
| 59 | 186 | 
   currentQName = attributes.getQName(i);  | 
| 60 | 186 | 
   int separatorIndex = currentQName.indexOf(":");  | 
| 61 | 186 | 
   
                if (separatorIndex != 1) {
   
 | 
| 62 | 186 | 
   nameSpaces.put(currentQName.substring(separatorIndex + 1),  | 
| 63 | 
      attributes.getValue(i));  | 
|
| 64 | 
      }  | 
|
| 65 | 
      }  | 
|
| 66 | 
       | 
|
| 67 | 32 | 
   Process process = getElementFactory().createProcess(name,  | 
| 68 | 
      targetNamespace, queryLanguage, expressionLanguage,  | 
|
| 69 | 
      suppressJoinFailure, enableInstanceCompensation,  | 
|
| 70 | 
      abstractProcess, xmlns, nameSpaces);  | 
|
| 71 | 
       | 
|
| 72 | 32 | 
            return process;
 | 
| 73 | 
      }  | 
|
| 74 | 
      }  | 
  | 
||||||||||