1 19 20 package org.netbeans.modules.websvc.api.webservices; 21 22 import java.util.Iterator ; 23 import java.util.List ; 24 import org.netbeans.api.java.classpath.ClassPath; 25 import org.netbeans.modules.j2ee.metadata.MetadataUnit; 26 import org.netbeans.modules.websvc.webservices.WebServicesSupportAccessor; 27 import org.netbeans.modules.websvc.spi.webservices.*; 28 import org.openide.filesystems.FileObject; 29 import org.openide.util.Lookup; 30 import org.netbeans.spi.project.support.ant.AntProjectHelper; 31 import org.netbeans.api.project.Project; 32 import org.netbeans.modules.j2ee.dd.api.webservices.ServiceImplBean; 33 import org.netbeans.spi.java.classpath.support.ClassPathSupport; 34 import org.netbeans.spi.project.support.ant.ReferenceHelper; 35 36 45 public final class WebServicesSupport implements MetadataUnit { 46 47 private WebServicesSupportImpl impl; 48 private static final Lookup.Result implementations = 49 Lookup.getDefault().lookup(new Lookup.Template(WebServicesSupportProvider.class)); 50 51 static { 52 WebServicesSupportAccessor.DEFAULT = new WebServicesSupportAccessor() { 53 public WebServicesSupport createWebServicesSupport(WebServicesSupportImpl spiWebServicesSupport) { 54 return new WebServicesSupport(spiWebServicesSupport); 55 } 56 57 public WebServicesSupportImpl getWebServicesSupportImpl(WebServicesSupport wss) { 58 return wss == null ? null : wss.impl; 59 } 60 }; 61 } 62 63 private WebServicesSupport(WebServicesSupportImpl impl) { 64 if (impl == null) 65 throw new IllegalArgumentException (); 66 this.impl = impl; 67 } 68 69 72 public static WebServicesSupport getWebServicesSupport(FileObject f) { 73 if (f == null) { 74 throw new NullPointerException ("Passed null to WebServicesSupport.getWebServicesSupport(FileObject)"); } 76 Iterator it = implementations.allInstances().iterator(); 77 while (it.hasNext()) { 78 WebServicesSupportProvider impl = (WebServicesSupportProvider)it.next(); 79 WebServicesSupport wss = impl.findWebServicesSupport(f); 80 if (wss != null) { 81 return wss; 82 } 83 } 84 return null; 85 } 86 87 89 public void addServiceImpl(String serviceName, FileObject configFile, boolean fromWSDL) { 90 impl.addServiceImpl(serviceName, configFile, fromWSDL); 91 } 92 93 public void addServiceEntriesToDD(String serviceName, String serviceEndpointInterface, String servantClassName){ 94 impl.addServiceEntriesToDD(serviceName, serviceEndpointInterface, servantClassName); 95 } 96 97 public FileObject getWebservicesDD() { 98 return impl.getWebservicesDD(); 99 } 100 101 public FileObject getWsDDFolder() { 102 return impl.getWsDDFolder(); 103 } 104 105 public String getArchiveDDFolderName() { 106 return impl.getArchiveDDFolderName(); 107 } 108 109 public String getImplementationBean(String linkName) { 110 return impl.getImplementationBean(linkName); 111 } 112 113 public void removeServiceEntry(String linkName) { 114 impl.removeServiceEntry(linkName); 115 } 116 117 public void removeProjectEntries(String serviceName){ 118 impl.removeProjectEntries(serviceName); 119 } 120 121 public AntProjectHelper getAntProjectHelper() { 122 return impl.getAntProjectHelper(); 123 } 124 125 public String generateImplementationBean(String name, FileObject pkg, Project project, String delegateData) throws java.io.IOException { 126 return impl.generateImplementationBean(name, pkg, project, delegateData); 127 } 128 129 public void addServiceImplLinkEntry(ServiceImplBean serviceImplBean, String wsName) { 130 impl.addServiceImplLinkEntry(serviceImplBean, wsName); 131 } 132 133 public ReferenceHelper getReferenceHelper(){ 134 return impl.getReferenceHelper(); 135 } 136 137 public List getServices() { 138 return impl.getServices(); 139 } 140 141 public void addInfrastructure(String implBeanClass, FileObject pkg) { 142 impl.addInfrastructure(implBeanClass, pkg); 143 } 144 145 public boolean isFromWSDL(String serviceName) { 146 return impl.isFromWSDL(serviceName); 147 } 148 149 public void addServiceImpl(String serviceName, FileObject configFile, boolean fromWSDL, String [] wscompileFeatures) { 150 impl.addServiceImpl(serviceName, configFile, fromWSDL,wscompileFeatures); 151 } 152 153 public FileObject getDeploymentDescriptor() { 154 return getWebservicesDD(); 155 } 156 157 public ClassPath getClassPath() { 158 return impl.getClassPath(); 159 } 160 161 } 162 | Popular Tags |