Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
nfs4j
Commits
6324659d
Commit
6324659d
authored
Sep 05, 2011
by
Tigran Mkrtchyan
☕
Browse files
vfs: updated ChimeraVfs to used inodeToBytes and inodeFromBytes
remove obsolete class.
parent
4c3ae1d1
Changes
5
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
6324659d
...
...
@@ -263,7 +263,7 @@
<dependency>
<groupId>
org.dcache.chimera
</groupId>
<artifactId>
chimera-core
</artifactId>
<version>
0.0.1
1
-SNAPSHOT
</version>
<version>
0.0.1
2
-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.dcache.common
</groupId>
...
...
src/org/dcache/chimera/nfs/NFSHandle.java
deleted
100644 → 0
View file @
4c3ae1d1
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This library 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 Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program (see the file COPYING.LIB for more
* details); if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
package
org.dcache.chimera.nfs
;
import
org.dcache.chimera.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.StringTokenizer
;
public
class
NFSHandle
{
private
static
final
Logger
_log
=
LoggerFactory
.
getLogger
(
NFSHandle
.
class
);
private
NFSHandle
()
{
// no instance allowed
}
public
static
FsInode
toFsInode
(
FileSystemProvider
fs
,
byte
[]
handle
)
{
FsInode
inode
=
null
;
String
strHandle
=
new
String
(
handle
);
_log
.
debug
(
"Processing FH: {}"
,
strHandle
);
StringTokenizer
st
=
new
StringTokenizer
(
strHandle
,
"[:]"
);
if
(
st
.
countTokens
()
<
3
)
{
throw
new
IllegalArgumentException
(
"Invalid HimeraNFS handler.("
+
strHandle
+
")"
);
}
/*
* reserved for future use
*/
int
fsId
=
Integer
.
parseInt
(
st
.
nextToken
());
String
type
=
st
.
nextToken
();
try
{
// IllegalArgumentException will be thrown is it's wrong type
FsInodeType
inodeType
=
FsInodeType
.
valueOf
(
type
);
String
id
;
int
argc
;
String
[]
args
;
switch
(
inodeType
)
{
case
INODE:
id
=
st
.
nextToken
();
int
level
=
0
;
if
(
st
.
countTokens
()
>
0
)
{
level
=
Integer
.
parseInt
(
st
.
nextToken
());
}
inode
=
new
FsInode
(
fs
,
id
,
level
);
break
;
case
ID:
id
=
st
.
nextToken
();
inode
=
new
FsInode_ID
(
fs
,
id
);
break
;
case
TAGS:
id
=
st
.
nextToken
();
inode
=
new
FsInode_TAGS
(
fs
,
id
);
break
;
case
TAG:
id
=
st
.
nextToken
();
String
tag
=
st
.
nextToken
();
inode
=
new
FsInode_TAG
(
fs
,
id
,
tag
);
break
;
case
NAMEOF:
id
=
st
.
nextToken
();
inode
=
new
FsInode_NAMEOF
(
fs
,
id
);
break
;
case
PARENT:
id
=
st
.
nextToken
();
inode
=
new
FsInode_PARENT
(
fs
,
id
);
break
;
case
PATHOF:
id
=
st
.
nextToken
();
inode
=
new
FsInode_PATHOF
(
fs
,
id
);
break
;
case
CONST:
String
cnst
=
st
.
nextToken
();
inode
=
new
FsInode_CONST
(
fs
,
cnst
);
break
;
case
PSET:
id
=
st
.
nextToken
();
argc
=
st
.
countTokens
();
args
=
new
String
[
argc
];
for
(
int
i
=
0
;
i
<
argc
;
i
++)
{
args
[
i
]
=
st
.
nextToken
();
}
inode
=
new
FsInode_PSET
(
fs
,
id
,
args
);
break
;
case
PGET:
id
=
st
.
nextToken
();
argc
=
st
.
countTokens
();
args
=
new
String
[
argc
];
for
(
int
i
=
0
;
i
<
argc
;
i
++)
{
args
[
i
]
=
st
.
nextToken
();
}
inode
=
new
FsInode_PGET
(
fs
,
id
,
args
);
break
;
}
}
catch
(
IllegalArgumentException
iae
)
{
_log
.
info
(
"Failed to generate an inode from file handle : {} : {}"
,
strHandle
,
iae
);
inode
=
null
;
}
return
inode
;
}
}
src/org/dcache/chimera/nfs/v4/OperationPUTFH.java
View file @
6324659d
...
...
@@ -21,7 +21,6 @@ import org.dcache.chimera.nfs.v4.xdr.nfsstat4;
import
org.dcache.chimera.nfs.v4.xdr.nfs_argop4
;
import
org.dcache.chimera.nfs.v4.xdr.nfs_opnum4
;
import
org.dcache.chimera.nfs.v4.xdr.PUTFH4res
;
import
org.dcache.chimera.nfs.NFSHandle
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
src/org/dcache/chimera/nfs/vfs/ChimeraVfs.java
View file @
6324659d
...
...
@@ -28,7 +28,6 @@ import org.dcache.chimera.HimeraDirectoryEntry;
import
org.dcache.chimera.JdbcFs
;
import
org.dcache.chimera.UnixPermission
;
import
org.dcache.chimera.nfs.vfs.Inode.Type
;
import
org.dcache.chimera.nfs.NFSHandle
;
import
org.dcache.chimera.nfs.v4.xdr.nfsace4
;
import
org.dcache.chimera.posix.Stat
;
...
...
@@ -49,8 +48,8 @@ public class ChimeraVfs implements VirtualFileSystem {
}
@Override
public
Inode
inodeOf
(
final
byte
[]
fh
)
{
return
toInode
(
NFSHandle
.
toFsInode
(
_fs
,
fh
));
public
Inode
inodeOf
(
final
byte
[]
fh
)
throws
IOException
{
return
toInode
(
_fs
.
inodeFromBytes
(
fh
));
}
@Override
...
...
@@ -138,7 +137,7 @@ public class ChimeraVfs implements VirtualFileSystem {
}
@Override
public
Inode
parentOf
(
Inode
inode
)
{
public
Inode
parentOf
(
Inode
inode
)
throws
IOException
{
return
toInode
(
toFsInode
(
inode
).
getParent
());
}
...
...
@@ -147,8 +146,8 @@ public class ChimeraVfs implements VirtualFileSystem {
return
_fs
.
getFsStat
();
}
private
FsInode
toFsInode
(
Inode
inode
)
{
return
NFSHandle
.
toFsInode
(
_fs
,
inode
.
toFileHandle
());
private
FsInode
toFsInode
(
Inode
inode
)
throws
IOException
{
return
_fs
.
inodeFromBytes
(
inode
.
toFileHandle
());
}
private
Inode
toInode
(
final
FsInode
inode
)
{
...
...
@@ -156,8 +155,8 @@ public class ChimeraVfs implements VirtualFileSystem {
return
new
Inode
()
{
@Override
public
byte
[]
toFileHandle
()
{
return
inode
.
toFullString
().
get
Bytes
();
public
byte
[]
toFileHandle
()
throws
IOException
{
return
_fs
.
inode
To
Bytes
(
inode
);
}
@Override
...
...
@@ -245,7 +244,11 @@ public class ChimeraVfs implements VirtualFileSystem {
return
false
;
}
Inode
other
=
(
Inode
)
obj
;
return
Arrays
.
equals
(
this
.
toFileHandle
(),
other
.
toFileHandle
());
try
{
return
Arrays
.
equals
(
this
.
toFileHandle
(),
other
.
toFileHandle
());
}
catch
(
IOException
e
)
{
return
false
;
}
}
@Override
...
...
src/org/dcache/chimera/nfs/vfs/Inode.java
View file @
6324659d
...
...
@@ -34,7 +34,7 @@ public interface Inode {
SOCK
}
public
byte
[]
toFileHandle
();
public
byte
[]
toFileHandle
()
throws
IOException
;
public
boolean
exists
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment