Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 47c93cf315f7fce09b85dbd387b2c28b817d8a45 @michaelfairley michaelfairley committed Aug 1, 2012
@@ -0,0 +1,4 @@
+.idea
+target
+*.iml
+*.ipr
62 pom.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>photon-example</groupId>
+ <artifactId>photon-example</artifactId>
+ <version>0.1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.thousandmemories.photon</groupId>
+ <artifactId>photon-core</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.yammer.dropwizard</groupId>
+ <artifactId>dropwizard-core</artifactId>
+ <version>0.5.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>1.4</version>
+ <configuration>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.DSA</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <transformers>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <mainClass>com.thousandmemories.photon.example.PhotonExampleService</mainClass>
+ </transformer>
+ </transformers>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
@@ -0,0 +1,17 @@
+package com.thousandmemories.photon.example;
+
+import com.thousandmemories.photon.core.PhotoResource;
+import com.yammer.dropwizard.Service;
+import com.yammer.dropwizard.config.Configuration;
+import com.yammer.dropwizard.config.Environment;
+
+public class PhotonExampleService extends Service<Configuration> {
+ public static void main(String[] args) throws Exception {
+ new PhotonExampleService().run(args);
+ }
+
+ @Override
+ protected void initialize(Configuration configuration, Environment environment) throws Exception {
+ environment.addResource(new PhotoResource(new TwitterPhotoProvider()));
+ }
+}
@@ -0,0 +1,14 @@
+package com.thousandmemories.photon.example;
+
+import com.thousandmemories.photon.core.PhotoProvider;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+public class TwitterPhotoProvider implements PhotoProvider {
+ @Override
+ public InputStream getPhotoInputStream(String path) throws IOException {
+ return new URL("https://api.twitter.com/1/users/profile_image?size=original&screen_name=" + path).openStream();
+ }
+}

0 comments on commit 47c93cf

Please sign in to comment.