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 2014/12/12 02:29:53 UTC
[10/51] [partial] incubator-ranger git commit: RANGER-194: Rename
packages from xasecure to apache ranger
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/view/VXRepositoryList.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXRepositoryList.java b/security-admin/src/main/java/com/xasecure/view/VXRepositoryList.java
deleted file mode 100644
index 298fab3..0000000
--- a/security-admin/src/main/java/com/xasecure/view/VXRepositoryList.java
+++ /dev/null
@@ -1,81 +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 com.xasecure.view;
-
-
-/**
- * List wrapper class for VXRepository
- */
-
-import java.util.*;
-import javax.xml.bind.annotation.*;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import com.xasecure.common.view.*;
-
-@JsonAutoDetect(getterVisibility = Visibility.NONE, setterVisibility = Visibility.NONE, fieldVisibility = Visibility.ANY)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VXRepositoryList extends VList {
- private static final long serialVersionUID = 1L;
- List<VXRepository> vXRepositories = new ArrayList<VXRepository>();
-
- public VXRepositoryList() {
- super();
- }
-
- public VXRepositoryList(List<VXRepository> objList) {
- super(objList);
- this.vXRepositories = objList;
- }
-
- /**
- * @return the vXRepositories
- */
- public List<VXRepository> getVXRepositories() {
- return vXRepositories;
- }
-
- /**
- * @param vXRepositories
- * the vXRepositories to set
- */
- public void setVXRepositories(List<VXRepository> vXRepositories) {
- this.vXRepositories = vXRepositories;
- }
-
- @Override
- public int getListSize() {
- if (vXRepositories != null) {
- return vXRepositories.size();
- }
- return 0;
- }
-
- @Override
- public List<VXRepository> getList() {
- return vXRepositories;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/view/VXResource.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXResource.java b/security-admin/src/main/java/com/xasecure/view/VXResource.java
deleted file mode 100644
index 3619ef7..0000000
--- a/security-admin/src/main/java/com/xasecure/view/VXResource.java
+++ /dev/null
@@ -1,624 +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 com.xasecure.view;
-
-/**
- * Resource
- *
- */
-
-import java.util.*;
-
-import com.xasecure.common.*;
-import com.xasecure.common.view.*;
-import com.xasecure.common.*;
-import com.xasecure.json.JsonDateSerializer;
-import com.xasecure.view.*;
-
-import javax.xml.bind.annotation.*;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-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
-public class VXResource extends VXDataObject implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
-
- /**
- * Name
- */
- protected String name;
- protected String policyName;
- /**
- * Description
- */
- protected String description;
- /**
- * Status
- * This attribute is of type enum CommonEnums::ResourceType
- */
- protected int resourceType;
- /**
- * Id of the asset
- */
- protected Long assetId;
- /**
- * Id of the parent
- */
- protected Long parentId;
- /**
- * Path for the parent
- */
- protected String parentPath;
- /**
- * Whether to encrypt this resource
- * This attribute is of type enum CommonEnums::BooleanValue
- */
- protected int isEncrypt = XAConstants.BOOL_FALSE;
- /**
- * List of permissions maps
- */
- protected List<VXPermMap> permMapList;
- /**
- * List of audits
- */
- protected List<VXAuditMap> auditList;
- /**
- * Is recursive
- * This attribute is of type enum CommonEnums::BooleanValue
- */
- protected int isRecursive = XAConstants.BOOL_NONE;
- /**
- * Group to which this resource belongs to
- */
- protected String resourceGroup;
- /**
- * Databases
- */
- protected String databases;
- /**
- * Tables
- */
- protected String tables;
- /**
- * Column families
- */
- protected String columnFamilies;
- /**
- * Columns
- */
- protected String columns;
- /**
- * UDFs
- */
- protected String udfs;
- /**
- * Asset Name
- */
- protected String assetName;
- /**
- * Asset Type
- */
- protected int assetType;
- /**
- * Resource Status
- */
- protected int resourceStatus;
- /**
- * Table Type
- */
- protected int tableType;
- /**
- * Resource Status
- */
- protected int columnType;
- /**
- * Check parent permission
- * This attribute is of type enum CommonEnums::BooleanValue
- */
- protected int checkParentPermission = XAConstants.BOOL_NONE;
- /**
- * Topologoies
- */
- protected String topologies;
- /**
- * Services
- */
- protected String services;
-
- /**
- * Default constructor. This will set all the attributes to default value.
- */
- public VXResource ( ) {
- resourceType = AppConstants.RESOURCE_PATH;
- isEncrypt = XAConstants.BOOL_FALSE;
- isRecursive = XAConstants.BOOL_NONE;
- checkParentPermission = XAConstants.BOOL_NONE;
- }
-
- /**
- * This method sets the value to the member attribute <b>name</b>.
- * You cannot set null to the attribute.
- * @param name Value to set member attribute <b>name</b>
- */
- public void setName( String name ) {
- this.name = name;
- }
-
- /**
- * Returns the value for the member attribute <b>name</b>
- * @return String - value of member attribute <b>name</b>.
- */
- public String getName( ) {
- return this.name;
- }
-
- public String getPolicyName() {
- return policyName;
- }
-
- public void setPolicyName(String policyName) {
- this.policyName = policyName;
- }
-
- /**
- * This method sets the value to the member attribute <b>description</b>.
- * You cannot set null to the attribute.
- * @param description Value to set member attribute <b>description</b>
- */
- public void setDescription( String description ) {
- this.description = description;
- }
-
- /**
- * Returns the value for the member attribute <b>description</b>
- * @return String - value of member attribute <b>description</b>.
- */
- public String getDescription( ) {
- return this.description;
- }
-
- /**
- * This method sets the value to the member attribute <b>resourceType</b>.
- * You cannot set null to the attribute.
- * @param resourceType Value to set member attribute <b>resourceType</b>
- */
- public void setResourceType( int resourceType ) {
- this.resourceType = resourceType;
- }
-
- /**
- * Returns the value for the member attribute <b>resourceType</b>
- * @return int - value of member attribute <b>resourceType</b>.
- */
- public int getResourceType( ) {
- return this.resourceType;
- }
-
- /**
- * This method sets the value to the member attribute <b>assetId</b>.
- * You cannot set null to the attribute.
- * @param assetId Value to set member attribute <b>assetId</b>
- */
- public void setAssetId( Long assetId ) {
- this.assetId = assetId;
- }
-
- /**
- * Returns the value for the member attribute <b>assetId</b>
- * @return Long - value of member attribute <b>assetId</b>.
- */
- public Long getAssetId( ) {
- return this.assetId;
- }
-
- /**
- * This method sets the value to the member attribute <b>parentId</b>.
- * You cannot set null to the attribute.
- * @param parentId Value to set member attribute <b>parentId</b>
- */
- public void setParentId( Long parentId ) {
- this.parentId = parentId;
- }
-
- /**
- * Returns the value for the member attribute <b>parentId</b>
- * @return Long - value of member attribute <b>parentId</b>.
- */
- public Long getParentId( ) {
- return this.parentId;
- }
-
- /**
- * This method sets the value to the member attribute <b>parentPath</b>.
- * You cannot set null to the attribute.
- * @param parentPath Value to set member attribute <b>parentPath</b>
- */
- public void setParentPath( String parentPath ) {
- this.parentPath = parentPath;
- }
-
- /**
- * Returns the value for the member attribute <b>parentPath</b>
- * @return String - value of member attribute <b>parentPath</b>.
- */
- public String getParentPath( ) {
- return this.parentPath;
- }
-
- /**
- * This method sets the value to the member attribute <b>isEncrypt</b>.
- * You cannot set null to the attribute.
- * @param isEncrypt Value to set member attribute <b>isEncrypt</b>
- */
- public void setIsEncrypt( int isEncrypt ) {
- this.isEncrypt = isEncrypt;
- }
-
- /**
- * Returns the value for the member attribute <b>isEncrypt</b>
- * @return int - value of member attribute <b>isEncrypt</b>.
- */
- public int getIsEncrypt( ) {
- return this.isEncrypt;
- }
-
- /**
- * This method sets the value to the member attribute <b>permMapList</b>.
- * You cannot set null to the attribute.
- * @param permMapList Value to set member attribute <b>permMapList</b>
- */
- public void setPermMapList( List<VXPermMap> permMapList ) {
- this.permMapList = permMapList;
- }
-
- /**
- * Returns the value for the member attribute <b>permMapList</b>
- * @return List<VXPermMap> - value of member attribute <b>permMapList</b>.
- */
- public List<VXPermMap> getPermMapList( ) {
- return this.permMapList;
- }
-
- /**
- * This method sets the value to the member attribute <b>auditList</b>.
- * You cannot set null to the attribute.
- * @param auditList Value to set member attribute <b>auditList</b>
- */
- public void setAuditList( List<VXAuditMap> auditList ) {
- this.auditList = auditList;
- }
-
- /**
- * Returns the value for the member attribute <b>auditList</b>
- * @return List<VXAuditMap> - value of member attribute <b>auditList</b>.
- */
- public List<VXAuditMap> getAuditList( ) {
- return this.auditList;
- }
-
- /**
- * This method sets the value to the member attribute <b>isRecursive</b>.
- * You cannot set null to the attribute.
- * @param isRecursive Value to set member attribute <b>isRecursive</b>
- */
- public void setIsRecursive( int isRecursive ) {
- this.isRecursive = isRecursive;
- }
-
- /**
- * Returns the value for the member attribute <b>isRecursive</b>
- * @return int - value of member attribute <b>isRecursive</b>.
- */
- public int getIsRecursive( ) {
- return this.isRecursive;
- }
-
- /**
- * This method sets the value to the member attribute <b>resourceGroup</b>.
- * You cannot set null to the attribute.
- * @param resourceGroup Value to set member attribute <b>resourceGroup</b>
- */
- public void setResourceGroup( String resourceGroup ) {
- this.resourceGroup = resourceGroup;
- }
-
- /**
- * Returns the value for the member attribute <b>resourceGroup</b>
- * @return String - value of member attribute <b>resourceGroup</b>.
- */
- public String getResourceGroup( ) {
- return this.resourceGroup;
- }
-
- /**
- * This method sets the value to the member attribute <b>databases</b>.
- * You cannot set null to the attribute.
- * @param databases Value to set member attribute <b>databases</b>
- */
- public void setDatabases( String databases ) {
- this.databases = databases;
- }
-
- /**
- * Returns the value for the member attribute <b>databases</b>
- * @return String - value of member attribute <b>databases</b>.
- */
- public String getDatabases( ) {
- return this.databases;
- }
-
- /**
- * This method sets the value to the member attribute <b>tables</b>.
- * You cannot set null to the attribute.
- * @param tables Value to set member attribute <b>tables</b>
- */
- public void setTables( String tables ) {
- this.tables = tables;
- }
-
- /**
- * Returns the value for the member attribute <b>tables</b>
- * @return String - value of member attribute <b>tables</b>.
- */
- public String getTables( ) {
- return this.tables;
- }
-
- /**
- * This method sets the value to the member attribute <b>columnFamilies</b>.
- * You cannot set null to the attribute.
- * @param columnFamilies Value to set member attribute <b>columnFamilies</b>
- */
- public void setColumnFamilies( String columnFamilies ) {
- this.columnFamilies = columnFamilies;
- }
-
- /**
- * Returns the value for the member attribute <b>columnFamilies</b>
- * @return String - value of member attribute <b>columnFamilies</b>.
- */
- public String getColumnFamilies( ) {
- return this.columnFamilies;
- }
-
- /**
- * This method sets the value to the member attribute <b>columns</b>.
- * You cannot set null to the attribute.
- * @param columns Value to set member attribute <b>columns</b>
- */
- public void setColumns( String columns ) {
- this.columns = columns;
- }
-
- /**
- * Returns the value for the member attribute <b>columns</b>
- * @return String - value of member attribute <b>columns</b>.
- */
- public String getColumns( ) {
- return this.columns;
- }
-
- /**
- * This method sets the value to the member attribute <b>udfs</b>.
- * You cannot set null to the attribute.
- * @param udfs Value to set member attribute <b>udfs</b>
- */
- public void setUdfs( String udfs ) {
- this.udfs = udfs;
- }
-
- /**
- * Returns the value for the member attribute <b>udfs</b>
- * @return String - value of member attribute <b>udfs</b>.
- */
- public String getUdfs( ) {
- return this.udfs;
- }
-
- /**
- * This method sets the value to the member attribute <b>assetName</b>.
- * You cannot set null to the attribute.
- * @param assetName Value to set member attribute <b>assetName</b>
- */
- public void setAssetName( String assetName ) {
- this.assetName = assetName;
- }
-
- /**
- * Returns the value for the member attribute <b>assetName</b>
- * @return String - value of member attribute <b>assetName</b>.
- */
- public String getAssetName( ) {
- return this.assetName;
- }
-
- /**
- * This method sets the value to the member attribute <b>assetType</b>.
- * You cannot set null to the attribute.
- * @param assetType Value to set member attribute <b>assetType</b>
- */
- public void setAssetType( int assetType ) {
- this.assetType = assetType;
- }
-
- /**
- * Returns the value for the member attribute <b>assetType</b>
- * @return int - value of member attribute <b>assetType</b>.
- */
- public int getAssetType( ) {
- return this.assetType;
- }
-
- /**
- * This method sets the value to the member attribute <b>resourceStatus</b>.
- * You cannot set null to the attribute.
- * @param resourceStatus Value to set member attribute <b>resourceStatus</b>
- */
- public void setResourceStatus( int resourceStatus ) {
- this.resourceStatus = resourceStatus;
- }
-
- /**
- * Returns the value for the member attribute <b>resourceStatus</b>
- * @return int - value of member attribute <b>resourceStatus</b>.
- */
- public int getResourceStatus( ) {
- return this.resourceStatus;
- }
-
- /**
- * This method sets the value to the member attribute <b>tableType</b>.
- * You cannot set null to the attribute.
- * @param tableType Value to set member attribute <b>tableType</b>
- */
- public void setTableType( int tableType ) {
- this.tableType = tableType;
- }
-
- /**
- * Returns the value for the member attribute <b>tableType</b>
- * @return int - value of member attribute <b>tableType</b>.
- */
- public int getTableType( ) {
- return this.tableType;
- }
-
- /**
- * This method sets the value to the member attribute <b>columnType</b>.
- * You cannot set null to the attribute.
- * @param columnType Value to set member attribute <b>columnType</b>
- */
- public void setColumnType( int columnType ) {
- this.columnType = columnType;
- }
-
- /**
- * Returns the value for the member attribute <b>columnType</b>
- * @return int - value of member attribute <b>columnType</b>.
- */
- public int getColumnType( ) {
- return this.columnType;
- }
-
- /**
- * Returns the value for the member attribute <b>topologies</b>
- *
- * @return String - value of member attribute <b>topologies</b>.
- */
- public String getTopologies() {
- return topologies;
- }
-
- /**
- * This method sets the value to the member attribute <b>topologies</b>. You
- * cannot set null to the attribute.
- *
- * @param topologies
- * Value to set member attribute <b>topologies</b>
- */
- public void setTopologies(String topologies) {
- this.topologies = topologies;
- }
-
- /**
- * Returns the value for the member attribute <b>services</b>
- *
- * @return String - value of member attribute <b>services</b>.
- */
- public String getServices() {
- return services;
- }
-
- /**
- * This method sets the value to the member attribute <b>services</b>. You
- * cannot set null to the attribute.
- *
- * @param services
- * Value to set member attribute <b>services</b>
- */
- public void setServices(String services) {
- this.services = services;
- }
-
- /**
- * This method sets the value to the member attribute <b>checkParentPermission</b>.
- * You cannot set null to the attribute.
- * @param checkParentPermission Value to set member attribute <b>checkParentPermission</b>
- */
- public void setCheckParentPermission( int checkParentPermission ) {
- this.checkParentPermission = checkParentPermission;
- }
-
- /**
- * Returns the value for the member attribute <b>checkParentPermission</b>
- * @return int - value of member attribute <b>checkParentPermission</b>.
- */
- public int getCheckParentPermission( ) {
- return this.checkParentPermission;
- }
-
- @Override
- public int getMyClassType( ) {
- return AppConstants.CLASS_TYPE_XA_RESOURCE;
- }
-
- /**
- * This return the bean content in string format
- * @return formatedStr
- */
- public String toString( ) {
- String str = "VXResource={";
- str += super.toString();
- str += "name={" + name + "} ";
- str += "policyName={" + policyName + "} ";
- str += "description={" + description + "} ";
- str += "resourceType={" + resourceType + "} ";
- str += "assetId={" + assetId + "} ";
- str += "parentId={" + parentId + "} ";
- str += "parentPath={" + parentPath + "} ";
- str += "isEncrypt={" + isEncrypt + "} ";
- str += "permMapList={" + permMapList + "} ";
- str += "auditList={" + auditList + "} ";
- str += "isRecursive={" + isRecursive + "} ";
- str += "resourceGroup={" + resourceGroup + "} ";
- str += "databases={" + databases + "} ";
- str += "tables={" + tables + "} ";
- str += "columnFamilies={" + columnFamilies + "} ";
- str += "columns={" + columns + "} ";
- str += "udfs={" + udfs + "} ";
- str += "assetName={" + assetName + "} ";
- str += "assetType={" + assetType + "} ";
- str += "resourceStatus={" + resourceStatus + "} ";
- str += "tableType={" + tableType + "} ";
- str += "columnType={" + columnType + "} ";
- str += "checkParentPermission={" + checkParentPermission + "} ";
- str += "topologies={" + topologies + "} ";
- str += "services={" + services + "} ";
- str += "}";
- return str;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/view/VXResourceList.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXResourceList.java b/security-admin/src/main/java/com/xasecure/view/VXResourceList.java
deleted file mode 100644
index d261477..0000000
--- a/security-admin/src/main/java/com/xasecure/view/VXResourceList.java
+++ /dev/null
@@ -1,81 +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 com.xasecure.view;
-
-/**
- * List wrapper class for VXResource
- *
- */
-
-import java.util.*;
-import javax.xml.bind.annotation.*;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import com.xasecure.common.view.*;
-
-@JsonAutoDetect(getterVisibility=Visibility.NONE, setterVisibility=Visibility.NONE, fieldVisibility=Visibility.ANY)
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL )
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VXResourceList extends VList {
- private static final long serialVersionUID = 1L;
- List<VXResource> vXResources = new ArrayList<VXResource>();
-
- public VXResourceList() {
- super();
- }
-
- public VXResourceList(List<VXResource> objList) {
- super(objList);
- this.vXResources = objList;
- }
-
- /**
- * @return the vXResources
- */
- public List<VXResource> getVXResources() {
- return vXResources;
- }
-
- /**
- * @param vXResources
- * the vXResources to set
- */
- public void setVXResources(List<VXResource> vXResources) {
- this.vXResources = vXResources;
- }
-
- @Override
- public int getListSize() {
- if (vXResources != null) {
- return vXResources.size();
- }
- return 0;
- }
-
- @Override
- public List<VXResource> getList() {
- return vXResources;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/view/VXResponse.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXResponse.java b/security-admin/src/main/java/com/xasecure/view/VXResponse.java
deleted file mode 100644
index 2650fb3..0000000
--- a/security-admin/src/main/java/com/xasecure/view/VXResponse.java
+++ /dev/null
@@ -1,175 +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 com.xasecure.view;
-
-/**
- * Response
- *
- */
-
-import java.util.*;
-
-import com.xasecure.common.*;
-import com.xasecure.common.view.*;
-
-import com.xasecure.common.*;
-import com.xasecure.json.JsonDateSerializer;
-
-import com.xasecure.view.*;
-
-import javax.xml.bind.annotation.*;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-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
-public class VXResponse extends ViewBaseBean implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
- /**
- * Enum values for ResponseStatus
- */
- /**
- * STATUS_SUCCESS is an element of enum ResponseStatus. Its value is "STATUS_SUCCESS".
- */
- public static final int STATUS_SUCCESS = 0;
- /**
- * STATUS_ERROR is an element of enum ResponseStatus. Its value is "STATUS_ERROR".
- */
- public static final int STATUS_ERROR = 1;
- /**
- * STATUS_VALIDATION is an element of enum ResponseStatus. Its value is "STATUS_VALIDATION".
- */
- public static final int STATUS_VALIDATION = 2;
- /**
- * STATUS_WARN is an element of enum ResponseStatus. Its value is "STATUS_WARN".
- */
- public static final int STATUS_WARN = 3;
- /**
- * STATUS_INFO is an element of enum ResponseStatus. Its value is "STATUS_INFO".
- */
- public static final int STATUS_INFO = 4;
- /**
- * STATUS_PARTIAL_SUCCESS is an element of enum ResponseStatus. Its value is "STATUS_PARTIAL_SUCCESS".
- */
- public static final int STATUS_PARTIAL_SUCCESS = 5;
-
- /**
- * Max value for enum ResponseStatus_MAX
- */
- public static final int ResponseStatus_MAX = 5;
-
-
- /**
- * Status code
- * This attribute is of type enum XResponse::ResponseStatus
- */
- protected int statusCode;
- /**
- * Message description
- */
- protected String msgDesc;
- /**
- * List of messages
- */
- protected List<VXMessage> messageList;
-
- /**
- * Default constructor. This will set all the attributes to default value.
- */
- public VXResponse ( ) {
- statusCode = 0;
- }
-
- /**
- * This method sets the value to the member attribute <b>statusCode</b>.
- * You cannot set null to the attribute.
- * @param statusCode Value to set member attribute <b>statusCode</b>
- */
- public void setStatusCode( int statusCode ) {
- this.statusCode = statusCode;
- }
-
- /**
- * Returns the value for the member attribute <b>statusCode</b>
- * @return int - value of member attribute <b>statusCode</b>.
- */
- public int getStatusCode( ) {
- return this.statusCode;
- }
-
- /**
- * This method sets the value to the member attribute <b>msgDesc</b>.
- * You cannot set null to the attribute.
- * @param msgDesc Value to set member attribute <b>msgDesc</b>
- */
- public void setMsgDesc( String msgDesc ) {
- this.msgDesc = msgDesc;
- }
-
- /**
- * Returns the value for the member attribute <b>msgDesc</b>
- * @return String - value of member attribute <b>msgDesc</b>.
- */
- public String getMsgDesc( ) {
- return this.msgDesc;
- }
-
- /**
- * This method sets the value to the member attribute <b>messageList</b>.
- * You cannot set null to the attribute.
- * @param messageList Value to set member attribute <b>messageList</b>
- */
- public void setMessageList( List<VXMessage> messageList ) {
- this.messageList = messageList;
- }
-
- /**
- * Returns the value for the member attribute <b>messageList</b>
- * @return List<VXMessage> - value of member attribute <b>messageList</b>.
- */
- public List<VXMessage> getMessageList( ) {
- return this.messageList;
- }
-
- @Override
- public int getMyClassType( ) {
- return AppConstants.CLASS_TYPE_RESPONSE;
- }
-
- /**
- * This return the bean content in string format
- * @return formatedStr
- */
- public String toString( ) {
- String str = "VXResponse={";
- str += super.toString();
- str += "statusCode={" + statusCode + "} ";
- str += "msgDesc={" + msgDesc + "} ";
- str += "messageList={" + messageList + "} ";
- str += "}";
- return str;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/view/VXString.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXString.java b/security-admin/src/main/java/com/xasecure/view/VXString.java
deleted file mode 100644
index 002b338..0000000
--- a/security-admin/src/main/java/com/xasecure/view/VXString.java
+++ /dev/null
@@ -1,96 +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 com.xasecure.view;
-
-/**
- * String
- *
- */
-
-import java.util.*;
-
-import com.xasecure.common.*;
-import com.xasecure.common.view.*;
-
-import com.xasecure.common.*;
-import com.xasecure.json.JsonDateSerializer;
-
-import com.xasecure.view.*;
-
-import javax.xml.bind.annotation.*;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-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
-public class VXString extends ViewBaseBean implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
-
- /**
- * Value
- */
- protected String value;
-
- /**
- * Default constructor. This will set all the attributes to default value.
- */
- public VXString ( ) {
- }
-
- /**
- * This method sets the value to the member attribute <b>value</b>.
- * You cannot set null to the attribute.
- * @param value Value to set member attribute <b>value</b>
- */
- public void setValue( String value ) {
- this.value = value;
- }
-
- /**
- * Returns the value for the member attribute <b>value</b>
- * @return String - value of member attribute <b>value</b>.
- */
- public String getValue( ) {
- return this.value;
- }
-
- @Override
- public int getMyClassType( ) {
- return AppConstants.CLASS_TYPE_STRING;
- }
-
- /**
- * This return the bean content in string format
- * @return formatedStr
- */
- public String toString( ) {
- String str = "VXString={";
- str += super.toString();
- str += "value={" + value + "} ";
- str += "}";
- return str;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/view/VXStringList.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXStringList.java b/security-admin/src/main/java/com/xasecure/view/VXStringList.java
deleted file mode 100644
index b2cc0af..0000000
--- a/security-admin/src/main/java/com/xasecure/view/VXStringList.java
+++ /dev/null
@@ -1,81 +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 com.xasecure.view;
-
-/**
- * List wrapper class for VXString
- *
- */
-
-import java.util.*;
-import javax.xml.bind.annotation.*;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import com.xasecure.common.view.*;
-
-@JsonAutoDetect(getterVisibility=Visibility.NONE, setterVisibility=Visibility.NONE, fieldVisibility=Visibility.ANY)
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL )
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VXStringList extends VList {
- private static final long serialVersionUID = 1L;
- List<VXString> vXStrings = new ArrayList<VXString>();
-
- public VXStringList() {
- super();
- }
-
- public VXStringList(List<VXString> objList) {
- super(objList);
- this.vXStrings = objList;
- }
-
- /**
- * @return the vXStrings
- */
- public List<VXString> getVXStrings() {
- return vXStrings;
- }
-
- /**
- * @param vXStrings
- * the vXStrings to set
- */
- public void setVXStrings(List<VXString> vXStrings) {
- this.vXStrings = vXStrings;
- }
-
- @Override
- public int getListSize() {
- if (vXStrings != null) {
- return vXStrings.size();
- }
- return 0;
- }
-
- @Override
- public List<VXString> getList() {
- return vXStrings;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/view/VXTrxLog.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXTrxLog.java b/security-admin/src/main/java/com/xasecure/view/VXTrxLog.java
deleted file mode 100644
index f2c635c..0000000
--- a/security-admin/src/main/java/com/xasecure/view/VXTrxLog.java
+++ /dev/null
@@ -1,379 +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 com.xasecure.view;
-
-/**
- * Logging table for all DB create and update queries
- *
- */
-
-import java.util.*;
-
-import com.xasecure.common.*;
-import com.xasecure.common.view.*;
-
-import com.xasecure.common.*;
-import com.xasecure.json.JsonDateSerializer;
-
-import com.xasecure.view.*;
-
-import javax.xml.bind.annotation.*;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-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
-public class VXTrxLog extends VXDataObject implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
-
- /**
- * Name of the class to which the object id belongs to
- * This attribute is of type enum CommonEnums::ClassTypes
- */
- protected int objectClassType = XAConstants.CLASS_TYPE_NONE;
- /**
- * Id of the object to which this notes refers to
- */
- protected Long objectId;
- /**
- * Object Id of the parent object
- */
- protected Long parentObjectId;
- /**
- * Object Class Type of the parent object
- */
- protected int parentObjectClassType;
- /**
- * Name of the parent object name that was changed
- */
- protected String parentObjectName;
- /**
- * Name of the object name that was changed
- */
- protected String objectName;
- /**
- * Name of the attribute that was changed
- */
- protected String attributeName;
- /**
- * Previous value
- */
- protected String previousValue;
- /**
- * New value
- */
- protected String newValue;
- /**
- * Transaction id
- */
- protected String transactionId;
- /**
- * Action of the transaction
- */
- protected String action;
- /**
- * Session Id
- */
- protected String sessionId;
- /**
- * Request Id
- */
- protected String requestId;
- /**
- * Session Type
- */
- protected String sessionType;
-
- /**
- * Default constructor. This will set all the attributes to default value.
- */
- public VXTrxLog ( ) {
- objectClassType = XAConstants.CLASS_TYPE_NONE;
- }
-
- /**
- * This method sets the value to the member attribute <b>objectClassType</b>.
- * You cannot set null to the attribute.
- * @param objectClassType Value to set member attribute <b>objectClassType</b>
- */
- public void setObjectClassType( int objectClassType ) {
- this.objectClassType = objectClassType;
- }
-
- /**
- * Returns the value for the member attribute <b>objectClassType</b>
- * @return int - value of member attribute <b>objectClassType</b>.
- */
- public int getObjectClassType( ) {
- return this.objectClassType;
- }
-
- /**
- * This method sets the value to the member attribute <b>objectId</b>.
- * You cannot set null to the attribute.
- * @param objectId Value to set member attribute <b>objectId</b>
- */
- public void setObjectId( Long objectId ) {
- this.objectId = objectId;
- }
-
- /**
- * Returns the value for the member attribute <b>objectId</b>
- * @return Long - value of member attribute <b>objectId</b>.
- */
- public Long getObjectId( ) {
- return this.objectId;
- }
-
- /**
- * This method sets the value to the member attribute <b>parentObjectId</b>.
- * You cannot set null to the attribute.
- * @param parentObjectId Value to set member attribute <b>parentObjectId</b>
- */
- public void setParentObjectId( Long parentObjectId ) {
- this.parentObjectId = parentObjectId;
- }
-
- /**
- * Returns the value for the member attribute <b>parentObjectId</b>
- * @return Long - value of member attribute <b>parentObjectId</b>.
- */
- public Long getParentObjectId( ) {
- return this.parentObjectId;
- }
-
- /**
- * This method sets the value to the member attribute <b>parentObjectClassType</b>.
- * You cannot set null to the attribute.
- * @param parentObjectClassType Value to set member attribute <b>parentObjectClassType</b>
- */
- public void setParentObjectClassType( int parentObjectClassType ) {
- this.parentObjectClassType = parentObjectClassType;
- }
-
- /**
- * Returns the value for the member attribute <b>parentObjectClassType</b>
- * @return int - value of member attribute <b>parentObjectClassType</b>.
- */
- public int getParentObjectClassType( ) {
- return this.parentObjectClassType;
- }
-
- /**
- * This method sets the value to the member attribute <b>parentObjectName</b>.
- * You cannot set null to the attribute.
- * @param parentObjectName Value to set member attribute <b>parentObjectName</b>
- */
- public void setParentObjectName( String parentObjectName ) {
- this.parentObjectName = parentObjectName;
- }
-
- /**
- * Returns the value for the member attribute <b>parentObjectName</b>
- * @return String - value of member attribute <b>parentObjectName</b>.
- */
- public String getParentObjectName( ) {
- return this.parentObjectName;
- }
-
- /**
- * This method sets the value to the member attribute <b>objectName</b>.
- * You cannot set null to the attribute.
- * @param objectName Value to set member attribute <b>objectName</b>
- */
- public void setObjectName( String objectName ) {
- this.objectName = objectName;
- }
-
- /**
- * Returns the value for the member attribute <b>objectName</b>
- * @return String - value of member attribute <b>objectName</b>.
- */
- public String getObjectName( ) {
- return this.objectName;
- }
-
- /**
- * This method sets the value to the member attribute <b>attributeName</b>.
- * You cannot set null to the attribute.
- * @param attributeName Value to set member attribute <b>attributeName</b>
- */
- public void setAttributeName( String attributeName ) {
- this.attributeName = attributeName;
- }
-
- /**
- * Returns the value for the member attribute <b>attributeName</b>
- * @return String - value of member attribute <b>attributeName</b>.
- */
- public String getAttributeName( ) {
- return this.attributeName;
- }
-
- /**
- * This method sets the value to the member attribute <b>previousValue</b>.
- * You cannot set null to the attribute.
- * @param previousValue Value to set member attribute <b>previousValue</b>
- */
- public void setPreviousValue( String previousValue ) {
- this.previousValue = previousValue;
- }
-
- /**
- * Returns the value for the member attribute <b>previousValue</b>
- * @return String - value of member attribute <b>previousValue</b>.
- */
- public String getPreviousValue( ) {
- return this.previousValue;
- }
-
- /**
- * This method sets the value to the member attribute <b>newValue</b>.
- * You cannot set null to the attribute.
- * @param newValue Value to set member attribute <b>newValue</b>
- */
- public void setNewValue( String newValue ) {
- this.newValue = newValue;
- }
-
- /**
- * Returns the value for the member attribute <b>newValue</b>
- * @return String - value of member attribute <b>newValue</b>.
- */
- public String getNewValue( ) {
- return this.newValue;
- }
-
- /**
- * This method sets the value to the member attribute <b>transactionId</b>.
- * You cannot set null to the attribute.
- * @param transactionId Value to set member attribute <b>transactionId</b>
- */
- public void setTransactionId( String transactionId ) {
- this.transactionId = transactionId;
- }
-
- /**
- * Returns the value for the member attribute <b>transactionId</b>
- * @return String - value of member attribute <b>transactionId</b>.
- */
- public String getTransactionId( ) {
- return this.transactionId;
- }
-
- /**
- * This method sets the value to the member attribute <b>action</b>.
- * You cannot set null to the attribute.
- * @param action Value to set member attribute <b>action</b>
- */
- public void setAction( String action ) {
- this.action = action;
- }
-
- /**
- * Returns the value for the member attribute <b>action</b>
- * @return String - value of member attribute <b>action</b>.
- */
- public String getAction( ) {
- return this.action;
- }
-
- /**
- * This method sets the value to the member attribute <b>sessionId</b>.
- * You cannot set null to the attribute.
- * @param sessionId Value to set member attribute <b>sessionId</b>
- */
- public void setSessionId( String sessionId ) {
- this.sessionId = sessionId;
- }
-
- /**
- * Returns the value for the member attribute <b>sessionId</b>
- * @return String - value of member attribute <b>sessionId</b>.
- */
- public String getSessionId( ) {
- return this.sessionId;
- }
-
- /**
- * This method sets the value to the member attribute <b>requestId</b>.
- * You cannot set null to the attribute.
- * @param requestId Value to set member attribute <b>requestId</b>
- */
- public void setRequestId( String requestId ) {
- this.requestId = requestId;
- }
-
- /**
- * Returns the value for the member attribute <b>requestId</b>
- * @return String - value of member attribute <b>requestId</b>.
- */
- public String getRequestId( ) {
- return this.requestId;
- }
-
- /**
- * This method sets the value to the member attribute <b>sessionType</b>.
- * You cannot set null to the attribute.
- * @param sessionType Value to set member attribute <b>sessionType</b>
- */
- public void setSessionType( String sessionType ) {
- this.sessionType = sessionType;
- }
-
- /**
- * Returns the value for the member attribute <b>sessionType</b>
- * @return String - value of member attribute <b>sessionType</b>.
- */
- public String getSessionType( ) {
- return this.sessionType;
- }
-
- /**
- * This return the bean content in string format
- * @return formatedStr
- */
- public String toString( ) {
- String str = "VXTrxLog={";
- str += super.toString();
- str += "objectClassType={" + objectClassType + "} ";
- str += "objectId={" + objectId + "} ";
- str += "parentObjectId={" + parentObjectId + "} ";
- str += "parentObjectClassType={" + parentObjectClassType + "} ";
- str += "parentObjectName={" + parentObjectName + "} ";
- str += "objectName={" + objectName + "} ";
- str += "attributeName={" + attributeName + "} ";
- str += "previousValue={" + previousValue + "} ";
- str += "newValue={" + newValue + "} ";
- str += "transactionId={" + transactionId + "} ";
- str += "action={" + action + "} ";
- str += "sessionId={" + sessionId + "} ";
- str += "requestId={" + requestId + "} ";
- str += "sessionType={" + sessionType + "} ";
- str += "}";
- return str;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/view/VXTrxLogList.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXTrxLogList.java b/security-admin/src/main/java/com/xasecure/view/VXTrxLogList.java
deleted file mode 100644
index 84be7a9..0000000
--- a/security-admin/src/main/java/com/xasecure/view/VXTrxLogList.java
+++ /dev/null
@@ -1,76 +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 com.xasecure.view;
-
-import java.util.*;
-import javax.xml.bind.annotation.*;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import com.xasecure.common.view.*;
-
-@JsonAutoDetect(getterVisibility=Visibility.NONE, setterVisibility=Visibility.NONE, fieldVisibility=Visibility.ANY)
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL )
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VXTrxLogList extends VList {
- private static final long serialVersionUID = 1L;
- List<VXTrxLog> vXTrxLogs = new ArrayList<VXTrxLog>();
-
- public VXTrxLogList() {
- super();
- }
-
- public VXTrxLogList(List<VXTrxLog> objList) {
- super(objList);
- this.vXTrxLogs = objList;
- }
-
- /**
- * @return the vXTrxLogs
- */
- public List<VXTrxLog> getVXTrxLogs() {
- return vXTrxLogs;
- }
-
- /**
- * @param vXTrxLogs
- * the vXTrxLogs to set
- */
- public void setVXTrxLogs(List<VXTrxLog> vXTrxLogs) {
- this.vXTrxLogs = vXTrxLogs;
- }
-
- @Override
- public int getListSize() {
- if (vXTrxLogs != null) {
- return vXTrxLogs.size();
- }
- return 0;
- }
-
- @Override
- public List<VXTrxLog> getList() {
- return vXTrxLogs;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/view/VXUser.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXUser.java b/security-admin/src/main/java/com/xasecure/view/VXUser.java
deleted file mode 100644
index 3606bc4..0000000
--- a/security-admin/src/main/java/com/xasecure/view/VXUser.java
+++ /dev/null
@@ -1,302 +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 com.xasecure.view;
-
-/**
- * User
- *
- */
-
-import java.util.*;
-
-import com.xasecure.common.*;
-import com.xasecure.common.view.*;
-import com.xasecure.common.*;
-import com.xasecure.json.JsonDateSerializer;
-import com.xasecure.view.*;
-
-import javax.xml.bind.annotation.*;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-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
-public class VXUser extends VXDataObject implements java.io.Serializable {
- private static final long serialVersionUID = 1L;
-
-
- /**
- * Name
- */
- protected String name;
- /**
- * First Name
- */
- protected String firstName;
- /**
- * Last Name
- */
- protected String lastName;
- /**
- * Email address
- */
- protected String emailAddress;
- /**
- * Password
- */
- protected String password;
- /**
- * Description
- */
- protected String description;
- /**
- * Id of the credential store
- */
- protected Long credStoreId;
- /**
- * List of group ids
- */
- protected Collection<Long> groupIdList;
- protected Collection<String> groupNameList;
-
- protected int status;
- protected int userSource;
- /**
- * List of roles for this user
- */
- protected Collection<String> userRoleList;
-
- /**
- * Default constructor. This will set all the attributes to default value.
- */
- public VXUser ( ) {
- }
-
- /**
- * This method sets the value to the member attribute <b>name</b>.
- * You cannot set null to the attribute.
- * @param name Value to set member attribute <b>name</b>
- */
- public void setName( String name ) {
- this.name = name;
- }
-
- /**
- * Returns the value for the member attribute <b>name</b>
- * @return String - value of member attribute <b>name</b>.
- */
- public String getName( ) {
- return this.name;
- }
-
- /**
- * This method sets the value to the member attribute <b>firstName</b>.
- * You cannot set null to the attribute.
- * @param firstName Value to set member attribute <b>firstName</b>
- */
- public void setFirstName( String firstName ) {
- this.firstName = firstName;
- }
-
- /**
- * Returns the value for the member attribute <b>firstName</b>
- * @return String - value of member attribute <b>firstName</b>.
- */
- public String getFirstName( ) {
- return this.firstName;
- }
-
- /**
- * This method sets the value to the member attribute <b>lastName</b>.
- * You cannot set null to the attribute.
- * @param lastName Value to set member attribute <b>lastName</b>
- */
- public void setLastName( String lastName ) {
- this.lastName = lastName;
- }
-
- /**
- * Returns the value for the member attribute <b>lastName</b>
- * @return String - value of member attribute <b>lastName</b>.
- */
- public String getLastName( ) {
- return this.lastName;
- }
-
- /**
- * This method sets the value to the member attribute <b>emailAddress</b>.
- * You cannot set null to the attribute.
- * @param emailAddress Value to set member attribute <b>emailAddress</b>
- */
- public void setEmailAddress( String emailAddress ) {
- this.emailAddress = emailAddress;
- }
-
- /**
- * Returns the value for the member attribute <b>emailAddress</b>
- * @return String - value of member attribute <b>emailAddress</b>.
- */
- public String getEmailAddress( ) {
- return this.emailAddress;
- }
-
- /**
- * This method sets the value to the member attribute <b>password</b>.
- * You cannot set null to the attribute.
- * @param password Value to set member attribute <b>password</b>
- */
- public void setPassword( String password ) {
- this.password = password;
- }
-
- /**
- * Returns the value for the member attribute <b>password</b>
- * @return String - value of member attribute <b>password</b>.
- */
- public String getPassword( ) {
- return this.password;
- }
-
- /**
- * This method sets the value to the member attribute <b>description</b>.
- * You cannot set null to the attribute.
- * @param description Value to set member attribute <b>description</b>
- */
- public void setDescription( String description ) {
- this.description = description;
- }
-
- /**
- * Returns the value for the member attribute <b>description</b>
- * @return String - value of member attribute <b>description</b>.
- */
- public String getDescription( ) {
- return this.description;
- }
-
- /**
- * This method sets the value to the member attribute <b>credStoreId</b>.
- * You cannot set null to the attribute.
- * @param credStoreId Value to set member attribute <b>credStoreId</b>
- */
- public void setCredStoreId( Long credStoreId ) {
- this.credStoreId = credStoreId;
- }
-
- /**
- * Returns the value for the member attribute <b>credStoreId</b>
- * @return Long - value of member attribute <b>credStoreId</b>.
- */
- public Long getCredStoreId( ) {
- return this.credStoreId;
- }
-
- /**
- * This method sets the value to the member attribute <b>groupIdList</b>.
- * You cannot set null to the attribute.
- * @param groupIdList Value to set member attribute <b>groupIdList</b>
- */
- public void setGroupIdList( Collection<Long> groupIdList ) {
- this.groupIdList = groupIdList;
- }
-
- /**
- * Returns the value for the member attribute <b>groupIdList</b>
- * @return Collection<Long> - value of member attribute <b>groupIdList</b>.
- */
- public Collection<Long> getGroupIdList( ) {
- return this.groupIdList;
- }
-
- @Override
- public int getMyClassType( ) {
- return AppConstants.CLASS_TYPE_XA_USER;
- }
-
-
- public int getStatus() {
- return status;
- }
-
- public void setStatus(int status) {
- this.status = status;
- }
-
-
-
- public int getUserSource() {
- return userSource;
- }
-
- public void setUserSource(int userSource) {
- this.userSource = userSource;
- }
-
- /**
- * This method sets the value to the member attribute <b>userRoleList</b>.
- * You cannot set null to the attribute.
- * @param userRoleList Value to set member attribute <b>userRoleList</b>
- */
- public void setUserRoleList( Collection<String> userRoleList ) {
- this.userRoleList = userRoleList;
- }
-
- /**
- * Returns the value for the member attribute <b>userRoleList</b>
- * @return Collection<String> - value of member attribute <b>userRoleList</b>.
- */
- public Collection<String> getUserRoleList( ) {
- return this.userRoleList;
- }
-
-
- public Collection<String> getGroupNameList() {
- return groupNameList;
- }
-
- public void setGroupNameList(Collection<String> groupNameList) {
- this.groupNameList = groupNameList;
- }
-
- /**
- * This return the bean content in string format
- * @return formatedStr
- */
- public String toString( ) {
- String str = "VXUser={";
- str += super.toString();
- str += "name={" + name + "} ";
- str += "firstName={" + firstName + "} ";
- str += "lastName={" + lastName + "} ";
- str += "emailAddress={" + emailAddress + "} ";
- str += "password={" + password + "} ";
- str += "description={" + description + "} ";
- str += "credStoreId={" + credStoreId + "} ";
- str += "groupIdList={" + groupIdList + "} ";
- str += "groupNameList={" + groupNameList + "} ";
- str += "}";
- return str;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/view/VXUserList.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/view/VXUserList.java b/security-admin/src/main/java/com/xasecure/view/VXUserList.java
deleted file mode 100644
index 0c429c8..0000000
--- a/security-admin/src/main/java/com/xasecure/view/VXUserList.java
+++ /dev/null
@@ -1,81 +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 com.xasecure.view;
-
-/**
- * List wrapper class for VXUser
- *
- */
-
-import java.util.*;
-import javax.xml.bind.annotation.*;
-
-import org.codehaus.jackson.annotate.JsonAutoDetect;
-import org.codehaus.jackson.annotate.JsonAutoDetect.Visibility;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import com.xasecure.common.view.*;
-
-@JsonAutoDetect(getterVisibility=Visibility.NONE, setterVisibility=Visibility.NONE, fieldVisibility=Visibility.ANY)
-@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL )
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class VXUserList extends VList {
- private static final long serialVersionUID = 1L;
- List<VXUser> vXUsers = new ArrayList<VXUser>();
-
- public VXUserList() {
- super();
- }
-
- public VXUserList(List<VXUser> objList) {
- super(objList);
- this.vXUsers = objList;
- }
-
- /**
- * @return the vXUsers
- */
- public List<VXUser> getVXUsers() {
- return vXUsers;
- }
-
- /**
- * @param vXUsers
- * the vXUsers to set
- */
- public void setVXUsers(List<VXUser> vXUsers) {
- this.vXUsers = vXUsers;
- }
-
- @Override
- public int getListSize() {
- if (vXUsers != null) {
- return vXUsers.size();
- }
- return 0;
- }
-
- @Override
- public List<VXUser> getList() {
- return vXUsers;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/org/apache/ranger/authentication/unix/jaas/RoleUserAuthorityGranter.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/authentication/unix/jaas/RoleUserAuthorityGranter.java b/security-admin/src/main/java/org/apache/ranger/authentication/unix/jaas/RoleUserAuthorityGranter.java
new file mode 100644
index 0000000..19d08f4
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/authentication/unix/jaas/RoleUserAuthorityGranter.java
@@ -0,0 +1,41 @@
+/*
+ * 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.authentication.unix.jaas;
+
+import java.security.Principal;
+import java.util.Collections;
+import java.util.Set;
+
+import org.apache.ranger.authentication.unix.jaas.UnixGroupPrincipal;
+import org.springframework.security.authentication.jaas.AuthorityGranter;
+
+public class RoleUserAuthorityGranter implements AuthorityGranter {
+
+ @Override
+ public Set<String> grant(Principal principal) {
+ if (principal instanceof UnixGroupPrincipal) {
+ Collections.singleton(principal.getName());
+ }
+ else {
+ Collections.singleton("ROLE_USER");
+ }
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/org/apache/ranger/biz/AssetConnectionMgr.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/biz/AssetConnectionMgr.java b/security-admin/src/main/java/org/apache/ranger/biz/AssetConnectionMgr.java
new file mode 100644
index 0000000..c481e65
--- /dev/null
+++ b/security-admin/src/main/java/org/apache/ranger/biz/AssetConnectionMgr.java
@@ -0,0 +1,424 @@
+/*
+ * 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.biz;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.log4j.Logger;
+import org.apache.ranger.common.AppConstants;
+import org.apache.ranger.common.JSONUtil;
+import org.apache.ranger.common.StringUtil;
+import org.apache.ranger.common.TimedEventUtil;
+import org.apache.ranger.db.XADaoManager;
+import org.apache.ranger.entity.XXAsset;
+import org.apache.ranger.hadoop.client.HadoopFS;
+import org.apache.ranger.hbase.client.HBaseClient;
+import org.apache.ranger.hive.client.HiveClient;
+import org.apache.ranger.knox.client.KnoxClient;
+import org.apache.ranger.service.XAssetService;
+import org.apache.ranger.storm.client.StormClient;
+import org.apache.ranger.view.VXAsset;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Component
+@Scope("singleton")
+public class AssetConnectionMgr {
+
+ private static Logger logger = Logger.getLogger(AssetConnectionMgr.class);
+
+ protected HashMap<String, HadoopFS> hadoopConnectionCache;
+ protected HashMap<String, HiveClient> hiveConnectionCache;
+ protected HashMap<String, HBaseClient> hbaseConnectionCache;
+
+ protected HashMap<String, Boolean> repoConnectStatusMap;
+
+ @Autowired
+ protected JSONUtil jsonUtil;
+
+ @Autowired
+ protected StringUtil stringUtil;
+
+ @Autowired
+ protected XADaoManager xADaoManager;
+
+ @Autowired
+ XAssetService xAssetService;
+
+ public AssetConnectionMgr(){
+ hadoopConnectionCache = new HashMap<String, HadoopFS>();
+ hiveConnectionCache = new HashMap<String, HiveClient>();
+ hbaseConnectionCache = new HashMap<String, HBaseClient>();
+ repoConnectStatusMap = new HashMap<String, Boolean>();
+ }
+
+ public HadoopFS getHadoopConnection(final String dataSourceName) {
+ HadoopFS hadoopFS = null;
+ XXAsset asset = xADaoManager.getXXAsset().findByAssetName(dataSourceName);
+ if (asset != null) {
+ // get it from the cache
+ synchronized (hadoopConnectionCache) {
+ hadoopFS = hadoopConnectionCache.get(asset.getName());
+ if (hadoopFS == null) {
+ // if it doesn't exist in cache then create the connection
+ String config = asset.getConfig();
+ if(!stringUtil.isEmpty(config)){
+ config=xAssetService.getConfigWithDecryptedPassword(config);
+ }
+ // FIXME remove this once we start using putting config for
+ // default asset "hadoopdev" (should come from properties)
+ if (stringUtil.isEmpty(config)
+ && asset.getName().equals("hadoopdev")) {
+
+ final Callable<HadoopFS> connectHDFS = new Callable<HadoopFS>() {
+ @Override
+ public HadoopFS call() throws Exception {
+ return new HadoopFS(dataSourceName);
+ }
+ };
+
+ try {
+ hadoopFS = TimedEventUtil.timedTask(connectHDFS, 10, TimeUnit.SECONDS);
+ } catch(Exception e){
+ logger.error("Error establishing connection for HDFS repository : "
+ + dataSourceName, e);
+ }
+
+ } else if (!stringUtil.isEmpty(config)) {
+ final HashMap<String, String> configMap = (HashMap<String, String>) jsonUtil
+ .jsonToMap(config);
+ final String assetName = asset.getName();
+
+ final Callable<HadoopFS> connectHDFS = new Callable<HadoopFS>() {
+ @Override
+ public HadoopFS call() throws Exception {
+ return new HadoopFS(assetName, configMap);
+ }
+ };
+
+ try {
+ hadoopFS = TimedEventUtil.timedTask(connectHDFS, 5, TimeUnit.SECONDS);
+ } catch(Exception e){
+ logger.error("Error establishing connection for HDFS repository : "
+ + dataSourceName + " using configuration : " +config, e);
+ }
+ // put it into the cache
+ } else {
+ logger.error("Connection Config not defined for asset :"
+ + asset.getName(), new Throwable());
+ }
+ hadoopConnectionCache.put(asset.getName(), hadoopFS);
+ repoConnectStatusMap.put(asset.getName(), true);
+ } else {
+ List<String> testConnect = hadoopFS.listFiles("/", "*");
+ if(testConnect == null){
+ hadoopConnectionCache.remove(dataSourceName);
+ hadoopFS = getHadoopConnection(dataSourceName);
+ }
+ }
+ }
+ } else {
+ logger.error("Asset not found with name "+dataSourceName, new Throwable());
+ }
+
+ return hadoopFS;
+ }
+
+ public HiveClient getHiveConnection(final String dataSourceName) {
+ HiveClient hiveClient = null;
+ XXAsset asset = xADaoManager.getXXAsset().findByAssetName(dataSourceName);
+ if (asset != null) {
+ // get it from the cache
+ synchronized (hiveConnectionCache) {
+ hiveClient = hiveConnectionCache.get(asset.getName());
+ if (hiveClient == null) {
+ String config = asset.getConfig();
+ if (!stringUtil.isEmpty(config)) {
+ config=xAssetService.getConfigWithDecryptedPassword(config);
+ final HashMap<String, String> configMap = (HashMap<String, String>) jsonUtil
+ .jsonToMap(config);
+
+ final Callable<HiveClient> connectHive = new Callable<HiveClient>() {
+ @Override
+ public HiveClient call() throws Exception {
+ return new HiveClient(dataSourceName, configMap);
+ }
+ };
+ try {
+ hiveClient = TimedEventUtil.timedTask(connectHive, 5, TimeUnit.SECONDS);
+ } catch(Exception e){
+ logger.error("Error connecting hive repository : "+
+ dataSourceName +" using config : "+ config, e);
+ }
+ hiveConnectionCache.put(asset.getName(), hiveClient);
+ repoConnectStatusMap.put(asset.getName(), true);
+ } else {
+ logger.error("Connection Config not defined for asset :"
+ + asset.getName(), new Throwable());
+ }
+ } else {
+ try {
+ List<String> testConnect = hiveClient.getDatabaseList("*");
+ } catch(Exception e) {
+ hiveConnectionCache.remove(dataSourceName);
+ hiveClient = getHiveConnection(dataSourceName);
+ }
+ }
+ }
+ } else {
+ logger.error("Asset not found with name "+dataSourceName, new Throwable());
+ }
+ return hiveClient;
+ }
+
+ public KnoxClient getKnoxClient(String dataSourceName) {
+ KnoxClient knoxClient = null;
+ logger.debug("Getting knoxClient for datasource: " + dataSourceName);
+ XXAsset asset = xADaoManager.getXXAsset().findByAssetName(dataSourceName);
+ if (asset == null) {
+ logger.error("Asset not found with name " + dataSourceName, new Throwable());
+ } else {
+ knoxClient = getKnoxClient(asset);
+ }
+ return knoxClient;
+ }
+
+ public KnoxClient getKnoxClient(XXAsset asset) {
+ KnoxClient knoxClient = null;
+ if (asset == null) {
+ logger.error("Asset is null", new Throwable());
+ } else {
+ String config = asset.getConfig();
+ if(!stringUtil.isEmpty(config)){
+ config=xAssetService.getConfigWithDecryptedPassword(config);
+ }
+ knoxClient = getKnoxClientByConfig(config);
+ }
+ return knoxClient;
+ }
+
+ public KnoxClient getKnoxClientByConfig(String config) {
+ KnoxClient knoxClient = null;
+ if (config == null || config.trim().isEmpty()) {
+ logger.error("Connection Config is empty");
+
+ } else {
+ final HashMap<String, String> configMap = (HashMap<String, String>) jsonUtil
+ .jsonToMap(config);
+ String knoxUrl = configMap.get("knox.url");
+ String knoxAdminUser = configMap.get("username");
+ String knoxAdminPassword = configMap.get("password");
+ knoxClient = new KnoxClient(knoxUrl, knoxAdminUser, knoxAdminPassword);
+ }
+ return knoxClient;
+ }
+
+ public KnoxClient getKnoxClient(String dataSourceName,
+ Map<String, String> configMap) {
+ KnoxClient knoxClient = null;
+ logger.debug("Getting knoxClient for datasource: " + dataSourceName +
+ "configMap: " + configMap);
+ if (configMap == null || configMap.isEmpty()) {
+ logger.error("Connection ConfigMap is empty");
+ } else {
+ String knoxUrl = configMap.get("knox.url");
+ String knoxAdminUser = configMap.get("username");
+ String knoxAdminPassword = configMap.get("password");
+ knoxClient = new KnoxClient(knoxUrl, knoxAdminUser, knoxAdminPassword);
+ }
+ return knoxClient;
+ }
+
+
+ public static KnoxClient getKnoxClient(final String knoxUrl, String knoxAdminUser, String knoxAdminPassword) {
+ KnoxClient knoxClient = null;
+ if (knoxUrl == null || knoxUrl.isEmpty()) {
+ logger.error("Can not create KnoxClient: knoxUrl is empty");
+ } else if (knoxAdminUser == null || knoxAdminUser.isEmpty()) {
+ logger.error("Can not create KnoxClient: knoxAdminUser is empty");
+ } else if (knoxAdminPassword == null || knoxAdminPassword.isEmpty()) {
+ logger.error("Can not create KnoxClient: knoxAdminPassword is empty");
+ } else {
+ knoxClient = new KnoxClient(knoxUrl, knoxAdminUser, knoxAdminPassword);
+ }
+ return knoxClient;
+ }
+
+ public HBaseClient getHBaseConnection(final String dataSourceName) {
+ HBaseClient client = null;
+ XXAsset asset = xADaoManager.getXXAsset().findByAssetName(
+ dataSourceName);
+ if (asset != null) {
+ // get it from the cache
+ synchronized (hbaseConnectionCache) {
+ client = hbaseConnectionCache.get(asset.getName());
+ if (client == null) {
+ // if it doesn't exist in cache then create the connection
+ String config = asset.getConfig();
+ if(!stringUtil.isEmpty(config)){
+ config=xAssetService.getConfigWithDecryptedPassword(config);
+ }
+ // FIXME remove this once we start using putting config for
+ // default asset "dev-hive" (should come from properties)
+ if (stringUtil.isEmpty(config)
+ && asset.getName().equals("hbase")) {
+
+ final Callable<HBaseClient> connectHBase = new Callable<HBaseClient>() {
+ @Override
+
+ public HBaseClient call() throws Exception {
+ HBaseClient hBaseClient=null;
+ if(dataSourceName!=null){
+ try{
+ hBaseClient=new HBaseClient(dataSourceName);
+ }catch(Exception ex){
+ logger.error("Error connecting HBase repository : ", ex);
+ }
+ }
+ return hBaseClient;
+ }
+
+ };
+
+ try {
+ if(connectHBase!=null){
+ client = TimedEventUtil.timedTask(connectHBase, 5, TimeUnit.SECONDS);
+ }
+ } catch(Exception e){
+ logger.error("Error connecting HBase repository : " + dataSourceName);
+ }
+ } else if (!stringUtil.isEmpty(config)) {
+ final HashMap<String, String> configMap = (HashMap<String, String>) jsonUtil
+ .jsonToMap(config);
+
+ final Callable<HBaseClient> connectHBase = new Callable<HBaseClient>() {
+ @Override
+ public HBaseClient call() throws Exception {
+ HBaseClient hBaseClient=null;
+ if(dataSourceName!=null && configMap!=null){
+ try{
+ hBaseClient=new HBaseClient(dataSourceName,configMap);
+ }catch(Exception ex){
+ logger.error("Error connecting HBase repository : ", ex);
+ }
+ }
+ return hBaseClient;
+ }
+ };
+
+ try {
+ if(connectHBase!=null){
+ client = TimedEventUtil.timedTask(connectHBase, 5, TimeUnit.SECONDS);
+ }
+ } catch(Exception e){
+ logger.error("Error connecting HBase repository : "+
+ dataSourceName +" using config : "+ config);
+ }
+
+ } else {
+ logger.error(
+ "Connection Config not defined for asset :"
+ + asset.getName(), new Throwable());
+ }
+ if(client!=null){
+ hbaseConnectionCache.put(asset.getName(), client);
+ }
+ } else {
+ List<String> testConnect = client.getTableList(".\\*");
+ if(testConnect == null){
+ hbaseConnectionCache.remove(dataSourceName);
+ client = getHBaseConnection(dataSourceName);
+ }
+ }
+ repoConnectStatusMap.put(asset.getName(), true);
+ }
+ } else {
+ logger.error("Asset not found with name " + dataSourceName,
+ new Throwable());
+ }
+
+ return client;
+ }
+
+ public boolean destroyConnection(VXAsset asset) {
+ boolean result = false;
+ if (asset != null) {
+ if(asset.getAssetType() == AppConstants.ASSET_HDFS) {
+ synchronized (hadoopConnectionCache) {
+
+ @SuppressWarnings("unused")
+ HadoopFS hadoopFS = hadoopConnectionCache.get(asset.getName());
+ // TODO need a way to close the connection
+ hadoopConnectionCache.remove(asset.getName());
+ repoConnectStatusMap.remove(asset.getName());
+
+ }
+ } else if(asset.getAssetType() == AppConstants.ASSET_HIVE) {
+ synchronized (hadoopConnectionCache) {
+
+ HiveClient hiveClient = hiveConnectionCache.get(asset.getName());
+ if(hiveClient != null) {
+ hiveClient.close();
+ }
+ hadoopConnectionCache.remove(asset.getName());
+ repoConnectStatusMap.remove(asset.getName());
+
+ }
+ } else if (asset.getAssetType() == AppConstants.ASSET_HBASE) {
+ synchronized (hbaseConnectionCache) {
+ @SuppressWarnings("unused")
+ HBaseClient hBaseClient = hbaseConnectionCache.get(asset
+ .getName());
+ // TODO need a way to close the connection
+ hbaseConnectionCache.remove(asset.getName());
+ repoConnectStatusMap.remove(asset.getName());
+
+ }
+ }
+ result = true;
+ }
+ return result;
+ }
+
+ public HadoopFS resetHadoopConnection(final String dataSourceName){
+ hadoopConnectionCache.remove(dataSourceName);
+ return getHadoopConnection(dataSourceName);
+ }
+
+ public static StormClient getStormClient(final String stormUIURL, String userName, String password) {
+ StormClient stormClient = null;
+ if (stormUIURL == null || stormUIURL.isEmpty()) {
+ logger.error("Can not create KnoxClient: stormUIURL is empty");
+ } else if (userName == null || userName.isEmpty()) {
+ logger.error("Can not create KnoxClient: knoxAdminUser is empty");
+ } else if (password == null || password.isEmpty()) {
+ logger.error("Can not create KnoxClient: knoxAdminPassword is empty");
+ } else {
+ stormClient = new StormClient(stormUIURL, userName, password);
+ }
+ return stormClient;
+ }
+
+}