EMMA Coverage Report (generated Mon Aug 23 17:21:34 CEST 2010)
[all classes][org.dcache.vehicles]

COVERAGE SUMMARY FOR SOURCE FILE [PnfsGetFileAttributes.java]

nameclass, %method, %block, %line, %
PnfsGetFileAttributes.java0%   (0/1)0%   (0/8)0%   (0/103)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PnfsGetFileAttributes0%   (0/1)0%   (0/8)0%   (0/103)0%   (0/24)
PnfsGetFileAttributes (PnfsId, Set): void 0%   (0/1)0%   (0/7)0%   (0/3)
PnfsGetFileAttributes (String, Set): void 0%   (0/1)0%   (0/9)0%   (0/4)
fold (Message): boolean 0%   (0/1)0%   (0/56)0%   (0/11)
getFileAttributes (): FileAttributes 0%   (0/1)0%   (0/3)0%   (0/1)
getRequestedAttributes (): Set 0%   (0/1)0%   (0/3)0%   (0/1)
invalidates (Message): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
setFileAttributes (FileAttributes): void 0%   (0/1)0%   (0/4)0%   (0/2)
toString (): String 0%   (0/1)0%   (0/19)0%   (0/1)

1package org.dcache.vehicles;
2 
3import diskCacheV111.vehicles.*;
4import diskCacheV111.util.PnfsId;
5import org.dcache.namespace.FileAttribute;
6import java.util.Set;
7 
8 
9/**
10 * Vehicle for get files combined attributes.
11 *
12 * @since 1.9.4
13 */
14public class PnfsGetFileAttributes extends PnfsMessage {
15 
16    private static final long serialVersionUID = -6750531802534981651L;
17 
18    protected FileAttributes _fileAttributes;
19    protected Set<FileAttribute> _attributes;
20 
21    /**
22     * Construct request by PnfsId.
23     *
24     * @param pnfsid
25     * @param attr
26     */
27    public PnfsGetFileAttributes(PnfsId pnfsid, Set<FileAttribute> attr) {
28        super(pnfsid);
29        _attributes = attr;
30    }
31 
32    /**
33     * Construct request by path.
34     *
35     * @param path
36     * @param attr
37     */
38    public PnfsGetFileAttributes(String path, Set<FileAttribute> attr) {
39        super();
40        setPnfsPath(path);
41        _attributes = attr;
42    }
43 
44    /**
45     * Set file attributes.
46     *
47     * @param fileAttributes
48     */
49    public void setFileAttributes(FileAttributes fileAttributes) {
50        _fileAttributes = fileAttributes;
51    }
52 
53    /**
54     * Get requested attributes. Note that PnfsManager may return less attributes than requested.
55     *
56     * @return
57     */
58    public FileAttributes getFileAttributes() {
59        return _fileAttributes;
60    }
61 
62    /**
63     * Get set of requested {@link FileAttributes}. An empty set
64     * indicates that client interested in file existence only.
65     * @return
66     */
67    public Set<FileAttribute> getRequestedAttributes() {
68        return _attributes;
69    }
70 
71    @Override
72    public boolean invalidates(Message message)
73    {
74        return false;
75    }
76 
77    @Override
78    public boolean fold(Message message)
79    {
80        if (message instanceof PnfsGetFileAttributes) {
81            PnfsId pnfsId = getPnfsId();
82            String path = getPnfsPath();
83            Set<FileAttribute> requested = getRequestedAttributes();
84            PnfsGetFileAttributes other =
85                (PnfsGetFileAttributes) message;
86            if ((pnfsId == null || pnfsId.equals(other.getPnfsId())) &&
87                (path == null || path.equals(other.getPnfsPath())) &&
88                (getSubject().equals(other.getSubject())) &&
89                (other.getRequestedAttributes().containsAll(requested))) {
90                setPnfsId(other.getPnfsId());
91                setPnfsPath(other.getPnfsPath());
92                setFileAttributes(other.getFileAttributes());
93                return true;
94            }
95        }
96 
97        return false;
98    }
99 
100    @Override
101    public String toString()
102    {
103        return super.toString() + ";" +
104            ((_fileAttributes == null)
105             ? "[noMetaData]"
106             : _fileAttributes.toString());
107    }
108}

[all classes][org.dcache.vehicles]
EMMA 2.0.5312 (C) Vladimir Roubtsov