Skip to content

Commit

Permalink
common prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrichsralf committed Aug 25, 2021
1 parent 30c2032 commit 86c4213
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 31 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ The Ladon S3 Server is built using Java 8-13 and Maven
If you prefer to run it with Jetty have a look at the [Jetty example](./ladon-s3-server-jetty/src/main/java/de/mc/ladon/s3server/jetty/S3JettyServer.java )

```bash
mvn package && java -jar ladon-s3-server-jetty/target/ladon-s3-server-jetty-2.3.0.jar
mvn package && java -jar ladon-s3-server-jetty/target/ladon-s3-server-jetty-2.3.1.jar
```

### Spring Boot:

```bash
mvn package && java -jar ladon-s3-server-boot/target/ladon-s3-server-boot-2.3.0.jar
mvn package && java -jar ladon-s3-server-boot/target/ladon-s3-server-boot-2.3.1.jar
```
Or run Docker:
```bash
mvn package && docker run -i --network=host mindconsulting/ladon:2.3.0
mvn package && docker run -i --network=host mindconsulting/ladon:2.3.1
```

### Example credentials
Expand Down
2 changes: 1 addition & 1 deletion ladon-s3-server-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.mindconsulting</groupId>
<artifactId>ladon-s3-server-boot</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
<packaging>jar</packaging>

<name>s3-server-boot</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ s3server.baseUrl=/api/s3
s3server.threadPoolSize=5
# enable or disable the authorization header check. if disabled, the system user will be used for all requests
# and all data is exposed to public!
s3server.securityEnabled=true
s3server.securityEnabled=false
# switch to enable logging. each api request and each repository call will be logged
s3server.loggingEnabled=true
# directory where the FSRepository stores the bucket and file data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ public static void main(String[] args) {

System.out.println(count);

client.putObject("test", "peter/", "");
System.out.println(client.listObjects("test").getCommonPrefixes());
}

private static void printListing(ObjectListing listing) {
Expand Down
2 changes: 1 addition & 1 deletion ladon-s3-server-fs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.mindconsulting</groupId>
<artifactId>ladon-s3-server-fs</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
<build>
<plugins>
<plugin>
Expand Down
4 changes: 2 additions & 2 deletions ladon-s3-server-jetty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>s3-server</artifactId>
<groupId>de.mindconsulting</groupId>
<version>2.3.0</version>
<version>2.3.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ladon-s3-server-jetty</artifactId>
Expand All @@ -26,7 +26,7 @@
<dependency>
<groupId>de.mindconsulting</groupId>
<artifactId>ladon-s3-server-fs</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion ladon-s3-server-osgi-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.mindconsulting</groupId>
<artifactId>ladon-s3-server-osgi-starter</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
<build>
<plugins>
<plugin>
Expand Down
4 changes: 2 additions & 2 deletions ladon-s3-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.mindconsulting</groupId>
<artifactId>ladon-s3-server</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -65,7 +65,7 @@
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
@XmlRootElement(name = "CommonPrefixes")
public class CommonPrefixes {

private List<String> prefix;
private String prefix;


public CommonPrefixes() {
}

public CommonPrefixes(List<String> prefix) {
public CommonPrefixes(String prefix) {
this.prefix = prefix;
}

@XmlElement(name = "Prefix")
public List<String> getPrefix() {
public String getPrefix() {
return prefix;
}

public void setPrefix(List<String> prefix) {
public void setPrefix(String prefix) {
this.prefix = prefix;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ public class ListBucketResult {
private String delimiter;
private Boolean isTruncated;
private List<Contents> contentsList;
private CommonPrefixes commonPrefixes;
private List<CommonPrefixes> commonPrefixes;

public ListBucketResult() {
}

public ListBucketResult(S3CallContext callContext,
String bucketName,
List<Contents> contentsList,
CommonPrefixes commonPrefixes,
List<CommonPrefixes> commonPrefixes,
boolean isTruncated) {
this.bucketName = bucketName;
this.prefix = getEncoded(callContext,callContext.getParams().getPrefix());
this.marker = getEncoded(callContext,callContext.getParams().getMarker());
this.prefix = getEncoded(callContext, callContext.getParams().getPrefix());
this.marker = getEncoded(callContext, callContext.getParams().getMarker());
this.maxKeys = callContext.getParams().getMaxKeys();
this.delimiter = getEncoded(callContext,callContext.getParams().getDelimiter());
this.delimiter = getEncoded(callContext, callContext.getParams().getDelimiter());
this.isTruncated = isTruncated;
this.contentsList = contentsList;
this.commonPrefixes = commonPrefixes;
Expand Down Expand Up @@ -89,6 +89,7 @@ public String getDelimiter() {
public void setDelimiter(String delimiter) {
this.delimiter = delimiter;
}

@XmlElement(name = "IsTruncated")
public Boolean getIsTruncated() {
return isTruncated;
Expand All @@ -109,11 +110,11 @@ public void setContentsList(List<Contents> contentsList) {


@XmlElement(name = "CommonPrefixes")
public CommonPrefixes getCommonPrefixes() {
public List<CommonPrefixes> getCommonPrefixes() {
return commonPrefixes;
}

public void setCommonPrefixesList(CommonPrefixes commonPrefixes) {
public void setCommonPrefixesList(List<CommonPrefixes> commonPrefixes) {
this.commonPrefixes = commonPrefixes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;

import static de.mc.ladon.s3server.common.EncodingUtil.*;
import static de.mc.ladon.s3server.common.EncodingUtil.getEncoded;

/**
* @author Ralf Ulrich on 17.02.16.
Expand All @@ -28,23 +28,23 @@ public class ListVersionsResult {
private String delimiter;
private Boolean isTruncated;
private List<AbstractVersionElement> versions;
private CommonPrefixes commonPrefixes;
private List<CommonPrefixes> commonPrefixes;

public ListVersionsResult() {
}

public ListVersionsResult(S3CallContext callContext,
String bucketName,
List<AbstractVersionElement> versions,
CommonPrefixes commonPrefixes,
List<CommonPrefixes> commonPrefixes,
boolean isTruncated,
String nextKeyMarker,
String nextVersionIdMarker) {
this.bucketName = bucketName;
this.prefix = getEncoded(callContext, callContext.getParams().getPrefix());
this.keyMarker = callContext.getParams().getKeyMarker();
this.maxKeys = callContext.getParams().getMaxKeys();
this.delimiter = getEncoded(callContext,callContext.getParams().getDelimiter());
this.delimiter = getEncoded(callContext, callContext.getParams().getDelimiter());
this.isTruncated = isTruncated;
this.versions = versions;
this.nextKeyMarker = nextKeyMarker;
Expand Down Expand Up @@ -126,11 +126,11 @@ public void setVersions(List<AbstractVersionElement> versions) {
}

@XmlElement(name = "CommonPrefixes")
public CommonPrefixes getCommonPrefixes() {
public List<CommonPrefixes> getCommonPrefixes() {
return commonPrefixes;
}

public void setCommonPrefixesList(CommonPrefixes commonPrefixes) {
public void setCommonPrefixesList(List<CommonPrefixes> commonPrefixes) {
this.commonPrefixes = commonPrefixes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public static ListBucketResult listBucketResult(S3CallContext callContext, S3Lis
list.getObjects().stream().map(o -> new Contents(new Owner(o.getOwner().getUserId(), o.getOwner().getUserName()),
getEncoded(callContext, o.getKey()), o.getLastModified(), o.getETag(), o.getSize(), o.getStorageClass()))
.collect(Collectors.toList()),
list.getCommonPrefixes() != null ? new CommonPrefixes(list.getCommonPrefixes()) : null,
list.getCommonPrefixes() != null ? list.getCommonPrefixes().stream()
.map(CommonPrefixes::new).collect(Collectors.toList()) : null,
list.isTruncated());
}

Expand All @@ -47,7 +48,8 @@ public static ListVersionsResult listVersionsResult(S3CallContext callContext, S
return new Version(new Owner(o.getOwner().getUserId(), o.getOwner().getUserName()),
getEncoded(callContext, o.getKey()), o.getVersionId(), o.isLatest(), o.getLastModified(), o.getETag(), o.getSize(), o.getStorageClass());
}
}).collect(Collectors.toList()), list.getCommonPrefixes() != null ? new CommonPrefixes(list.getCommonPrefixes()) : null, list.isTruncated(),
}).collect(Collectors.toList()), list.getCommonPrefixes() != null ? list.getCommonPrefixes().stream()
.map(CommonPrefixes::new).collect(Collectors.toList()) : null, list.isTruncated(),
getEncoded(callContext, list.nextKeyMarker()),
getEncoded(callContext, list.nextVersionIdMarker()));
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.mindconsulting</groupId>
<artifactId>s3-server</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
<packaging>pom</packaging>

<name>s3-server-boot</name>
Expand Down

0 comments on commit 86c4213

Please sign in to comment.