01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * 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: *
22: */package org.netbeans.modules.bpel.model.impl;
23:
24: import java.util.concurrent.atomic.AtomicReference;
25:
26: import org.netbeans.modules.bpel.model.api.NamespaceSpec;
27: import org.netbeans.modules.bpel.model.api.events.VetoException;
28: import org.netbeans.modules.bpel.model.xam.BpelAttributes;
29: import org.netbeans.modules.xml.xam.dom.Attribute;
30: import org.w3c.dom.Element;
31:
32: /**
33: * @author ads
34: *
35: */
36: public abstract class NamespaceSpecImpl extends ExtensibleElementsImpl
37: implements NamespaceSpec {
38:
39: NamespaceSpecImpl(BpelModelImpl model, Element e) {
40: super (model, e);
41: }
42:
43: NamespaceSpecImpl(BpelBuilderImpl builder, String tagName) {
44: super (builder, tagName);
45: }
46:
47: /* (non-Javadoc)
48: * @see org.netbeans.modules.soa.model.bpel20.api.NamespaceReference#getNamespace()
49: */
50: public String getNamespace() {
51: return getAttribute(BpelAttributes.NAMESPACE);
52: }
53:
54: /* (non-Javadoc)
55: * @see org.netbeans.modules.soa.model.bpel20.api.NamespaceReference#setNamespace(java.lang.String)
56: */
57: public void setNamespace(String uri) throws VetoException {
58: setBpelAttribute(BpelAttributes.NAMESPACE, uri);
59: }
60:
61: /* (non-Javadoc)
62: * @see org.netbeans.modules.soa.model.bpel20.impl.BpelEntityImpl#getDomainAttributes()
63: */
64: protected Attribute[] getDomainAttributes() {
65: if (myAttributes.get() == null) {
66: Attribute[] attr = super .getDomainAttributes();
67: Attribute[] ret = new Attribute[attr.length + 1];
68: System.arraycopy(attr, 0, ret, 1, attr.length);
69: ret[0] = BpelAttributes.NAMESPACE;
70: myAttributes.compareAndSet(null, ret);
71: }
72: return myAttributes.get();
73: }
74:
75: private static AtomicReference<Attribute[]> myAttributes = new AtomicReference<Attribute[]>();
76:
77: }
|