You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2015/02/17 09:16:37 UTC
[04/55] [abbrv] incubator-ranger git commit: RANGER-203: moved
pluggable-service-model implementation from plugin-common to exiting project
ranger-plugin-common
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java b/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
deleted file mode 100644
index 78ba6e2..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerPolicy.java
+++ /dev/null
@@ -1,686 +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.ranger.plugin.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-
-@JsonAutoDetect(getterVisibility=Visibility.NONE, setterVisibility=Visibility.NONE, fieldVisibility=Visibility.ANY)
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL )
-@JsonIgnoreProperties(ignoreUnknown=true)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class RangerPolicy extends RangerBaseModelObject implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String service = null;
- private String name = null;
- private String description = null;
- private Boolean isAuditEnabled = null;
- private Map<String, RangerPolicyResource> resources = null;
- private List<RangerPolicyItem> policyItems = null;
-
-
- /**
- * @param type
- */
- public RangerPolicy() {
- this(null, null, null, null, null);
- }
-
- /**
- * @param type
- * @param name
- * @param description
- * @param resources
- * @param policyItems
- */
- public RangerPolicy(String service, String name, String description, Map<String, RangerPolicyResource> resources, List<RangerPolicyItem> policyItems) {
- super();
-
- setService(service);
- setName(name);
- setDescription(description);
- setIsAuditEnabled(null);
- setResources(resources);
- setPolicyItems(policyItems);
- }
-
- /**
- * @param other
- */
- public void updateFrom(RangerPolicy other) {
- super.updateFrom(other);
-
- setService(other.getService());
- setName(other.getName());
- setDescription(other.getDescription());
- setIsAuditEnabled(other.getIsAuditEnabled());
- setResources(other.getResources());
- setPolicyItems(other.getPolicyItems());
- }
-
- /**
- * @return the type
- */
- public String getService() {
- return service;
- }
-
- /**
- * @param type the type to set
- */
- public void setService(String service) {
- this.service = service;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return the isAuditEnabled
- */
- public Boolean getIsAuditEnabled() {
- return isAuditEnabled;
- }
-
- /**
- * @param isEnabled the isEnabled to set
- */
- public void setIsAuditEnabled(Boolean isAuditEnabled) {
- this.isAuditEnabled = isAuditEnabled == null ? Boolean.TRUE : isAuditEnabled;
- }
-
- /**
- * @return the resources
- */
- public Map<String, RangerPolicyResource> getResources() {
- return resources;
- }
-
- /**
- * @param configs the resources to set
- */
- public void setResources(Map<String, RangerPolicyResource> resources) {
- if(this.resources == null) {
- this.resources = new HashMap<String, RangerPolicyResource>();
- }
-
- if(this.resources == resources) {
- return;
- }
-
- this.resources.clear();
-
- if(resources != null) {
- for(Map.Entry<String, RangerPolicyResource> e : resources.entrySet()) {
- this.resources.put(e.getKey(), e.getValue());
- }
- }
- }
-
- /**
- * @return the policyItems
- */
- public List<RangerPolicyItem> getPolicyItems() {
- return policyItems;
- }
-
- /**
- * @param policyItems the policyItems to set
- */
- public void setPolicyItems(List<RangerPolicyItem> policyItems) {
- if(this.policyItems == null) {
- this.policyItems = new ArrayList<RangerPolicyItem>();
- }
-
- if(this.policyItems == policyItems) {
- return;
- }
-
- this.policyItems.clear();
-
- if(policyItems != null) {
- for(RangerPolicyItem policyItem : policyItems) {
- this.policyItems.add(policyItem);
- }
- }
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerPolicy={");
-
- super.toString(sb);
-
- sb.append("service={").append(service).append("} ");
- sb.append("name={").append(name).append("} ");
- sb.append("description={").append(description).append("} ");
- sb.append("isAuditEnabled={").append(isAuditEnabled).append("} ");
-
- sb.append("resources={");
- if(resources != null) {
- for(Map.Entry<String, RangerPolicyResource> e : resources.entrySet()) {
- sb.append(e.getKey()).append("={");
- e.getValue().toString(sb);
- sb.append("} ");
- }
- }
- sb.append("} ");
-
- sb.append("policyItems={");
- if(policyItems != null) {
- for(RangerPolicyItem policyItem : policyItems) {
- if(policyItem != null) {
- policyItem.toString(sb);
- }
- }
- }
- sb.append("} ");
-
- sb.append("}");
-
- return sb;
- }
-
-
- public static class RangerPolicyResource implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private List<String> values = null;
- private Boolean isExcludes = null;
- private Boolean isRecursive = null;
-
-
- public RangerPolicyResource() {
- this((List<String>)null, null, null);
- }
-
- public RangerPolicyResource(String value, Boolean isExcludes, Boolean isRecursive) {
- setValue(value);
- setIsExcludes(isExcludes);
- setIsRecursive(isRecursive);
- }
-
- public RangerPolicyResource(List<String> values, Boolean isExcludes, Boolean isRecursive) {
- setValues(values);
- setIsExcludes(isExcludes);
- setIsRecursive(isRecursive);
- }
-
- /**
- * @return the values
- */
- public List<String> getValues() {
- return values;
- }
-
- /**
- * @param values the values to set
- */
- public void setValues(List<String> values) {
- if(this.values == null) {
- this.values = new ArrayList<String>();
- }
-
- if(this.values == values) {
- return;
- }
-
- this.values.clear();
-
- if(values != null) {
- for(String value : values) {
- this.values.add(value);
- }
- }
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- if(this.values == null) {
- this.values = new ArrayList<String>();
- }
-
- this.values.clear();
-
- this.values.add(value);
- }
-
- /**
- * @return the isExcludes
- */
- public Boolean getIsExcludes() {
- return isExcludes;
- }
-
- /**
- * @param isExcludes the isExcludes to set
- */
- public void setIsExcludes(Boolean isExcludes) {
- this.isExcludes = isExcludes == null ? Boolean.FALSE : isExcludes;
- }
-
- /**
- * @return the isRecursive
- */
- public Boolean getIsRecursive() {
- return isRecursive;
- }
-
- /**
- * @param isRecursive the isRecursive to set
- */
- public void setIsRecursive(Boolean isRecursive) {
- this.isRecursive = isRecursive == null ? Boolean.FALSE : isRecursive;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerPolicyResource={");
- sb.append("values={");
- if(values != null) {
- for(String value : values) {
- sb.append(value).append(" ");
- }
- }
- sb.append("} ");
- sb.append("isExcludes={").append(isExcludes).append("} ");
- sb.append("isRecursive={").append(isRecursive).append("} ");
- sb.append("}");
-
- return sb;
- }
- }
-
- public static class RangerPolicyItem implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private List<RangerPolicyItemAccess> accesses = null;
- private List<String> users = null;
- private List<String> groups = null;
- private List<RangerPolicyItemCondition> conditions = null;
- private Boolean delegateAdmin = null;
-
- public RangerPolicyItem() {
- this(null, null, null, null, null);
- }
-
- public RangerPolicyItem(List<RangerPolicyItemAccess> accessTypes, List<String> users, List<String> groups, List<RangerPolicyItemCondition> conditions, Boolean delegateAdmin) {
- setAccesses(accessTypes);
- setUsers(users);
- setGroups(groups);
- setConditions(conditions);
- setDelegateAdmin(delegateAdmin);
- }
-
- /**
- * @return the accesses
- */
- public List<RangerPolicyItemAccess> getAccesses() {
- return accesses;
- }
- /**
- * @param accesses the accesses to set
- */
- public void setAccesses(List<RangerPolicyItemAccess> accesses) {
- if(this.accesses == null) {
- this.accesses = new ArrayList<RangerPolicyItemAccess>();
- }
-
- if(this.accesses == accesses) {
- return;
- }
-
- if(accesses != null) {
- for(RangerPolicyItemAccess access : accesses) {
- this.accesses.add(access);
- }
- }
- }
- /**
- * @return the users
- */
- public List<String> getUsers() {
- return users;
- }
- /**
- * @param users the users to set
- */
- public void setUsers(List<String> users) {
- if(this.users == null) {
- this.users = new ArrayList<String>();
- }
-
- if(this.users == users) {
- return;
- }
-
- if(users != null) {
- for(String user : users) {
- this.users.add(user);
- }
- }
- }
- /**
- * @return the groups
- */
- public List<String> getGroups() {
- return groups;
- }
- /**
- * @param groups the groups to set
- */
- public void setGroups(List<String> groups) {
- if(this.groups == null) {
- this.groups = new ArrayList<String>();
- }
-
- if(this.groups == groups) {
- return;
- }
-
- if(groups != null) {
- for(String group : groups) {
- this.groups.add(group);
- }
- }
- }
- /**
- * @return the conditions
- */
- public List<RangerPolicyItemCondition> getConditions() {
- return conditions;
- }
- /**
- * @param conditions the conditions to set
- */
- public void setConditions(List<RangerPolicyItemCondition> conditions) {
- if(this.conditions == null) {
- this.conditions = new ArrayList<RangerPolicyItemCondition>();
- }
-
- if(this.conditions == conditions) {
- return;
- }
-
- if(conditions != null) {
- for(RangerPolicyItemCondition condition : conditions) {
- this.conditions.add(condition);
- }
- }
- }
-
- /**
- * @return the delegateAdmin
- */
- public Boolean getDelegateAdmin() {
- return delegateAdmin;
- }
-
- /**
- * @param delegateAdmin the delegateAdmin to set
- */
- public void setDelegateAdmin(Boolean delegateAdmin) {
- this.delegateAdmin = delegateAdmin == null ? Boolean.FALSE : delegateAdmin;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerPolicyItem={");
-
- sb.append("accessTypes={");
- if(accesses != null) {
- for(RangerPolicyItemAccess access : accesses) {
- if(access != null) {
- access.toString(sb);
- }
- }
- }
- sb.append("} ");
-
- sb.append("users={");
- if(users != null) {
- for(String user : users) {
- if(user != null) {
- sb.append(user).append(" ");
- }
- }
- }
- sb.append("} ");
-
- sb.append("groups={");
- if(groups != null) {
- for(String group : groups) {
- if(group != null) {
- sb.append(group).append(" ");
- }
- }
- }
- sb.append("} ");
-
- sb.append("conditions={");
- if(conditions != null) {
- for(RangerPolicyItemCondition condition : conditions) {
- if(condition != null) {
- condition.toString(sb);
- }
- }
- }
- sb.append("} ");
-
- sb.append("delegateAdmin={").append(delegateAdmin).append("} ");
- sb.append("}");
-
- return sb;
- }
- }
-
- public static class RangerPolicyItemAccess implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String type = null;
- private Boolean isAllowed = null;
-
- public RangerPolicyItemAccess() {
- this(null, null);
- }
-
- public RangerPolicyItemAccess(String type) {
- this(type, null);
- }
-
- public RangerPolicyItemAccess(String type, Boolean isAllowed) {
- setType(type);
- setIsAllowed(isAllowed);
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the isAllowed
- */
- public Boolean getIsAllowed() {
- return isAllowed;
- }
-
- /**
- * @param isAllowed the isAllowed to set
- */
- public void setIsAllowed(Boolean isAllowed) {
- this.isAllowed = isAllowed == null ? Boolean.TRUE : isAllowed;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerPolicyItemAccess={");
- sb.append("type={").append(type).append("} ");
- sb.append("isAllowed={").append(isAllowed).append("} ");
- sb.append("}");
-
- return sb;
- }
- }
-
- public static class RangerPolicyItemCondition implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String type = null;
- private String value = null;
-
- public RangerPolicyItemCondition() {
- this(null, null);
- }
-
- public RangerPolicyItemCondition(String type, String value) {
- setType(type);
- setValue(value);
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerPolicyItemCondition={");
- sb.append("type={").append(type).append("} ");
- sb.append("value={").append(value).append("} ");
- sb.append("}");
-
- return sb;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerService.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerService.java b/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerService.java
deleted file mode 100644
index f5e4d3e..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerService.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.ranger.plugin.model;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-
-@JsonAutoDetect(getterVisibility=Visibility.NONE, setterVisibility=Visibility.NONE, fieldVisibility=Visibility.ANY)
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL )
-@JsonIgnoreProperties(ignoreUnknown=true)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class RangerService extends RangerBaseModelObject implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String type = null;
- private String name = null;
- private String description = null;
- private Map<String, String> configs = null;
- private Long policyVersion = null;
- private Date policyUpdateTime = null;
-
-
- /**
- * @param type
- */
- public RangerService() {
- this(null, null, null, null);
- }
-
- /**
- * @param type
- * @param name
- * @param description
- * @param configs
- */
- public RangerService(String type, String name, String description, Map<String, String> configs) {
- super();
-
- setType(type);
- setName(name);
- setDescription(description);
- setConfigs(configs);
- }
-
- /**
- * @param other
- */
- public void updateFrom(RangerService other) {
- super.updateFrom(other);
-
- setType(other.getType());
- setName(other.getName());
- setDescription(other.getDescription());
- setConfigs(other.getConfigs());
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return the configs
- */
- public Map<String, String> getConfigs() {
- return configs;
- }
-
- /**
- * @param configs the configs to set
- */
- public void setConfigs(Map<String, String> configs) {
- if(this.configs == null) {
- this.configs = new HashMap<String, String>();
- }
-
- if(this.configs == configs) {
- return;
- }
-
- this.configs.clear();
-
- if(configs != null) {
- for(Map.Entry<String, String> e : configs.entrySet()) {
- this.configs.put(e.getKey(), e.getValue());
- }
- }
- }
-
- /**
- * @return the policyVersion
- */
- public Long getPolicyVersion() {
- return policyVersion;
- }
-
- /**
- * @param policyVersion the policyVersion to set
- */
- public void setPolicyVersion(Long policyVersion) {
- this.policyVersion = policyVersion;
- }
-
- /**
- * @return the policyUpdateTime
- */
- public Date getPolicyUpdateTime() {
- return policyUpdateTime;
- }
-
- /**
- * @param policyUpdateTime the policyUpdateTime to set
- */
- public void setPolicyUpdateTime(Date policyUpdateTime) {
- this.policyUpdateTime = policyUpdateTime;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerService={");
-
- super.toString(sb);
- sb.append("name={").append(name).append("} ");
- sb.append("type={").append(type).append("} ");
- sb.append("description={").append(description).append("} ");
-
- sb.append("configs={");
- if(configs != null) {
- for(Map.Entry<String, String> e : configs.entrySet()) {
- sb.append(e.getKey()).append("={").append(e.getValue()).append("} ");
- }
- }
- sb.append("} ");
-
- sb.append("policyVersion={").append(policyVersion).append("} ");
- sb.append("policyUpdateTime={").append(policyUpdateTime).append("} ");
-
- sb.append("}");
-
- return sb;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerServiceDef.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerServiceDef.java b/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerServiceDef.java
deleted file mode 100644
index 2841a23..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/model/RangerServiceDef.java
+++ /dev/null
@@ -1,1320 +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.ranger.plugin.model;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-
-@JsonAutoDetect(getterVisibility=Visibility.NONE, setterVisibility=Visibility.NONE, fieldVisibility=Visibility.ANY)
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL )
-@JsonIgnoreProperties(ignoreUnknown=true)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class RangerServiceDef extends RangerBaseModelObject implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String name = null;
- private String implClass = null;
- private String label = null;
- private String description = null;
- private String rbKeyLabel = null;
- private String rbKeyDescription = null;
- private List<RangerServiceConfigDef> configs = null;
- private List<RangerResourceDef> resources = null;
- private List<RangerAccessTypeDef> accessTypes = null;
- private List<RangerPolicyConditionDef> policyConditions = null;
- private List<RangerEnumDef> enums = null;
-
-
- public RangerServiceDef() {
- this(null, null, null, null, null, null, null, null, null);
- }
-
- /**
- * @param name
- * @param implClass
- * @param label
- * @param description
- * @param configs
- * @param resources
- * @param accessTypes
- * @param policyConditions
- * @param enums
- */
- public RangerServiceDef(String name, String implClass, String label, String description, List<RangerServiceConfigDef> configs, List<RangerResourceDef> resources, List<RangerAccessTypeDef> accessTypes, List<RangerPolicyConditionDef> policyConditions, List<RangerEnumDef> enums) {
- super();
-
- setName(name);
- setImplClass(implClass);
- setLabel(label);
- setDescription(description);
- setConfigs(configs);
- setResources(resources);
- setAccessTypes(accessTypes);
- setPolicyConditions(policyConditions);
- setEnums(enums);
- }
-
- /**
- * @param other
- */
- public void updateFrom(RangerServiceDef other) {
- super.updateFrom(other);
-
- setName(other.getName());
- setImplClass(other.getImplClass());
- setLabel(other.getLabel());
- setDescription(other.getDescription());
- setConfigs(other.getConfigs());
- setResources(other.getResources());
- setAccessTypes(other.getAccessTypes());
- setPolicyConditions(other.getPolicyConditions());
- setEnums(other.getEnums());
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the implClass
- */
- public String getImplClass() {
- return implClass;
- }
-
- /**
- * @param implClass the implClass to set
- */
- public void setImplClass(String implClass) {
- this.implClass = implClass;
- }
-
- /**
- * @return the label
- */
- public String getLabel() {
- return label;
- }
-
- /**
- * @param label the label to set
- */
- public void setLabel(String label) {
- this.label = label;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return the rbKeyLabel
- */
- public String getRbKeyLabel() {
- return rbKeyLabel;
- }
-
- /**
- * @param rbKeyLabel the rbKeyLabel to set
- */
- public void setRbKeyLabel(String rbKeyLabel) {
- this.rbKeyLabel = rbKeyLabel;
- }
-
- /**
- * @return the rbKeyDescription
- */
- public String getRbKeyDescription() {
- return rbKeyDescription;
- }
-
- /**
- * @param rbKeyDescription the rbKeyDescription to set
- */
- public void setRbKeyDescription(String rbKeyDescription) {
- this.rbKeyDescription = rbKeyDescription;
- }
-
- /**
- * @return the configs
- */
- public List<RangerServiceConfigDef> getConfigs() {
- return configs;
- }
-
- /**
- * @param configs the configs to set
- */
- public void setConfigs(List<RangerServiceConfigDef> configs) {
- if(this.configs == null) {
- this.configs = new ArrayList<RangerServiceConfigDef>();
- } else
-
- if(this.configs == configs) {
- return;
- }
-
- this.configs.clear();
-
- if(configs != null) {
- for(RangerServiceConfigDef config : configs) {
- this.configs.add(config);
- }
- }
- }
-
- /**
- * @return the resources
- */
- public List<RangerResourceDef> getResources() {
- return resources;
- }
-
- /**
- * @param resources the resources to set
- */
- public void setResources(List<RangerResourceDef> resources) {
- if(this.resources == null) {
- this.resources = new ArrayList<RangerResourceDef>();
- }
-
- if(this.resources == resources) {
- return;
- }
-
- this.resources.clear();
-
- if(resources != null) {
- for(RangerResourceDef resource : resources) {
- this.resources.add(resource);
- }
- }
- }
-
- /**
- * @return the accessTypes
- */
- public List<RangerAccessTypeDef> getAccessTypes() {
- return accessTypes;
- }
-
- /**
- * @param accessTypes the accessTypes to set
- */
- public void setAccessTypes(List<RangerAccessTypeDef> accessTypes) {
- if(this.accessTypes == null) {
- this.accessTypes = new ArrayList<RangerAccessTypeDef>();
- }
-
- if(this.accessTypes == accessTypes) {
- return;
- }
-
- this.accessTypes.clear();
-
- if(accessTypes != null) {
- for(RangerAccessTypeDef accessType : accessTypes) {
- this.accessTypes.add(accessType);
- }
- }
- }
-
- /**
- * @return the policyConditions
- */
- public List<RangerPolicyConditionDef> getPolicyConditions() {
- return policyConditions;
- }
-
- /**
- * @param policyConditions the policyConditions to set
- */
- public void setPolicyConditions(List<RangerPolicyConditionDef> policyConditions) {
- if(this.policyConditions == null) {
- this.policyConditions = new ArrayList<RangerPolicyConditionDef>();
- }
-
- if(this.policyConditions == policyConditions) {
- return;
- }
-
- this.policyConditions.clear();
-
- if(policyConditions != null) {
- for(RangerPolicyConditionDef policyCondition : policyConditions) {
- this.policyConditions.add(policyCondition);
- }
- }
- }
-
- /**
- * @return the enums
- */
- public List<RangerEnumDef> getEnums() {
- return enums;
- }
-
- /**
- * @param enums the enums to set
- */
- public void setEnums(List<RangerEnumDef> enums) {
- if(this.enums == null) {
- this.enums = new ArrayList<RangerEnumDef>();
- }
-
- if(this.enums == enums) {
- return;
- }
-
- this.enums.clear();
-
- if(enums != null) {
- for(RangerEnumDef enum1 : enums) {
- this.enums.add(enum1);
- }
- }
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerServiceDef={");
-
- super.toString(sb);
-
- sb.append("name={").append(name).append("} ");
- sb.append("implClass={").append(implClass).append("} ");
- sb.append("label={").append(label).append("} ");
- sb.append("description={").append(description).append("} ");
- sb.append("rbKeyLabel={").append(rbKeyLabel).append("} ");
- sb.append("rbKeyDescription={").append(rbKeyDescription).append("} ");
-
- sb.append("configs={");
- if(configs != null) {
- for(RangerServiceConfigDef config : configs) {
- if(config != null) {
- config.toString(sb);
- }
- }
- }
- sb.append("} ");
-
- sb.append("resources={");
- if(resources != null) {
- for(RangerResourceDef resource : resources) {
- if(resource != null) {
- resource.toString(sb);
- }
- }
- }
- sb.append("} ");
-
- sb.append("accessTypes={");
- if(accessTypes != null) {
- for(RangerAccessTypeDef accessType : accessTypes) {
- if(accessType != null) {
- accessType.toString(sb);
- }
- }
- }
- sb.append("} ");
-
- sb.append("policyConditions={");
- if(policyConditions != null) {
- for(RangerPolicyConditionDef policyCondition : policyConditions) {
- if(policyCondition != null) {
- policyCondition.toString(sb);
- }
- }
- }
- sb.append("} ");
-
- sb.append("enums={");
- if(enums != null) {
- for(RangerEnumDef e : enums) {
- if(e != null) {
- e.toString(sb);
- }
- }
- }
- sb.append("} ");
-
- sb.append("}");
-
- return sb;
- }
-
-
- public static class RangerEnumDef implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String name = null;
- private List<RangerEnumElementDef> elements = null;
- private Integer defaultIndex = null;
-
-
- public RangerEnumDef() {
- this(null, null, null);
- }
-
- public RangerEnumDef(String name, List<RangerEnumElementDef> elements, Integer defaultIndex) {
- setName(name);
- setElements(elements);
- setDefaultIndex(defaultIndex);
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the elements
- */
- public List<RangerEnumElementDef> getElements() {
- return elements;
- }
-
- /**
- * @param elements the elements to set
- */
- public void setElements(List<RangerEnumElementDef> elements) {
- if(this.elements == null) {
- this.elements = new ArrayList<RangerEnumElementDef>();
- }
-
- if(this.elements == elements) {
- return;
- }
-
- this.elements.clear();
-
- if(elements != null) {
- for(RangerEnumElementDef element : elements) {
- this.elements.add(element);
- }
- }
- }
-
- /**
- * @return the defaultIndex
- */
- public Integer getDefaultIndex() {
- return defaultIndex;
- }
-
- /**
- * @param defaultIndex the defaultIndex to set
- */
- public void setDefaultIndex(Integer defaultIndex) {
- this.defaultIndex = (defaultIndex != null && this.elements.size() > defaultIndex) ? defaultIndex : 0;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerEnumDef={");
- sb.append("name={").append(name).append("} ");
- sb.append("elements={");
- if(elements != null) {
- for(RangerEnumElementDef element : elements) {
- if(element != null) {
- element.toString(sb);
- }
- }
- }
- sb.append("} ");
- sb.append("defaultIndex={").append(defaultIndex).append("} ");
- sb.append("}");
-
- return sb;
- }
- }
-
-
- public static class RangerEnumElementDef implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String name = null;
- private String label = null;
- private String rbKeyLabel = null;
-
-
- public RangerEnumElementDef() {
- this(null, null, null);
- }
-
- public RangerEnumElementDef(String name, String label, String rbKeyLabel) {
- setName(name);
- setLabel(label);
- setRbKeyLabel(rbKeyLabel);
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the label
- */
- public String getLabel() {
- return label;
- }
-
- /**
- * @param label the label to set
- */
- public void setLabel(String label) {
- this.label = label;
- }
-
- /**
- * @return the rbKeyLabel
- */
- public String getRbKeyLabel() {
- return rbKeyLabel;
- }
-
- /**
- * @param rbKeyLabel the rbKeyLabel to set
- */
- public void setRbKeyLabel(String rbKeyLabel) {
- this.rbKeyLabel = rbKeyLabel;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerEnumElementDef={");
- sb.append("name={").append(name).append("} ");
- sb.append("label={").append(label).append("} ");
- sb.append("rbKeyLabel={").append(rbKeyLabel).append("} ");
- sb.append("}");
-
- return sb;
- }
- }
-
-
- public static class RangerServiceConfigDef implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String name = null;
- private String type = null;
- private String subType = null;
- private Boolean mandatory = null;
- private String defaultValue = null;
- private String label = null;
- private String description = null;
- private String rbKeyLabel = null;
- private String rbKeyDescription = null;
-
-
- public RangerServiceConfigDef() {
- this(null, null, null, null, null, null, null, null, null);
- }
-
- public RangerServiceConfigDef(String name, String type, String subType, Boolean mandatory, String defaultValue, String label, String description, String rbKeyLabel, String rbKeyDescription) {
- setName(name);
- setType(type);
- setSubType(subType);
- setMandatory(mandatory);
- setDefaultValue(defaultValue);
- setLabel(label);
- setDescription(description);
- setRbKeyLabel(rbKeyLabel);
- setRbKeyDescription(rbKeyDescription);
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the type
- */
- public String getSubType() {
- return subType;
- }
-
- /**
- * @param type the type to set
- */
- public void setSubType(String subType) {
- this.subType = subType;
- }
-
- /**
- * @return the mandatory
- */
- public Boolean getMandatory() {
- return mandatory;
- }
-
- /**
- * @param mandatory the mandatory to set
- */
- public void setMandatory(Boolean mandatory) {
- this.mandatory = mandatory == null ? Boolean.FALSE : mandatory;
- }
-
- /**
- * @return the defaultValue
- */
- public String getDefaultValue() {
- return defaultValue;
- }
-
- /**
- * @param defaultValue the defaultValue to set
- */
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
- }
-
- /**
- * @return the label
- */
- public String getLabel() {
- return label;
- }
-
- /**
- * @param label the label to set
- */
- public void setLabel(String label) {
- this.label = label;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return the rbKeyLabel
- */
- public String getRbKeyLabel() {
- return rbKeyLabel;
- }
-
- /**
- * @param rbKeyLabel the rbKeyLabel to set
- */
- public void setRbKeyLabel(String rbKeyLabel) {
- this.rbKeyLabel = rbKeyLabel;
- }
-
- /**
- * @return the rbKeyDescription
- */
- public String getRbKeyDescription() {
- return rbKeyDescription;
- }
-
- /**
- * @param rbKeyDescription the rbKeyDescription to set
- */
- public void setRbKeyDescription(String rbKeyDescription) {
- this.rbKeyDescription = rbKeyDescription;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerServiceConfigDef={");
- sb.append("name={").append(name).append("} ");
- sb.append("type={").append(type).append("} ");
- sb.append("subType={").append(subType).append("} ");
- sb.append("mandatory={").append(mandatory).append("} ");
- sb.append("defaultValue={").append(defaultValue).append("} ");
- sb.append("label={").append(label).append("} ");
- sb.append("description={").append(description).append("} ");
- sb.append("rbKeyLabel={").append(rbKeyLabel).append("} ");
- sb.append("rbKeyDescription={").append(rbKeyDescription).append("} ");
- sb.append("}");
-
- return sb;
- }
- }
-
-
- public static class RangerResourceDef implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String name = null;
- private String type = null;
- private Integer level = null;
- private String parent = null;
- private Boolean mandatory = null;
- private Boolean lookupSupported = null;
- private Boolean recursiveSupported = null;
- private Boolean excludesSupported = null;
- private String matcher = null;
- private String matcherOptions = null;
- private String label = null;
- private String description = null;
- private String rbKeyLabel = null;
- private String rbKeyDescription = null;
-
-
- public RangerResourceDef() {
- this(null, null, null, null, null, null, null, null, null, null, null, null, null, null);
- }
-
- public RangerResourceDef(String name, String type, Integer level, String parent, Boolean mandatory, Boolean lookupSupported, Boolean recursiveSupported, Boolean excludesSupported, String matcher, String matcherOptions, String label, String description, String rbKeyLabel, String rbKeyDescription) {
- setName(name);
- setType(type);
- setLevel(level);
- setParent(parent);
- setMandatory(mandatory);
- setLookupSupported(lookupSupported);
- setRecursiveSupported(recursiveSupported);
- setExcludesSupported(excludesSupported);
- setMatcher(matcher);
- setMatcher(matcherOptions);
- setLabel(label);
- setDescription(description);
- setRbKeyLabel(rbKeyLabel);
- setRbKeyDescription(rbKeyDescription);
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the level
- */
- public Integer getLevel() {
- return level;
- }
-
- /**
- * @param level the level to set
- */
- public void setLevel(Integer level) {
- this.level = level == null ? 1 : level;
- }
-
- /**
- * @return the parent
- */
- public String getParent() {
- return parent;
- }
-
- /**
- * @param parent the parent to set
- */
- public void setParent(String parent) {
- this.parent = parent;
- }
-
- /**
- * @return the mandatory
- */
- public Boolean getMandatory() {
- return mandatory;
- }
-
- /**
- * @param mandatory the mandatory to set
- */
- public void setMandatory(Boolean mandatory) {
- this.mandatory = mandatory == null ? Boolean.FALSE : mandatory;
- }
-
- /**
- * @return the lookupSupported
- */
- public Boolean getLookupSupported() {
- return lookupSupported;
- }
-
- /**
- * @param lookupSupported the lookupSupported to set
- */
- public void setLookupSupported(Boolean lookupSupported) {
- this.lookupSupported = lookupSupported == null ? Boolean.FALSE : lookupSupported;
- }
-
- /**
- * @return the recursiveSupported
- */
- public Boolean getRecursiveSupported() {
- return recursiveSupported;
- }
-
- /**
- * @param recursiveSupported the recursiveSupported to set
- */
- public void setRecursiveSupported(Boolean recursiveSupported) {
- this.recursiveSupported = recursiveSupported == null ? Boolean.FALSE : recursiveSupported;
- }
-
- /**
- * @return the excludesSupported
- */
- public Boolean getExcludesSupported() {
- return excludesSupported;
- }
-
- /**
- * @param excludesSupported the excludesSupported to set
- */
- public void setExcludesSupported(Boolean excludesSupported) {
- this.excludesSupported = excludesSupported == null ? Boolean.FALSE : excludesSupported;
- }
-
- /**
- * @return the matcher
- */
- public String getMatcher() {
- return matcher;
- }
-
- /**
- * @param matcher the matcher to set
- */
- public void setMatcher(String matcher) {
- this.matcher = matcher;
- }
-
- /**
- * @return the matcher
- */
- public String getMatcherOptions() {
- return matcherOptions;
- }
-
- /**
- * @param matcher the matcher to set
- */
- public void setMatcherOptions(String matcherOptions) {
- this.matcherOptions = matcherOptions;
- }
-
- /**
- * @return the label
- */
- public String getLabel() {
- return label;
- }
-
- /**
- * @param label the label to set
- */
- public void setLabel(String label) {
- this.label = label;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return the rbKeyLabel
- */
- public String getRbKeyLabel() {
- return rbKeyLabel;
- }
-
- /**
- * @param rbKeyLabel the rbKeyLabel to set
- */
- public void setRbKeyLabel(String rbKeyLabel) {
- this.rbKeyLabel = rbKeyLabel;
- }
-
- /**
- * @return the rbKeyDescription
- */
- public String getRbKeyDescription() {
- return rbKeyDescription;
- }
-
- /**
- * @param rbKeyDescription the rbKeyDescription to set
- */
- public void setRbKeyDescription(String rbKeyDescription) {
- this.rbKeyDescription = rbKeyDescription;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerResourceDef={");
- sb.append("name={").append(name).append("} ");
- sb.append("type={").append(type).append("} ");
- sb.append("level={").append(level).append("} ");
- sb.append("parent={").append(parent).append("} ");
- sb.append("mandatory={").append(mandatory).append("} ");
- sb.append("lookupSupported={").append(lookupSupported).append("} ");
- sb.append("recursiveSupported={").append(recursiveSupported).append("} ");
- sb.append("excludesSupported={").append(excludesSupported).append("} ");
- sb.append("matcher={").append(matcher).append("} ");
- sb.append("matcherOptions={").append(matcherOptions).append("} ");
- sb.append("label={").append(label).append("} ");
- sb.append("description={").append(description).append("} ");
- sb.append("rbKeyLabel={").append(rbKeyLabel).append("} ");
- sb.append("rbKeyDescription={").append(rbKeyDescription).append("} ");
- sb.append("}");
-
- return sb;
- }
- }
-
-
- public static class RangerAccessTypeDef implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String name = null;
- private String label = null;
- private String rbKeyLabel = null;
- private Collection<String> impliedGrants = null;
-
-
- public RangerAccessTypeDef() {
- this(null, null, null, null);
- }
-
- public RangerAccessTypeDef(String name, String label, String rbKeyLabel, Collection<String> impliedGrants) {
- setName(name);
- setLabel(label);
- setRbKeyLabel(rbKeyLabel);
- setImpliedGrants(impliedGrants);
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the label
- */
- public String getLabel() {
- return label;
- }
-
- /**
- * @param label the label to set
- */
- public void setLabel(String label) {
- this.label = label;
- }
-
- /**
- * @return the rbKeyLabel
- */
- public String getRbKeyLabel() {
- return rbKeyLabel;
- }
-
- /**
- * @param rbKeyLabel the rbKeyLabel to set
- */
- public void setRbKeyLabel(String rbKeyLabel) {
- this.rbKeyLabel = rbKeyLabel;
- }
-
- /**
- * @return the impliedGrants
- */
- public Collection<String> getImpliedGrants() {
- return impliedGrants;
- }
-
- /**
- * @param impliedGrants the impliedGrants to set
- */
- public void setImpliedGrants(Collection<String> impliedGrants) {
- if(this.impliedGrants == null) {
- this.impliedGrants = new ArrayList<String>();
- }
-
- if(this.impliedGrants == impliedGrants) {
- return;
- }
-
- this.impliedGrants.clear();
-
- if(impliedGrants != null) {
- for(String impliedGrant : impliedGrants) {
- this.impliedGrants.add(impliedGrant);
- }
- }
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerAccessTypeDef={");
- sb.append("name={").append(name).append("} ");
- sb.append("label={").append(label).append("} ");
- sb.append("rbKeyLabel={").append(rbKeyLabel).append("} ");
-
- sb.append("impliedGrants={");
- if(impliedGrants != null) {
- for(String impliedGrant : impliedGrants) {
- if(impliedGrant != null) {
- sb.append(impliedGrant).append(" ");
- }
- }
- }
- sb.append("} ");
-
- sb.append("}");
-
- return sb;
- }
- }
-
-
- public static class RangerPolicyConditionDef implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- private String name = null;
- private String evaluator = null;
- private String evaluatorOptions = null;
- private String label = null;
- private String description = null;
- private String rbKeyLabel = null;
- private String rbKeyDescription = null;
-
-
- public RangerPolicyConditionDef() {
- this(null, null, null, null, null, null, null);
- }
-
- public RangerPolicyConditionDef(String name, String evaluator, String evaluatorOptions) {
- this(name, evaluator, evaluatorOptions, null, null, null, null);
- }
-
- public RangerPolicyConditionDef(String name, String evaluator, String evaluatorOptions, String label) {
- this(name, evaluator, evaluatorOptions, label, null, null, null);
- }
-
- public RangerPolicyConditionDef(String name, String evaluator, String evaluatorOptions, String label, String description) {
- this(name, evaluator, evaluatorOptions, label, description, null, null);
- }
-
- public RangerPolicyConditionDef(String name, String evaluator, String evaluatorOptions, String label, String description, String rbKeyLabel, String rbKeyDescription) {
- setName(name);
- setEvaluator(evaluator);
- setEvaluatorOptions(evaluatorOptions);
- setLabel(label);
- setDescription(description);
- setRbKeyLabel(rbKeyLabel);
- setRbKeyDescription(rbKeyDescription);
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the evaluator
- */
- public String getEvaluator() {
- return evaluator;
- }
-
- /**
- * @param evaluator the evaluator to set
- */
- public void setEvaluator(String evaluator) {
- this.evaluator = evaluator;
- }
-
- /**
- * @return the evaluator
- */
- public String getEvaluatorOptions() {
- return evaluatorOptions;
- }
-
- /**
- * @param evaluator the evaluator to set
- */
- public void setEvaluatorOptions(String evaluatorOptions) {
- this.evaluatorOptions = evaluatorOptions;
- }
-
- /**
- * @return the label
- */
- public String getLabel() {
- return label;
- }
-
- /**
- * @param label the label to set
- */
- public void setLabel(String label) {
- this.label = label;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @param description the description to set
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * @return the rbKeyLabel
- */
- public String getRbKeyLabel() {
- return rbKeyLabel;
- }
-
- /**
- * @param rbKeyLabel the rbKeyLabel to set
- */
- public void setRbKeyLabel(String rbKeyLabel) {
- this.rbKeyLabel = rbKeyLabel;
- }
-
- /**
- * @return the rbKeyDescription
- */
- public String getRbKeyDescription() {
- return rbKeyDescription;
- }
-
- /**
- * @param rbKeyDescription the rbKeyDescription to set
- */
- public void setRbKeyDescription(String rbKeyDescription) {
- this.rbKeyDescription = rbKeyDescription;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerPolicyConditionDef={");
- sb.append("name={").append(name).append("} ");
- sb.append("evaluator={").append(evaluator).append("} ");
- sb.append("evaluatorOptions={").append(evaluatorOptions).append("} ");
- sb.append("label={").append(label).append("} ");
- sb.append("description={").append(description).append("} ");
- sb.append("rbKeyLabel={").append(rbKeyLabel).append("} ");
- sb.append("rbKeyDescription={").append(rbKeyDescription).append("} ");
- sb.append("}");
-
- return sb;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequest.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequest.java b/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequest.java
deleted file mode 100644
index 56a55ae..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequest.java
+++ /dev/null
@@ -1,48 +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.ranger.plugin.policyengine;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-public interface RangerAccessRequest {
- RangerResource getResource();
-
- String getAccessType();
-
- String getUser();
-
- Set<String> getUserGroups();
-
- Date getAccessTime();
-
- String getClientIPAddress();
-
- String getClientType();
-
- String getAction();
-
- String getRequestData();
-
- String getSessionId();
-
- Map<String, Object> getContext();
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequestImpl.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequestImpl.java b/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequestImpl.java
deleted file mode 100644
index fff8d4c..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessRequestImpl.java
+++ /dev/null
@@ -1,208 +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.ranger.plugin.policyengine;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.lang.StringUtils;
-
-
-public class RangerAccessRequestImpl implements RangerAccessRequest {
- private RangerResource resource = null;
- private String accessType = null;
- private String user = null;
- private Set<String> userGroups = null;
- private Date accessTime = null;
- private String clientIPAddress = null;
- private String clientType = null;
- private String action = null;
- private String requestData = null;
- private String sessionId = null;
- private Map<String, Object> context = null;
-
-
- public RangerAccessRequestImpl() {
- this(null, null, null, null);
- }
-
- public RangerAccessRequestImpl(RangerResource resource, String accessType, String user, Set<String> userGroups) {
- setResource(resource);
- setAccessType(accessType);
- setUser(user);
- setUserGroups(userGroups);
-
- // set remaining fields to default value
- setAccessTime(null);
- setClientIPAddress(null);
- setClientType(null);
- setAction(null);
- setRequestData(null);
- setSessionId(null);
- setContext(null);
- }
-
- @Override
- public RangerResource getResource() {
- return resource;
- }
-
- @Override
- public String getAccessType() {
- return accessType;
- }
-
- @Override
- public String getUser() {
- return user;
- }
-
- @Override
- public Set<String> getUserGroups() {
- return userGroups;
- }
-
- @Override
- public Date getAccessTime() {
- return accessTime;
- }
-
- @Override
- public String getClientIPAddress() {
- return clientIPAddress;
- }
-
- @Override
- public String getClientType() {
- return clientType;
- }
-
- @Override
- public String getAction() {
- return action;
- }
-
- @Override
- public String getRequestData() {
- return requestData;
- }
-
- @Override
- public String getSessionId() {
- return sessionId;
- }
-
- @Override
- public Map<String, Object> getContext() {
- return context;
- }
-
-
- public void setResource(RangerResource resource) {
- this.resource = resource;
- }
-
- public void setAccessType(String accessType) {
- this.accessType = accessType;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public void setUserGroups(Set<String> userGroups) {
- this.userGroups = (userGroups == null) ? new HashSet<String>() : userGroups;
- }
-
- public void setAccessTime(Date accessTime) {
- this.accessTime = (accessTime == null) ? new Date() : accessTime;
- }
-
- public void setClientIPAddress(String clientIPAddress) {
- this.clientIPAddress = clientIPAddress;
- }
-
- public void setClientType(String clientType) {
- this.clientType = clientType;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- public void setRequestData(String requestData) {
- this.requestData = requestData;
- }
-
- public void setSessionId(String sessionId) {
- this.sessionId = sessionId;
- }
-
- public void setContext(Map<String, Object> context) {
- this.context = (context == null) ? new HashMap<String, Object>() : context;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerAccessRequestImpl={");
-
- sb.append("resource={").append(resource).append("} ");
- sb.append("accessType={").append(accessType).append("} ");
- sb.append("user={").append(user).append("} ");
-
- sb.append("userGroups={");
- if(userGroups != null) {
- for(String userGroup : userGroups) {
- sb.append(userGroup).append(" ");
- }
- }
-
- sb.append("accessTime={").append(accessTime).append("} ");
- sb.append("clientIPAddress={").append(clientIPAddress).append("} ");
- sb.append("clientType={").append(clientType).append("} ");
- sb.append("action={").append(action).append("} ");
- sb.append("requestData={").append(requestData).append("} ");
- sb.append("sessionId={").append(sessionId).append("} ");
-
-
- sb.append("context={");
- if(context != null) {
- for(Map.Entry<String, Object> e : context.entrySet()) {
- sb.append(e.getKey()).append("={").append(e.getValue()).append("} ");
- }
- }
- sb.append("} ");
-
- sb.append("}");
-
- return sb;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessResult.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessResult.java b/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessResult.java
deleted file mode 100644
index 2eaec16..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerAccessResult.java
+++ /dev/null
@@ -1,157 +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.ranger.plugin.policyengine;
-
-import org.apache.ranger.plugin.model.RangerServiceDef;
-
-
-public class RangerAccessResult {
- private String serviceName = null;
- private RangerServiceDef serviceDef = null;
- private RangerAccessRequest request = null;
-
- private boolean isAllowed = false;
- private boolean isAudited = false;
- private long policyId = -1;
- private String reason = null;
-
- public RangerAccessResult(String serviceName, RangerServiceDef serviceDef, RangerAccessRequest request) {
- this(serviceName, serviceDef, request, false, false, -1, null);
- }
-
- public RangerAccessResult(String serviceName, RangerServiceDef serviceDef, RangerAccessRequest request, boolean isAllowed, boolean isAudited, long policyId, String reason) {
- this.serviceName = serviceName;
- this.serviceDef = serviceDef;
- this.request = request;
- this.isAllowed = isAllowed;
- this.isAudited = isAudited;
- this.policyId = policyId;
- this.reason = reason;
- }
-
- /**
- * @return the serviceName
- */
- public String getServiceName() {
- return serviceName;
- }
-
- /**
- * @return the serviceDef
- */
- public RangerServiceDef getServiceDef() {
- return serviceDef;
- }
-
- /**
- * @return the request
- */
- public RangerAccessRequest getAccessRequest() {
- return request;
- }
-
- /**
- * @return the isAllowed
- */
- public boolean getIsAllowed() {
- return isAllowed;
- }
-
- /**
- * @param isAllowed the isAllowed to set
- */
- public void setIsAllowed(boolean isAllowed) {
- this.isAllowed = isAllowed;
- }
-
- /**
- * @param reason the reason to set
- */
- public void setReason(String reason) {
- this.reason = reason;
- }
-
- /**
- * @return the isAudited
- */
- public boolean getIsAudited() {
- return isAudited;
- }
-
- /**
- * @param isAudited the isAudited to set
- */
- public void setIsAudited(boolean isAudited) {
- this.isAudited = isAudited;
- }
-
- /**
- * @return the reason
- */
- public String getReason() {
- return reason;
- }
-
- /**
- * @return the policyId
- */
- public long getPolicyId() {
- return policyId;
- }
-
- /**
- * @return the policyId
- */
- public void setPolicyId(long policyId) {
- this.policyId = policyId;
- }
-
- public int getServiceType() {
- int ret = -1;
-
- if(serviceDef != null && serviceDef.getId() != null) {
- ret = serviceDef.getId().intValue();
- }
-
- return ret;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerAccessResult={");
-
- sb.append("isAllowed={").append(isAllowed).append("} ");
- sb.append("isAudited={").append(isAudited).append("} ");
- sb.append("policyId={").append(policyId).append("} ");
- sb.append("reason={").append(reason).append("} ");
-
- sb.append("}");
-
- return sb;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerMutableResource.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerMutableResource.java b/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerMutableResource.java
deleted file mode 100644
index f49bf8c..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerMutableResource.java
+++ /dev/null
@@ -1,27 +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.ranger.plugin.policyengine;
-
-
-public interface RangerMutableResource extends RangerResource {
- void setOwnerUser(String ownerUser);
-
- void setValue(String type, String value);
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyEngine.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyEngine.java b/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyEngine.java
deleted file mode 100644
index a66bc23..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyEngine.java
+++ /dev/null
@@ -1,54 +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.ranger.plugin.policyengine;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.ranger.plugin.audit.RangerAuditHandler;
-import org.apache.ranger.plugin.model.RangerPolicy;
-import org.apache.ranger.plugin.model.RangerServiceDef;
-
-public interface RangerPolicyEngine {
- public static final String GROUP_PUBLIC = "public";
- public static final String ANY_ACCESS = "_any";
- public static final String ADMIN_ACCESS = "_admin";
- public static final long UNKNOWN_POLICY = -1;
-
- String getServiceName();
-
- RangerServiceDef getServiceDef();
-
- void setPolicies(String serviceName, RangerServiceDef serviceDef, List<RangerPolicy> policies);
-
- void setDefaultAuditHandler(RangerAuditHandler auditHandler);
-
- RangerAuditHandler getDefaultAuditHandler();
-
- RangerAccessResult createAccessResult(RangerAccessRequest request);
-
- RangerAccessResult isAccessAllowed(RangerAccessRequest request);
-
- Collection<RangerAccessResult> isAccessAllowed(Collection<RangerAccessRequest> requests);
-
- RangerAccessResult isAccessAllowed(RangerAccessRequest request, RangerAuditHandler auditHandler);
-
- Collection<RangerAccessResult> isAccessAllowed(Collection<RangerAccessRequest> requests, RangerAuditHandler auditHandler);
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyEngineImpl.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyEngineImpl.java b/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyEngineImpl.java
deleted file mode 100644
index 8f6231b..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPolicyEngineImpl.java
+++ /dev/null
@@ -1,254 +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.ranger.plugin.policyengine;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ranger.plugin.audit.RangerAuditHandler;
-import org.apache.ranger.plugin.model.RangerPolicy;
-import org.apache.ranger.plugin.model.RangerServiceDef;
-import org.apache.ranger.plugin.policyevaluator.RangerDefaultPolicyEvaluator;
-import org.apache.ranger.plugin.policyevaluator.RangerPolicyEvaluator;
-
-
-public class RangerPolicyEngineImpl implements RangerPolicyEngine {
- private static final Log LOG = LogFactory.getLog(RangerPolicyEngineImpl.class);
-
- private String serviceName = null;
- private RangerServiceDef serviceDef = null;
- private List<RangerPolicyEvaluator> policyEvaluators = null;
- private RangerAuditHandler defaultAuditHandler = null;
-
-
- public RangerPolicyEngineImpl() {
- if(LOG.isDebugEnabled()) {
- LOG.debug("==> RangerPolicyEngineImpl()");
- }
-
- if(LOG.isDebugEnabled()) {
- LOG.debug("<== RangerPolicyEngineImpl()");
- }
- }
-
- @Override
- public String getServiceName() {
- return serviceName;
- }
-
- @Override
- public RangerServiceDef getServiceDef() {
- return serviceDef;
- }
-
- @Override
- public void setPolicies(String serviceName, RangerServiceDef serviceDef, List<RangerPolicy> policies) {
- if(LOG.isDebugEnabled()) {
- LOG.debug("==> RangerPolicyEngineImpl.setPolicies(" + serviceName + ", " + serviceDef + ", policies.count=" + (policies == null ? 0 : policies.size()) + ")");
- }
-
- if(serviceName != null && serviceDef != null && policies != null) {
- List<RangerPolicyEvaluator> evaluators = new ArrayList<RangerPolicyEvaluator>();
-
- for(RangerPolicy policy : policies) {
- if(! policy.getIsEnabled()) {
- continue;
- }
-
- RangerPolicyEvaluator evaluator = getPolicyEvaluator(policy, serviceDef);
-
- if(evaluator != null) {
- evaluators.add(evaluator);
- }
- }
-
- /* TODO:
- * sort evaluators list for faster completion of isAccessAllowed() method
- * 1. Global policies: the policies that cover for any resource (for example: database=*; table=*; column=*)
- * 2. Policies that cover all resources under level-1 (for example: every thing in one or more databases)
- * 3. Policies that cover all resources under level-2 (for example: every thing in one or more tables)
- * ...
- * 4. Policies that cover all resources under level-n (for example: one or more columns)
- *
- */
-
- this.serviceName = serviceName;
- this.serviceDef = serviceDef;
- this.policyEvaluators = evaluators;
- } else {
- LOG.error("RangerPolicyEngineImpl.setPolicies(): invalid arguments - null serviceDef/policies");
- }
-
- if(LOG.isDebugEnabled()) {
- LOG.debug("<== RangerPolicyEngineImpl.setPolicies(" + serviceName + ", " + serviceDef + ", policies.count=" + (policies == null ? 0 : policies.size()) + ")");
- }
- }
-
- @Override
- public void setDefaultAuditHandler(RangerAuditHandler auditHandler) {
- this.defaultAuditHandler = auditHandler;
- }
-
- @Override
- public RangerAuditHandler getDefaultAuditHandler() {
- return defaultAuditHandler;
- }
-
- @Override
- public RangerAccessResult createAccessResult(RangerAccessRequest request) {
- return new RangerAccessResult(serviceName, serviceDef, request);
- }
-
- @Override
- public RangerAccessResult isAccessAllowed(RangerAccessRequest request) {
- return isAccessAllowed(request, defaultAuditHandler);
- }
-
- @Override
- public Collection<RangerAccessResult> isAccessAllowed(Collection<RangerAccessRequest> requests) {
- return isAccessAllowed(requests, defaultAuditHandler);
- }
-
- @Override
- public RangerAccessResult isAccessAllowed(RangerAccessRequest request, RangerAuditHandler auditHandler) {
- if(LOG.isDebugEnabled()) {
- LOG.debug("==> RangerPolicyEngineImpl.isAccessAllowed(" + request + ")");
- }
-
- RangerAccessResult ret = isAccessAllowedNoAudit(request);
-
- if(auditHandler != null) {
- auditHandler.logAudit(ret);
- }
-
- if(LOG.isDebugEnabled()) {
- LOG.debug("<== RangerPolicyEngineImpl.isAccessAllowed(" + request + "): " + ret);
- }
-
- return ret;
- }
-
- @Override
- public Collection<RangerAccessResult> isAccessAllowed(Collection<RangerAccessRequest> requests, RangerAuditHandler auditHandler) {
- if(LOG.isDebugEnabled()) {
- LOG.debug("==> RangerPolicyEngineImpl.isAccessAllowed(" + requests + ")");
- }
-
- Collection<RangerAccessResult> ret = new ArrayList<RangerAccessResult>();
-
- if(requests != null) {
- for(RangerAccessRequest request : requests) {
- RangerAccessResult result = isAccessAllowedNoAudit(request);
-
- ret.add(result);
- }
- }
-
- if(auditHandler != null) {
- auditHandler.logAudit(ret);
- }
-
- if(LOG.isDebugEnabled()) {
- LOG.debug("<== RangerPolicyEngineImpl.isAccessAllowed(" + requests + "): " + ret);
- }
-
- return ret;
- }
-
- protected RangerAccessResult isAccessAllowedNoAudit(RangerAccessRequest request) {
- if(LOG.isDebugEnabled()) {
- LOG.debug("==> RangerPolicyEngineImpl.isAccessAllowedNoAudit(" + request + ")");
- }
-
- RangerAccessResult ret = createAccessResult(request);
-
- if(request != null) {
- List<RangerPolicyEvaluator> evaluators = policyEvaluators;
-
- if(evaluators != null) {
- for(RangerPolicyEvaluator evaluator : evaluators) {
- evaluator.evaluate(request, ret);
-
- // stop once allowed=true && audited==true
- if(ret.getIsAllowed() && ret.getIsAudited()) {
- break;
- }
- }
- }
- }
-
- if(LOG.isDebugEnabled()) {
- LOG.debug("<== RangerPolicyEngineImpl.isAccessAllowedNoAudit(" + request + "): " + ret);
- }
-
- return ret;
- }
-
- private RangerPolicyEvaluator getPolicyEvaluator(RangerPolicy policy, RangerServiceDef serviceDef) {
- if(LOG.isDebugEnabled()) {
- LOG.debug("==> RangerPolicyEngineImpl.getPolicyEvaluator(" + policy + "," + serviceDef + ")");
- }
-
- RangerPolicyEvaluator ret = null;
-
- ret = new RangerDefaultPolicyEvaluator(); // TODO: configurable evaluator class?
-
- ret.init(policy, serviceDef);
-
- if(LOG.isDebugEnabled()) {
- LOG.debug("<== RangerPolicyEngineImpl.getPolicyEvaluator(" + policy + "," + serviceDef + "): " + ret);
- }
-
- return ret;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerPolicyEngineImpl={");
-
- sb.append("serviceName={").append(serviceName).append("} ");
- sb.append("serviceDef={").append(serviceDef).append("} ");
-
- sb.append("policyEvaluators={");
- if(policyEvaluators != null) {
- for(RangerPolicyEvaluator policyEvaluator : policyEvaluators) {
- if(policyEvaluator != null) {
- sb.append(policyEvaluator).append(" ");
- }
- }
- }
- sb.append("} ");
-
- sb.append("}");
-
- return sb;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerResource.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerResource.java b/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerResource.java
deleted file mode 100644
index 6941bc3..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerResource.java
+++ /dev/null
@@ -1,33 +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.ranger.plugin.policyengine;
-
-import java.util.Set;
-
-
-public interface RangerResource {
- public abstract String getOwnerUser();
-
- public abstract boolean exists(String name);
-
- public abstract String getValue(String name);
-
- public Set<String> getKeys();
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerResourceImpl.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerResourceImpl.java b/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerResourceImpl.java
deleted file mode 100644
index 86f7ea4..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerResourceImpl.java
+++ /dev/null
@@ -1,107 +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.ranger.plugin.policyengine;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-
-public class RangerResourceImpl implements RangerMutableResource {
- private String ownerUser = null;
- private Map<String, String> elements = null;
-
-
- public RangerResourceImpl() {
- }
-
- @Override
- public String getOwnerUser() {
- return ownerUser;
- }
-
- @Override
- public boolean exists(String name) {
- return elements != null && elements.containsKey(name);
- }
-
- @Override
- public String getValue(String name) {
- String ret = null;
-
- if(elements != null && elements.containsKey(name)) {
- ret = elements.get(name);
- }
-
- return ret;
- }
-
- @Override
- public Set<String> getKeys() {
- Set<String> ret = null;
-
- if(elements != null) {
- ret = elements.keySet();
- }
-
- return ret;
- }
-
- @Override
- public void setOwnerUser(String ownerUser) {
- this.ownerUser = ownerUser;
- }
-
- @Override
- public void setValue(String name, String value) {
- if(elements == null) {
- elements = new HashMap<String, String>();
- }
-
- elements.put(name, value);
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerResourceImpl={");
-
- sb.append("ownerUser={").append(ownerUser).append("} ");
-
- sb.append("elements={");
- if(elements != null) {
- for(Map.Entry<String, String> e : elements.entrySet()) {
- sb.append(e.getKey()).append("=").append(e.getValue()).append("; ");
- }
- }
- sb.append("} ");
-
- sb.append("}");
-
- return sb;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/217e1892/plugin-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerAbstractPolicyEvaluator.java
----------------------------------------------------------------------
diff --git a/plugin-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerAbstractPolicyEvaluator.java b/plugin-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerAbstractPolicyEvaluator.java
deleted file mode 100644
index 36273eb..0000000
--- a/plugin-common/src/main/java/org/apache/ranger/plugin/policyevaluator/RangerAbstractPolicyEvaluator.java
+++ /dev/null
@@ -1,79 +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.ranger.plugin.policyevaluator;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ranger.plugin.model.RangerPolicy;
-import org.apache.ranger.plugin.model.RangerServiceDef;
-
-
-public abstract class RangerAbstractPolicyEvaluator implements RangerPolicyEvaluator {
- private static final Log LOG = LogFactory.getLog(RangerAbstractPolicyEvaluator.class);
-
- private RangerPolicy policy = null;
- private RangerServiceDef serviceDef = null;
-
-
- @Override
- public void init(RangerPolicy policy, RangerServiceDef serviceDef) {
- if(LOG.isDebugEnabled()) {
- LOG.debug("==> RangerAbstractPolicyEvaluator.init(" + policy + ", " + serviceDef + ")");
- }
-
- this.policy = policy;
- this.serviceDef = serviceDef;
-
- if(LOG.isDebugEnabled()) {
- LOG.debug("<== RangerAbstractPolicyEvaluator.init(" + policy + ", " + serviceDef + ")");
- }
- }
-
- @Override
- public RangerPolicy getPolicy() {
- return policy;
- }
-
- @Override
- public RangerServiceDef getServiceDef() {
- return serviceDef;
- }
-
- @Override
- public String toString( ) {
- StringBuilder sb = new StringBuilder();
-
- toString(sb);
-
- return sb.toString();
- }
-
- public StringBuilder toString(StringBuilder sb) {
- sb.append("RangerAbstractPolicyEvaluator={");
-
- sb.append("policy={").append(policy).append("} ");
- sb.append("serviceDef={").append(serviceDef).append("} ");
-
- sb.append("}");
-
- return sb;
- }
-}