1 19 20 package org.netbeans.modules.websvc.wsitmodelext.mex; 21 22 import org.netbeans.modules.xml.wsdl.model.WSDLComponent; 23 import org.netbeans.modules.xml.wsdl.model.spi.ElementFactory; 24 import org.w3c.dom.Element ; 25 26 import javax.xml.namespace.QName ; 27 import java.util.Collections ; 28 import java.util.Set ; 29 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.DialectImpl; 30 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.IdentifierImpl; 31 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.LocationImpl; 32 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.MetadataImpl; 33 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.MetadataReferenceImpl; 34 import org.netbeans.modules.websvc.wsitmodelext.mex.impl.MetadataSectionImpl; 35 36 public class MexFactories { 37 38 public static class Metadata extends ElementFactory { 39 @Override 40 public Set <QName > getElementQNames() { 41 return Collections.singleton(MexQName.METADATA.getQName()); 42 } 43 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 44 return type.cast(new MetadataImpl(context.getModel())); 45 } 46 @Override 47 public WSDLComponent create(WSDLComponent context, Element element) { 48 return new MetadataImpl(context.getModel(), element); 49 } 50 } 51 52 public static class MetadataReference extends ElementFactory { 53 @Override 54 public Set <QName > getElementQNames() { 55 return Collections.singleton(MexQName.METADATAREFERENCE.getQName()); 56 } 57 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 58 return type.cast(new MetadataReferenceImpl(context.getModel())); 59 } 60 @Override 61 public WSDLComponent create(WSDLComponent context, Element element) { 62 return new MetadataReferenceImpl(context.getModel(), element); 63 } 64 } 65 66 public static class MetadataSection extends ElementFactory { 67 @Override 68 public Set <QName > getElementQNames() { 69 return Collections.singleton(MexQName.METADATASECTION.getQName()); 70 } 71 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 72 return type.cast(new MetadataSectionImpl(context.getModel())); 73 } 74 @Override 75 public WSDLComponent create(WSDLComponent context, Element element) { 76 return new MetadataSectionImpl(context.getModel(), element); 77 } 78 } 79 80 public static class Dialect extends ElementFactory { 81 @Override 82 public Set <QName > getElementQNames() { 83 return Collections.singleton(MexQName.DIALECT.getQName()); 84 } 85 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 86 return type.cast(new DialectImpl(context.getModel())); 87 } 88 @Override 89 public WSDLComponent create(WSDLComponent context, Element element) { 90 return new DialectImpl(context.getModel(), element); 91 } 92 } 93 94 public static class Identifier extends ElementFactory { 95 @Override 96 public Set <QName > getElementQNames() { 97 return Collections.singleton(MexQName.IDENTIFIER.getQName()); 98 } 99 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 100 return type.cast(new IdentifierImpl(context.getModel())); 101 } 102 @Override 103 public WSDLComponent create(WSDLComponent context, Element element) { 104 return new IdentifierImpl(context.getModel(), element); 105 } 106 } 107 108 public static class Location extends ElementFactory { 109 @Override 110 public Set <QName > getElementQNames() { 111 return Collections.singleton(MexQName.LOCATION.getQName()); 112 } 113 public <C extends WSDLComponent> C create(WSDLComponent context, Class <C> type) { 114 return type.cast(new LocationImpl(context.getModel())); 115 } 116 @Override 117 public WSDLComponent create(WSDLComponent context, Element element) { 118 return new LocationImpl(context.getModel(), element); 119 } 120 } 121 } 122 | Popular Tags |