当前位置: 首页>>代码示例>>Java>>正文


Java Import.getDefinition方法代码示例

本文整理汇总了Java中javax.wsdl.Import.getDefinition方法的典型用法代码示例。如果您正苦于以下问题:Java Import.getDefinition方法的具体用法?Java Import.getDefinition怎么用?Java Import.getDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.wsdl.Import的用法示例。


在下文中一共展示了Import.getDefinition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllServices

import javax.wsdl.Import; //导入方法依赖的package包/类
/**
 * This method is an utility method that that handling the cyclic dependent wsdl imports, and wraps javax.wsdl.Definition.getServices.
 * Functions similar to javax.wsdl.Definition.getAllServices(this cannot handle cyclic wsdl imports).
 * @param wsdlDefinition
 * @param traversedDefinitionList
 * @return
 */
private Map<QName, javax.wsdl.Service> getAllServices(Definition wsdlDefinition, List<String> traversedDefinitionList) {
    final Map<QName, javax.wsdl.Service> servicesMap = new HashMap<QName, javax.wsdl.Service>();
    //return if already processed. this avoids cyclic dependencies.
    if (traversedDefinitionList.contains(wsdlDefinition.getTargetNamespace())) {
        return null;
    }
    traversedDefinitionList.add(wsdlDefinition.getTargetNamespace());
    //process the imports
    for (Object imprtCol : wsdlDefinition.getImports().values()) {
        Vector<Import> importVector = (Vector) imprtCol;
        for (Import importEel : importVector) {
            if (importEel.getDefinition() == null) {
                continue;
            }
            Map<QName, javax.wsdl.Service> childMap = getAllServices(importEel.getDefinition(), traversedDefinitionList);
            if (childMap != null) {
                servicesMap.putAll(childMap);
            }
        }
    }
    //process the root node
    if (!wsdlDefinition.getServices().isEmpty()) {
        servicesMap.putAll(wsdlDefinition.getServices());
    }
    return servicesMap;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:34,代码来源:UDDIPublisher.java

示例2: walkWSDLFindingSchema

import javax.wsdl.Import; //导入方法依赖的package包/类
public static void walkWSDLFindingSchema(Definition mainDefinition, Map<String, org.jdom.Element> schemas) {
	LOG.debug("Looking at WSDL at:" + mainDefinition.getDocumentBaseURI());
	org.jdom.Element schema = extractTypesSchema(mainDefinition);
	if (schema != null) {
		LOG.debug("Found types schema.");
		schemas.put(mainDefinition.getDocumentBaseURI(), schema);
	} else {
		LOG.debug("No types schema found.");
	}

	LOG.debug("Looking for imports...");
	Map imports = mainDefinition.getImports();
	if (imports != null) {
		Iterator iter = imports.values().iterator();
		while (iter.hasNext()) {
			LOG.debug("Found imports...");
			List wsdlImports = (List) iter.next();
			for (int i = 0; i < wsdlImports.size(); i++) {
				Import wsdlImport = (Import) wsdlImports.get(i);
				Definition importDefinition = wsdlImport.getDefinition();
				if (importDefinition != null) {
					LOG.debug("Looking at imported WSDL at:" + importDefinition.getDocumentBaseURI());
					walkWSDLFindingSchema(importDefinition, schemas);
				}
			}

		}
	}

}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:31,代码来源:WSDLUtils.java

示例3: publishWsdlImports

import javax.wsdl.Import; //导入方法依赖的package包/类
/** Publish the wsdl imports for a given wsdl definition
 */
@SuppressWarnings("unchecked")
protected void publishWsdlImports(URL parentURL, Definition parentDefinition, List<String> published, String expLocation) throws Exception
{
   @SuppressWarnings("rawtypes")
   Iterator it = parentDefinition.getImports().values().iterator();
   while (it.hasNext())
   {
      for (Import wsdlImport : (List<Import>)it.next())
      {
         String locationURI = wsdlImport.getLocationURI();
         // its an external import, don't publish locally
         if (locationURI.startsWith("http://") == false && locationURI.startsWith("https://") == false)
         {
            // infinity loops prevention
            if (published.contains(locationURI))
            {
               continue;
            }
            else
            {
               published.add(locationURI);
            }
            
            String baseURI = parentURL.toExternalForm();
            URL targetURL = new URL(baseURI.substring(0, baseURI.lastIndexOf("/") + 1) + locationURI);
            File targetFile = new File(targetURL.getFile()); //JBWS-3488
            createParentDir(targetFile);

            Definition subdef = wsdlImport.getDefinition();
            WSDLFactory wsdlFactory = WSDLFactory.newInstance();
            javax.wsdl.xml.WSDLWriter wsdlWriter = wsdlFactory.newWSDLWriter();
            BufferedOutputStream bfos = new BufferedOutputStream(new FileOutputStream(targetFile));
            OutputStreamWriter osw = new OutputStreamWriter(bfos, "UTF-8");
            try {
               wsdlWriter.writeWSDL(subdef, osw);
            } finally {
               osw.close();
            }

            DEPLOYMENT_LOGGER.wsdlImportPublishedTo(targetURL);

            // recursively publish imports
            publishWsdlImports(targetURL, subdef, published, expLocation);

            // Publish XMLSchema imports
            Element subdoc = DOMUtils.parse(targetURL.openStream(), getDocumentBuilder());
            publishSchemaImports(targetURL, subdoc, published, expLocation);
         }
      }
   }
}
 
开发者ID:jbossws,项目名称:jbossws-common,代码行数:54,代码来源:AbstractWSDLFilePublisher.java


注:本文中的javax.wsdl.Import.getDefinition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。