001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 package org.apache.hadoop.mapreduce;
019
020 import java.io.DataInput;
021 import java.io.DataOutput;
022 import java.io.IOException;
023
024 import org.apache.hadoop.classification.InterfaceAudience;
025 import org.apache.hadoop.classification.InterfaceStability;
026 import org.apache.hadoop.io.Text;
027 import org.apache.hadoop.io.Writable;
028 import org.apache.hadoop.io.WritableUtils;
029
030 /**
031 * Class to encapsulate Queue ACLs for a particular
032 * user.
033 *
034 */
035 @InterfaceAudience.Public
036 @InterfaceStability.Evolving
037 public class QueueAclsInfo implements Writable {
038
039 private String queueName;
040 private String[] operations;
041 /**
042 * Default constructor for QueueAclsInfo.
043 *
044 */
045 public QueueAclsInfo() {
046
047 }
048
049 /**
050 * Construct a new QueueAclsInfo object using the queue name and the
051 * queue operations array
052 *
053 * @param queueName Name of the job queue
054 * @param operations
055 */
056 public QueueAclsInfo(String queueName, String[] operations) {
057 this.queueName = queueName;
058 this.operations = operations;
059 }
060
061 /**
062 * Get queue name.
063 *
064 * @return name
065 */
066 public String getQueueName() {
067 return queueName;
068 }
069
070 protected void setQueueName(String queueName) {
071 this.queueName = queueName;
072 }
073
074 /**
075 * Get opearations allowed on queue.
076 *
077 * @return array of String
078 */
079 public String[] getOperations() {
080 return operations;
081 }
082
083 @Override
084 public void readFields(DataInput in) throws IOException {
085 queueName = Text.readString(in);
086 operations = WritableUtils.readStringArray(in);
087 }
088
089 @Override
090 public void write(DataOutput out) throws IOException {
091 Text.writeString(out, queueName);
092 WritableUtils.writeStringArray(out, operations);
093 }
094 }