-
Notifications
You must be signed in to change notification settings - Fork 154
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
12 changed files
with
196 additions
and
10 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
11 changes: 11 additions & 0 deletions
11
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,11 @@ | ||
package org.jfrog.artifactory.client.model; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
public interface FileList { | ||
|
||
String getUri(); | ||
Date getCreated(); | ||
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(); | ||
} |
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 @@ | ||
currentVersion=2.9.x-SNAPSHOT | ||
currentVersion=2.9.1 |
43 changes: 43 additions & 0 deletions
43
services/src/main/groovy/org/jfrog/artifactory/client/impl/FolderHandleImpl.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,43 @@ | ||
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; | ||
|
||
import java.io.IOException; | ||
|
||
public class FolderHandleImpl extends ItemHandleImpl implements FolderHandle { | ||
|
||
private final String baseApiPath; | ||
|
||
private final ArtifactoryImpl artifactory; | ||
private final String repo; | ||
private final 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; | ||
} | ||
|
||
public FileList list(boolean deep, boolean listFolders, boolean timestamps) { | ||
String deepInt = toInt(deep); | ||
String listFoldersInt = toInt(listFolders); | ||
String timestampsInt = toInt(timestamps); | ||
String url = String.format("%s/storage/%s/%s?list&deep=%s&listFolders=%s&mdTimestamps=%s", | ||
baseApiPath, repo, path, deepInt, listFoldersInt, timestampsInt); | ||
|
||
FileListImpl fileListImpl = new FileListImpl(); | ||
try { | ||
return artifactory.get(url, fileListImpl.getClass(), null); | ||
} catch (IOException e) { | ||
return null; | ||
} | ||
} | ||
|
||
private 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
39 changes: 39 additions & 0 deletions
39
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,39 @@ | ||
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 String getUri() { | ||
return uri; | ||
} | ||
|
||
@Override | ||
public Date getCreated() { | ||
return created; | ||
} | ||
|
||
@Override | ||
public List<ListItem> getFiles() { | ||
return Arrays.asList(files); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
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,50 @@ | ||
package org.jfrog.artifactory.client.model.impl; | ||
|
||
import org.jfrog.artifactory.client.model.File; | ||
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