KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > wsdl > impl > PartnerLinkTypeImpl


1 package org.jbpm.bpel.wsdl.impl;
2
3 import javax.wsdl.PortType;
4
5 import org.jbpm.bpel.wsdl.def.PartnerLinkType;
6 import org.jbpm.bpel.wsdl.xml.WsdlConstants;
7
8 /**
9  * A partner link type characterizes the conversational relationship between
10  * two services. It does so by defining the "roles" played by each of the
11  * services in the conversation and specifying the portType provided by each
12  * service to receive messages within the context of the conversation.
13  * @author Alejandro Guízar
14  * @version $Revision: 1.4 $ $Date: 2005/06/03 01:26:49 $
15  */

16 public class PartnerLinkTypeImpl extends NamedExtension implements PartnerLinkType {
17   
18   private static final long serialVersionUID = 1L;
19
20   /**
21    * The role played by each of the services in the conversation.
22    */

23   public static class RoleImpl implements Role {
24     
25     long id;
26     private String JavaDoc name;
27     private PortType portType;
28     
29     private static final long serialVersionUID = 1L;
30
31     /**
32      * {@inheritDoc}
33      */

34     public String JavaDoc getName() {
35       return name;
36     }
37
38     /**
39      * {@inheritDoc}
40      */

41     public void setName(String JavaDoc name) {
42       this.name = name;
43     }
44
45     /**
46      * {@inheritDoc}
47      */

48     public PortType getPortType() {
49       return portType;
50     }
51
52     /**
53      * {@inheritDoc}
54      */

55     public void setPortType(PortType portType) {
56       this.portType = portType;
57     }
58   }
59   
60   private Role firstRole;
61   private Role secondRole;
62
63   /**
64    * Constructs a partner link type and sets the element type.
65    */

66   public PartnerLinkTypeImpl() {
67     setElementType(WsdlConstants.Q_PARTNER_LINK_TYPE);
68   }
69
70   /**
71    * {@inheritDoc}
72    */

73   public Role getFirstRole() {
74     return firstRole;
75   }
76
77   /**
78    * {@inheritDoc}
79    */

80   public void setFirstRole(Role firstRole) {
81     this.firstRole = firstRole;
82   }
83
84   /**
85    * {@inheritDoc}
86    */

87   public Role getSecondRole() {
88     return secondRole;
89   }
90   
91   /**
92    * {@inheritDoc}
93    */

94   public void setSecondRole(Role secondRole) {
95     this.secondRole = secondRole;
96   }
97   
98   /**
99    * {@inheritDoc}
100    */

101   public Role createRole() {
102     return new RoleImpl();
103   }
104   
105   public Role getRole(String JavaDoc roleName) {
106     Role role = null;
107     if (firstRole != null && firstRole.getName().equals(roleName))
108       role = firstRole;
109     else if (secondRole != null && secondRole.getName().equals(roleName))
110       role = secondRole;
111     return role;
112   }
113 }
114
Popular Tags