Thank you for your time. Some would have used already the suitable java swift api for CS. Would like to hear from them.
I tried using, https://github.com/rackerlabs/java-cloudfiles. Since it requires lot of other deps, the java program fails. I'm getting,
java -classpath lib/*:apache-log4j-1.2.16/log4j-1.2.16.jar:. MyExample
log4j:WARN No appenders could be found for logger (com.rackspacecloud.client.cloudfiles.FilesUtil).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.IllegalArgumentException: timeout can't be negative
at java.net.Socket.setSoTimeout(Socket.java:1091)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:116)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at com.rackspacecloud.client.cloudfiles.FilesClient.login(FilesClient.java:288)
at MyExample.main(MyExample.java:22)
and java program is:
import java.io.*;
import java.io.File;
import java.util.List;
import java.util.Map;
import com.rackspacecloud.client.cloudfiles.FilesClient;
import com.rackspacecloud.client.cloudfiles.FilesConstants;
import com.rackspacecloud.client.cloudfiles.FilesContainer;
import com.rackspacecloud.client.cloudfiles.FilesContainerExistsException;
import com.rackspacecloud.client.cloudfiles.FilesObject;
import com.rackspacecloud.client.cloudfiles.FilesObjectMetaData;
import org.apache.http.*;
public class MyExample {
public static void main(String a[]){
String username = "raj:swift";
String password = "PJpKiW4XVjC534czbbgexOS6/TEpso6p306ML9KZ";
String authUrl = "http://192.168.211.71/auth";
try {
FilesClient client = new FilesClient(username, password, authUrl);
if (!client.login()) {
throw new RuntimeException("Failed to log in");
}
client.createContainer("my-new-javacontainer");
File file = new File("foo.txt");
String mimeType = FilesConstants.getMimetype("txt");
client.storeObject("my-new-javacontainer", file, mimeType);
List<FilesObject> objects = client.listObjects("my-new-javacontainer");
for (FilesObject object : objects) {
System.out.println(" " + object.getName());
}
} catch(HttpException | IOException e) {
System.out.println("error");
}
}
}
On Tue, Jan 7, 2014 at 12:45 PM, raj kumar <rajkumar600003@xxxxxxxxx> wrote:
I meant could not find required jar files to run java swift program.On Mon, Jan 6, 2014 at 11:35 PM, raj kumar <rajkumar600003@xxxxxxxxx> wrote:
Hi, could find all necessary jars required to run the java program. Is there any place to get all jars for both swift and s3? Thanks.
_______________________________________________ ceph-users mailing list ceph-users@xxxxxxxxxxxxxx http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com