本文整理汇总了Java中com.sun.xml.internal.ws.runtime.config.MetroConfig类的典型用法代码示例。如果您正苦于以下问题:Java MetroConfig类的具体用法?Java MetroConfig怎么用?Java MetroConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetroConfig类属于com.sun.xml.internal.ws.runtime.config包,在下文中一共展示了MetroConfig类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createJAXBContext
import com.sun.xml.internal.ws.runtime.config.MetroConfig; //导入依赖的package包/类
private static JAXBContext createJAXBContext() throws Exception {
if (isJDKInternal()) {
// since jdk classes are repackaged, extra privilege is necessary to create JAXBContext
return AccessController.doPrivileged(
new PrivilegedExceptionAction<JAXBContext>() {
@Override
public JAXBContext run() throws Exception {
return JAXBContext.newInstance(MetroConfig.class.getPackage().getName());
}
}, createSecurityContext()
);
} else {
// usage from JAX-WS/Metro/Glassfish
return JAXBContext.newInstance(MetroConfig.class.getPackage().getName());
}
}
示例2: getTubeline
import com.sun.xml.internal.ws.runtime.config.MetroConfig; //导入依赖的package包/类
TubelineDefinition getTubeline(MetroConfig config, URI tubelineDefinitionUri) {
if (config != null && config.getTubelines() != null) {
for (TubelineDefinition td : config.getTubelines().getTubelineDefinitions()) {
if (td.getName().equals(tubelineDefinitionUri.getFragment())) {
return td;
}
}
}
return null;
}
示例3: loadMetroConfig
import com.sun.xml.internal.ws.runtime.config.MetroConfig; //导入依赖的package包/类
private static MetroConfig loadMetroConfig(@NotNull URL resourceUrl) {
MetroConfig result = null;
try {
JAXBContext jaxbContext = createJAXBContext();
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
XMLInputFactory factory = XmlUtil.newXMLInputFactory(true);
final JAXBElement<MetroConfig> configElement = unmarshaller.unmarshal(factory.createXMLStreamReader(resourceUrl.openStream()), MetroConfig.class);
result = configElement.getValue();
} catch (Exception e) {
LOGGER.warning(TubelineassemblyMessages.MASM_0010_ERROR_READING_CFG_FILE_FROM_LOCATION(resourceUrl.toString()), e);
}
return result;
}
示例4: loadMetroConfig
import com.sun.xml.internal.ws.runtime.config.MetroConfig; //导入依赖的package包/类
private static MetroConfig loadMetroConfig(@NotNull URL resourceUrl) {
try (InputStream is = getConfigInputStream(resourceUrl)) {
JAXBContext jaxbContext = createJAXBContext();
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
XMLInputFactory factory = XmlUtil.newXMLInputFactory(true);
JAXBElement<MetroConfig> configElement = unmarshaller.unmarshal(factory.createXMLStreamReader(is), MetroConfig.class);
return configElement.getValue();
} catch (Exception e) {
String message = TubelineassemblyMessages.MASM_0010_ERROR_READING_CFG_FILE_FROM_LOCATION(
resourceUrl != null ? resourceUrl.toString() : null);
InternalError error = new InternalError(message);
LOGGER.logException(error, e, Level.SEVERE);
throw error;
}
}
示例5: createJAXBContext
import com.sun.xml.internal.ws.runtime.config.MetroConfig; //导入依赖的package包/类
private static JAXBContext createJAXBContext() throws Exception {
if (isJDKInternal()) {
// since jdk classes are repackaged, extra privilege is necessary to create JAXBContext
return AccessController.doPrivileged(
new PrivilegedExceptionAction<JAXBContext>() {
@Override
public JAXBContext run() throws Exception {
return JAXBContext.newInstance(MetroConfig.class.getPackage().getName());
}
});
} else {
// usage from JAX-WS/Metro/Glassfish
return JAXBContext.newInstance(MetroConfig.class.getPackage().getName());
}
}