http://git-wip-us.apache.org/repos/asf/sentry/blob/e72e6eac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPrivilege.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPrivilege.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPrivilege.java deleted file mode 100644 index 4c3af79..0000000 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryPrivilege.java +++ /dev/null @@ -1,332 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.sentry.provider.db.service.model; - -import java.util.HashSet; -import java.util.Set; - -import javax.jdo.annotations.PersistenceCapable; - -import org.apache.sentry.core.common.utils.PathUtils; -import org.apache.sentry.core.model.db.AccessConstants; -import org.apache.sentry.provider.db.service.persistent.SentryStore; - -/** - * Database backed Sentry Privilege. Any changes to this object - * require re-running the maven build so DN an re-enhance. - */ -@PersistenceCapable -public class MSentryPrivilege { - - private String privilegeScope; - /** - * Privilege name is unique - */ - private String serverName = ""; - private String dbName = ""; - private String tableName = ""; - private String columnName = ""; - private String URI = ""; - private String action = ""; - private Boolean grantOption = false; - // roles this privilege is a part of - private Set<MSentryRole> roles; - private long createTime; - - public MSentryPrivilege() { - this.roles = new HashSet<MSentryRole>(); - } - - public MSentryPrivilege(String privilegeScope, - String serverName, String dbName, String tableName, String columnName, - String URI, String action, Boolean grantOption) { - this.privilegeScope = privilegeScope; - this.serverName = serverName; - this.dbName = SentryStore.toNULLCol(dbName); - this.tableName = SentryStore.toNULLCol(tableName); - this.columnName = SentryStore.toNULLCol(columnName); - this.URI = SentryStore.toNULLCol(URI); - this.action = SentryStore.toNULLCol(action); - this.grantOption = grantOption; - this.roles = new HashSet<MSentryRole>(); - } - - public MSentryPrivilege(String privilegeScope, - String serverName, String dbName, String tableName, String columnName, - String URI, String action) { - this(privilegeScope, serverName, dbName, tableName, - columnName, URI, action, false); - } - - public MSentryPrivilege(MSentryPrivilege other) { - this.privilegeScope = other.privilegeScope; - this.serverName = other.serverName; - this.dbName = SentryStore.toNULLCol(other.dbName); - this.tableName = SentryStore.toNULLCol(other.tableName); - this.columnName = SentryStore.toNULLCol(other.columnName); - this.URI = SentryStore.toNULLCol(other.URI); - this.action = SentryStore.toNULLCol(other.action); - this.grantOption = other.grantOption; - this.roles = new HashSet<MSentryRole>(); - for (MSentryRole role : other.roles) { - roles.add(role); - } - } - - public String getServerName() { - return serverName; - } - - public void setServerName(String serverName) { - this.serverName = (serverName == null) ? "" : serverName; - } - - public String getDbName() { - return dbName; - } - - public void setDbName(String dbName) { - this.dbName = (dbName == null) ? "" : dbName; - } - - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = (tableName == null) ? "" : tableName; - } - - public String getColumnName() { - return columnName; - } - - public void setColumnName(String columnName) { - this.columnName = (columnName == null) ? "" : columnName; - } - - public String getURI() { - return URI; - } - - public void setURI(String uRI) { - URI = (uRI == null) ? "" : uRI; - } - - public String getAction() { - return action; - } - - public void setAction(String action) { - this.action = (action == null) ? "" : action; - } - - public long getCreateTime() { - return createTime; - } - - public void setCreateTime(long createTime) { - this.createTime = createTime; - } - - public String getPrivilegeScope() { - return privilegeScope; - } - - public void setPrivilegeScope(String privilegeScope) { - this.privilegeScope = privilegeScope; - } - - public Boolean getGrantOption() { - return grantOption; - } - - public void setGrantOption(Boolean grantOption) { - this.grantOption = grantOption; - } - - public void appendRole(MSentryRole role) { - roles.add(role); - } - - public Set<MSentryRole> getRoles() { - return roles; - } - - public void removeRole(MSentryRole role) { - roles.remove(role); - role.removePrivilege(this); - } - - @Override - public String toString() { - return "MSentryPrivilege [privilegeScope=" + privilegeScope - + ", serverName=" + serverName + ", dbName=" + dbName - + ", tableName=" + tableName + ", columnName=" + columnName - + ", URI=" + URI + ", action=" + action + ", roles=[...]" - + ", createTime=" + createTime + ", grantOption=" + grantOption +"]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((URI == null) ? 0 : URI.hashCode()); - result = prime * result + ((action == null) ? 0 : action.hashCode()); - result = prime * result + ((dbName == null) ? 0 : dbName.hashCode()); - result = prime * result - + ((serverName == null) ? 0 : serverName.hashCode()); - result = prime * result + ((tableName == null) ? 0 : tableName.hashCode()); - result = prime * result - + ((columnName == null) ? 0 : columnName.hashCode()); - result = prime * result - + ((grantOption == null) ? 0 : grantOption.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - MSentryPrivilege other = (MSentryPrivilege) obj; - if (URI == null) { - if (other.URI != null) { - return false; - } - } else if (!URI.equals(other.URI)) { - return false; - } - if (action == null) { - if (other.action != null) { - return false; - } - } else if (!action.equals(other.action)) { - return false; - } - if (dbName == null) { - if (other.dbName != null) { - return false; - } - } else if (!dbName.equals(other.dbName)) { - return false; - } - if (serverName == null) { - if (other.serverName != null) { - return false; - } - } else if (!serverName.equals(other.serverName)) { - return false; - } - if (tableName == null) { - if (other.tableName != null) { - return false; - } - } else if (!tableName.equals(other.tableName)) { - return false; - } - if (columnName == null) { - if (other.columnName != null) { - return false; - } - } else if (!columnName.equals(other.columnName)) { - return false; - } - if (grantOption == null) { - if (other.grantOption != null) { - return false; - } - } else if (!grantOption.equals(other.grantOption)) { - return false; - } - return true; - } - - /** - * Return true if this privilege implies other privilege - * Otherwise, return false - * @param other, other privilege - */ - public boolean implies(MSentryPrivilege other) { - // serverName never be null - if (isNULL(serverName) || isNULL(other.serverName)) { - return false; - } else if (!serverName.equals(other.serverName)) { - return false; - } - - // check URI implies - if (!isNULL(URI) && !isNULL(other.URI)) { - if (!PathUtils.impliesURI(URI, other.URI)) { - return false; - } - // if URI is NULL, check dbName and tableName - } else if (isNULL(URI) && isNULL(other.URI)) { - if (!isNULL(dbName)) { - if (isNULL(other.dbName)) { - return false; - } else if (!dbName.equals(other.dbName)) { - return false; - } - } - if (!isNULL(tableName)) { - if (isNULL(other.tableName)) { - return false; - } else if (!tableName.equals(other.tableName)) { - return false; - } - } - if (!isNULL(columnName)) { - if (isNULL(other.columnName)) { - return false; - } else if (!columnName.equals(other.columnName)) { - return false; - } - } - // if URI is not NULL, but other's URI is NULL, return false - } else if (!isNULL(URI) && isNULL(other.URI)){ - return false; - } - - // check action implies - if (!action.equalsIgnoreCase(AccessConstants.ALL) - && !action.equalsIgnoreCase(other.action) - && !action.equalsIgnoreCase(AccessConstants.ACTION_ALL)) { - return false; - } - - return true; - } - - private boolean isNULL(String s) { - return SentryStore.isNULL(s); - } - - public boolean isActionALL() { - return AccessConstants.ACTION_ALL.equalsIgnoreCase(action) - || AccessConstants.ALL.equals(action); - } - -}
http://git-wip-us.apache.org/repos/asf/sentry/blob/e72e6eac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java deleted file mode 100644 index 0484eaa..0000000 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryRole.java +++ /dev/null @@ -1,216 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.sentry.provider.db.service.model; - -import java.util.HashSet; -import java.util.Set; - -import javax.jdo.annotations.PersistenceCapable; - -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableSet; - -/** - * Database backed Sentry Role. Any changes to this object - * require re-running the maven build so DN an re-enhance. - */ -@PersistenceCapable -public class MSentryRole { - - private String roleName; - // set of privileges granted to this role - private Set<MSentryPrivilege> privileges; - // set of generic model privileges grant ro this role - private Set<MSentryGMPrivilege> gmPrivileges; - - // set of groups this role belongs to - private Set<MSentryGroup> groups; - // set of users this role belongs to - private Set<MSentryUser> users; - private long createTime; - - public MSentryRole(String roleName, long createTime) { - this.roleName = roleName; - this.createTime = createTime; - privileges = new HashSet<MSentryPrivilege>(); - gmPrivileges = new HashSet<MSentryGMPrivilege>(); - groups = new HashSet<MSentryGroup>(); - users = new HashSet<MSentryUser>(); - } - - public long getCreateTime() { - return createTime; - } - - public void setCreateTime(long createTime) { - this.createTime = createTime; - } - - public String getRoleName() { - return roleName; - } - - public void setRoleName(String roleName) { - this.roleName = roleName; - } - - public void setPrivileges(Set<MSentryPrivilege> privileges) { - this.privileges = privileges; - } - - public Set<MSentryPrivilege> getPrivileges() { - return privileges; - } - - public Set<MSentryGMPrivilege> getGmPrivileges() { - return gmPrivileges; - } - - public void setGmPrivileges(Set<MSentryGMPrivilege> gmPrivileges) { - this.gmPrivileges = gmPrivileges; - } - - public void setGroups(Set<MSentryGroup> groups) { - this.groups = groups; - } - - public Set<MSentryGroup> getGroups() { - return groups; - } - - public Set<MSentryUser> getUsers() { - return users; - } - - public void setUsers(Set<MSentryUser> users) { - this.users = users; - } - - public void removePrivilege(MSentryPrivilege privilege) { - if (privileges.remove(privilege)) { - privilege.removeRole(this); - } - } - - public void appendPrivileges(Set<MSentryPrivilege> privileges) { - this.privileges.addAll(privileges); - } - - public void appendPrivilege(MSentryPrivilege privilege) { - if (privileges.add(privilege)) { - privilege.appendRole(this); - } - } - - public void removeGMPrivilege(MSentryGMPrivilege gmPrivilege) { - if (gmPrivileges.remove(gmPrivilege)) { - gmPrivilege.removeRole(this); - } - } - - public void appendGMPrivilege(MSentryGMPrivilege gmPrivilege) { - if (gmPrivileges.add(gmPrivilege)) { - gmPrivilege.appendRole(this); - } - } - - public void removeGMPrivileges() { - for (MSentryGMPrivilege privilege : ImmutableSet.copyOf(gmPrivileges)) { - privilege.removeRole(this); - } - Preconditions.checkState(gmPrivileges.isEmpty(), "gmPrivileges should be empty: " + gmPrivileges); - } - - public void appendGroups(Set<MSentryGroup> groups) { - this.groups.addAll(groups); - } - - public void appendGroup(MSentryGroup group) { - if (groups.add(group)) { - group.appendRole(this); - } - } - - public void removeGroup(MSentryGroup group) { - if (groups.remove(group)) { - group.removeRole(this); - } - } - - public void appendUsers(Set<MSentryUser> users) { - this.users.addAll(users); - } - - public void appendUser(MSentryUser user) { - if (users.add(user)) { - user.appendRole(this); - } - } - - public void removeUser(MSentryUser user) { - if (users.remove(user)) { - user.removeRole(this); - } - } - - public void removePrivileges() { - // copy is required since privilege.removeRole will call remotePrivilege - for (MSentryPrivilege privilege : ImmutableSet.copyOf(privileges)) { - privilege.removeRole(this); - } - Preconditions.checkState(privileges.isEmpty(), "Privileges should be empty: " + privileges); - } - - @Override - public String toString() { - return "MSentryRole [roleName=" + roleName + ", privileges=[..]" + ", gmPrivileges=[..]" - + ", groups=[...]" + ", users=[...]" + ", createTime=" + createTime + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((roleName == null) ? 0 : roleName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - MSentryRole other = (MSentryRole) obj; - if (roleName == null) { - if (other.roleName != null) { - return false; - } - } else if (!roleName.equals(other.roleName)) { - return false; - } - return true; - } - -} http://git-wip-us.apache.org/repos/asf/sentry/blob/e72e6eac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryUser.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryUser.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryUser.java deleted file mode 100644 index ff57249..0000000 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryUser.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.sentry.provider.db.service.model; - -import java.util.Set; - -import javax.jdo.annotations.PersistenceCapable; - -/** - * Database backed Sentry User. Any changes to this object - * require re-running the maven build so DN an re-enhance. - */ -@PersistenceCapable -public class MSentryUser { - - /** - * User name is unique - */ - private String userName; - // set of roles granted to this user - private Set<MSentryRole> roles; - private long createTime; - - public MSentryUser(String userName, long createTime, Set<MSentryRole> roles) { - this.setUserName(userName); - this.createTime = createTime; - this.roles = roles; - } - - public long getCreateTime() { - return createTime; - } - - public void setCreateTime(long createTime) { - this.createTime = createTime; - } - - public Set<MSentryRole> getRoles() { - return roles; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public void appendRole(MSentryRole role) { - if (roles.add(role)) { - role.appendUser(this); - } - } - - public void removeRole(MSentryRole role) { - if (roles.remove(role)) { - role.removeUser(this); - } - } - - @Override - public String toString() { - return "MSentryUser [userName=" + userName + ", roles=[...]" + ", createTime=" + createTime - + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((userName == null) ? 0 : userName.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - MSentryUser other = (MSentryUser) obj; - if (createTime != other.createTime) { - return false; - } - if (userName == null) { - if (other.userName != null) { - return false; - } - } else if (!userName.equals(other.userName)) { - return false; - } - return true; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sentry/blob/e72e6eac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryVersion.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryVersion.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryVersion.java deleted file mode 100644 index ff8830f..0000000 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryVersion.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.sentry.provider.db.service.model; - -import javax.jdo.annotations.PersistenceCapable; - -@PersistenceCapable -public class MSentryVersion { - private String schemaVersion; - private String versionComment; - - public MSentryVersion() { - } - - public MSentryVersion(String schemaVersion, String versionComment) { - this.schemaVersion = schemaVersion; - this.versionComment = versionComment; - } - - /** - * @return the versionComment - */ - public String getVersionComment() { - return versionComment; - } - - /** - * @param versionComment - * the versionComment to set - */ - public void setVersionComment(String versionComment) { - this.versionComment = versionComment; - } - - /** - * @return the schemaVersion - */ - public String getSchemaVersion() { - return schemaVersion; - } - - /** - * @param schemaVersion - * the schemaVersion to set - */ - public void setSchemaVersion(String schemaVersion) { - this.schemaVersion = schemaVersion; - } - -} http://git-wip-us.apache.org/repos/asf/sentry/blob/e72e6eac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo deleted file mode 100644 index b3b9494..0000000 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/package.jdo +++ /dev/null @@ -1,242 +0,0 @@ -<?xml version="1.0"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 2.0//EN" - "http://java.sun.com/dtd/jdo_2_0.dtd"> -<!-- - Size Limitations: - - Indexed VARCHAR: 767 bytes (MySQL running on InnoDB Engine http://bugs.mysql.com/bug.php?id=13315) - Non-indexed VARCHAR: 4000 bytes (max length on Oracle 9i/10g/11g) - ---> -<jdo> - <package name="org.apache.sentry.provider.db.service.model"> - <class name="MSentryGroup" identity-type="datastore" table="SENTRY_GROUP" detachable="true"> - <datastore-identity> - <column name="GROUP_ID"/> - </datastore-identity> - <field name="groupName"> - <column name="GROUP_NAME" length="128" jdbc-type="VARCHAR"/> - <index name="SentryGroupName" unique="true"/> - </field> - <field name = "createTime"> - <column name = "CREATE_TIME" jdbc-type="BIGINT"/> - </field> - - <field name="roles" mapped-by="groups"> - <collection element-type="org.apache.sentry.provider.db.service.model.MSentryRole"/> - </field> - - </class> - - <class name="MSentryUser" identity-type="datastore" table="SENTRY_USER" detachable="true"> - <datastore-identity> - <column name="USER_ID"/> - </datastore-identity> - <field name="userName"> - <column name="USER_NAME" length="128" jdbc-type="VARCHAR"/> - <index name="SentryUserName" unique="true"/> - </field> - <field name = "createTime"> - <column name = "CREATE_TIME" jdbc-type="BIGINT"/> - </field> - - <field name="roles" mapped-by="users"> - <collection element-type="org.apache.sentry.provider.db.service.model.MSentryRole"/> - </field> - - </class> - - <class name="MSentryRole" identity-type="datastore" table="SENTRY_ROLE" detachable="true"> - <datastore-identity> - <column name="ROLE_ID"/> - </datastore-identity> - <field name="roleName"> - <column name="ROLE_NAME" length="128" jdbc-type="VARCHAR"/> - <index name="SentryRoleName" unique="true"/> - </field> - <field name = "createTime"> - <column name = "CREATE_TIME" jdbc-type="BIGINT"/> - </field> - <field name = "privileges" table="SENTRY_ROLE_DB_PRIVILEGE_MAP" default-fetch-group="true"> - <collection element-type="org.apache.sentry.provider.db.service.model.MSentryPrivilege"/> - <join> - <column name="ROLE_ID"/> - </join> - <element> - <column name="DB_PRIVILEGE_ID"/> - </element> - </field> - - <field name = "gmPrivileges" table="SENTRY_ROLE_GM_PRIVILEGE_MAP" default-fetch-group="true"> - <collection element-type="org.apache.sentry.provider.db.service.model.MSentryGMPrivilege"/> - <join> - <column name="ROLE_ID"/> - </join> - <element> - <column name="GM_PRIVILEGE_ID"/> - </element> - </field> - - <field name = "groups" table="SENTRY_ROLE_GROUP_MAP" default-fetch-group="true"> - <collection element-type="org.apache.sentry.provider.db.service.model.MSentryGroup"/> - <join> - <column name="ROLE_ID"/> - </join> - <element> - <column name="GROUP_ID"/> - </element> - </field> - - <field name = "users" table="SENTRY_ROLE_USER_MAP" default-fetch-group="true"> - <collection element-type="org.apache.sentry.provider.db.service.model.MSentryUser"/> - <join> - <column name="ROLE_ID"/> - </join> - <element> - <column name="USER_ID"/> - </element> - </field> - </class> - - <class name="MSentryPrivilege" identity-type="datastore" table="SENTRY_DB_PRIVILEGE" detachable="true"> - <datastore-identity> - <column name="DB_PRIVILEGE_ID"/> - </datastore-identity> - <index name="PRIVILEGE_INDEX" unique="true"> - <field name="serverName"/> - <field name="dbName"/> - <field name="tableName"/> - <field name="columnName"/> - <field name="URI"/> - <field name="action"/> - <field name="grantOption"/> - </index> - <field name="privilegeScope"> - <column name="PRIVILEGE_SCOPE" length="40" jdbc-type="VARCHAR"/> - </field> - <field name="serverName"> - <column name="SERVER_NAME" length="4000" jdbc-type="VARCHAR"/> - </field> - <field name="dbName"> - <column name="DB_NAME" length="4000" jdbc-type="VARCHAR"/> - </field> - <field name="tableName"> - <column name="TABLE_NAME" length="4000" jdbc-type="VARCHAR"/> - </field> - <field name="columnName"> - <column name="COLUMN_NAME" length="4000" jdbc-type="VARCHAR"/> - </field> - <field name="URI"> - <column name="URI" length="4000" jdbc-type="VARCHAR"/> - </field> - <field name="action"> - <column name="ACTION" length="40" jdbc-type="VARCHAR"/> - </field> - <field name = "createTime"> - <column name = "CREATE_TIME" jdbc-type="BIGINT"/> - </field> - <field name="grantOption"> - <column name="WITH_GRANT_OPTION" length="1" jdbc-type="CHAR"/> - </field> - <field name="roles" mapped-by="privileges"> - <collection element-type="org.apache.sentry.provider.db.service.model.MSentryRole"/> - </field> - </class> - - <class name="MSentryGMPrivilege" identity-type="datastore" table="SENTRY_GM_PRIVILEGE" detachable="true"> - <datastore-identity> - <column name="GM_PRIVILEGE_ID"/> - </datastore-identity> - <index name="GM_PRIVILEGE_INDEX" unique="true"> - <field name="componentName"/> - <field name="serviceName"/> - <field name="resourceName0"/> - <field name="resourceType0"/> - <field name="resourceName1"/> - <field name="resourceType1"/> - <field name="resourceName2"/> - <field name="resourceType2"/> - <field name="resourceName3"/> - <field name="resourceType3"/> - <field name="action"/> - <field name="grantOption"/> - </index> - <field name="componentName"> - <column name="COMPONENT_NAME" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="serviceName"> - <column name="SERVICE_NAME" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="resourceName0"> - <column name="RESOURCE_NAME_0" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="resourceType0"> - <column name="RESOURCE_TYPE_0" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="resourceName1"> - <column name="RESOURCE_NAME_1" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="resourceType1"> - <column name="RESOURCE_TYPE_1" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="resourceName2"> - <column name="RESOURCE_NAME_2" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="resourceType2"> - <column name="RESOURCE_TYPE_2" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="resourceName3"> - <column name="RESOURCE_NAME_3" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="resourceType3"> - <column name="RESOURCE_TYPE_3" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="action"> - <column name="ACTION" length="100" jdbc-type="VARCHAR"/> - </field> - <field name="scope"> - <column name="SCOPE" length="100" jdbc-type="VARCHAR"/> - </field> - <field name = "createTime"> - <column name = "CREATE_TIME" jdbc-type="BIGINT"/> - </field> - <field name="grantOption"> - <column name="WITH_GRANT_OPTION" length="1" jdbc-type="CHAR"/> - </field> - <field name="roles" mapped-by="gmPrivileges"> - <collection element-type="org.apache.sentry.provider.db.service.model.MSentryRole"/> - </field> - </class> - - <class name="MSentryVersion" table="SENTRY_VERSION" identity-type="datastore" detachable="true"> - <datastore-identity> - <column name="VER_ID"/> - </datastore-identity> - <field name ="schemaVersion"> - <column name="SCHEMA_VERSION" length="127" jdbc-type="VARCHAR" allows-null="false"/> - </field> - <field name ="versionComment"> - <column name="VERSION_COMMENT" length="255" jdbc-type="VARCHAR" allows-null="false"/> - </field> - </class> - - </package> -</jdo> - http://git-wip-us.apache.org/repos/asf/sentry/blob/e72e6eac/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/CommitContext.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/CommitContext.java b/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/CommitContext.java deleted file mode 100644 index c74dbf3..0000000 --- a/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/CommitContext.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.sentry.provider.db.service.persistent; - -import java.util.UUID; - -/** - * Stores the UUID associated with the server who processed - * a commit and a commit order sequence id. - */ -public class CommitContext { - - private final String serverUUID; - private final long sequenceId; - - public CommitContext(UUID serverUUID, long sequenceId) { - this.serverUUID = serverUUID.toString(); - this.sequenceId = sequenceId; - } - public String getServerUUID() { - return serverUUID; - } - public long getSequenceId() { - return sequenceId; - } -} \ No newline at end of file
