本文整理汇总了Java中com.atlassian.core.util.ClassLoaderUtils类的典型用法代码示例。如果您正苦于以下问题:Java ClassLoaderUtils类的具体用法?Java ClassLoaderUtils怎么用?Java ClassLoaderUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassLoaderUtils类属于com.atlassian.core.util包,在下文中一共展示了ClassLoaderUtils类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTransformerUrlFromConfigFile
import com.atlassian.core.util.ClassLoaderUtils; //导入依赖的package包/类
private String getTransformerUrlFromConfigFile() {
InputStream properties = ClassLoaderUtils.getResourceAsStream("autodoc_confluence.properties", getClass());
Properties props = new Properties();
try {
props.load(properties);
} catch (IOException e) {
log.error("Couldn't load the configuration file", e);
}
return props.getProperty("transformerUrl", "https://localhost:8080/transformer");
}
示例2: populateI18nProperties
import com.atlassian.core.util.ClassLoaderUtils; //导入依赖的package包/类
private void populateI18nProperties() {
try (final InputStream stream = ClassLoaderUtils.getResourceAsStream(HubJiraConstants.PROPERTY_FILENAME, this.getClass())) {
if (stream != null) {
i18nProperties.load(stream);
} else {
logger.warn("Error opening property file: " + HubJiraConstants.PROPERTY_FILENAME);
}
} catch (final IOException e) {
logger.warn("Error reading property file: " + HubJiraConstants.PROPERTY_FILENAME);
}
logger.debug("i18nProperties: " + i18nProperties);
}
示例3: getWorkflowDescriptorFromResource
import com.atlassian.core.util.ClassLoaderUtils; //导入依赖的package包/类
private WorkflowDescriptor getWorkflowDescriptorFromResource() throws IOException, FactoryException {
// https://developer.atlassian.com/confdev/development-resources/confluence-developer-faq/what-is-the-best-way-to-load-a-class-or-resource-from-a-plugin
final InputStream inputStream = ClassLoaderUtils
.getResourceAsStream(HubJiraConstants.HUB_JIRA_WORKFLOW_RESOURCE, this.getClass());
if (inputStream == null) {
logger.error("Could not find the Hub JIRA workflow resource.");
settingService.addHubError("Could not find the Hub JIRA workflow resource.", "addHubWorkflow");
return null;
}
final String workflowXml = IOUtils.toString(inputStream, StandardCharsets.UTF_8.name());
return WorkflowUtil.convertXMLtoWorkflowDescriptor(workflowXml);
}
示例4: createBlackDuckAvatar
import com.atlassian.core.util.ClassLoaderUtils; //导入依赖的package包/类
private Avatar createBlackDuckAvatar(String issueTypeName) throws DataAccessException, IOException {
logger.debug("Creating avatar for issue type: " + issueTypeName);
String avatarImagePath = getAvatarImagePath(issueTypeName);
String avatarImageFilename = getAvatarImageFilename(issueTypeName);
logger.debug("Loading Black Duck avatar from " + avatarImagePath);
logger.debug("Creating avatar template");
final Avatar avatarTemplate = jiraServices.createIssueTypeAvatarTemplate(
avatarImageFilename,
"image/png", jiraUser.getKey());
if (avatarTemplate == null) {
logger.debug("jiraServices.createIssueTypeAvatarTemplate() returned null");
return null;
}
InputStream is = ClassLoaderUtils.getResourceAsStream(avatarImagePath, this.getClass());
final Avatar duckyAvatar = jiraServices.getAvatarManager().create(avatarTemplate,
is, null);
if (duckyAvatar == null) {
throw new DataAccessException("AvatarManager().create() returned null");
}
logger.debug("Created Avatar " + duckyAvatar.getFileName() + " with ID " + duckyAvatar.getId());
return duckyAvatar;
}