Examples of DataServiceFault


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

        try {
            Scraper scraper = getScraperConfig();
            scraper.execute();
            return (Variable) scraper.getContext().get(queryVariable);
        } catch (Exception e) {
            throw new DataServiceFault(e, "Error in Scraper Execution");
        }

    }
View Full Code Here

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

    private void registerSubscribers(EventBroker eventBroker, String topic,
                                     List<String> endpointUrls) throws DataServiceFault {
        if (eventBroker == null) {
            String msg = "Unable To Register Event Subscribers, Event Broker Not Available.";
            log.error(msg);
            throw new DataServiceFault(msg);
        }

        /*
         * Adding new subscriptions.
         */
        Subscription subscription;
        for (String epr : endpointUrls) {
            try {
                subscription = new Subscription();
                subscription.setEventSinkURL(epr);
                subscription.setId(UUID.randomUUID().toString());
                subscription.setTopicName(topic);
                subscription.setEventDispatcherName(EVENT_DISPATCHER_NAME);
                subscription.setOwner(this.getDataService().getName());
                eventBroker.subscribe(subscription);
            } catch (Exception e) {
                throw new DataServiceFault(e, "Error in event subscription for EPR: " + epr +
                        " Topic:" + topic);
            }
        }
    }
View Full Code Here

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

     */
    private void sendMessageToTopic(OMElement omMessage, String topic) throws DataServiceFault {
        try {
            EventBroker eventBroker = DataServicesDSComponent.getEventBroker();
            if (eventBroker == null) {
              throw new DataServiceFault("Event broker instance is not available");
            }
            Message message = new Message();
            message.setMessage(omMessage);
            eventBroker.publish(message, topic);
        } catch (Exception e) {
          throw new DataServiceFault(e, "Error in publishing event for topic: " +
                    topic + " message:-\n" + omMessage);
        }
    }
View Full Code Here

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

      validateRDBMSConfig();
        this.setDBCPConnectionManager(new DBCPConnectionManager(this));
        try {
          this.initSQLDataSource();
        } catch (SQLException e) {
          throw new DataServiceFault(e, DBConstants.FaultCodes.CONNECTION_UNAVAILABLE_ERROR,
              e.getMessage());
        }
    }
  }
View Full Code Here

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

 
  private XADataSourceInfo createXADataSourceInfo(Map<String, String> properties)
      throws DataServiceFault {
    String className = properties.get(DBConstants.RDBMS.XA_DATASOURCE_CLASS);
    if (DBUtils.isEmptyString(className)) {
      throw new DataServiceFault(
          "The class cannot be empty in XADataSource entry with props: \n" + properties);
    }
    String propsString = properties.get(DBConstants.RDBMS.XA_DATASOURCE_PROPS);
    OMElement xaPropsEl = null;
    try {
      xaPropsEl = AXIOMUtil.stringToOM(propsString);
    } catch (Exception e) {
      throw new DataServiceFault(e, "Error in passing XA data source properties: " + propsString);
    }
    Map<String, String> xaProps = DBUtils.extractProperties(xaPropsEl);
    return new XADataSourceInfo(this.getDataService(), className, xaProps);
  }
View Full Code Here

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

    try {
      XMLStreamWriter xmlWriter = XMLOutputFactory.newInstance()
          .createXMLStreamWriter(new NullOutputStream());
      this.execute(xmlWriter, true);
    } catch (XMLStreamException e) {
      throw new DataServiceFault(e, "Error in pre-fetching data");
    }
  }
View Full Code Here

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

          this.endElement(xmlWriter);
      }
     
      return null;
    } catch (XMLStreamException e) {
      throw new DataServiceFault(e, "Error in CallQueryGroup.execute");
    }
  }
View Full Code Here

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

      throws DataServiceFault {
    Query query;
    String configId = getConfigId(queryEl);
    Config config = dataService.getConfig(configId);
    if (config == null) {
      throw new DataServiceFault("Invalid configId: " + configId + " in :- \n" + queryEl);
    }
    String sourceType = config.getType();
    if (DataSourceTypes.RDBMS.equals(sourceType)
        || DataSourceTypes.JNDI.equals(sourceType)
        || DataSourceTypes.CARBON.equals(sourceType)) {
      query = createSQLQuery(dataService, queryEl);
    } else if (DataSourceTypes.CSV.equals(sourceType)) {
      query = createCSVQuery(dataService, queryEl);
    } else if (DataSourceTypes.EXCEL.equals(sourceType)) {
      query = createExcelQuery(dataService, queryEl);
    } else if (DataSourceTypes.GDATA_SPREADSHEET.equals(sourceType)) {
      query = createGSpreadQuery(dataService, queryEl);
        } else if (DataSourceTypes.RDF.equals(sourceType)) {
          query = createSPARQLQuery(dataService, queryEl);
    else if (DataSourceTypes.WEB.equals(sourceType)) {
      query = createWebQuery(dataService, queryEl);
    } else {
      throw new DataServiceFault("Invalid configType: " +
          sourceType + " in :- \n" + queryEl);
    }   
    return query;
  }
View Full Code Here

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

        sparql = queryEl.getFirstChildWithName(new QName(DBSFields.SPARQL)).getText();
        eventTriggers = getEventTriggers(dataService, queryEl);
        result = getResultFromQueryElement(dataService, queryEl);
        inputNamespace = extractQueryInputNamespace(dataService, result, queryEl);
    } catch (Exception e) {
      throw new DataServiceFault(e, "Error in parsing SPARQL query element");
    }   
    SPARQLQuery query = new SPARQLQuery(dataService, queryId, configId,
        sparql, getQueryParamsFromQueryElement(queryEl), result,
        eventTriggers[0], eventTriggers[1],
        extractAdvancedProps(queryEl), inputNamespace);
View Full Code Here

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

          String repeatedDialects = "";
          Iterator<String> it = intersect.iterator();
          while (it.hasNext()) {
            repeatedDialects = repeatedDialects +" "+it.hasNext();
          }
          throw new DataServiceFault("SQL Dialect(s) repeated "+repeatedDialects);
        }
      }
    }
    return dialectList;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.