View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.codehaus.plexus.archiver.util;
20  
21  /**
22   * @author Olivier Lamy
23   * @since 1.1
24   *
25   */
26  public class FilePermission {
27  
28      private final boolean executable;
29  
30      private final boolean ownerOnlyExecutable;
31  
32      private final boolean ownerOnlyReadable;
33  
34      private final boolean readable;
35  
36      private final boolean ownerOnlyWritable;
37  
38      private final boolean writable;
39  
40      public FilePermission(
41              boolean executable,
42              boolean ownerOnlyExecutable,
43              boolean ownerOnlyReadable,
44              boolean readable,
45              boolean ownerOnlyWritable,
46              boolean writable) {
47          this.executable = executable;
48          this.ownerOnlyExecutable = ownerOnlyExecutable;
49          this.ownerOnlyReadable = ownerOnlyReadable;
50          this.readable = readable;
51          this.ownerOnlyWritable = ownerOnlyWritable;
52          this.writable = writable;
53      }
54  
55      public boolean isExecutable() {
56          return executable;
57      }
58  
59      public boolean isOwnerOnlyExecutable() {
60          return ownerOnlyExecutable;
61      }
62  
63      public boolean isOwnerOnlyReadable() {
64          return ownerOnlyReadable;
65      }
66  
67      public boolean isReadable() {
68          return readable;
69      }
70  
71      public boolean isOwnerOnlyWritable() {
72          return ownerOnlyWritable;
73      }
74  
75      public boolean isWritable() {
76          return writable;
77      }
78  
79      @Override
80      public String toString() {
81          return "FilePermission [executable=" + executable + ", ownerOnlyExecutable=" + ownerOnlyExecutable
82                  + ", ownerOnlyReadable=" + ownerOnlyReadable + ", readable=" + readable + ", ownerOnlyWritable="
83                  + ownerOnlyWritable + ", writable=" + writable + "]";
84      }
85  }