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


Java Resource.getDescription方法代码示例

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


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

示例1: installBundle

import org.springframework.core.io.Resource; //导入方法依赖的package包/类
/**
 * Installs an OSGi bundle from the given location.
 *
 * @param location - location bundle to install
 * @return bundle instance
 * @throws Exception
 */
private Bundle installBundle(Resource location) throws Exception {
    Assert.notNull(platformContext, "the OSGi platform is not set");
    Assert.notNull(location, "cannot install from a null location");
    if (logger.isDebugEnabled())
        logger.debug("Installing bundle from location " + location.getDescription());

    String bundleLocation;

    try {
        bundleLocation = URLDecoder.decode(location.getURL().toExternalForm(), UTF_8_CHARSET);
    } catch (Exception ex) {
        // the URL cannot be created, fall back to the description
        bundleLocation = location.getDescription();
    }

    return platformContext.installBundle(bundleLocation, location.getInputStream());
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:25,代码来源:AbstractOsgiTests.java

示例2: getGroupIdFromPom

import org.springframework.core.io.Resource; //导入方法依赖的package包/类
/**
 * Returns the <tt>groupId</tt> setting in a <tt>pom.xml</tt> file.
 * 
 * @return a <tt>pom.xml</tt> <tt>groupId</tt>.
 */
String getGroupIdFromPom(Resource pomXml) {
	try {
		DocumentLoader docLoader = new DefaultDocumentLoader();
		Document document = docLoader.loadDocument(new InputSource(pomXml.getInputStream()), null, null,
			XmlValidationModeDetector.VALIDATION_NONE, false);

		String groupId = DomUtils.getChildElementValueByTagName(document.getDocumentElement(), GROUP_ID_ELEM);
		// no groupId specified, try the parent definition
		if (groupId == null) {
			if (log.isTraceEnabled())
				log.trace("No groupId defined; checking for the parent definition");
			Element parent = DomUtils.getChildElementByTagName(document.getDocumentElement(), "parent");
			if (parent != null)
				return DomUtils.getChildElementValueByTagName(parent, GROUP_ID_ELEM);
		}
		else {
			return groupId;
		}
	}
	catch (Exception ex) {
		throw (RuntimeException) new RuntimeException(new ParserConfigurationException("error parsing resource="
				+ pomXml).initCause(ex));
	}

	throw new IllegalArgumentException("no groupId or parent/groupId defined by resource ["
			+ pomXml.getDescription() + "]");

}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:34,代码来源:MavenPackagedArtifactFinder.java


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