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

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

本文整理了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

  1. @Override
  2. public void setDefaultElementTypeNamespace(String uri) throws XQException {
  3. if (uri == null) {
  4. throw new XQException("Default element type namespace URI is null");
  5. }
  6. defaultElementTypeNamespace = uri;
  7. }

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

  1. @Override
  2. public void setDefaultCollation(String uri) throws XQException {
  3. if (uri == null) {
  4. throw new XQException("Default collation URI is null");
  5. }
  6. this.defaultCollationUri = uri;
  7. }

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

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

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

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

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

  1. protected void checkAccess(boolean checkPosition) throws XQException {
  2. if (checkPosition && !positioned) {
  3. throw new XQException("Not positioned on an Item");
  4. }
  5. if (accessed) {
  6. throw new XQException("Item has been already accessed");
  7. }
  8. }

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

  1. private XQItemAccessor getBoundItem(Map<String, Object> bindings, String varName) throws XQException {
  2. if (bindings.size() == 0) {
  3. throw new XQException("bindings not provided");
  4. }
  5. XQItemAccessor item = (XQItemAccessor) bindings.get(varName);
  6. if (item == null) {
  7. throw new XQException("variable '" + varName + "' not bound");
  8. }
  9. return item;
  10. }

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

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

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

  1. @Override
  2. public String getPIName() throws XQException {
  3. if (XQUtils.isPINameSupported(kind)) {
  4. if (nodeName != null) {
  5. return nodeName.getLocalPart();
  6. }
  7. return null;
  8. }
  9. throw new XQException("getPIName is not supported for this item kind: " + kind);
  10. }

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

  1. @Override
  2. public void writeSequence(Writer ow, Properties props) throws XQException {
  3. checkState(ex_sequence_closed);
  4. if (ow == null) {
  5. throw new XQException("Provided Writer is null");
  6. }
  7. try {
  8. ow.write(getSequenceAsString(props));
  9. } catch (IOException ex) {
  10. throw new XQException(ex.getMessage());
  11. }
  12. }

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

  1. void checkState(String error) throws XQException {
  2. if (isClosed()) {
  3. throw new XQException(error);
  4. }
  5. }

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

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

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

  1. @Override
  2. public void writeSequenceToResult(Result result) throws XQException {
  3. checkState(ex_sequence_closed);
  4. if (result == null) {
  5. throw new XQException("Provided Result is null");
  6. }
  7. try {
  8. XMLUtils.stringToResult(getSequenceAsString(null), result);
  9. } catch (IOException ex) {
  10. throw new XQException(ex.getMessage());
  11. }
  12. }

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

  1. @Override
  2. public void writeItemToResult(Result result) throws XQException {
  3. checkState(ex_item_closed);
  4. if (result == null) {
  5. throw new XQException("Provided Result is null");
  6. }
  7. try {
  8. XMLUtils.stringToResult(getItemAsString(null), result);
  9. } catch (IOException ex) {
  10. throw new XQException(ex.getMessage());
  11. }
  12. }

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

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

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

  1. @Override
  2. public XQExpression createExpression(XQStaticContext context) throws XQException {
  3. checkState(ex_connection_closed);
  4. if (context == null) {
  5. throw new XQException(ex_null_context);
  6. }
  7. return new BagriXQExpression(this, context);
  8. }

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

  1. @Override
  2. public XMLStreamReader getSequenceAsStream() throws XQException {
  3. checkState(ex_sequence_closed);
  4. try {
  5. return XMLUtils.stringToStream(getSequenceAsString(null));
  6. } catch (IOException ex) {
  7. throw new XQException(ex.getMessage());
  8. }
  9. }

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

  1. @Override
  2. public double getDouble() throws XQException {
  3. checkState(ex_item_closed);
  4. if (type.getBaseType() == XQBASETYPE_DOUBLE) {
  5. return (Double) value;
  6. }
  7. if (type.getBaseType() == XQBASETYPE_FLOAT) {
  8. return ((Float) value).doubleValue();
  9. }
  10. throw new XQException("ItemType is not double");
  11. }

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

  1. @Override
  2. @SuppressWarnings({ "rawtypes", "unchecked" })
  3. public XQSequence createSequence(Iterator itr) throws XQException {
  4. checkState(ex_connection_closed);
  5. if (itr == null) {
  6. throw new XQException("Iterator is null");
  7. }
  8. // shouldn't we check processor props to know type of sequence?
  9. return new ScrollableXQSequence(this, xqProcessor, copyIterator(itr));
  10. //return new IterableXQSequence(this, xqProcessor, itr);
  11. }

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

  1. @Override
  2. public void executeCommand(String cmd) throws XQException {
  3. checkState(ex_expression_closed);
  4. if (cmd == null) {
  5. throw new XQException("Provided command is null");
  6. }
  7. connection.executeCommand(cmd, getBindings());
  8. }

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

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

相关文章