Skip to content

Commit

Permalink
TFJ-201 introduced twitter4j-async and twitter4j-stream artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuke committed Feb 22, 2011
1 parent 807bbb6 commit 85e2b88
Show file tree
Hide file tree
Showing 96 changed files with 1,565 additions and 475 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ twitter4j-core/target/*
twitter4j-core/src/test/resources/xauth-test.properties
twitter4j-core/src/test/resources/sitestream-test.properties
twitter4j-core/src/test/resources/test.properties
twitter4j-stream/target/*
twitter4j-stream/src/test/resources/test.properties
twitter4j-async/target/*
twitter4j-async/src/test/resources/test.properties
twitter4j-media-support/src/test/resources/twitter4j.properties
twitter4j-httpclient-support/src/test/resources/twitter4j.properties
twitter4j-examples/target/*
Expand Down
33 changes: 30 additions & 3 deletions package.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
LANG=C
mkdir /tmp/t4jbuild
cp -r ./* /tmp/t4jbuild/
cd /tmp/t4jbuild/

cd twitter4j-core
mvn clean package -Dmaven.test.skip=true
Expand All @@ -8,6 +11,10 @@ mvn clean package -Dmaven.test.skip=true
#mvn clean package -Dmaven.test.skip=true
cd ../twitter4j-media-support
mvn clean package -Dmaven.test.skip=true
cd ../twitter4j-async
mvn clean package -Dmaven.test.skip=true
cd ../twitter4j-stream
mvn clean package -Dmaven.test.skip=true
cd ..

DIR=twitter4j-$1
Expand All @@ -31,6 +38,14 @@ mkdir $DIR/twitter4j-media-support
cp -r twitter4j-media-support/src $DIR/twitter4j-media-support/
cp twitter4j-media-support/pom.xml $DIR/twitter4j-media-support/

mkdir $DIR/twitter4j-async
cp -r twitter4j-async/src $DIR/twitter4j-async/
cp twitter4j-async/pom.xml $DIR/twitter4j-async/

mkdir $DIR/twitter4j-stream
cp -r twitter4j-stream/src $DIR/twitter4j-stream/
cp twitter4j-stream/pom.xml $DIR/twitter4j-stream/

cp pom.xml $DIR/pom.xml
cp LICENSE.txt $DIR/
cp -r powered-by-badge $DIR/
Expand All @@ -50,6 +65,16 @@ unzip twitter4j-examples/target/twitter4j-examples-$1-javadoc.jar -d $DIR/twitte
cp twitter4j-examples/target/twitter4j-examples-$1-javadoc.jar -d $DIR/twitter4j-examples/
cp twitter4j-examples/target/twitter4j-examples-$1-sources.jar -d $DIR/twitter4j-examples/

mkdir $DIR/twitter4j-async/javadoc/
unzip twitter4j-async/target/twitter4j-async-$1-javadoc.jar -d $DIR/twitter4j-async/javadoc/
cp twitter4j-async/target/twitter4j-async-$1-javadoc.jar -d $DIR/twitter4j-async/
cp twitter4j-async/target/twitter4j-async-$1-sources.jar -d $DIR/twitter4j-async/

mkdir $DIR/twitter4j-stream/javadoc/
unzip twitter4j-stream/target/twitter4j-stream-$1-javadoc.jar -d $DIR/twitter4j-stream/javadoc/
cp twitter4j-stream/target/twitter4j-stream-$1-javadoc.jar -d $DIR/twitter4j-stream/
cp twitter4j-stream/target/twitter4j-stream-$1-sources.jar -d $DIR/twitter4j-stream/

#cp twitter4j-httpclient-support/target/twitter4j-httpclient-support-$1.jar $DIR/twitter4j-httpclient-support/
#mkdir $DIR/twitter4j-httpclient-support/javadoc/
#unzip twitter4j-httpclient-support/target/twitter4j-httpclient-support-$1-javadoc.jar -d $DIR/twitter4j-httpclient-support/javadoc/
Expand All @@ -58,12 +83,14 @@ mkdir $DIR/lib
cp twitter4j-core/target/twitter4j-core-$1.jar $DIR/lib
cp twitter4j-media-support/target/twitter4j-media-support-$1.jar $DIR/lib
cp twitter4j-examples/target/twitter4j-examples-$1.jar $DIR/lib
cp twitter4j-async/target/twitter4j-async-$1.jar $DIR/lib
cp twitter4j-stream/target/twitter4j-stream-$1.jar $DIR/lib

cd $DIR/
find . -name ".svn" -print -exec rm -rf {} ";"
find . -name ".DS_Store" -print -exec rm -r {} ";"
find . -name ._* -exec rm -r {} ";"
rm ../twitter4j-$1.zip
zip -r ../twitter4j-$1.zip .
cd ..
rm -Rf $DIR
zip -r ../../twitter4j-$1.zip .
cd ../..
rm -Rf t4jbuild/
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@
</profile>
</profiles>
<modules>
<module>twitter4j-core</module>
<module>twitter4j-async</module>
<module>twitter4j-stream</module>
<module>twitter4j-media-support</module>
<module>twitter4j-httpclient-support</module>
<module>twitter4j-core</module>
<module>twitter4j-examples</module>
</modules>
</project>
194 changes: 194 additions & 0 deletions twitter4j-async/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j</artifactId>
<version>2.2.0-SNAPSHOT</version>
</parent>

<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-async</artifactId>
<version>2.2.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>twitter4j-async</name>
<description>A Java library for the Twitter API</description>
<url>http://twitter4j.org/</url>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/yusuke/twitter4j</url>
<connection>scm:git:git://github.com/yusuke/twitter4j.git</connection>
<developerConnection>scm:git:git://github.com/yusuke/twitter4j.git
</developerConnection>
</scm>
<developers>
<developer>
<id>yusuke</id>
<name>Yusuke</name>
<email>yusuke@mac.com</email>
<url>http://yusuke.homeip.net/blog/</url>
<roles>
<role>lead</role>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>-9</timezone>
</developer>
</developers>
<issueManagement>
<system>Jira</system>
<url>http://twitter4j.org/jira/browse/TFJ</url>
</issueManagement>
<distributionManagement>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<uniqueVersion>false</uniqueVersion>
<url>http://oss.sonatype.org/service/local/staging/deploy/maven2/
</url>
</repository>
<snapshotRepository>
<id>org.twitter4j</id>
<name>twitter4j.org Repository</name>
<uniqueVersion>false</uniqueVersion>
<url>file:${user.home}/maven2/</url>
</snapshotRepository>
</distributionManagement>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.0-alpha-4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<mailingLists>
<mailingList>
<name>Twitter4J</name>
<subscribe>twitter4j-subscribe@googlegroups.com</subscribe>
<unsubscribe>twitter4j-unsubscribe@googlegroups.com</unsubscribe>
<post>twitter4j@googlegroups.com</post>
<archive>http://groups.google.com/group/twitter4j</archive>
</mailingList>
</mailingLists>
<dependencies>
<dependency>
<groupId>org.twitter4j</groupId>
<artifactId>twitter4j-core</artifactId>
<version>2.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-9</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<source>1.5</source>
<target>jsr14</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>src/main/resources/META-INF/MANIFEST.MF
</manifestFile>
<manifest>
<addDefaultSpecificationEntries>true
</addDefaultSpecificationEntries>
<addDefaultImplementationEntries>true
</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>javadoc-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<excludePackageNames>
</excludePackageNames>
</configuration>
</execution>
</executions>
<configuration>
<charset>UTF-8</charset>
<show>public</show>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8
</project.reporting.outputEncoding>
</properties>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,29 @@
* limitations under the License.
*/

package twitter4j.internal.async;
package twitter4j;

/**
* @author Yusuke Yamamoto - yusuke at mac.com
* @since Twitter4J 2.1.2
*/
public interface DispatcherConfiguration {
int getAsyncNumThreads();
public final class VersionAsync {
private static final String VERSION = "2.2.0-SNAPSHOT";
private static final String TITLE = "Twitter4J Async API";

String getDispatcherImpl();
private VersionAsync() {
throw new AssertionError();
}

public static String getVersion() {
return VERSION;
}

/**
* prints the version string
*
* @param args will be just ignored.
*/
public static void main(String[] args) {
System.out.println(TITLE + " " + VERSION);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package twitter4j.internal.async;

import twitter4j.conf.Configuration;
import twitter4j.conf.ConfigurationContext;

import java.lang.reflect.InvocationTargetException;
Expand All @@ -26,9 +27,9 @@
*/
public final class DispatcherFactory {
private String dispatcherImpl;
private DispatcherConfiguration conf;
private Configuration conf;

public DispatcherFactory(DispatcherConfiguration conf) {
public DispatcherFactory(Configuration conf) {
dispatcherImpl = conf.getDispatcherImpl();
this.conf = conf;
}
Expand All @@ -45,7 +46,7 @@ public DispatcherFactory() {
public Dispatcher getInstance() {
try {
return (Dispatcher) Class.forName(dispatcherImpl)
.getConstructor(DispatcherConfiguration.class).newInstance(conf);
.getConstructor(Configuration.class).newInstance(conf);
} catch (InstantiationException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package twitter4j.internal.async;

import twitter4j.conf.Configuration;

import java.util.LinkedList;
import java.util.List;

Expand All @@ -27,7 +28,7 @@ final class DispatcherImpl implements Dispatcher {
private ExecuteThread[] threads;
private final List<Runnable> q = new LinkedList<Runnable>();

public DispatcherImpl(DispatcherConfiguration conf) {
public DispatcherImpl(Configuration conf) {
threads = new ExecuteThread[conf.getAsyncNumThreads()];
for (int i = 0; i < threads.length; i++) {
threads[i] = new ExecuteThread("Twitter4J Async Dispatcher", this, i);
Expand Down Expand Up @@ -115,4 +116,4 @@ public void run() {
}
}
}
}
}
Loading

0 comments on commit 85e2b88

Please sign in to comment.