1 19 20 package org.netbeans.modules.j2ee.clientproject.wsclient; 21 22 import java.io.IOException ; 23 import org.netbeans.modules.j2ee.api.ejbjar.Car; 24 import org.netbeans.modules.j2ee.clientproject.AppClientProject; 25 import org.netbeans.modules.websvc.api.jaxws.project.WSUtils; 26 import org.netbeans.modules.websvc.api.jaxws.project.config.Client; 27 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel; 28 import org.netbeans.modules.websvc.spi.jaxws.client.ProjectJAXWSClientSupport; 29 import org.netbeans.spi.project.support.ant.AntProjectHelper; 30 import org.openide.ErrorManager; 31 import org.openide.filesystems.FileObject; 32 33 37 public class AppClientProjectJAXWSClientSupport extends ProjectJAXWSClientSupport { 38 AppClientProject project; 39 40 43 public AppClientProjectJAXWSClientSupport(AppClientProject project, AntProjectHelper antProjectHelper) { 44 super(project); 45 this.project=project; 46 } 47 48 public FileObject getWsdlFolder(boolean create) throws IOException { 49 JaxWsModel jaxWsModel = (JaxWsModel)project.getLookup().lookup(JaxWsModel.class); 50 Car carModule = Car.getCar(project.getProjectDirectory()); 51 if (carModule!=null) { 52 FileObject webInfFo = carModule.getMetaInf(); 53 if (webInfFo!=null) { 54 FileObject wsdlFo = webInfFo.getFileObject("wsdl"); if (wsdlFo!=null) { 56 return wsdlFo; 57 } else if (create) { 58 return webInfFo.createFolder("wsdl"); } 60 } 61 } 62 return null; 63 } 64 65 protected void addJaxWs20Library() throws Exception { 66 } 67 68 70 protected FileObject getXmlArtifactsRoot() { 71 return project.getCarModule().getMetaInf(); 72 } 73 74 public String addServiceClient(String clientName, String wsdlUrl, String packageName, boolean isJsr109) { 75 FileObject fo = project.findJaxWsFileObject(); 77 if (fo==null) { 78 try { 79 project.createJaxWsFileObject(); 80 } catch (IOException ex) { 81 ErrorManager.getDefault().notify(ex); 82 } 83 } 84 String finalClientName = super.addServiceClient(clientName, wsdlUrl, packageName, isJsr109); 85 86 JaxWsModel jaxWsModel = (JaxWsModel)project.getLookup().lookup(JaxWsModel.class); 89 Client client = jaxWsModel.findClientByName(finalClientName); 90 if (client!=null && client.getWsdlUrl().startsWith("file:")) try { 92 FileObject wsdlFolder = getWsdlFolderForClient(finalClientName); 93 FileObject xmlResorcesFo = getLocalWsdlFolderForClient(finalClientName,false); 94 if (xmlResorcesFo!=null) WSUtils.copyFiles(xmlResorcesFo, wsdlFolder); 95 } catch (IOException ex) { 96 ErrorManager.getDefault().notify(ex); 97 } 98 return finalClientName; 99 } 100 101 } 102 | Popular Tags |