001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019:
020: /**
021: *
022: */package org.netbeans.modules.bpel.model.impl;
023:
024: import java.util.concurrent.atomic.AtomicReference;
025:
026: import org.netbeans.modules.bpel.model.api.BpelEntity;
027: import org.netbeans.modules.bpel.model.api.ServiceRef;
028: import org.netbeans.modules.bpel.model.api.events.VetoException;
029: import org.netbeans.modules.bpel.model.api.support.BpelModelVisitor;
030: import org.netbeans.modules.bpel.model.xam.BpelAttributes;
031: import org.netbeans.modules.bpel.model.xam.BpelElements;
032: import org.netbeans.modules.xml.xam.dom.Attribute;
033: import org.w3c.dom.Element;
034:
035: /**
036: * @author ads
037: *
038: */
039: public class ServiceRefImpl extends BpelContainerImpl implements
040: ServiceRef {
041:
042: ServiceRefImpl(BpelModelImpl model, Element e) {
043: super (model, e);
044: }
045:
046: ServiceRefImpl(BpelBuilderImpl builder) {
047: super (builder, BpelElements.SERVICE_REF);
048: }
049:
050: /* (non-Javadoc)
051: * @see org.netbeans.modules.bpel.model.api.ServiceRef#getReferenceScheme()
052: */
053: public String getReferenceScheme() {
054: return getAttribute(BpelAttributes.REFERENCE_SCHEME);
055: }
056:
057: /* (non-Javadoc)
058: * @see org.netbeans.modules.bpel.model.api.ServiceRef#setReferenceScheme(java.lang.String)
059: */
060: public void setReferenceScheme(String value) throws VetoException {
061: setBpelAttribute(BpelAttributes.REFERENCE_SCHEME, value);
062: }
063:
064: /* (non-Javadoc)
065: * @see org.netbeans.modules.bpel.model.api.ServiceRef#removeReferenceScheme()
066: */
067: public void removeReferenceScheme() {
068: removeAttribute(BpelAttributes.REFERENCE_SCHEME);
069: }
070:
071: /* (non-Javadoc)
072: * @see org.netbeans.modules.bpel.model.api.BpelEntity#getElementType()
073: */
074: public Class<? extends BpelEntity> getElementType() {
075: return ServiceRef.class;
076: }
077:
078: /* (non-Javadoc)
079: * @see org.netbeans.modules.bpel.model.api.BpelEntity#accept(org.netbeans.modules.bpel.model.api.support.BpelModelVisitor)
080: */
081: public void accept(BpelModelVisitor visitor) {
082: visitor.visit(this );
083: }
084:
085: /* (non-Javadoc)
086: * @see org.netbeans.modules.bpel.model.impl.BpelContainerImpl#create(org.w3c.dom.Element)
087: */
088: @Override
089: protected BpelEntity create(Element element) {
090: return null;
091: }
092:
093: /* (non-Javadoc)
094: * @see org.netbeans.modules.bpel.model.impl.BpelEntityImpl#getDomainAttributes()
095: */
096: @Override
097: protected Attribute[] getDomainAttributes() {
098: if (myAttributes.get() == null) {
099: Attribute[] ret = new Attribute[] { BpelAttributes.REFERENCE_SCHEME };
100: myAttributes.compareAndSet(null, ret);
101: }
102: return myAttributes.get();
103: }
104:
105: private static AtomicReference<Attribute[]> myAttributes = new AtomicReference<Attribute[]>();
106: }
|