1 19 20 package org.netbeans.modules.j2ee.ejbjarproject.jaxws; 21 22 import java.io.IOException ; 23 import org.netbeans.api.project.Project; 24 import org.netbeans.modules.j2ee.api.ejbjar.EjbJar; 25 import org.netbeans.modules.j2ee.ejbjarproject.EjbJarProject; 26 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel; 27 import org.netbeans.modules.websvc.api.jaxws.project.WSUtils; 28 import org.netbeans.modules.websvc.api.jaxws.project.config.Service; 29 import org.netbeans.modules.websvc.jaxws.spi.ProjectJAXWSSupport; 30 import org.netbeans.spi.project.support.ant.AntProjectHelper; 31 import org.openide.ErrorManager; 32 import org.openide.filesystems.FileObject; 33 34 38 public class EjbProjectJAXWSSupport extends ProjectJAXWSSupport { 39 private EjbJarProject project; 40 private AntProjectHelper antProjectHelper; 41 42 43 public EjbProjectJAXWSSupport(EjbJarProject project, AntProjectHelper antProjectHelper) { 44 super(project,antProjectHelper); 45 this.project = project; 46 this.antProjectHelper = antProjectHelper; 47 } 48 49 public FileObject getWsdlFolder(boolean create) throws java.io.IOException { 50 EjbJar ejbModule = EjbJar.getEjbJar(project.getProjectDirectory()); 51 if (ejbModule!=null) { 52 FileObject metaInfFo = ejbModule.getMetaInf(); 53 if (metaInfFo!=null) { 54 FileObject wsdlFo = metaInfFo.getFileObject("wsdl"); if (wsdlFo!=null) return wsdlFo; 56 else if (create) { 57 return metaInfFo.createFolder("wsdl"); } 59 } 60 } 61 return null; 62 } 63 64 68 public String getWsdlLocation(String serviceName) { 69 String localWsdl = serviceName+".wsdl"; JaxWsModel jaxWsModel = (JaxWsModel)project.getLookup().lookup(JaxWsModel.class); 71 if (jaxWsModel!=null) { 72 Service service = jaxWsModel.findServiceByName(serviceName); 73 if (service!=null) { 74 String localWsdlFile = service.getLocalWsdlFile(); 75 if (localWsdlFile!=null) localWsdl=localWsdlFile; 76 } 77 } 78 String prefix = "META-INF/wsdl/"; return prefix+serviceName+"/"+localWsdl; } 81 82 public FileObject getDeploymentDescriptorFolder() { 83 EjbJar ejbModule = EjbJar.getEjbJar(project.getProjectDirectory()); 84 if (ejbModule!=null) { 85 return ejbModule.getMetaInf(); 86 } 87 return null; 88 } 89 90 protected void addJaxwsArtifacts(Project project, String wsName, String serviceImpl) throws Exception { 91 } 92 93 95 protected FileObject getXmlArtifactsRoot() { 96 return project.getAPIEjbJar().getMetaInf(); 97 } 98 99 public void removeNonJsr109Entries(String serviceName) throws IOException { 100 } 102 103 public String addService(String name, String serviceImpl, String wsdlUrl, String serviceName, String portName, String packageName, boolean isJsr109) { 104 FileObject fo = project.findJaxWsFileObject(); 106 if (fo==null) { 107 try { 108 project.createJaxWsFileObject(); 109 } catch (IOException ex) { 110 ErrorManager.getDefault().notify(ex); 111 } 112 } 113 return super.addService(name, serviceImpl, wsdlUrl, serviceName, portName, packageName, isJsr109); 114 } 115 116 public void addService(String serviceName, String serviceImpl, boolean isJsr109) { 117 FileObject fo = project.findJaxWsFileObject(); 119 if (fo==null) { 120 try { 121 project.createJaxWsFileObject(); 122 } catch (IOException ex) { 123 ErrorManager.getDefault().notify(ex); 124 } 125 } 126 super.addService(serviceName, serviceImpl, isJsr109); 127 } 128 129 } 130 | Popular Tags |