@Test public void testGenerateStoreServiceImplementationFromWSDL() { SwitchyardJavaGenerator gen=new SwitchyardJavaGenerator(); try { java.net.URL url=ClassLoader.getSystemClassLoader().getResource(STORE_WSDL_LOCATION); java.net.URL modelurl=ClassLoader.getSystemClassLoader().getResource("models/PurchaseGoods.spr"); java.io.File modelFile=new java.io.File(modelurl.getPath()); java.util.List<Role> refRoles=new java.util.Vector<Role>(); refRoles.add(new Role("CreditAgency")); refRoles.add(new Role("Logistics")); java.util.List<String> refWsdlPaths=new java.util.Vector<String>(); refWsdlPaths.add(ClassLoader.getSystemClassLoader().getResource(CREDITAGENCY_WSDL_LOCATION).getFile()); refWsdlPaths.add(ClassLoader.getSystemClassLoader().getResource(LOGISTICS_WSDL_LOCATION).getFile()); gen.createServiceImplementationFromWSDL(new Role("Store"), refRoles, getProtocol("PurchaseGoods", "Store"), url.getFile(), STORE_WSDL_LOCATION, refWsdlPaths, SRC_PATH, new DefaultResourceLocator(modelFile.getParentFile())); compare("expected/StoreImpl.java.txt", SRC_PATH+"/org/savara/examples/store/StoreImpl.java"); } catch(Exception e) { e.printStackTrace(); fail("Failed to generate interface: "+e); } }
@Override public void createServiceImplementationFromWSDL(Role role, java.util.List<Role> refRoles, ProtocolModel behaviour, String wsdlPath, String wsdlLocation, java.util.List<String> refWsdlPaths, String srcFolder, ResourceLocator locator) throws Exception { super.createServiceImplementationFromWSDL(role, refRoles, behaviour, wsdlPath, wsdlLocation, refWsdlPaths, srcFolder, locator); javax.wsdl.Definition defn=getWSDLReader().readWSDL(wsdlPath); if (defn != null) { String pack=JavaGeneratorUtil.getJavaPackage(defn.getTargetNamespace()); String folder=pack.replace('.', java.io.File.separatorChar); @SuppressWarnings("unchecked") java.util.Iterator<PortType> portTypes=defn.getPortTypes().values().iterator(); while (portTypes.hasNext()) { PortType portType=portTypes.next(); java.io.File f=new java.io.File(srcFolder+java.io.File.separatorChar+ folder+java.io.File.separatorChar+portType.getQName().getLocalPart()+"Impl.java"); if (f.exists()) { makeSwitchyardService(f, portType, srcFolder); addServiceReferencesToImplementation(f, role, refRoles, refWsdlPaths, srcFolder); addServiceBehaviour(f, role, refRoles, behaviour, srcFolder, locator); } else { logger.severe("Service file '"+f.getAbsolutePath()+"' does not exist"); } } removeWebServiceAndClientAnnotations(wsdlPath, srcFolder); } else { logger.severe("Failed to retrieve WSDL definition '"+wsdlPath+"'"); } }
SwitchyardJavaGenerator extends org.savara.java.generator.JavaServiceGenerator { @Override public void createServiceImplementationFromWSDL(Role role, java.util.List<Role> refRoles, ProtocolModel behaviour, String wsdlPath, String wsdlLocation, java.util.List<String> refWsdlPaths, String srcFolder, ResourceLocator locator) throws Exception { super.createServiceImplementationFromWSDL(role, refRoles, behaviour, wsdlPath, wsdlLocation, refWsdlPaths, srcFolder, locator); javax.wsdl.Definition defn=getWSDLReader().readWSDL(wsdlPath); if (defn != null) { String pack=JavaGeneratorUtil.getJavaPackage(defn.getTargetNamespace()); String folder=pack.replace('.', java.io.File.separatorChar); @SuppressWarnings("unchecked") java.util.Iterator<PortType> portTypes=defn.getPortTypes().values().iterator(); while (portTypes.hasNext()) { PortType portType=portTypes.next(); java.io.File f=new java.io.File(srcFolder+java.io.File.separatorChar+ folder+java.io.File.separatorChar+portType.getQName().getLocalPart()+"Impl.java"); if (f.exists()) { makeSwitchyardService(f, portType, srcFolder); addServiceReferencesToImplementation(f, role, refRoles, refWsdlPaths, srcFolder); addServiceBehaviour(f, role, refRoles, behaviour, srcFolder, locator); } else { logger.severe("Service file '"+f.getAbsolutePath()+"' does not exist"); } } removeWebServiceAndClientAnnotations(wsdlPath, srcFolder); } else { logger.severe("Failed to retrieve WSDL definition '"+wsdlPath+"'"); } } }
SwitchyardJavaGenerator extends org.savara.java.generator.JavaServiceGenerator { @Override public void createServiceImplementationFromWSDL(Role role, java.util.List<Role> refRoles, ProtocolModel behaviour, String wsdlPath, String wsdlLocation, java.util.List<String> refWsdlPaths, String srcFolder, ResourceLocator locator) throws Exception { super.createServiceImplementationFromWSDL(role, refRoles, behaviour, wsdlPath, wsdlLocation, refWsdlPaths, srcFolder, locator); javax.wsdl.Definition defn=getWSDLReader().readWSDL(wsdlPath); if (defn != null) { String pack=JavaGeneratorUtil.getJavaPackage(defn.getTargetNamespace()); String folder=pack.replace('.', java.io.File.separatorChar); @SuppressWarnings("unchecked") java.util.Iterator<PortType> portTypes=defn.getPortTypes().values().iterator(); while (portTypes.hasNext()) { PortType portType=portTypes.next(); java.io.File f=new java.io.File(srcFolder+java.io.File.separatorChar+ folder+java.io.File.separatorChar+portType.getQName().getLocalPart()+"Impl.java"); if (f.exists()) { makeSwitchyardService(f, portType, srcFolder); addServiceReferencesToImplementation(f, role, refRoles, refWsdlPaths, srcFolder); addServiceBehaviour(f, role, refRoles, behaviour, srcFolder, locator); } else { logger.severe("Service file '"+f.getAbsolutePath()+"' does not exist"); } } removeWebServiceAndClientAnnotations(wsdlPath, srcFolder); } else { logger.severe("Failed to retrieve WSDL definition '"+wsdlPath+"'"); } } SwitchyardJavaGenerator(); }
SwitchyardJavaGenerator extends org.savara.java.generator.JavaServiceGenerator { @Override public void createServiceImplementationFromWSDL(Role role, java.util.List<Role> refRoles, ProtocolModel behaviour, String wsdlPath, String wsdlLocation, java.util.List<String> refWsdlPaths, String srcFolder, ResourceLocator locator) throws Exception { super.createServiceImplementationFromWSDL(role, refRoles, behaviour, wsdlPath, wsdlLocation, refWsdlPaths, srcFolder, locator); javax.wsdl.Definition defn=getWSDLReader().readWSDL(wsdlPath); if (defn != null) { String pack=JavaGeneratorUtil.getJavaPackage(defn.getTargetNamespace()); String folder=pack.replace('.', java.io.File.separatorChar); @SuppressWarnings("unchecked") java.util.Iterator<PortType> portTypes=defn.getPortTypes().values().iterator(); while (portTypes.hasNext()) { PortType portType=portTypes.next(); java.io.File f=new java.io.File(srcFolder+java.io.File.separatorChar+ folder+java.io.File.separatorChar+portType.getQName().getLocalPart()+"Impl.java"); if (f.exists()) { makeSwitchyardService(f, portType, srcFolder); addServiceReferencesToImplementation(f, role, refRoles, refWsdlPaths, srcFolder); addServiceBehaviour(f, role, refRoles, behaviour, srcFolder, locator); } else { logger.severe("Service file '"+f.getAbsolutePath()+"' does not exist"); } } removeWebServiceAndClientAnnotations(wsdlPath, srcFolder); } else { logger.severe("Failed to retrieve WSDL definition '"+wsdlPath+"'"); } } SwitchyardJavaGenerator(); static void main(String[] args); @Override void createServiceInterfaceFromWSDL(String wsdlPath, String wsdlLocation, String srcFolder); @Override void createServiceImplementationFromWSDL(Role role, java.util.List<Role> refRoles,
							ProtocolModel behaviour, String wsdlPath, String wsdlLocation,
						java.util.List<String> refWsdlPaths, String srcFolder,
						ResourceLocator locator); void createServiceComposite(Role role, java.util.List<Role> refRoles,
				String wsdlPath, java.util.List<String> refWsdlPaths,
				String resourceFolder, String srcFolder); }
SwitchyardJavaGenerator extends org.savara.java.generator.JavaServiceGenerator { @Override public void createServiceImplementationFromWSDL(Role role, java.util.List<Role> refRoles, ProtocolModel behaviour, String wsdlPath, String wsdlLocation, java.util.List<String> refWsdlPaths, String srcFolder, ResourceLocator locator) throws Exception { super.createServiceImplementationFromWSDL(role, refRoles, behaviour, wsdlPath, wsdlLocation, refWsdlPaths, srcFolder, locator); javax.wsdl.Definition defn=getWSDLReader().readWSDL(wsdlPath); if (defn != null) { String pack=JavaGeneratorUtil.getJavaPackage(defn.getTargetNamespace()); String folder=pack.replace('.', java.io.File.separatorChar); @SuppressWarnings("unchecked") java.util.Iterator<PortType> portTypes=defn.getPortTypes().values().iterator(); while (portTypes.hasNext()) { PortType portType=portTypes.next(); java.io.File f=new java.io.File(srcFolder+java.io.File.separatorChar+ folder+java.io.File.separatorChar+portType.getQName().getLocalPart()+"Impl.java"); if (f.exists()) { makeSwitchyardService(f, portType, srcFolder); addServiceReferencesToImplementation(f, role, refRoles, refWsdlPaths, srcFolder); addServiceBehaviour(f, role, refRoles, behaviour, srcFolder, locator); } else { logger.severe("Service file '"+f.getAbsolutePath()+"' does not exist"); } } removeWebServiceAndClientAnnotations(wsdlPath, srcFolder); } else { logger.severe("Failed to retrieve WSDL definition '"+wsdlPath+"'"); } } SwitchyardJavaGenerator(); static void main(String[] args); @Override void createServiceInterfaceFromWSDL(String wsdlPath, String wsdlLocation, String srcFolder); @Override void createServiceImplementationFromWSDL(Role role, java.util.List<Role> refRoles,
							ProtocolModel behaviour, String wsdlPath, String wsdlLocation,
						java.util.List<String> refWsdlPaths, String srcFolder,
						ResourceLocator locator); void createServiceComposite(Role role, java.util.List<Role> refRoles,
				String wsdlPath, java.util.List<String> refWsdlPaths,
				String resourceFolder, String srcFolder);  }