javax.xml.xquery.XQException.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中javax.xml.xquery.XQException.<init>()方法的一些代码示例,展示了XQException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XQException.<init>()方法的具体详情如下:
包路径:javax.xml.xquery.XQException
类名称:XQException
方法名:<init>

XQException.<init>介绍

[英]Constructs an XQException object with a given message. An optional chain of additional XQException objects may be set subsequently using setNextException.
[中]用给定的消息构造一个XQException对象。后续可使用setNextException设置额外XQException对象的可选链。

代码示例

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void setDefaultElementTypeNamespace(String uri) throws XQException {
  
  if (uri == null) {
    throw new XQException("Default element type namespace URI is null");
  }  
  defaultElementTypeNamespace = uri;
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void setDefaultCollation(String uri) throws XQException {
  
  if (uri == null) {
    throw new XQException("Default collation URI is null");
  }  
  this.defaultCollationUri = uri;
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void setQueryLanguageTypeAndVersion(int langType) throws XQException {
  
  if (langType != LANGTYPE_XQUERY && langType != LANGTYPE_XQUERYX) {
    throw new XQException("Wrong language type and version value: " + langType);
  }  
  // we do not support XQueryX, don't see how it can be set.. 
  this.queryLanguageTypeAndVersion = langType;
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void setQueryTimeout(int seconds) throws XQException {
  
  if (seconds < 0) {
    throw new XQException("Wrong query timeout value: " + seconds);
  }
  this.queryTimeout = seconds;
}

代码示例来源:origin: dsukhoroslov/bagri

protected void checkAccess(boolean checkPosition) throws XQException {
  if (checkPosition && !positioned) {
    throw new XQException("Not positioned on an Item");
  }
  if (accessed) {
    throw new XQException("Item has been already accessed");
  }
}

代码示例来源:origin: dsukhoroslov/bagri

private XQItemAccessor getBoundItem(Map<String, Object> bindings, String varName) throws XQException {
  if (bindings.size() == 0) {
    throw new XQException("bindings not provided");
  }
  XQItemAccessor item = (XQItemAccessor) bindings.get(varName);
  if (item == null) {
    throw new XQException("variable '" + varName + "' not bound");
  }
  return item;
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public int getBaseType() throws XQException {
  
  if (XQUtils.isBaseTypeSupported(kind)) {
    return baseType;
  }
  throw new XQException("getBaseType is not supported for this item kind: " + kind);
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public String getPIName() throws XQException {
  
  if (XQUtils.isPINameSupported(kind)) {
    if (nodeName != null) {
      return nodeName.getLocalPart();
    }
    return null;
  }
  throw new XQException("getPIName is not supported for this item kind: " + kind);
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void writeSequence(Writer ow, Properties props) throws XQException {
  
  checkState(ex_sequence_closed);
  if (ow == null) {
    throw new XQException("Provided Writer is null");
  }
  try {
    ow.write(getSequenceAsString(props));
  } catch (IOException ex) {
    throw new XQException(ex.getMessage());
  }
}

代码示例来源:origin: dsukhoroslov/bagri

void checkState(String error) throws XQException {
  if (isClosed()) {
    throw new XQException(error);
  }
}

代码示例来源:origin: dsukhoroslov/bagri

public static void main(String[] args) throws Exception {
  
  if (args.length < 4) {
    throw new XQException("wrong number of arguments passed. Expected: schemaAddress schemaName userName password");
  }
  
  Properties props = new Properties();
  props.setProperty(pn_schema_address, args[0]);
  props.setProperty(pn_schema_name, args[1]);
  props.setProperty(pn_schema_user, args[2]);
  props.setProperty(pn_schema_password, args[3]);
  XQJClientApp client = new XQJClientApp(props); 
  tester.testClient(client);
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void writeSequenceToResult(Result result) throws XQException {
  
  checkState(ex_sequence_closed);
  if (result == null) {
    throw new XQException("Provided Result is null");
  }
  try {
    XMLUtils.stringToResult(getSequenceAsString(null), result);
  } catch (IOException ex) {
    throw new XQException(ex.getMessage());
  }
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void writeItemToResult(Result result) throws XQException {
  checkState(ex_item_closed);
  if (result == null) {
    throw new XQException("Provided Result is null");
  }
  
  try {
    XMLUtils.stringToResult(getItemAsString(null), result);
  } catch (IOException ex) {
    throw new XQException(ex.getMessage());
  }
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public XQItemType createAttributeType(QName nodeName, int baseType, QName typeName,	URI schemaURI) throws XQException {
  
  checkState(ex_connection_closed);
  if (baseType == XQBASETYPE_UNTYPED || baseType == XQBASETYPE_ANYTYPE) {
    throw new XQException("Wrong base type: " + baseType);
  }
  return new BagriXQItemType(baseType, XQITEMKIND_ATTRIBUTE, nodeName, typeName, false, schemaURI);
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public XQExpression createExpression(XQStaticContext context) throws XQException {
  
  checkState(ex_connection_closed);
  if (context == null) {
    throw new XQException(ex_null_context);
  }
  return new BagriXQExpression(this, context);
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public XMLStreamReader getSequenceAsStream() throws XQException {
  checkState(ex_sequence_closed);
  try {
    return XMLUtils.stringToStream(getSequenceAsString(null));
  } catch (IOException ex) {
    throw new XQException(ex.getMessage());
  }
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public double getDouble() throws XQException {
  
  checkState(ex_item_closed);
  if (type.getBaseType() == XQBASETYPE_DOUBLE) {
    return (Double) value;
  }
  if (type.getBaseType() == XQBASETYPE_FLOAT) {
    return ((Float) value).doubleValue();
  }
  throw new XQException("ItemType is not double");
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public XQSequence createSequence(Iterator itr) throws XQException {
  checkState(ex_connection_closed);
  if (itr == null) {
    throw new XQException("Iterator is null");
  }
  // shouldn't we check processor props to know type of sequence?
  return new ScrollableXQSequence(this, xqProcessor, copyIterator(itr));
  //return new IterableXQSequence(this, xqProcessor, itr);
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public void executeCommand(String cmd) throws XQException {
  
  checkState(ex_expression_closed);
  if (cmd == null) {
    throw new XQException("Provided command is null");
  }
  connection.executeCommand(cmd, getBindings());
}

代码示例来源:origin: dsukhoroslov/bagri

@Override
public XQItem createItemFromBoolean(boolean value, XQItemType type) throws XQException {
  checkState(ex_connection_closed);
  if (type == null || type.getBaseType() == XQBASETYPE_BOOLEAN) {
    return new BagriXQItem(xqProcessor, new BagriXQItemType(XQBASETYPE_BOOLEAN, XQITEMKIND_ATOMIC, null, getTypeName(XQBASETYPE_BOOLEAN), false, null), value);
  } 
  throw new XQException("wrong boolean type: " + type + "(" + type.getBaseType() + ")");
}

相关文章