KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > model > extensions > bpel > BPELComponentFactory


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
23  *
24  * $Id: BPELComponentFactory.java,v 1.4 2007/02/22 18:58:51 samaresh Exp $
25  */

26
27 package org.netbeans.modules.xml.wsdl.model.extensions.bpel;
28
29 import javax.xml.namespace.QName JavaDoc;
30
31 import org.netbeans.modules.xml.wsdl.model.WSDLComponent;
32 import org.netbeans.modules.xml.wsdl.model.WSDLModel;
33 import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent;
34
35 /**
36  *
37  * @author Nam Nguyen
38  *
39  * changed by
40  * @author ads
41  */

42 public class BPELComponentFactory {
43     private WSDLModel model;
44     
45     /** Creates a new instance of BPELComponentFactory */
46     public BPELComponentFactory(WSDLModel model) {
47         this.model = model;
48     }
49     
50     public CorrelationProperty createCorrelationProperty( WSDLComponent context )
51     {
52         return (CorrelationProperty) model.getFactory().create(context,
53                 BPELQName.PROPERTY.getQName());
54     }
55     
56     public PropertyAlias createPropertyAlias( WSDLComponent context ) {
57         return (PropertyAlias) model.getFactory().create(context,
58                 BPELQName.PROPERTY_ALIAS.getQName());
59     }
60
61     public PartnerLinkType createPartnerLinkType( WSDLComponent context ) {
62         return (PartnerLinkType) model.getFactory().create(context,
63                 BPELQName.PARTNER_LINK_TYPE.getQName());
64     }
65
66     public Role createRole( WSDLComponent context ) {
67         return (Role) model.getFactory().create(context,
68                 BPELQName.ROLE.getQName());
69     }
70     
71     public Query createQuery( WSDLComponent context ){
72         return (Query) model.getFactory().create(context,
73                 BPELQName.QUERY.getQName());
74     }
75     
76     public Documentation createDocumentation(WSDLComponent context) {
77         QName JavaDoc qName = null;
78         if ( context instanceof AbstractDocumentComponent ) {
79             qName = ((AbstractDocumentComponent)context).getQName();
80         }
81         else {
82             throw new IllegalStateException JavaDoc("Couldn't create child " + // NOI18N
83
"documentation for unknown implementation parent"); // NOI18N
84
}
85         assert qName != null;
86         if ( BPELQName.VARPROP_NS.equals( qName.getNamespaceURI() )) {
87             return (Documentation) model.getFactory().create(context,
88                     BPELQName.DOCUMENTATION_VARPROP.getQName());
89         }
90         else if ( BPELQName.PLNK_NS.equals( qName.getNamespaceURI() )) {
91             return (Documentation) model.getFactory().create(context,
92                     BPELQName.DOCUMENTATION_PLNK.getQName());
93         }
94         else {
95             assert false;
96             return null;
97         }
98     }
99 }
100
Popular Tags