JGett

A Java wrapper for the Ge.tt file sharing service.
Download, Upload, Share and Manage your file directly from your Java application.

JGett is a Java wrapper for the client API of Ge.tt file sharing service.

Ge.tt is an instant, real-time file publishing and sharing service. With Ge.tt there is no need for special software or plug-ins. It is a simple file sharing and publishing tool for all types of materials including documents, video, music and photos.

JGett is the Java implementation of Ge.tt Rest API.
The Ge.tt API allows you to use Ge.tt in your own applications. By using the API, developers are able to easily put their own content, or the content of their users online. At the same time they are able to use Ge.tt's unique real-time file sharing technology where files are available before they are even uploaded.

This library is built with Maven and it can be downloaded from the Central Maven Repository. To do so, you have to include a dependency into your pom.xml:

<dependency>
	<groupId>it.atcetera</groupId>
	<artifactId>jgett</artifactId>
	<version>1.0.1</version>
	<scope>compile</scope>
</dependency>
If you do not use Maven you could download the latest version of JGett here. If you choose to download it manually, please check the Requirements section in order to download the libraries that JGett requires.

To manage, upload and download file with Ge.tt system you will use a JGettClient instance.
With this object you can handle all the possibilities that the Ge.tt Rest API offers.

Connection initialization and User authentication

To connect to Ge.tt and authenticate a user you use this code:

String apiKey = "yourApiKey";
String userName = "Ge.tt username";
String password = "Ge.tt password";

JGettClient client = new JGettClient();
client.authenticate(apiKey, userName, password);
once your authentication is successful, you could manage your shares thru the client methods.

Obtaining user and storage information

To obtain information about a Ge.tt account you use this code:

UserInfo me = client.getUserInformation();
System.out.println("User email" + me.getEMail());
System.out.println("Available size: " + me.getStorageInfo().getLimitSpace());
which provide a UserInfo instance with information about user and a StorageInfo instance with the information about the size used and available for this account.

Managing a Share

A Share in Ge.tt is a collection of files.

The client can create, destroy and retrieve shares. The information about a share is contained in a ShareInfo instance:

ShareInfo si = client.createShare("The Test"); 		// Create a share named "The Test";
si = client.getShare("The Test"); 			// Search for a share named "The test"
List<ShareInfo> shares = client.getShares(); 		// Retrieve all the shares that belongs to this users
client.updateShare(si, "The new Test"); 		// Rename the share
client.destroyShare(si); 				// Delete the share "The new test" and all the files that belongs to this share

A share basically has a set of information, which can be retrieved with these methods:

ShareInfo si = client.getShare("The Test");
si.getShareTitle();
si.getShareName();
si.getFiles();
si.getCreationDate();
si.getUrl();  // The URL on the Ge.tt System used to display the share

Managing files

The client can upload, download and remove a file from a share. The information about a file is contained in a FileInfo instance:

File file = new File();
FileInfo fi = client.uploadFile(file);                  // Overloaded method that creates an anonymous share and upload the file to it
byte[] data = client.getFileData();                     // Retrieve file from Ge.tt system
fi = client.getFile(fi.getShare(), fi.getFileId());     // Search for a specific file into Ge.tt system
client.destroyFile(fi);                                 // Delete the selected file

A file also has a set of information, which can be retrieved with these methods:

FileInfo fi = client.getFile(client.getShare("Test"), "0");
fi.getFileName();
fi.getFileId();
fi.getNumberOfDownloads();
fi.getShare();
fi.getCreationDate();
fi.getUrl(); // The URL on the Ge.tt System used to download the file thru Ge.tt web interface

Software is never bug-free. This library is built by human being like you, so some mistakes could have been done.
To solve the bug you can eventually found, we catalog them thru the Issue Tracking System hosted on Bitbucket.

If you think you have found a bug into JGett, fill an issue into the Tracking System. Some of Atcetera's developers will promptly address at your issue and eventually release a new version of the library with the fixes we made.

JGett source code is hosted on Bitbucket and it is managed thru Mercurial SCM.
You could easily fork the repository and modify the source. JGett is open source and you could (and you are encouraged to) improve the library or fix bugs you can eventually found.

JGett is built upon:

All this dependencies are handled by Maven by default. If you want to use JGett without Maven support, please download this libraries manually.

The build mechanism is entirely managed by Maven.

There is only a caveat to build this package. During the test phase, it is mandatory to use a valid Ge.tt account to test the client. In order to pass to the test suite the credential you have to write a testng.xml file into the src/test/resources folder crafted in that way:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
	
<suite name="All" verbose="1">
	<parameter name="gettApiKey" value="Ge.tt api key" />
	<parameter name="gettEmail" value="Ge.tt email" />
	<parameter name="gettPassword" value="Ge.tt password" />
	<parameter name="gettPasswordWrong" value="76" />
	
	<test name="All">
	    <packages>
	        <package name="it.atcetera.jgett" />
	    </packages>
	</test>
</suite>
This file is used by TestNG to supply the parameters to the test suite.

Atcetera strongly believes in Open Source. Every day we use and take advantage of Open Source products, so we decided to contibute with this little piece of software: JGett is distributed under the LGPL v.3.0 license.

If this kind of license is, in some ways, restrictive, do not hesitate to contact us. Surely we can found a solution.

The preferred way to contact us is email.
Use opensource@atcetera.it to contact us for issues or clarifications on JGett.