Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
JAliEn
JAliEn
Commits
66cc3714
Commit
66cc3714
authored
Apr 27, 2021
by
Costin Grigoras
Browse files
More cleanup by SpotBugs and Eclipse
parent
49fe16f9
Changes
14
Hide whitespace changes
Inline
Side-by-side
src/main/java/alien/api/catalogue/CatalogueApiUtils.java
View file @
66cc3714
...
...
@@ -5,6 +5,7 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -768,8 +769,7 @@ public class CatalogueApiUtils {
cpArgs
.
add
(
lfnAbsolutePath
);
if
(
args
!=
null
)
for
(
final
String
arg
:
args
)
cpArgs
.
add
(
arg
);
Collections
.
addAll
(
cpArgs
,
args
);
final
JAliEnCommandcp
cp
=
new
JAliEnCommandcp
(
commander
,
cpArgs
);
...
...
@@ -798,8 +798,7 @@ public class CatalogueApiUtils {
cpArgs
.
add
(
"file:"
+
localFile
.
getAbsolutePath
());
if
(
args
!=
null
)
for
(
final
String
arg
:
args
)
cpArgs
.
add
(
arg
);
Collections
.
addAll
(
cpArgs
,
args
);
final
JAliEnCommandcp
cp
=
new
JAliEnCommandcp
(
commander
,
cpArgs
);
...
...
@@ -919,9 +918,7 @@ public class CatalogueApiUtils {
public
LFN_CSD
getLFNCSD
(
final
String
lfn_path
)
{
final
ArrayList
<
String
>
slfn
=
new
ArrayList
<>();
slfn
.
add
(
lfn_path
);
Collection
<
LFN_CSD
>
slfn_res
=
new
ArrayList
<>();
slfn_res
=
getLFNCSD
(
slfn
,
false
);
final
Collection
<
LFN_CSD
>
slfn_res
=
getLFNCSD
(
slfn
,
false
);
if
(
slfn_res
!=
null
&&
slfn_res
.
iterator
().
hasNext
())
return
slfn_res
.
iterator
().
next
();
...
...
@@ -1077,11 +1074,11 @@ public class CatalogueApiUtils {
* @param expireTime an ExppireTime object specifying the expire time to add
* @param extend specify if the given expire time should extend or replace the current one
*/
public
void
setLFNExpireTime
(
final
List
<
String
>
paths
,
ExpireTime
expireTime
,
boolean
extend
)
{
public
void
setLFNExpireTime
(
final
List
<
String
>
paths
,
final
ExpireTime
expireTime
,
final
boolean
extend
)
{
try
{
Dispatcher
.
execute
(
new
LFNExpireTime
(
commander
.
getUser
(),
paths
,
expireTime
,
extend
));
}
catch
(
ServerException
e
)
{
catch
(
final
ServerException
e
)
{
e
.
printStackTrace
();
}
...
...
src/main/java/alien/api/catalogue/ListSEDistance.java
View file @
66cc3714
...
...
@@ -69,7 +69,7 @@ public class ListSEDistance extends Request {
this
.
ses
=
new
ArrayList
<>();
LFN
lfn
=
null
;
if
(
this
.
lfn_name
!=
null
&&
this
.
lfn_name
.
length
()
!=
0
)
if
(
this
.
lfn_name
.
length
()
!=
0
)
lfn
=
LFNUtils
.
getLFN
(
this
.
lfn_name
);
if
(
lfn
==
null
)
...
...
src/main/java/alien/api/catalogue/PFNforReadOrDelCsd.java
View file @
66cc3714
...
...
@@ -82,7 +82,6 @@ public class PFNforReadOrDelCsd extends Request {
final
LFN_CSD
lfnc
=
(
LFN_CSD
)
entity
;
final
Set
<
PFN
>
pfns_lfnc
=
lfnc
.
getPFNs
();
// TODO resolve whereis recursively
if
(
pfns_lfnc
!=
null
)
{
try
{
for
(
final
PFN
pfn
:
pfns_lfnc
)
{
// final UUID archiveLinkedTo = pfn.retrieveArchiveLinkedGUID();
...
...
@@ -139,9 +138,6 @@ public class PFNforReadOrDelCsd extends Request {
}
else
logger
.
log
(
Level
.
WARNING
,
"Sorry ... No PFN to make an envelope for!"
);
}
else
logger
.
log
(
Level
.
WARNING
,
"Sorry ... No PFNs for the file's GUID!"
);
if
(
pfns
.
size
()
<
1
)
logger
.
log
(
Level
.
WARNING
,
"Sorry ... No PFNs for the file's GUID!"
);
...
...
src/main/java/alien/api/catalogue/RegisterEnvelopes.java
View file @
66cc3714
...
...
@@ -27,7 +27,7 @@ import alien.user.AliEnPrincipal;
*/
public
class
RegisterEnvelopes
extends
Request
{
/**
*
*
*/
private
static
final
long
serialVersionUID
=
6927727456767661381L
;
...
...
@@ -146,7 +146,7 @@ public class RegisterEnvelopes extends Request {
}
else
if
(
encryptedEnvelope
!=
null
)
{
pfns
=
new
ArrayList
<>(
1
);
XrootDEnvelope
xenv
=
null
;
final
XrootDEnvelope
xenv
;
try
{
xenv
=
XrootDEnvelopeSigner
.
decryptEnvelope
(
encryptedEnvelope
);
}
...
...
@@ -155,43 +155,39 @@ public class RegisterEnvelopes extends Request {
return
;
}
if
(
xenv
!=
null
)
{
PFN
bookedpfn
=
null
;
PFN
bookedpfn
=
null
;
try
{
bookedpfn
=
BookingTable
.
getBookedPFN
(
xenv
.
pfn
.
pfn
);
}
catch
(
final
Exception
e
)
{
logger
.
log
(
Level
.
WARNING
,
"Error getting the PFN: "
,
e
);
return
;
}
try
{
bookedpfn
=
BookingTable
.
getBookedPFN
(
xenv
.
pfn
.
pfn
);
}
catch
(
final
Exception
e
)
{
logger
.
log
(
Level
.
WARNING
,
"Error getting the PFN: "
,
e
);
return
;
}
if
(
bookedpfn
!=
null
)
{
if
(
size
!=
0
)
bookedpfn
.
getGuid
().
size
=
size
;
if
(
bookedpfn
!=
null
)
{
if
(
size
!=
0
)
bookedpfn
.
getGuid
().
size
=
size
;
if
(
md5
!=
null
&&
md5
.
length
()
>
0
&&
!
md5
.
equals
(
"0"
))
bookedpfn
.
getGuid
().
md5
=
md5
;
if
(
md5
!=
null
&&
md5
.
length
()
>
0
&&
!
"0"
.
equals
(
md5
))
bookedpfn
.
getGuid
().
md5
=
md5
;
try
{
if
(
flagEntry
(
bookedpfn
))
{
if
(
logger
.
isLoggable
(
Level
.
FINE
))
logger
.
log
(
Level
.
FINE
,
"Successfully moved "
+
xenv
.
pfn
.
pfn
+
" to the Catalogue"
);
try
{
if
(
flagEntry
(
bookedpfn
))
{
if
(
logger
.
isLoggable
(
Level
.
FINE
))
logger
.
log
(
Level
.
FINE
,
"Successfully moved "
+
xenv
.
pfn
.
pfn
+
" to the Catalogue"
);
pfns
.
add
(
bookedpfn
);
}
else
logger
.
log
(
Level
.
WARNING
,
"Unable to register "
+
xenv
.
pfn
.
pfn
+
" in the Catalogue"
);
}
catch
(
final
Exception
e
)
{
logger
.
log
(
Level
.
WARNING
,
"Error registering pfn"
,
e
);
pfns
.
add
(
bookedpfn
);
}
else
logger
.
log
(
Level
.
WARNING
,
"Unable to register "
+
xenv
.
pfn
.
pfn
+
" in the Catalogue"
);
}
catch
(
final
Exception
e
)
{
logger
.
log
(
Level
.
WARNING
,
"Error registering pfn"
,
e
);
}
else
logger
.
log
(
Level
.
WARNING
,
"Could not find this booked pfn: "
+
xenv
.
pfn
.
pfn
);
}
else
logger
.
log
(
Level
.
WARNING
,
"
Null decrypted envelope"
);
logger
.
log
(
Level
.
WARNING
,
"
Could not find this booked pfn: "
+
xenv
.
pfn
.
pfn
);
}
}
...
...
src/main/java/alien/catalogue/GUID.java
View file @
66cc3714
...
...
@@ -257,9 +257,6 @@ public class GUID implements Comparable<GUID>, CatalogEntity {
return
false
;
try
(
DBFunctions
db
=
h
.
getDB
())
{
if
(
db
==
null
)
return
false
;
if
(!
exists
)
{
final
boolean
insertOK
=
insert
(
db
);
...
...
@@ -422,9 +419,6 @@ public class GUID implements Comparable<GUID>, CatalogEntity {
boolean
tainted
=
false
;
try
(
DBFunctions
db
=
h
.
getDB
())
{
if
(
db
==
null
)
return
null
;
if
(
monitor
!=
null
)
monitor
.
incrementCounter
(
"PFN_db_lookup"
);
...
...
@@ -474,9 +468,6 @@ public class GUID implements Comparable<GUID>, CatalogEntity {
return
false
;
try
(
DBFunctions
db
=
h
.
getDB
())
{
if
(
db
==
null
)
return
false
;
if
(
monitor
!=
null
)
monitor
.
incrementCounter
(
"PFN_db_insert"
);
...
...
@@ -678,11 +669,6 @@ public class GUID implements Comparable<GUID>, CatalogEntity {
boolean
removed
;
try
(
DBFunctions
db
=
h
.
getDB
())
{
if
(
db
==
null
)
{
logger
.
log
(
Level
.
WARNING
,
"Host DB is null for: "
+
h
);
return
false
;
}
if
(
monitor
!=
null
)
monitor
.
incrementCounter
(
"GUID_db_delete"
);
...
...
@@ -755,11 +741,6 @@ public class GUID implements Comparable<GUID>, CatalogEntity {
final
Integer
seNo
=
Integer
.
valueOf
(
pfn
.
seNumber
);
try
(
DBFunctions
db
=
h
.
getDB
())
{
if
(
db
==
null
)
{
logger
.
log
(
Level
.
WARNING
,
"Host DB is null for: "
+
h
);
return
false
;
}
if
(
monitor
!=
null
)
monitor
.
incrementCounter
(
"PFN_db_delete"
);
...
...
@@ -913,9 +894,6 @@ public class GUID implements Comparable<GUID>, CatalogEntity {
}
try
(
DBFunctions
db2
=
h
.
getDB
())
{
if
(
db2
==
null
)
continue
;
db2
.
setReadOnly
(
true
);
if
(
monitor
!=
null
)
...
...
src/main/java/alien/catalogue/GUIDIndex.java
View file @
66cc3714
...
...
@@ -161,9 +161,6 @@ public class GUIDIndex implements Serializable, Comparable<GUIDIndex> {
monitor
.
incrementCounter
(
"GUID_seUsageStats"
);
try
(
DBFunctions
db
=
h
.
getDB
())
{
if
(
db
==
null
)
return
ret
;
db
.
setReadOnly
(
true
);
db
.
query
(
"select seNumber, sum(size),count(1) from G"
+
tableName
+
"L INNER JOIN G"
+
tableName
+
"L_PFN USING(guidId) GROUP BY seNumber;"
);
...
...
src/main/java/alien/catalogue/GUIDUtils.java
View file @
66cc3714
...
...
@@ -172,9 +172,6 @@ public final class GUIDUtils {
return
null
;
try
(
DBFunctions
db
=
h
.
getDB
())
{
if
(
db
==
null
)
return
null
;
db
.
setReadOnly
(
true
);
final
int
tableName
=
GUIDUtils
.
getTableNameForGUID
(
guid
);
...
...
@@ -264,9 +261,6 @@ public final class GUIDUtils {
final
Map
<
Integer
,
Set
<
UUID
>>
hostMapping
=
entry
.
getValue
();
try
(
DBFunctions
db
=
h
.
getDB
())
{
if
(
db
==
null
)
continue
;
db
.
setReadOnly
(
true
);
db
.
setQueryTimeout
(
600
);
// in normal conditions it cannot take 10 minutes to ask for up to 100 guids from a table
...
...
@@ -331,9 +325,6 @@ public final class GUIDUtils {
return
null
;
try
(
DBFunctions
db
=
h
.
getDB
())
{
if
(
db
==
null
)
return
null
;
final
int
tableName
=
GUIDUtils
.
getTableNameForGUID
(
guid
);
if
(
tableName
<
0
)
...
...
@@ -739,9 +730,6 @@ public final class GUIDUtils {
return
false
;
try
(
DBFunctions
db
=
h
.
getDB
())
{
if
(
db
==
null
)
return
false
;
final
int
tableName
=
GUIDUtils
.
getTableNameForGUID
(
guid
);
if
(
tableName
<
0
)
...
...
src/main/java/alien/catalogue/LFNCSDUtils.java
View file @
66cc3714
...
...
@@ -118,23 +118,19 @@ public class LFNCSDUtils {
if
(
file_pattern
.
contains
(
"/"
))
{
file_pattern
=
"*"
+
file_pattern
;
file_pattern
=
Format
.
replace
(
Format
.
replace
(
file_pattern
,
"*"
,
".*"
),
"?"
,
".?"
);
}
else
{
file_pattern
=
Format
.
replace
(
Format
.
replace
(
file_pattern
,
"*"
,
".*"
),
"?"
,
".?"
);
}
file_pattern
=
Format
.
replace
(
Format
.
replace
(
file_pattern
,
"*"
,
".*"
),
"?"
,
".?"
);
path
=
"/"
;
path_parts
.
remove
(
0
);
// position 0 otherwise is an empty string
for
(
int
i
=
0
;
i
<
path_parts
.
size
();
i
++)
{
String
s
=
path_parts
.
get
(
i
);
for
(
final
String
s
:
path_parts
)
{
if
(
s
.
contains
(
".*"
)
||
s
.
contains
(
".?"
))
break
;
path
+=
s
+
"/"
;
index
++;
}
Pattern
pat
=
Pattern
.
compile
(
file_pattern
);
final
Pattern
pat
=
Pattern
.
compile
(
file_pattern
);
logger
.
info
(
"Going to recurseAndFilterLFNs: "
+
path
+
" - "
+
file_pattern
+
" - "
+
index
+
" - "
+
flags
+
" - "
+
path_parts
.
toString
()
+
" metadata: "
+
metadata
);
...
...
@@ -147,13 +143,12 @@ public class LFNCSDUtils {
this
.
notifyAll
();
}
}
return
;
}
};
try
{
tPool
.
submit
(
rl
);
}
catch
(
RejectedExecutionException
ree
)
{
catch
(
final
RejectedExecutionException
ree
)
{
logger
.
severe
(
"LFNCSDUtils recurseAndFilterLFNs: can't submit: "
+
ree
);
return
false
;
}
...
...
@@ -164,7 +159,7 @@ public class LFNCSDUtils {
try
{
rl
.
wait
(
1
*
1000
);
}
catch
(
InterruptedException
e
)
{
catch
(
final
InterruptedException
e
)
{
logger
.
severe
(
"LFNCSDUtils recurseAndFilterLFNs: can't wait"
+
e
);
}
}
...
...
@@ -211,10 +206,8 @@ public class LFNCSDUtils {
public
void
notifyUp
()
{
if
(
this
.
counter_left
.
decrementAndGet
()
<=
0
)
{
if
(!
critical_errors
&&
!
operation
.
getOnlyAppend
())
{
if
(!
operation
.
callback
(
dir
))
critical_errors
=
true
;
}
if
((!
critical_errors
&&
!
operation
.
getOnlyAppend
())
&&
!
operation
.
callback
(
dir
))
critical_errors
=
true
;
if
(
critical_errors
)
parent
.
critical_errors
=
true
;
...
...
@@ -229,7 +222,7 @@ public class LFNCSDUtils {
@Override
public
void
run
()
{
boolean
lastpart
=
(!
operation
.
getRecurseInfinitely
()
&&
index
>=
parts
.
size
());
final
boolean
lastpart
=
(!
operation
.
getRecurseInfinitely
()
&&
index
>=
parts
.
size
());
boolean
includeDirs
=
false
;
if
((
flags
&
LFNCSDUtils
.
FIND_INCLUDE_DIRS
)
!=
0
)
...
...
@@ -240,14 +233,12 @@ public class LFNCSDUtils {
return
;
}
List
<
LFN_CSD
>
list
=
dir
.
list
(
true
,
append_table
,
clevel
);
final
List
<
LFN_CSD
>
list
=
dir
.
list
(
true
,
append_table
,
clevel
);
// if the dir is empty, do the operation and notify
if
(
list
.
isEmpty
())
{
if
(!
operation
.
getOnlyAppend
())
{
if
(!
operation
.
callback
(
dir
))
parent
.
critical_errors
=
true
;
}
if
(!
operation
.
getOnlyAppend
()
&&
!
operation
.
callback
(
dir
))
parent
.
critical_errors
=
true
;
parent
.
notifyUp
();
}
...
...
@@ -259,11 +250,11 @@ public class LFNCSDUtils {
JEP
jep
=
null
;
if
(
metadata
!=
null
&&
!
metadata
.
equals
(
""
))
{
if
(
metadata
!=
null
&&
!
""
.
equals
(
metadata
))
{
jep
=
new
JEP
();
jep
.
setAllowUndeclared
(
true
);
String
expression
=
Format
.
replace
(
Format
.
replace
(
Format
.
replace
(
metadata
,
"and"
,
"&&"
),
"or"
,
"||"
),
":"
,
"__"
);
expression
=
expression
.
replace
All
(
"\""
,
""
);
expression
=
expression
.
replace
(
"\""
,
""
);
jep
.
parseExpression
(
expression
);
}
...
...
@@ -272,24 +263,24 @@ public class LFNCSDUtils {
filesVersion
=
new
ArrayList
<>();
// loop entries
for
(
LFN_CSD
lfnc
:
list
)
{
for
(
final
LFN_CSD
lfnc
:
list
)
{
if
(
lfnc
.
type
!=
'd'
)
{
// no dir
if
(
lastpart
||
operation
.
getRecurseInfinitely
())
{
// check pattern
Matcher
m
=
p
.
matcher
(
operation
.
getRecurseInfinitely
()
?
lfnc
.
canonicalName
:
lfnc
.
child
);
final
Matcher
m
=
p
.
matcher
(
operation
.
getRecurseInfinitely
()
?
lfnc
.
canonicalName
:
lfnc
.
child
);
if
(
m
.
matches
())
{
if
(
jep
!=
null
)
{
// we check the metadata of the file against our expression
Set
<
String
>
keys_values
=
new
HashSet
<>();
final
Set
<
String
>
keys_values
=
new
HashSet
<>();
// set the variable values from the metadata map
for
(
String
s
:
lfnc
.
metadata
.
keySet
())
{
for
(
final
String
s
:
lfnc
.
metadata
.
keySet
())
{
Double
value
;
try
{
value
=
Double
.
valueOf
(
lfnc
.
metadata
.
get
(
s
));
}
catch
(
NumberFormatException
e
)
{
catch
(
final
NumberFormatException
e
)
{
logger
.
info
(
"Skipped: "
+
s
+
e
);
continue
;
}
...
...
@@ -300,8 +291,8 @@ public class LFNCSDUtils {
try
{
// This should return 1.0 or 0.0
Object
result
=
jep
.
getValueAsObject
();
if
(
result
!=
null
&&
result
instanceof
Double
&&
((
Double
)
result
).
intValue
()
==
1.0
)
{
final
Object
result
=
jep
.
getValueAsObject
();
if
(
result
instanceof
Double
&&
((
Double
)
result
).
intValue
()
==
1.0
)
{
if
(
filesVersion
!=
null
)
filesVersion
.
add
(
lfnc
);
else
{
...
...
@@ -311,12 +302,12 @@ public class LFNCSDUtils {
}
}
}
catch
(
Exception
e
)
{
catch
(
final
Exception
e
)
{
logger
.
info
(
"RecurseLFNs metadata - cannot get result: "
+
e
);
}
// unset the variables for the next lfnc to be processed
for
(
String
s
:
keys_values
)
{
for
(
final
String
s
:
keys_values
)
{
jep
.
setVarValue
(
s
,
null
);
}
}
...
...
@@ -338,11 +329,10 @@ public class LFNCSDUtils {
// if we already passed the hierarchy introduced on the command, all dirs are valid
try
{
if
(
includeDirs
)
{
Matcher
m
=
p
.
matcher
(
operation
.
getRecurseInfinitely
()
?
lfnc
.
canonicalName
:
lfnc
.
child
);
if
(
m
.
matches
())
if
(!
operation
.
callback
(
lfnc
))
{
parent
.
critical_errors
=
true
;
}
final
Matcher
m
=
p
.
matcher
(
operation
.
getRecurseInfinitely
()
?
lfnc
.
canonicalName
:
lfnc
.
child
);
if
(
m
.
matches
()
&&
!
operation
.
callback
(
lfnc
))
{
parent
.
critical_errors
=
true
;
}
}
if
(
operation
.
getRecurseInfinitely
())
{
// submit
...
...
@@ -351,18 +341,18 @@ public class LFNCSDUtils {
submitted
++;
tPool
.
submit
(
new
RecurseLFNs
(
this
,
operation
,
base
+
lfnc
.
child
+
"/"
,
file_pattern
,
index
+
1
,
parts
,
flags
,
metadata
,
lfnc
));
}
catch
(
RejectedExecutionException
ree
)
{
catch
(
final
RejectedExecutionException
ree
)
{
logger
.
severe
(
"LFNCSDUtils recurseAndFilterLFNs: can't submit: "
+
ree
);
}
}
}
catch
(
RejectedExecutionException
ree
)
{
catch
(
final
RejectedExecutionException
ree
)
{
logger
.
severe
(
"LFNCSDUtils recurseAndFilterLFNs: can't submit dir(l) - "
+
base
+
lfnc
.
child
+
"/"
+
": "
+
ree
);
}
}
else
{
// while exploring introduced dir, need to check patterns
Matcher
m
=
p
.
matcher
(
lfnc
.
child
);
final
Matcher
m
=
p
.
matcher
(
lfnc
.
child
);
if
(
m
.
matches
())
{
// submit the dir
try
{
...
...
@@ -370,7 +360,7 @@ public class LFNCSDUtils {
submitted
++;
tPool
.
submit
(
new
RecurseLFNs
(
this
,
operation
,
base
+
lfnc
.
child
+
"/"
,
file_pattern
,
index
+
1
,
parts
,
flags
,
metadata
,
lfnc
));
}
catch
(
RejectedExecutionException
ree
)
{
catch
(
final
RejectedExecutionException
ree
)
{
logger
.
severe
(
"LFNCSDUtils recurseAndFilterLFNs: can't submit dir - "
+
base
+
lfnc
.
child
+
"/"
+
": "
+
ree
);
}
}
...
...
@@ -380,10 +370,10 @@ public class LFNCSDUtils {
// we filter and add the file if -y and metadata
if
(
filesVersion
!=
null
)
{
HashMap
<
String
,
Integer
>
lfn_version
=
new
HashMap
<>();
HashMap
<
String
,
LFN_CSD
>
lfn_to_csd
=
new
HashMap
<>();
final
HashMap
<
String
,
Integer
>
lfn_version
=
new
HashMap
<>();
final
HashMap
<
String
,
LFN_CSD
>
lfn_to_csd
=
new
HashMap
<>();
for
(
LFN_CSD
lfnc
:
filesVersion
)
{
for
(
final
LFN_CSD
lfnc
:
filesVersion
)
{
Integer
version
=
Integer
.
valueOf
(
0
);
String
lfn_without_version
=
lfnc
.
child
;
if
(
lfnc
.
child
.
lastIndexOf
(
"_v"
)
>
0
)
{
...
...
@@ -429,7 +419,7 @@ public class LFNCSDUtils {
* @return list of files for find command
*/
public
static
Collection
<
LFN_CSD
>
find
(
final
String
base_path
,
final
String
pattern
,
final
int
flags
,
final
String
metadata
)
{
Append
ap
=
new
Append
();
final
Append
ap
=
new
Append
();
ap
.
setRecurseInfinitely
(
true
);
ap
.
setOnlyAppend
(
true
);
recurseAndFilterLFNs
(
ap
,
base_path
,
"*"
+
pattern
,
metadata
,
flags
);
...
...
@@ -443,7 +433,7 @@ public class LFNCSDUtils {
public
static
Collection
<
LFN_CSD
>
ls
(
final
String
path
)
{
// if need to resolve wildcard and recurse, we call the recurse method
if
(
path
.
contains
(
"*"
)
||
path
.
contains
(
"?"
))
{
Append
ap
=
new
Append
();
final
Append
ap
=
new
Append
();
ap
.
setOnlyAppend
(
true
);
recurseAndFilterLFNs
(
ap
,
path
,
null
,
null
,
LFNCSDUtils
.
FIND_INCLUDE_DIRS
);
return
ap
.
getLfnsOk
();
...
...
@@ -451,9 +441,9 @@ public class LFNCSDUtils {
// otherwise we should be able to create the LFN_CSD from the path
final
Set
<
LFN_CSD
>
ret
=
new
TreeSet
<>();
LFN_CSD
lfnc
=
new
LFN_CSD
(
path
,
true
,
append_table
,
null
,
null
);
final
LFN_CSD
lfnc
=
new
LFN_CSD
(
path
,
true
,
append_table
,
null
,
null
);
if
(
lfnc
.
isDirectory
())
{
List
<
LFN_CSD
>
list
=
lfnc
.
list
(
true
,
append_table
,
clevel
);
final
List
<
LFN_CSD
>
list
=
lfnc
.
list
(
true
,
append_table
,
clevel
);
ret
.
addAll
(
list
);
}
else
{
...
...
@@ -532,7 +522,7 @@ public class LFNCSDUtils {
// expand wildcards and filter if needed
if
(
source
.
contains
(
"*"
)
||
source
.
contains
(
"?"
))
{
Move
mv
=
new
Move
();
final
Move
mv
=
new
Move
();
mv
.
setUser
(
user
);
mv
.
setLfnTarget
(
lfnc_target
);
mv
.
setLfnTargetParent
(
lfnc_target_parent
);
...
...
@@ -540,7 +530,7 @@ public class LFNCSDUtils {
return
(
mv
.
getLfnsError
().
isEmpty
()
?
0
:
4
);
}
LFN_CSD
lfnc_source
=
new
LFN_CSD
(
source
,
true
,
null
,
null
,
null
);
final
LFN_CSD
lfnc_source
=
new
LFN_CSD
(
source
,
true
,
null
,
null
,
null
);
// check permissions to move
if
(!
AuthorizationChecker
.
canWrite
(
lfnc_source
,
user
))
{
logger
.
info
(
"LFNCSDUtils: mv: no permission on the source: "
+
source
);
...
...
@@ -570,7 +560,7 @@ public class LFNCSDUtils {
// expand wildcards and filter if needed
if
(
lfn
.
contains
(
"*"
)
||
lfn
.
contains
(
"?"
)
||
recursive
)
{
Delete
de
=
new
Delete
();
final
Delete
de
=
new
Delete
();
de
.
setUser
(
user
);
recurseAndFilterLFNs
(
de
,
lfn
,
null
,
null
,
LFNCSDUtils
.
FIND_INCLUDE_DIRS
);
return
de
.
getLfnsError
().
isEmpty
();
...
...
@@ -672,7 +662,7 @@ public class LFNCSDUtils {
try
{
created
=
LFN_CSD
.
createDirectory
(
lfnc
.
canonicalName
,
null
,
ConsistencyLevel
.
QUORUM
,
lfnc
.
owner
,
lfnc
.
gowner
,
0
,
"755"
,
new
Date
());
}
catch
(
Exception
e
)
{
catch
(
final
Exception
e
)
{
logger
.
severe
(
"LFNCSDUtils: mkdir: exception creating directory: "
+
lfnc
.
canonicalName
+
": exception: "
+
e
.
toString
());
}
...
...
@@ -692,7 +682,7 @@ public class LFNCSDUtils {
* @return transfer IDs to each SE
*/
public
static
HashMap
<
String
,
Long
>
mirror
(
final
String
path
,
final
List
<
String
>
ses
,
final
List
<
String
>
exses
,
final
HashMap
<
String
,
Integer
>
qos
,
final
Integer
attempts
)
{
LFN_CSD
lfnc
=
new
LFN_CSD
(
path
,
true
,
null
,
null
,
null
);
final
LFN_CSD
lfnc
=
new
LFN_CSD
(
path
,
true
,
null
,
null
,
null
);
if
(!
lfnc
.
exists
||
lfnc
.
pfns
.
size
()
<=
0
)
return
null
;
...
...
@@ -700,7 +690,7 @@ public class LFNCSDUtils {
// find closest SE
final
String
site
=
ConfigUtils
.
getCloseSite
();
for
(
Integer
seNumber
:
lfnc
.
pfns
.
keySet
())
{
for
(
final
Integer
seNumber
:
lfnc
.
pfns
.
keySet
())
{
exses
.
add
(
SEUtils
.
getSE
(
seNumber
).
getName
());
}
...
...
@@ -716,7 +706,7 @@ public class LFNCSDUtils {
/**
* Change owner
*
*
* @param user
* @param lfn
* @param new_owner
...
...
@@ -733,7 +723,7 @@ public class LFNCSDUtils {
// expand wildcards and filter if needed
if
(
lfn
.
contains
(
"*"
)
||
lfn
.
contains
(
"?"
)
||
recursive
)
{
Chown
ch
=
new
Chown
();
final
Chown
ch
=
new
Chown
();
ch
.
setUser
(
user
);
ch
.
setNewOwner
(
new_owner
);
ch
.
setNewGroup
(
new_group
);
...
...
@@ -764,7 +754,7 @@ public class LFNCSDUtils {
* @param getFromDB
* @return LFN_CSD corresponding to path
*/
public
static
LFN_CSD
getLFN
(
String
path
,
boolean
getFromDB
)
{
public
static
LFN_CSD
getLFN
(
final
String
path
,
final
boolean
getFromDB
)
{
return
new
LFN_CSD
(
path
,
getFromDB
,
null
,
null
,
null
);