pm.retrieveAll(mVerTables); } catch (JDODataStoreException e) { if (e.getCause() instanceof MissingTableException) { throw new MetaException("Version table not found. " + "The metastore is not upgraded to " + MetaStoreSchemaInfoFactory.get(getConf()).getHiveSchemaVersion());
public JdoResourceFailureException(JDODataStoreException ex) { super(ex.getMessage(), ex); }
/** * Convenience method to return a datastore exception appropriate for this API. * @param msg The message * @param e Any root cause exception * @return The exception */ public RuntimeException getDataStoreExceptionForException(String msg, Exception e) { return new JDODataStoreException(msg, e); }
@Override public boolean apply(Throwable input) { final List<Throwable> causalChain = Throwables.getCausalChain(input); for (String message : messages) { for (Throwable throwable : causalChain) { final String throwableMessage = throwable.getMessage(); if(throwableMessage != null && throwableMessage.contains(message)) { return false; } if(throwable instanceof JDODataStoreException) { final JDODataStoreException jdoDataStoreException = (JDODataStoreException) throwable; final Throwable[] nestedExceptions = jdoDataStoreException.getNestedExceptions(); for (Throwable nestedException : nestedExceptions) { final String nestedThrowableMessage = nestedException.getMessage(); if(nestedThrowableMessage != null && nestedThrowableMessage.contains(message)) { return false; } } } } } return true; } };
public void run() { isJDOConnectionInUse = false; if (createNew) { try { nativeConnection.close(); } catch (SQLException sqle) { throw new JDODataStoreException(sqle.getMessage()); } } } });
private MSentryVersion getMSentryVersion() throws Exception { return tm.executeTransaction( pm -> { try { Query query = pm.newQuery(MSentryVersion.class); @SuppressWarnings("unchecked") List<MSentryVersion> mSentryVersions = (List<MSentryVersion>) query .execute(); pm.retrieveAll(mSentryVersions); if (mSentryVersions.isEmpty()) { throw new SentryNoSuchObjectException("Matching Version"); } if (mSentryVersions.size() > 1) { throw new SentryAccessDeniedException( "Metastore contains multiple versions"); } return mSentryVersions.get(0); } catch (JDODataStoreException e) { if (e.getCause() instanceof MissingTableException) { throw new SentryAccessDeniedException("Version table not found. " + "The sentry store is not set or corrupt "); } else { throw e; } } }); }
public JdoResourceFailureException(JDODataStoreException ex) { super(ex.getMessage(), ex); }
public void setFloat(Object ps, int param, float value) { try { ((PreparedStatement) ps).setDouble(param, value); } catch (SQLException e) { throw new JDODataStoreException(LOCALISER.msg("RDBMS.Mapping.UnableToGetParam","float","" + value, column, e.getMessage()), e); } }
pm.retrieveAll(mVerTables); } catch (JDODataStoreException e) { if (e.getCause() instanceof MissingTableException) { throw new MetaException("Version table not found. " + "The metastore is not upgraded to " + MetaStoreSchemaInfo.getHiveSchemaVersion());
private void renamePrivilegeCore(PersistenceManager pm, TSentryPrivilege tPrivilege, final TSentryPrivilege newPrivilege) throws Exception { try { // In case of tables or DBs, check all actions if (isMultiActionsSupported(tPrivilege)) { for (String privilegeAction : ALL_ACTIONS) { tPrivilege.setAction(privilegeAction); newPrivilege.setAction(privilegeAction); renamePrivilegeForAllEntities(pm, tPrivilege, newPrivilege); } } else { renamePrivilegeForAllEntities(pm, tPrivilege, newPrivilege); } } catch (JDODataStoreException e) { throw new SentryInvalidInputException("Failed to get privileges: " + e.getMessage()); } }
public void setLong(Object ps, int param, long value) { try { ((PreparedStatement) ps).setLong(param, value); } catch (SQLException e) { throw new JDODataStoreException(LOCALISER.msg("RDBMS.Mapping.UnableToSetParam","long", "" + value, column, e.getMessage()), e); } }
pm.retrieveAll(mVerTables); } catch (JDODataStoreException e) { if (e.getCause() instanceof MissingTableException) { throw new MetaException("Version table not found. " + "The metastore is not upgraded to " + MetaStoreSchemaInfo.getHiveSchemaVersion());
private void dropPrivilegeCore(PersistenceManager pm, TSentryAuthorizable tAuthorizable) throws Exception { // Drop the give privilege for all possible actions from all entities. TSentryPrivilege tPrivilege = toSentryPrivilege(tAuthorizable); tPrivilege.setGrantOption(TSentryGrantOption.UNSET); try { if (isMultiActionsSupported(tPrivilege)) { for (String privilegeAction : ALL_ACTIONS) { tPrivilege.setAction(privilegeAction); dropPrivilegeForAllEntities(pm, new TSentryPrivilege(tPrivilege)); } } else { dropPrivilegeForAllEntities(pm, new TSentryPrivilege(tPrivilege)); } } catch (JDODataStoreException e) { throw new SentryInvalidInputException("Failed to get privileges: " + e.getMessage()); } }
public void setLong(Object ps, int param, long value) { try { ((PreparedStatement) ps).setLong(param, value); } catch (SQLException e) { throw new JDODataStoreException(LOCALISER.msg("RDBMS.Mapping.UnableToSetParam","long","" + value, column, e.getMessage()), e); } }
if (e.getCause() instanceof MissingTableException) { throw new SentryAccessDeniedException("Version table not found. " + "The sentry store is not set or corrupt ");
throw new SentryInvalidInputException("Failed to grant owner privilege on Authorizable : " + tAuthorizable.toString() + " to " + principalType.toString() + ": " + ownerName + " " + e.getMessage());
public void setDouble(Object ps, int param, double value) { try { ((PreparedStatement) ps).setDouble(param, value); } catch (SQLException e) { throw new JDODataStoreException(LOCALISER.msg("RDBMS.Mapping.UnableToSetParam","double","" + value, column, e.getMessage()), e); } }
pm.retrieveAll(mVerTables); } catch (JDODataStoreException e) { if (e.getCause() instanceof MissingTableException) { throw new MetaException("Version table not found. " + "The metastore is not upgraded to " + MetaStoreSchemaInfoFactory.get(getConf()).getHiveSchemaVersion());
/** * 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); } } }
public void setBoolean(Object ps, int param, boolean value) { try { ((PreparedStatement) ps).setBoolean(param, value); } catch (SQLException e) { throw new JDODataStoreException(LOCALISER.msg("RDBMS.Mapping.UnableToSetParam", "boolean", "" + value, column, e.getMessage()), e); } }