Package org.wso2.carbon.dataservices.core

Examples of org.wso2.carbon.dataservices.core.DataServiceFault


  private void assignProps(Object obj, Map<String, String> props) throws DataServiceFault {
    Method method;
    for (Entry<String, String> prop : props.entrySet()) {
      method = getSetterMethod(obj, this.getSetterMethodNameFromPropName(prop.getKey()));
      if (method == null) {
        throw new DataServiceFault("Setter method for property '" + prop.getKey()
            + "' cannot be found");
      }
      try {
          method.invoke(obj, convertStringToGivenType(prop.getValue(),
              method.getParameterTypes()[0]));
      } catch (Exception e) {
        throw new DataServiceFault(e, "Cannot invoke setter for property '" +
            prop.getKey() + "'");
      }
    }
  }
View Full Code Here


      return Float.parseFloat(value);
    }
    if (double.class.equals(type) || Double.class.equals(type)) {
      return Double.parseDouble(value);
    }   
    throw new DataServiceFault("Cannot convert value: '" +
        value + "' to type: '" + type.getName() + "'");
  }
View Full Code Here

      if (this.getName() != null) {
          this.endElement(xmlWriter);
      }
      return null;
    } catch (XMLStreamException e) {
      throw new DataServiceFault(e, "Error in XML generation at OutputElementGroup.execute");
    }
  }
View Full Code Here

    int maxPoolSize = DBConstants.DEFAULT_DBCP_MAX_POOL_SIZE;
    try {
      if (!DBUtils.isEmptyString(minPool)) {
        minPoolSize = Integer.valueOf(minPool).intValue();
        if (minPoolSize < 0) {
          throw new DataServiceFault("Minimum pool size '" + minPoolSize +
              "' should be a positive value in config '" + this.getConfigId() + "'");
        }
      }
    } catch (NumberFormatException e) {
      throw new DataServiceFault(e, "Invalid minimum pool size '" + minPool + "' in config '" +
          this.getConfigId() + "'");
    }
    try {
      if (!DBUtils.isEmptyString(maxPool)) {
        maxPoolSize = Integer.valueOf(maxPool).intValue();
      }
    } catch (NumberFormatException e) {
      throw new DataServiceFault(e, "Invalid maximum pool size '" + maxPool + "' in config '" +
            this.getConfigId() + "'");
    }
      if (!DBUtils.isEmptyString(minPool) && !DBUtils.isEmptyString(maxPool)) {
        if (minPoolSize > maxPoolSize) {
         throw new DataServiceFault("Minimum pool size is greater than maximum pool size in config '" +
            this.getConfigId() + "'");
        }
      }
  }
View Full Code Here

          this.autoCommit = AutoCommit.AUTO_COMMIT_ON;
        } else {
          this.autoCommit = AutoCommit.AUTO_COMMIT_OFF;
        }
      } catch (Exception e) {
        throw new DataServiceFault(e, "Invalid autocommit value in config: " +
            autoCommitProp + ", autocommit should be a boolean value");
      }   
    } else {
      this.autoCommit = AutoCommit.DEFAULT;     
    }
View Full Code Here

    DataSource ds = this.getDataSource();
    if (ds != null) {
      Connection conn = ds.getConnection();
      return conn;
    } else {
      throw new DataServiceFault("The data source is nonexistent");
    }
  }
View Full Code Here

   
    if (resultType != DBConstants.ResultTypes.RDF) {
      /* validate element name */
      if (this.elementName != null && this.elementName.trim().length() > 0
          && !NCName.isValid(this.elementName)) {
        throw new DataServiceFault("Invalid wrapper element name: '"
              + this.elementName + "', must be an NCName.");
      }
      /* validate row name */
      if (this.rowName != null && this.rowName.length() != 0 &&
          !NCName.isValid(this.rowName)) {
        throw new DataServiceFault("Invalid row name: '" + this.rowName
            + "', must be an NCName.");
      }
    }
    this.namespace = namespace;
    if (xsltPath != null) {
            try {
                xsltTransformer = new XSLTTransformer(xsltPath);
            } catch (Exception e) {
                throw new DataServiceFault(e,
                        "Error in XSLT Transformation initialization in Result");
            }
        }
        this.resultType = resultType;
  }
View Full Code Here

  }
 
  public static String extractKey(String documentURL) throws DataServiceFault {
    int i1 = documentURL.lastIndexOf("key=");
    if (documentURL.length() < (i1 + 5)) {
      throw new DataServiceFault("Invalid documentURL: " + documentURL);
    }
    int i2 = documentURL.indexOf("&", i1);
    if (i2 < 0) {
      return documentURL.substring(i1 + 4);
    } else {
View Full Code Here

    super(dataService, queryId, queryParams, result, configId,
        inputEventTrigger, outputEventTrigger, advancedProperties, inputNamespace);
        try {
            this.config = (WebConfig) this.getDataService().getConfig(this.getConfigId());
        } catch (ClassCastException e) {
      throw new DataServiceFault(e, "Configuration is not an Web config:"
          + this.getConfigId());
        }
        this.scraperVariable = scraperVariable;
    }
View Full Code Here

            }

            return null;
        } catch (Exception e) {
            log.error("Error in executing web scraping query", e);
            throw new DataServiceFault(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.dataservices.core.DataServiceFault

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.