Package javax.resource

Examples of javax.resource.ResourceException


    public javax.resource.cci.LocalTransaction getLocalTransaction()
      throws ResourceException {
  try {
        java.sql.Connection con = getJdbcConnection();
  if (con.getTransactionIsolation() == con.TRANSACTION_NONE) {
      throw new ResourceException("Local Transaction not supported!!");
  }
  } catch(Exception e) {
      throw new ResourceException(e.getMessage());
  }
        return new CciLocalTransactionImpl(mc);
    }
View Full Code Here


    public void setAutoCommit(boolean autoCommit) throws ResourceException {

  try {
      java.sql.Connection con = getJdbcConnection();
      if (con.getTransactionIsolation() == con.TRANSACTION_NONE) {
          throw new ResourceException("Local Transaction not " +
              "supported!!");
      }
      con.setAutoCommit(autoCommit);
  }catch(Exception e) {
      throw new ResourceException(e.getMessage());
  }
    }
View Full Code Here

       
  boolean val = false;
  try{
            java.sql.Connection con = getJdbcConnection();
      if (con.getTransactionIsolation() == con.TRANSACTION_NONE) {
          throw new ResourceException("Local Transaction not " +
              "supported!!");
      }
            val =  con.getAutoCommit();
  }catch(SQLException e) {
      throw new ResourceException(e.getMessage());
  }
  return val;
    }
View Full Code Here

        mc = newMc;
    }

    void checkIfValid() throws ResourceException {
        if (mc == null) {
            throw new ResourceException("Connection is invalid");
        }
    }
View Full Code Here

 
  String getUserName() throws ResourceException {
      try {
        return sfSoap.getUserInfo(sh).getUserName();
      } catch (com.sforce.soap.partner.UnexpectedErrorFault e) {
        throw new ResourceException(e);
      }
  }
View Full Code Here

      // This value identifies Teiid as a SF certified solution.
      // It was provided by SF and should not be changed.
      co.setClient("RedHat/MetaMatrix/"); //$NON-NLS-1$
     
      if(url == null) {
        throw new ResourceException("SalesForce URL is not specified, please provide a valid URL"); //$NON-NLS-1$
      }

      Bus bus = BusFactory.getThreadDefaultBus();
      BusFactory.setThreadDefaultBus(mcf.getBus());
      try {
        sfService = new SforceService();
        sfSoap = sfService.getSoap();
        ((BindingProvider)sfSoap).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url.toExternalForm());
        loginResult = sfSoap.login(username, password);
      } catch (LoginFault e) {
        throw new ResourceException(e);
      } catch (InvalidIdFault e) {
        throw new ResourceException(e);
      } catch (com.sforce.soap.partner.UnexpectedErrorFault e) {
        throw new ResourceException(e);
      } finally {
        BusFactory.setThreadDefaultBus(bus);
      }
      LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Login was successful for username " + username); //$NON-NLS-1$

      sh = new SessionHeader();
      sh.setSessionId(loginResult.getSessionId());
      // Reset the SOAP endpoint to the returned server URL
      ((BindingProvider)sfSoap).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,loginResult.getServerUrl());
      // or maybe org.apache.cxf.message.Message.ENDPOINT_ADDRESS
      ((BindingProvider)sfSoap).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY,Boolean.TRUE);
      // Set the timeout.
      //((BindingProvider)sfSoap).getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT, timeout);

     
      // Test the connection.
      try {
        sfSoap.getUserInfo(sh);
      } catch (com.sforce.soap.partner.UnexpectedErrorFault e) {
        throw new ResourceException(e);
      }
    }
  }
View Full Code Here

        mruHeader.setUpdateMru(false);
       
        qr = sfSoap.query(queryString, sh);
      }
    } catch (InvalidFieldFault e) {
      throw new ResourceException(e);
    } catch (MalformedQueryFault e) {
      throw new ResourceException(e);
    } catch (com.sforce.soap.partner.InvalidSObjectFault e) {
      throw new ResourceException(e);
    } catch (InvalidIdFault e) {
      throw new ResourceException(e);
    } catch (com.sforce.soap.partner.UnexpectedErrorFault e) {
      throw new ResourceException(e);
    } catch (com.sforce.soap.partner.InvalidQueryLocatorFault e) {
      throw new ResourceException(e);
    }
    return qr;
  }
View Full Code Here

    QueryOptions qo = partnerFactory.createQueryOptions();
    qo.setBatchSize(batchSize);
    try {
      return sfSoap.queryMore(queryLocator, sh);
    } catch (InvalidFieldFault e) {
      throw new ResourceException(e);
    } catch (com.sforce.soap.partner.UnexpectedErrorFault e) {
      throw new ResourceException(e);
    } catch (com.sforce.soap.partner.InvalidQueryLocatorFault e) {
      throw new ResourceException(e);
    }
   
  }
View Full Code Here

  public int delete(String[] ids) throws ResourceException {
    List<DeleteResult> results = null;
    try {
      results = sfSoap.delete(Arrays.asList(ids), sh);
    } catch (com.sforce.soap.partner.UnexpectedErrorFault e) {
      throw new ResourceException(e);
    }
   
    boolean allGood = true;
    StringBuffer errorMessages = new StringBuffer();
    for(int i = 0; i < results.size(); i++) {
      DeleteResult result = results.get(i);
      if(!result.isSuccess()) {
        if(allGood) {
          errorMessages.append("Error(s) executing DELETE: "); //$NON-NLS-1$
          allGood = false;
        }
        List<com.sforce.soap.partner.Error> errors = result.getErrors();
        if(null != errors && errors.size() > 0) {
          for(int x = 0; x < errors.size(); x++) {
            com.sforce.soap.partner.Error error = errors.get(x);
            errorMessages.append(error.getMessage()).append(';');
          }
        }
       
      }
    }
    if(!allGood) {
      throw new ResourceException(errorMessages.toString());
    }
    return results.size();
  }
View Full Code Here

    objects.add(toCreate);
    List<SaveResult> result;
    try {
      result = sfSoap.create(objects, sh);
    } catch (InvalidFieldFault e) {
      throw new ResourceException(e);
    } catch (com.sforce.soap.partner.InvalidSObjectFault e) {
      throw new ResourceException(e);
    } catch (InvalidIdFault e) {
      throw new ResourceException(e);
    } catch (com.sforce.soap.partner.UnexpectedErrorFault e) {
      throw new ResourceException(e);
    }
    return analyzeResult(result);
  }
View Full Code Here

TOP

Related Classes of javax.resource.ResourceException

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.