|
GettingStarted
IntroductionLittleS3 is distributed as a WAR file designed to be installed and run from a Java-based application server. This documentation uses Tomcat as an example. The goal is to install littleS3 and be able to manually store objects within the application. InstallationTomcatTo start, download and install Tomcat as appropriate for your environment. Configuration filesLittleS3 uses two configuration files by default: StorageEngine.properties and StorageEngine-servlet.xml. These configuration files are loaded automatically from the classpath. Custom classpathYou can modify the Tomcat start up script to modify the default. For example... In the tomcat home directory, C:\apps\apache-tomcat-5.5.23 for instance, create a new directory named "settings". Edit the catalina.bat file, found in the "tomcat home directory/bin" directory, adding: rem Extra classpath environment stuff set CLASSPATH=%CLASSPATH%;C:\apps\apache-tomcat-5.5.23\settings to this section: :noJsse set CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\bootstrap.jar rem Extra classpath environment stuff set CLASSPATH=%CLASSPATH%;C:\apps\apache-tomcat-5.5.23\settings if not "%CATALINA_BASE%" == "" goto gotBase set CATALINA_BASE=%CATALINA_HOME% :gotBase The two configuration files StorageEngine.properties and StorageEngine-servlet.xml can now be placed in the new directory "settings". Deploy warThe littleS3 application is distributed as a WAR file. The WAR packaging follows the pattern littleS3-[version].war: littleS3-2.1.0.war for instance. A WAR file can be deployed to a default Tomcat instance by placing the WAR file in the "tomcat home directory/webapps" directory. Tomcat will automatically unpack and deploy the WAR. This will make the littleS3 application available at the URL: http://localhost:8080/littleS3-2.1.0/ Where "localhost:8080" is the host and default port that Tomcat uses. There are more advanced Tomcat deployment options that allow you to control the "context path", the "/littleS3-2.1.0" portion of the URL. You could deploy to a context path of "/littleS3", or even to the Tomcat root, so the context path would be "/". The context path is important when crafting the URL to access littlS3, as the S3 protocol uses URL components to create buckets. ConfigurationThere are two configuration files for littleS3: StorageEngine-servlet.xml and StorageEngine.properties.
Property Names
SourceThe source is divided into 4 different components: api, webapp, filesystem module, and je module. The api component provides the common objects used by the system. The webapp is the collection of the other components into a runnable system. The filesystem and je modules provide different persistent storage options. The filesystem module stores the persistent data using plain files in the file system. The je module store stores the persistent data using the Oracle Berkeley DB Java Edition (JE) database. Basic UsageIn these samples, I have used a base URL of http://localhost:8080/littleS3-2.1.0/. The StorageEngine.properties configuration parameter host is set to the value localhost:8080: host=localhost:8080 This will allow the littleS3 system to properly parse the URL request and determine what function to perform. Create a bucketThe following REST request will create the bucket firstBucket. curl --request PUT "http://localhost:8080/littleS3-2.1.0/firstBucket" Based on the other configuration parameters and using the filesystem module, this command will:
Add an objectThe following REST request will create the object foo.html. curl --data "@foo.html" --request PUT --header "Content-Type: text/html" "http://localhost:8080/littleS3-2.1.0/firstBucket/foo.html" This command will:
Retrieve an objectFor this, you can use your browser. Open the following URL in your browser: http://localhost:8080/littleS3-2.1.0/firstBucket/foo.html Delete an objectThe following REST request will delete the object foo.html. curl --request DELETE "http://localhost:8080/littleS3-2.1.0/firstBucket/foo.html"
Delete a bucketThe following REST request will delete the object firstBucket. curl --request DELETE "http://localhost:8080/littleS3-2.1.0/firstBucket"
List bucketsFor this, you can use your browser. Open the following URL in your browser: http://localhost:8080/littleS3-2.1.0/ |