forked from dCache/dcache
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chimera: make list method to support virtual directory listing
Motivation Tags can be attached to a file, and it was poosible to list files by labels but only using RESTFUL API. This patch is the draft for addapting listing virtual directories based on label of files. currently is will work in a way only if we use the following syntacs `.(collection)(cat)` than files having cat label will be returned. Modifications Add a new FSInode Type LABEL to separate real inode from virtual one. Result chimera.newDirectory() method can distinguesh between to cases. but there is work to be done to test list() method for more cases and change FSPATH.create() method to addapt for `.(collection)(cat)`. Acked-by: Tigran Target: master Require-book: no
- Loading branch information
1 parent
030d5ce
commit 1fbd7ae
Showing
6 changed files
with
139 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
modules/chimera/src/main/java/org/dcache/chimera/FsInode_LABEL.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* dCache - http://www.dcache.org/ | ||
* | ||
* Copyright (C) 2023 Deutsches Elektronen-Synchrotron | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.dcache.chimera; | ||
|
||
import java.util.Set; | ||
|
||
public class FsInode_LABEL extends FsInode { | ||
|
||
public String getLabel() { | ||
return _label; | ||
} | ||
|
||
private final String _label; | ||
|
||
/** | ||
* @param fs pointer to 'File System' | ||
* @param ino inode number of the label_id | ||
* @param label | ||
*/ | ||
public FsInode_LABEL(FileSystemProvider fs, long ino, String label) { | ||
super(fs, ino, FsInodeType.LABEL); | ||
_label = label; | ||
} | ||
|
||
@Override | ||
public boolean exists() { | ||
boolean rc = false; | ||
try { | ||
Set<String> list = _fs.getLabels(this); | ||
if (list.contains(_label)) { | ||
rc = true; | ||
} | ||
} catch (Exception e) { | ||
} | ||
return rc; | ||
} | ||
|
||
@Override | ||
public boolean isDirectory() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isLink() { | ||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters