Thoughts by Techxplorer

Thoughts on my experiences with technology

Exploring tweetStream4J

By: Dave Mott

My attention today has been focussed on the third service that is under development as part of the Aus-e-Stage project which is in turn part of the larger AusStage project. The focus of this third service is to use mobile based technologies to solicit feedback in real time from audience members who are attending, or have just attended, a performance.

The two main mechanisms for soliciting feedback I’m currently focused on are SMS and Twitter messages.

My current task is exploring the way in which we can interact with Twitter in order to retrieve messages, via the Twitter API, that are pieces of feedback for performances that we’re interested in. All of our development to-date has been in the Java programming language and as such I’ve been looking into libraries that I can used to make it easier for my development work. The library I’m starting with the tweetStream4J library by John Crepezzi.

He uses Git for his source code repository and Apache Maven as his build tool. Whereas we’re using Apache Subversion and Apache Ant respectively. All of our source code is hosted as the Aus-e-Stage project on Google Code. To keep things separate and easy to manage I’ve decided to set aside a directory specifically for compiling and packaging the library so that I can use my already established processes with my own preferred tools for my development.

To do this I undertook the following tasks:

Note: This is not intended as a full procedure. It is rather a list of notes to act as a reminder to me and a prompt to others who may be experiencing similar issues to those that I had.

1. Configuring my System

  1. Install the git-core package including dependencies
  2. Install the maven2 package including dependencies

2. Checkout / Clone the tweetStream4J Repository

  1. Create a directory to store files related to development
    mkdir mobile-tools
  2. Navigate to the newly created directory
    cd mobile-tools
  3. Clone the tweetStream4J repository
    git clone http://github.com/seejohnrun/tweetStream4J.git
  4. A newly created tweetStream4J directory will be created in the mobile-tools directory that contains the repository

3. Compile the tweetStream4J code using Maven

  1. Navigate to the newly created tweetStream4J directory
    cd tweetStream4J
  2. Compile the source code using Maven
    mvn compile
  3. All of the required dependencies will be automatically downloaded into the ~/.m2/repository directory
  4. The compiled classes will be in the ./target directory

4. Edit the Tests in preparation for packaging

  1. Stay in the tweetStream4J directory
  2. Navigate to the following directory
    ./src/test/java/com/crepezzi/tweetStream4j
  3. Open the following file for editing
    ./APITest.java
  4. Locate the following line
    
    private static final TwitterStreamConfiguration tws = new TwitterStreamConfiguration("seejohnrun", "");
    
  5. Change the line so that it includes your Twitter username and password. For example:
    private static final TwitterStreamConfiguration tws = new TwitterStreamConfiguration("myuser", "mypass");
    
  6. Save the changed file

5. Package the tweetStream4J code using Maven

  1. Navigate to the main tweetStream4J directory
    cd ../../../../../../
  2. Package the compiled classes using Maven
    mvn package
  3. All of the required dependencies will be automatically downloaded into the ~/.m2/repository directory
  4. The packaged jar file will be in the ./target directory

6. Use the Packaged tweetStream4J Library

  1. Copy the packaged library to the required location
  2. Ensure the other required dependencies are in your class path or in the same location as the library
  3. At the time of writing the list included:

7. Keeping the Source Code Updated

  1. Navigate to the mobile-tools directory
  2. Navigate to the tweetStream4J directory
    cd tweetStream4J
  3. Update the source code with the following command
    git pull
  4. Repeat steps 4 and 5 above to recompile and package the library

The “Twitter Bling” image was uploaded to Flickr by Dave Mott and used under the terms of a Creative Commons License.

Category: Thoughts
Tag: