Java Code Examples for javax.jdo.JDODataStoreException#getMessage()

The following examples show how to use javax.jdo.JDODataStoreException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SentryStore.java    From incubator-sentry with Apache License 2.0 5 votes vote down vote up
/**
 * Drop given privilege from all roles
 */
public void dropPrivilege(TSentryAuthorizable tAuthorizable)
    throws SentryNoSuchObjectException, SentryInvalidInputException {
  PersistenceManager pm = null;
  boolean rollbackTransaction = true;

  TSentryPrivilege tPrivilege = toSentryPrivilege(tAuthorizable);
  try {
    pm = openTransaction();

    if (isMultiActionsSupported(tPrivilege)) {
      for (String privilegeAction : ALL_ACTIONS) {
        tPrivilege.setAction(privilegeAction);
        dropPrivilegeForAllRoles(pm, new TSentryPrivilege(tPrivilege));
      }
    } else {
      dropPrivilegeForAllRoles(pm, new TSentryPrivilege(tPrivilege));
    }
    rollbackTransaction = false;
    commitTransaction(pm);
  } catch (JDODataStoreException e) {
    throw new SentryInvalidInputException("Failed to get privileges: "
        + e.getMessage());
  } finally {
    if (rollbackTransaction) {
      rollbackTransaction(pm);
    }
  }
}
 
Example 2
Source File: SentryStore.java    From incubator-sentry with Apache License 2.0 5 votes vote down vote up
/**
 * Rename given privilege from all roles drop the old privilege and create the new one
 * @param tAuthorizable
 * @param newTAuthorizable
 * @throws SentryNoSuchObjectException
 * @throws SentryInvalidInputException
 */
public void renamePrivilege(TSentryAuthorizable tAuthorizable,
    TSentryAuthorizable newTAuthorizable)
    throws SentryNoSuchObjectException, SentryInvalidInputException {
  PersistenceManager pm = null;
  boolean rollbackTransaction = true;

  TSentryPrivilege tPrivilege = toSentryPrivilege(tAuthorizable);
  TSentryPrivilege newPrivilege = toSentryPrivilege(newTAuthorizable);

  try {
    pm = openTransaction();
    // In case of tables or DBs, check all actions
    if (isMultiActionsSupported(tPrivilege)) {
      for (String privilegeAction : ALL_ACTIONS) {
        tPrivilege.setAction(privilegeAction);
        newPrivilege.setAction(privilegeAction);
        renamePrivilegeForAllRoles(pm, tPrivilege, newPrivilege);
      }
    } else {
      renamePrivilegeForAllRoles(pm, tPrivilege, newPrivilege);
    }
    rollbackTransaction = false;
    commitTransaction(pm);
  } catch (JDODataStoreException e) {
    throw new SentryInvalidInputException("Failed to get privileges: "
        + e.getMessage());
  } finally {
    if (rollbackTransaction) {
      rollbackTransaction(pm);
    }
  }
}
 
Example 3
Source File: JdoResourceFailureException.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public JdoResourceFailureException(JDODataStoreException ex) {
	super(ex.getMessage(), ex);
}
 
Example 4
Source File: JdoResourceFailureException.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public JdoResourceFailureException(JDODataStoreException ex) {
	super(ex.getMessage(), ex);
}