Examples of TranslatorException


Examples of org.teiid.translator.TranslatorException

    // real connection to the LDAP server
    try {
      ldapCtx = (LdapContext)this.ldapConnection.lookup("")//$NON-NLS-1$
    } catch (NamingException ne) {
            final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.createContextError",ne.getExplanation()); //$NON-NLS-1$
      throw new TranslatorException(msg);
    }

    if (command instanceof Update) {
      executeUpdate();
    }
    else if (command instanceof Delete) {
      executeDelete();
    }
    else if (command instanceof Insert) {
      executeInsert();
    }
    else {
            final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.incorrectCommandError"); //$NON-NLS-1$
      throw new TranslatorException(msg);
    }
  }
View Full Code Here

Examples of org.teiid.translator.TranslatorException

      // distinguishedName value.
      if (nameInsertElement.toUpperCase().equals("DN")) {  //$NON-NLS-1$
        insertValue = ((Literal)insertValueList.get(i)).getValue();
        if (insertValue == null) {
                final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.columnSourceNameDNNullError"); //$NON-NLS-1$
          throw new TranslatorException(msg);
        }
        if (!(insertValue instanceof java.lang.String)) {
                final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.columnSourceNameDNTypeError"); //$NON-NLS-1$
          throw new TranslatorException(msg);
        }
        distinguishedName = (String)insertValue;
      }
      // for other attributes specified in the insert command,
      // create a new
      else {
        insertAttr = new BasicAttribute(nameInsertElement);
        insertValue = ((Literal)insertValueList.get(i)).getValue();
        insertAttr.add(insertValue);
        insertAttrs.put(insertAttr);
      }
    }
    // if the DN is not specified, we don't know enough to attempt
    // the LDAP add operation, so throw an exception
    if (distinguishedName == null) {
            final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.noInsertSourceNameDNError"); //$NON-NLS-1$
      throw new TranslatorException(msg);
    }
    // just try to create a new LDAP entry using the DN and
    // attributes specified in the INSERT operation.  If it isn't
    // legal, we'll get a NamingException back, whose explanation
    // we'll return in a ConnectorException
    try {
      ldapCtx.createSubcontext(distinguishedName, insertAttrs);
    } catch (NamingException ne) {
            final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.insertFailed",distinguishedName,ne.getExplanation()); //$NON-NLS-1$
      throw new TranslatorException(msg);
    } catch (Exception e) {
            final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.insertFailedUnexpected",distinguishedName); //$NON-NLS-1$
      throw new TranslatorException(e, msg);
    }
  }
View Full Code Here

Examples of org.teiid.translator.TranslatorException

    // we'll return in a ConnectorException
    try {
      ldapCtx.destroySubcontext(distinguishedName);
    } catch (NamingException ne) {
            final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.deleteFailed",distinguishedName,ne.getExplanation()); //$NON-NLS-1$
      throw new TranslatorException(msg);
    // don't remember why I added this generic catch of Exception,
    // but it does no harm...
    } catch (Exception e) {
            final String msg = LDAPPlugin.Util.getString("LDAPUpdateExecution.deleteFailedUnexpected",distinguishedName); //$NON-NLS-1$
      throw new TranslatorException(e, msg);
    }
  }
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.