Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
File Repository
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
Operations
Operations
Incidents
Environments
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
File Repository
Commits
08036e3f
Commit
08036e3f
authored
Aug 31, 2018
by
Matija Obreza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FTP: CanBeAnythingFile updated with date and dir/file type
parent
7c85407d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
17 deletions
+18
-17
file-repository-ftpserver/src/main/java/org/genesys/filerepository/service/ftp/CanBeAnythingFile.java
...genesys/filerepository/service/ftp/CanBeAnythingFile.java
+13
-13
file-repository-ftpserver/src/main/java/org/genesys/filerepository/service/ftp/RepositoryFileSystemFactory.java
...lerepository/service/ftp/RepositoryFileSystemFactory.java
+5
-4
No files found.
file-repository-ftpserver/src/main/java/org/genesys/filerepository/service/ftp/CanBeAnythingFile.java
View file @
08036e3f
...
...
@@ -18,6 +18,8 @@ package org.genesys.filerepository.service.ftp;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.nio.file.Path
;
import
java.util.Date
;
import
java.util.List
;
import
org.apache.ftpserver.ftplet.FtpFile
;
...
...
@@ -28,20 +30,18 @@ import org.apache.ftpserver.ftplet.FtpFile;
public
abstract
class
CanBeAnythingFile
implements
FtpFile
{
/** The parent. */
private
final
String
parent
;
/** The name. */
private
final
String
name
;
private
final
Path
path
;
private
long
date
=
new
Date
().
getTime
();
protected
boolean
dir
=
false
;
/**
* Instantiates a new can be anything file.
*
* @param parent the parent
* @param
name
the name
* @param
path2
the name
*/
public
CanBeAnythingFile
(
final
String
parent
,
final
String
name
)
{
this
.
parent
=
parent
;
this
.
name
=
name
;
public
CanBeAnythingFile
(
final
Path
parent
,
final
String
name
)
{
this
.
path
=
parent
.
resolve
(
name
);
}
/*
...
...
@@ -50,7 +50,7 @@ public abstract class CanBeAnythingFile implements FtpFile {
*/
@Override
public
String
getAbsolutePath
()
{
return
pa
rent
.
length
()
>
1
?
parent
.
concat
(
"/"
).
concat
(
name
)
:
parent
.
concat
(
name
);
return
pa
th
.
toAbsolutePath
().
toString
(
);
}
/*
...
...
@@ -59,7 +59,7 @@ public abstract class CanBeAnythingFile implements FtpFile {
*/
@Override
public
String
getName
()
{
return
name
;
return
path
.
getFileName
().
toString
()
;
}
/*
...
...
@@ -77,7 +77,7 @@ public abstract class CanBeAnythingFile implements FtpFile {
*/
@Override
public
boolean
isDirectory
()
{
return
true
;
return
dir
;
}
/*
...
...
@@ -86,7 +86,7 @@ public abstract class CanBeAnythingFile implements FtpFile {
*/
@Override
public
boolean
isFile
()
{
return
true
;
return
!
dir
;
}
/*
...
...
@@ -158,7 +158,7 @@ public abstract class CanBeAnythingFile implements FtpFile {
*/
@Override
public
long
getLastModified
()
{
return
0
;
return
date
;
}
/*
...
...
file-repository-ftpserver/src/main/java/org/genesys/filerepository/service/ftp/RepositoryFileSystemFactory.java
View file @
08036e3f
...
...
@@ -301,9 +301,9 @@ public class RepositoryFileSystemFactory implements FileSystemFactory, Initializ
// directory
directory
(
path
.
toString
(),
this
)
// or file
:
file
(
repositoryService
.
getFile
(
:
file
(
FtpRunAs
.
asFtpUser
(
user
,
()
->
repositoryService
.
getFile
(
path
.
getParent
().
toString
(),
path
.
getFileName
().
toString
()),
this
);
path
.
getFileName
().
toString
())
)
,
this
);
}
catch
(
final
AuthenticationException
e
)
{
LOG
.
warn
(
"Authentication problem {}"
,
e
.
getMessage
(),
e
);
...
...
@@ -311,10 +311,11 @@ public class RepositoryFileSystemFactory implements FileSystemFactory, Initializ
}
catch
(
final
NoSuchRepositoryFileException
e
)
{
LOG
.
debug
(
"Making new CanBeAnythingFile path={} name={}"
,
path
.
getParent
().
toString
(),
path
.
getFileName
().
toString
());
return
new
CanBeAnythingFile
(
path
.
getParent
()
.
toString
()
,
path
.
getFileName
().
toString
())
{
return
new
CanBeAnythingFile
(
path
.
getParent
(),
path
.
getFileName
().
toString
())
{
@Override
public
boolean
mkdir
()
{
this
.
dir
=
true
;
LOG
.
info
(
"Mkdir path={}"
,
this
.
getAbsolutePath
());
temporaryDirs
.
add
(
this
.
getAbsolutePath
());
return
true
;
...
...
@@ -391,8 +392,8 @@ public class RepositoryFileSystemFactory implements FileSystemFactory, Initializ
* @param user the user
*/
public
RepositoryFileSystemView
(
final
FtpUser
user
)
{
username
=
user
.
getName
();
this
.
user
=
user
;
username
=
user
.
getName
();
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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