| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.vfs.internal.attach; |
| 21 |
|
|
| 22 |
|
import java.io.IOException; |
| 23 |
|
|
| 24 |
|
import org.xwiki.component.manager.ComponentManager; |
| 25 |
|
|
| 26 |
|
import net.java.truecommons.cio.Entry; |
| 27 |
|
import net.java.truecommons.cio.Entry.Access; |
| 28 |
|
import net.java.truecommons.cio.Entry.Type; |
| 29 |
|
import net.java.truecommons.cio.InputSocket; |
| 30 |
|
import net.java.truecommons.cio.OutputSocket; |
| 31 |
|
import net.java.truecommons.shed.BitField; |
| 32 |
|
import net.java.truevfs.kernel.spec.FsAbstractController; |
| 33 |
|
import net.java.truevfs.kernel.spec.FsAccessOption; |
| 34 |
|
import net.java.truevfs.kernel.spec.FsController; |
| 35 |
|
import net.java.truevfs.kernel.spec.FsModel; |
| 36 |
|
import net.java.truevfs.kernel.spec.FsNodeName; |
| 37 |
|
import net.java.truevfs.kernel.spec.FsNodePath; |
| 38 |
|
import net.java.truevfs.kernel.spec.FsReadOnlyFileSystemException; |
| 39 |
|
import net.java.truevfs.kernel.spec.FsSyncOption; |
| 40 |
|
|
| 41 |
|
import static net.java.truecommons.cio.Entry.Access.READ; |
| 42 |
|
import static net.java.truecommons.cio.Entry.Type.FILE; |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
@version |
| 48 |
|
@since |
| 49 |
|
|
| |
|
| 58.8% |
Uncovered Elements: 14 (34) |
Complexity: 17 |
Complexity Density: 1.06 |
|
| 50 |
|
public class AttachController extends FsAbstractController |
| 51 |
|
{ |
| 52 |
|
private static final BitField<Access> READ_ONLY = BitField.of(READ); |
| 53 |
|
|
| 54 |
|
private final AttachDriver driver; |
| 55 |
|
|
| 56 |
|
private ComponentManager componentManager; |
| 57 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 58 |
2 |
AttachController(AttachDriver driver, FsModel model, ComponentManager componentManager)... |
| 59 |
|
{ |
| 60 |
2 |
super(model); |
| 61 |
2 |
this.driver = driver; |
| 62 |
2 |
this.componentManager = componentManager; |
| 63 |
|
} |
| 64 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 65 |
4 |
private AttachNode newEntry(FsNodeName name)... |
| 66 |
|
{ |
| 67 |
4 |
return new AttachNode(this, name); |
| 68 |
|
} |
| 69 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 70 |
8 |
final FsNodePath resolve(FsNodeName name)... |
| 71 |
|
{ |
| 72 |
8 |
return getMountPoint().resolve(name); |
| 73 |
|
} |
| 74 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 75 |
0 |
@Override... |
| 76 |
|
public FsController getParent() |
| 77 |
|
{ |
| 78 |
0 |
return null; |
| 79 |
|
} |
| 80 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
| 81 |
2 |
@Override... |
| 82 |
|
public AttachNode node(BitField<FsAccessOption> options, FsNodeName name) throws IOException |
| 83 |
|
{ |
| 84 |
2 |
AttachNode entry = newEntry(name); |
| 85 |
2 |
return entry.isType(FILE) ? entry : null; |
| 86 |
|
} |
| 87 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 3 |
Complexity Density: 1.5 |
|
| 88 |
2 |
@Override... |
| 89 |
|
public void checkAccess(BitField<FsAccessOption> options, FsNodeName name, BitField<Access> types) |
| 90 |
|
throws IOException |
| 91 |
|
{ |
| 92 |
|
|
| 93 |
2 |
if (!types.isEmpty() && !READ_ONLY.equals(types)) { |
| 94 |
2 |
throw new FsReadOnlyFileSystemException(getMountPoint()); |
| 95 |
|
} |
| 96 |
|
} |
| 97 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 98 |
0 |
@Override... |
| 99 |
|
public void setReadOnly(BitField<FsAccessOption> options, FsNodeName name) throws IOException |
| 100 |
|
{ |
| 101 |
|
|
| 102 |
|
} |
| 103 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 104 |
0 |
@Override... |
| 105 |
|
public boolean setTime(BitField<FsAccessOption> options, FsNodeName name, BitField<Access> types, long value) |
| 106 |
|
throws IOException |
| 107 |
|
{ |
| 108 |
0 |
throw new FsReadOnlyFileSystemException(getMountPoint()); |
| 109 |
|
} |
| 110 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 111 |
2 |
@Override... |
| 112 |
|
public InputSocket<?> input(BitField<FsAccessOption> options, FsNodeName name) |
| 113 |
|
{ |
| 114 |
2 |
return newEntry(name).input(options); |
| 115 |
|
} |
| 116 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 117 |
0 |
@Override... |
| 118 |
|
public OutputSocket<?> output(BitField<FsAccessOption> options, FsNodeName name, Entry template) |
| 119 |
|
{ |
| 120 |
0 |
return newEntry(name).output(options, template); |
| 121 |
|
} |
| 122 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 123 |
0 |
@Override... |
| 124 |
|
public void make(final BitField<FsAccessOption> options, final FsNodeName name, Type type, Entry template) |
| 125 |
|
throws IOException |
| 126 |
|
{ |
| 127 |
0 |
throw new FsReadOnlyFileSystemException(getMountPoint()); |
| 128 |
|
} |
| 129 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 130 |
0 |
@Override... |
| 131 |
|
public void unlink(BitField<FsAccessOption> options, FsNodeName name) throws IOException |
| 132 |
|
{ |
| 133 |
0 |
throw new FsReadOnlyFileSystemException(getMountPoint()); |
| 134 |
|
} |
| 135 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 136 |
0 |
@Override... |
| 137 |
|
public void sync(BitField<FsSyncOption> options) |
| 138 |
|
{ |
| 139 |
|
|
| 140 |
|
} |
| 141 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 142 |
4 |
ComponentManager getComponentManager()... |
| 143 |
|
{ |
| 144 |
4 |
return this.componentManager; |
| 145 |
|
} |
| 146 |
|
} |