View Javadoc

1   package fr.in2p3.jsaga.adaptor.data;
2   
3   import fr.in2p3.jsaga.adaptor.data.permission.PermissionBytes;
4   import fr.in2p3.jsaga.adaptor.data.read.FileAttributes;
5   import fr.in2p3.jsaga.adaptor.schema.data.catalog.*;
6   
7   /* ***************************************************
8   * *** Centre de Calcul de l'IN2P3 - Lyon (France) ***
9   * ***             http://cc.in2p3.fr/             ***
10  * ***************************************************
11  * File:   CatalogFileAttributes
12  * Author: Sylvain Reynaud (sreynaud@in2p3.fr)
13  * Date:   10 sept. 2007
14  * ***************************************************
15  * Description:                                      */
16  /**
17   *
18   */
19  public class CatalogFileAttributes extends FileAttributes {
20      private EntryType m_entry;
21  
22      public CatalogFileAttributes(EntryType entry) {
23          m_entry = entry;
24      }
25  
26      public CatalogFileAttributes(EntryType entry, String relativePath) {
27          this(entry);
28          m_relativePath = relativePath;
29      }
30  
31      public String getName() {
32          return m_entry.getName();
33      }
34  
35      public int getType() {
36          if (m_entry instanceof DirectoryType) {
37              return TYPE_DIRECTORY;
38          } else if (m_entry instanceof FileType) {
39              FileType file = (FileType) m_entry;
40              if (file.getLink() != null) {
41                  return TYPE_LINK;
42              } else {
43                  return TYPE_FILE;
44              }
45          } else {
46              return TYPE_UNKNOWN;
47          }
48      }
49  
50      public long getSize() {
51          if (m_entry instanceof FileType) {
52              FileType file = (FileType) m_entry;
53              return file.getReplicaCount();
54          } else {
55              return SIZE_UNKNOWN;
56          }
57      }
58  
59      public PermissionBytes getUserPermission() {
60          return PERMISSION_UNKNOWN;
61      }
62  
63      public PermissionBytes getGroupPermission() {
64          return PERMISSION_UNKNOWN;
65      }
66  
67      public PermissionBytes getAnyPermission() {
68          return PERMISSION_UNKNOWN;
69      }
70  
71      public String getOwner() {
72          return ID_UNKNOWN;
73      }
74  
75      public String getGroup() {
76          return ID_UNKNOWN;
77      }
78  
79      public long getLastModified() {
80          return DATE_UNKNOWN;
81      }
82  }