本文整理汇总了Java中javax.management.modelmbean.XMLParseException类的典型用法代码示例。如果您正苦于以下问题:Java XMLParseException类的具体用法?Java XMLParseException怎么用?Java XMLParseException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XMLParseException类属于javax.management.modelmbean包,在下文中一共展示了XMLParseException类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parseDataSubElement
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
/**
* Parse a value, ref or collection sub-element of a property or
* constructor-arg element.
* @param ele subelement of property element; we don't know which yet
* @param defaultTypeClassName the default type (class name) for any
* <code><value></code> tag that might be created
*/
public static Object parseDataSubElement(Element ele, String defaultTypeClassName) throws XMLParseException{
if (VALUE_ELEMENT.equals(ele.getName()))
return parseValueElement(ele, defaultTypeClassName);
else if (NULL_ELEMENT.equals(ele.getName()))
return null;
else if (LIST_ELEMENT.equals(ele.getName()))
return parseListElement(ele);
else if (SET_ELEMENT.equals(ele.getName()))
return parseSetElement(ele);
else if (MAP_ELEMENT.equals(ele.getName()))
return parseMapElement(ele);
else if (PROPS_ELEMENT.equals(ele.getName()))
return parsePropsElement(ele);
else
throw new XMLParseException("Unknown property sub-element: [" + ele.getName() + "]");
}
开发者ID:easycodebox,项目名称:easycode,代码行数:25,代码来源:XmlDataParser.java
示例2: toResponse
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
@Override
public Response toResponse(final XMLParseException exception) {
return Response
.status(Response.Status.BAD_REQUEST)
.type(getMediaType(headers,MediaType.APPLICATION_XML_TYPE))
.entity(new ErrorCodeDto(ErrorCodeDto.VMIDC_VALIDATION_EXCEPTION_ERROR_CODE, Arrays.asList(
"Value "+ exception.getMessage() + " is invalid"
)))
.build();
}
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:11,代码来源:XMLParseExceptionMapper.java
示例3: parseValueElement
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
/**
* Return a typed String value Object for the given value element.
*/
public static Object parseValueElement(Element ele, String defaultTypeClassName) throws XMLParseException{
String value = ele.getTextTrim();
String typeClassName = ele.attributeValue(TYPE_ATTRIBUTE);
if (StringUtils.isBlank(typeClassName)) {
typeClassName = defaultTypeClassName;
}
try {
return buildTypedStringValue(value, typeClassName, ele);
}catch (ClassNotFoundException ex) {
log.error("Type class [{}] not found for <value> element", typeClassName, ex);
return value;
}
}
开发者ID:easycodebox,项目名称:easycode,代码行数:17,代码来源:XmlDataParser.java
示例4: buildTypedStringValue
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
protected static Object buildTypedStringValue(String value, String targetTypeName, Element ele)
throws ClassNotFoundException, XMLParseException {
if(StringUtils.isNotBlank(targetTypeName)) {
Class<?> clazz = classPool.get(targetTypeName);
if(clazz == null)
clazz = Class.forName(targetTypeName);
if (clazz != null)
return DataConvert.convertType(value, clazz);
}
return value;
}
开发者ID:easycodebox,项目名称:easycode,代码行数:12,代码来源:XmlDataParser.java
示例5: parseListElement
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
public static List parseListElement(Element collectionEle) throws XMLParseException{
String defaultTypeClassName = collectionEle.attributeValue(VALUE_TYPE_ATTRIBUTE);
List<Element> el = collectionEle.elements();
List values = new ArrayList(el.size());
for (Element e : el) {
if (!COMMENT_ELEMENT.equals(e.getName())) {
values.add(parseDataSubElement(e, defaultTypeClassName));
}
}
return values;
}
开发者ID:easycodebox,项目名称:easycode,代码行数:12,代码来源:XmlDataParser.java
示例6: parseSetElement
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
public static Set parseSetElement(Element collectionEle) throws XMLParseException{
String defaultTypeClassName = collectionEle.attributeValue(VALUE_TYPE_ATTRIBUTE);
List<Element> el = collectionEle.elements();
Set set = new HashSet(el.size());
for (Element e : el) {
if (!COMMENT_ELEMENT.equals(e.getName())) {
set.add(parseDataSubElement(e, defaultTypeClassName));
}
}
return set;
}
开发者ID:easycodebox,项目名称:easycode,代码行数:12,代码来源:XmlDataParser.java
示例7: buildTypedStringValueForMap
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
protected static Object buildTypedStringValueForMap(String value, String defaultTypeClassName, Element entryEle) throws XMLParseException{
try {
return buildTypedStringValue(value, defaultTypeClassName, entryEle);
}
catch (ClassNotFoundException ex) {
log.error("Type class [{}] not found for Map key/value type {}", defaultTypeClassName, entryEle, ex);
return value;
}
}
开发者ID:easycodebox,项目名称:easycode,代码行数:10,代码来源:XmlDataParser.java
示例8: parsePropsElement
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
public static Properties parsePropsElement(Element propsEle) throws XMLParseException{
Properties props = new Properties();
List propEles = propsEle.elements(PROP_ELEMENT);
for (Iterator it = propEles.iterator(); it.hasNext();) {
Element propEle = (Element) it.next();
String key = propEle.attributeValue(KEY_ATTRIBUTE);
// Trim the text value to avoid unwanted whitespace
// caused by typical XML formatting.
String value = propEle.getTextTrim();
props.put(key, value);
}
return props;
}
开发者ID:easycodebox,项目名称:easycode,代码行数:15,代码来源:XmlDataParser.java
示例9: loadXmlFile
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void loadXmlFile(Properties properties, InputStream i) throws DocumentException, XMLParseException {
SAXReader reader = new SAXReader();
Document document = reader.read(i);
Element root = document.getRootElement();
List<Element> subs = root.elements("data");
for (Element e : subs) {
String nameVal = e.attributeValue("name");
if (StringUtils.isNotBlank(nameVal))
properties.put(nameVal, XmlDataParser.parseDataElement(e));
}
}
开发者ID:easycodebox,项目名称:easycode,代码行数:13,代码来源:PropertiesUtils.java
示例10: readMappings
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
private void readMappings(Reader in) throws FileNotFoundException, XMLStreamException, XMLParseException
{
//open the orthoXML for reading
OrthoXMLReader reader = new OrthoXMLReader(in);
// get species from reader
for (Species species : reader.getSpecies())
{
System.out.printf(species.getName() + "\t");
System.out.printf(species.getNcbiTaxId() + "\t");
}
System.out.printf("#");
//read the group iteratively
Group group;
while ((group = reader.next()) != null)
{
Set<Xref> groupRefs = new HashSet<Xref>();
for(Gene gene : group.getNestedGenes())
{
Database database = gene.getDatabase();
DataSource ds = aliases.get(database.getName());
if (ds == null) ds = DataSource.getByFullName(database.getName());
dataSources.add(ds);
groupRefs.add (new Xref(gene.getGeneIdentifier(), ds));
groupRefs.add (new Xref(gene.getProteinIdentifier(), ds));
}
for (Xref ref : groupRefs)
{
allIds.put (ref, groupRefs);
}
}
}
开发者ID:bridgedb,项目名称:BridgeDb,代码行数:38,代码来源:IDMapperOrthoXml.java
示例11: buildHostNodes
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
private void buildHostNodes(List<XmlNodeWrapper> contexts) throws Throwable {
if (0 == contexts.size()) {
throw new XmlParseException("Missing <mqSource> node.");
}
for (XmlNodeWrapper xNode : contexts) {
String id = StringUtils.trim(xNode.getStringAttribute("id"));
if (context.getMqSourceMap().containsKey(id)) {
throw new XmlParseException("Duplicate <mqSource> id: " + id);
}
MqSourceType type = null;
String _type = StringUtils.trim(xNode.getStringAttribute("type"));
type = getMqSourceType(_type);
if (null == type) {
throw new XmlParseException("Unsupported MQ types in <mqSource>: " + id);
}
boolean defaultMs = false;
String _isDefault = StringUtils.trim(xNode.getStringAttribute("isDefault"));
if (null != _isDefault) {
defaultMs = Boolean.parseBoolean(_isDefault);
if (defaultMs) {
if (null != this.defaultMqSource) {
throw new XMLParseException("The default mqSource can only have one");
}
this.defaultMqSource = id;
}
}
Map<String, String> data = new HashMap<String, String>();
List<XmlNodeWrapper> properties = xNode.evalNodes("property");
for (XmlNodeWrapper propertyNode : properties) {
data.put(StringUtils.trim(propertyNode.getStringAttribute("name")).toUpperCase(),
StringUtils.trim(propertyNode.getStringAttribute("value")));
}
MqSourceVo hostVo = new MqSourceVo(id, type, data);
context.getMqSourceMap().put(id, hostVo);
log.info("add mq source: " + id);
}
this.context.setDefaultMqSource(defaultMqSource);
MqSourceManager manager = new MqManagerCreater().create(defaultMqSource, context.getMqSourceMap());
MqContainer.getInstance().setMqSourceManager(manager);
}
开发者ID:xsonorg,项目名称:tangyuan2,代码行数:48,代码来源:XmlMqBuilder.java
示例12: start
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
@Override
public void start() throws Throwable {
boolean durableSubscribers = false;// 持久化订阅
String clientID = null;
if (ChannelType.Topic == queue.getType()) {
// durableSubscribers = (Boolean) queue.getProperties().get(ActiveMqVo.ACTIVEMQ_C_DURABLESUBSCRIBERS);
durableSubscribers = queue.isDurableSubscribers();
if (durableSubscribers) {
// clientID = (String) queue.getProperties().get(ActiveMqVo.ACTIVEMQ_C_CLIENTID);
clientID = queue.getClientID();
if (null == clientID) {
throw new XMLParseException("durable subscribers is missing a clientID: " + queue.getName());
}
}
}
ActiveMqSource mqSource = (ActiveMqSource) MqContainer.getInstance().getMqSourceManager().getMqSource(queue.getMsKey());
Connection connection = null;
if (!durableSubscribers) {
connection = mqSource.getConnection();
} else {
connection = mqSource.getConnection(clientID);
this.durableSubscriberConn = connection;
}
// boolean transacted = (Boolean) queue.getProperties().get(ActiveMqVo.ACTIVEMQ_C_TRANSACTED);
// int acknowledgeMode = (Integer) queue.getProperties().get(ActiveMqVo.ACTIVEMQ_C_ACKNOWLEDGEMODE);
boolean transacted = queue.isTransacted();
int acknowledgeMode = queue.getAcknowledgeMode();
session = connection.createSession(transacted, acknowledgeMode);
Destination destination = null;
if (ChannelType.Queue == queue.getType()) {
destination = session.createQueue(queue.getName());
typeStr = "queue";
} else if (ChannelType.Topic == queue.getType()) {
destination = session.createTopic(queue.getName());
typeStr = "topic";
}
MessageConsumer messageConsumer = null;
if (!durableSubscribers) {
messageConsumer = session.createConsumer(destination);
} else {
messageConsumer = session.createDurableSubscriber((Topic) destination, clientID);
}
running = true;
// boolean asynReceiveMessages = (Boolean) queue.getProperties().get(ActiveMqVo.ACTIVEMQ_C_ASYNRECEIVEMESSAGES);
boolean asynReceiveMessages = queue.isAsynReceive();
if (asynReceiveMessages) {
messageConsumer.setMessageListener(new MessageListener() {
@Override
public void onMessage(Message message) {
try {
// TODO 如果是session.commit();, 是否需要使用同步关键字, 防止提交别的线程的东西
// System.out.println("####################:" + Thread.currentThread().getName());
processMessage(message);
} catch (Throwable e) {
log.error("listen to the [" + queue.getName() + "] error.", e);
}
}
});
} else {
// long receiveTimeout = (Long) queue.getProperties().get(ActiveMqVo.ACTIVEMQ_C_RECEIVETIMEOUT);
long receiveTimeout = queue.getReceiveTimeout();
startSyncReceiveThread(messageConsumer, receiveTimeout);
}
}
开发者ID:xsonorg,项目名称:tangyuan2,代码行数:73,代码来源:ActiveMqReceiver.java
示例13: parseMapElement
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
public static Map parseMapElement(Element mapEle) throws XMLParseException{
String defaultKeyTypeClassName = mapEle.attributeValue(KEY_TYPE_ATTRIBUTE);
String defaultValueTypeClassName = mapEle.attributeValue(VALUE_TYPE_ATTRIBUTE);
List entryEles = mapEle.elements(ENTRY_ELEMENT);
Map map = new HashMap(entryEles.size());
for (Iterator it = entryEles.iterator(); it.hasNext();) {
Element entryEle = (Element) it.next();
// Should only have one value child element: value, list, etc.
// Optionally, there might be a key child element.
List<Element> el = entryEle.elements();
Element keyEle = null;
Element valueEle = null;
for (Element candidateEle : el) {
if (KEY_ELEMENT.equals(candidateEle.getName())) {
if (keyEle != null) {
throw new XMLParseException(entryEle.attributeValue("name") +
"<entry> element is only allowed to contain one <key> sub-element");
} else {
keyEle = candidateEle;
}
} else {
if (valueEle != null) {
throw new XMLParseException(entryEle.attributeValue("name") +
"<entry> element must not contain more than one value sub-element");
} else {
valueEle = candidateEle;
}
}
}
// Extract key from attribute or sub-element.
Object key;
Attribute keyAttribute = entryEle.attribute(KEY_ATTRIBUTE);
if (keyAttribute != null && keyEle != null) {
throw new XMLParseException(entryEle + "<entry> element is only allowed to contain either " +
"a 'key' attribute OR a <key> sub-element");
}
if (keyAttribute != null) {
key = buildTypedStringValueForMap(
entryEle.attributeValue(KEY_ATTRIBUTE), defaultKeyTypeClassName, entryEle);
} else if (keyEle != null) {
key = parseKeyElement(keyEle,defaultKeyTypeClassName);
} else {
throw new XMLParseException("<entry> element must specify a key" + entryEle);
}
// Extract value from attribute or sub-element.
Object value;
Attribute valueAttribute = entryEle.attribute(VALUE_ATTRIBUTE);
if (valueAttribute != null && valueEle != null) {
throw new XMLParseException("<entry> element is only allowed to contain either " +
"'value' attribute OR <value> sub-element" + entryEle);
}
if (valueAttribute != null) {
value = buildTypedStringValueForMap(
entryEle.attributeValue(VALUE_ATTRIBUTE), defaultValueTypeClassName, entryEle);
}
else if (valueEle != null) {
value = parseDataSubElement(valueEle,defaultValueTypeClassName);
}
else {
throw new XMLParseException("<entry> element must specify a value" + entryEle);
}
map.put(key, value);
}
return map;
}
开发者ID:easycodebox,项目名称:easycode,代码行数:71,代码来源:XmlDataParser.java
示例14: loadAbsoluteXmlFile
import javax.management.modelmbean.XMLParseException; //导入依赖的package包/类
/**
*
* @param properties
* @param absoluteFile 文件的绝对地址
* @throws IOException
* @throws FileNotFoundException
* @throws XMLParseException
* @throws DocumentException
*/
public static void loadAbsoluteXmlFile(Properties properties, String absoluteFile) throws IOException, DocumentException, XMLParseException {
Assert.notNull(properties, "'properties' can't be null.");
log.info("properties load file {}.", absoluteFile);
try (InputStream i = new FileInputStream(absoluteFile)) {
loadXmlFile(properties, i);
}
}
开发者ID:easycodebox,项目名称:easycode,代码行数:17,代码来源:PropertiesUtils.java
注:本文中的javax.management.modelmbean.XMLParseException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论