-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
179 additions
and
12 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
9 changes: 9 additions & 0 deletions
9
api/src/main/java/org/jfrog/artifactory/client/FolderHandle.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,9 @@ | ||
package org.jfrog.artifactory.client; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import org.jfrog.artifactory.client.model.FileList; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public interface FolderHandle extends ItemHandle { | ||
FileList list(boolean deep, boolean listFolders, boolean timestamps); | ||
} |
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
9 changes: 9 additions & 0 deletions
9
api/src/main/java/org/jfrog/artifactory/client/model/FileList.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,9 @@ | ||
package org.jfrog.artifactory.client.model; | ||
|
||
import java.util.List; | ||
|
||
public interface FileList { | ||
|
||
int size(); | ||
List<ListItem> getFiles(); | ||
} |
11 changes: 11 additions & 0 deletions
11
api/src/main/java/org/jfrog/artifactory/client/model/ListItem.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,11 @@ | ||
package org.jfrog.artifactory.client.model; | ||
|
||
import java.util.Date; | ||
|
||
public interface ListItem { | ||
String getUri(); | ||
Long getSize(); | ||
Date getLastModified(); | ||
Boolean isFolder(); | ||
String getSha1(); | ||
} |
35 changes: 35 additions & 0 deletions
35
services/src/main/groovy/org/jfrog/artifactory/client/impl/FolderHandleImpl.groovy
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,35 @@ | ||
package org.jfrog.artifactory.client.impl | ||
|
||
import org.jfrog.artifactory.client.FolderHandle | ||
import org.jfrog.artifactory.client.model.FileList | ||
import org.jfrog.artifactory.client.model.impl.FileListImpl | ||
|
||
class FolderHandleImpl extends ItemHandleImpl implements FolderHandle { | ||
|
||
private String baseApiPath | ||
|
||
private ArtifactoryImpl artifactory | ||
private String repo | ||
private String path | ||
|
||
FolderHandleImpl(ArtifactoryImpl artifactory, String baseApiPath, String repo, String path, Class itemType) { | ||
super(artifactory, baseApiPath, repo, path, itemType) | ||
this.artifactory = artifactory | ||
this.repo = repo | ||
this.path = path | ||
this.baseApiPath = baseApiPath | ||
} | ||
|
||
FileList list(boolean deep, boolean listFolders, boolean timestamps) { | ||
String deepInt = toInt(deep) | ||
String listFoldersInt = toInt(listFolders) | ||
String timestampsInt = toInt(timestamps) | ||
String url = baseApiPath + "/storage/$repo/$path?list&deep=$deepInt&listFolders=$listFoldersInt&mdTimestamps=$timestampsInt" | ||
return artifactory.get(url, FileListImpl, FileList) | ||
} | ||
|
||
private static String toInt(boolean b) { | ||
return b?"1":"0" | ||
} | ||
|
||
} |
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
34 changes: 34 additions & 0 deletions
34
services/src/main/java/org/jfrog/artifactory/client/model/impl/FileListImpl.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,34 @@ | ||
package org.jfrog.artifactory.client.model.impl; | ||
|
||
import org.jfrog.artifactory.client.model.FileList; | ||
import org.jfrog.artifactory.client.model.ListItem; | ||
|
||
import java.util.Arrays; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
public class FileListImpl implements FileList { | ||
|
||
String uri; | ||
Date created; | ||
ListItemImpl[] files; | ||
|
||
FileListImpl(String uri, Date created, ListItemImpl[] files) { | ||
this.uri = uri; | ||
this.created = created; | ||
this.files = files; | ||
} | ||
|
||
public FileListImpl() { | ||
} | ||
|
||
@Override | ||
public int size() { | ||
return files.length; | ||
} | ||
|
||
@Override | ||
public List<ListItem> getFiles() { | ||
return Arrays.asList(files); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
services/src/main/java/org/jfrog/artifactory/client/model/impl/ListItemImpl.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,48 @@ | ||
package org.jfrog.artifactory.client.model.impl; | ||
|
||
import org.jfrog.artifactory.client.model.ListItem; | ||
|
||
import java.util.Date; | ||
|
||
public class ListItemImpl implements ListItem { | ||
String uri; | ||
Long size; | ||
Date lastModified; | ||
Boolean folder; | ||
String sha1; | ||
|
||
ListItemImpl(String uri, Long size, Date lastModified, Boolean folder) { | ||
this.uri = uri; | ||
this.size = size; | ||
this.lastModified = lastModified; | ||
this.folder = folder; | ||
} | ||
|
||
ListItemImpl() { | ||
} | ||
|
||
@Override | ||
public String getUri() { | ||
return uri; | ||
} | ||
|
||
@Override | ||
public Long getSize() { | ||
return size; | ||
} | ||
|
||
@Override | ||
public Date getLastModified() { | ||
return lastModified; | ||
} | ||
|
||
@Override | ||
public Boolean isFolder() { | ||
return folder; | ||
} | ||
|
||
@Override | ||
public String getSha1() { | ||
return sha1; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
services/src/main/resources/artifactory.client.release.properties
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 |
---|---|---|
@@ -1 +1 @@ | ||
version=2.9.1 | ||
version=2.9.x-SNAPSHOT |
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