Permalink
Browse files

minor refactoring done

  • Loading branch information...
hemant24 committed Jan 11, 2012
1 parent 806fc67 commit 4e6198cbdc55c6b128c8ed8242c1fed6e422c9fa
View
56 pom.xml
@@ -1,15 +1,15 @@
-<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">
+<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>org.springframework.social</groupId>
<artifactId>spring-social-flickr</artifactId>
<name>Spring Social Flickr</name>
<version>0.0.1-SNAPSHOT</version>
-
+ <packaging>pom</packaging>
<properties>
<spring.social.version>1.0.0.RELEASE</spring.social.version>
<spring.framework.version>3.1.0.RC1</spring.framework.version>
</properties>
-
<description>Spring Social extension with connection support and an API binding for Flickr</description>
<url>https://github.com/ranjan-rk/spring-social-flickr</url>
<developers>
@@ -32,7 +32,7 @@
</snapshots>
</repository>
<repository>
- <id>org.springframework.maven.milestone</id>
+ <id>org.springframework.maven.milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
<snapshots>
@@ -42,54 +42,14 @@
</repositories>
<dependencies>
- <dependency>
- <groupId>org.springframework.social</groupId>
- <artifactId>spring-social-core</artifactId>
- <version>${spring.social.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${spring.framework.version}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- <version>1.8.5</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-jaxrs</artifactId>
- <version>1.9.2</version>
- </dependency>
- <dependency>
- <groupId>org.springframework.security</groupId>
- <artifactId>spring-security-core</artifactId>
- <version>3.1.0.RELEASE</version>
- </dependency>
- <dependency>
- <groupId>xom</groupId>
- <artifactId>xom</artifactId>
- <version>1.2.5</version>
- </dependency>
- <dependency>
- <groupId>jaxen</groupId>
- <artifactId>jaxen</artifactId>
- <version>1.1.1</version>
- </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
+
<build>
<plugins>
<plugin>
@@ -103,4 +63,10 @@
</plugin>
</plugins>
</build>
+
+ <modules>
+ <module>core</module>
+ <module>web</module>
+ </modules>
+
</project>
@@ -1,24 +0,0 @@
-/*
- * Copyright 2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.social.flickr.api;
-
-import org.springframework.social.ApiBinding;
-
-public interface Flickr extends ApiBinding{
-
- FlickrProfile getUserProfile();
-
-}
@@ -1,46 +0,0 @@
-/*
- * Copyright 2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.social.flickr.api;
-
-public class FlickrProfile {
- private String nsid;
- private String url;
- private String stat;
-
- public String getNsid() {
- return nsid;
- }
-
- public void setNsid(String nsid) {
- this.nsid = nsid;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- public String getStat() {
- return stat;
- }
-
- public void setStat(String stat) {
- this.stat = stat;
- }
-}
@@ -1,17 +0,0 @@
-package org.springframework.social.flickr.api;
-
-import org.codehaus.jackson.annotate.JsonCreator;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.annotate.JsonProperty;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class FlickrProfileMixin {
- @JsonCreator
- FlickrProfileMixin(@JsonProperty("nsid") long nsid){}
-
- @JsonProperty("url")
- private String url;
-
- @JsonProperty("stat")
- private String stat;
-}
@@ -1,37 +0,0 @@
-/*
- * Copyright 2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.social.flickr.api.impl;
-
-import org.codehaus.jackson.Version;
-import org.codehaus.jackson.map.module.SimpleModule;
-import org.springframework.social.flickr.api.FlickrProfile;
-import org.springframework.social.flickr.api.FlickrProfileMixin;
-
-public class FlickrModule extends SimpleModule {
-
- public FlickrModule(String name, Version version) {
- super(name, version);
- }
-
- public FlickrModule() {
- super("FlickrModule", new Version(1, 0, 0, null));
- }
-
- @Override
- public void setupModule(SetupContext context) {
- context.setMixInAnnotations(FlickrProfile.class, FlickrProfileMixin.class);
- }
-}
@@ -1,53 +0,0 @@
-/*
- * Copyright 2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.social.flickr.api.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.codehaus.jackson.map.ObjectMapper;
-import org.springframework.http.MediaType;
-import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
-import org.springframework.social.flickr.api.Flickr;
-import org.springframework.social.flickr.api.FlickrProfile;
-import org.springframework.social.oauth1.AbstractOAuth1ApiBinding;
-
-public class FlickrTemplate extends AbstractOAuth1ApiBinding implements Flickr {
- private String URL_TO_ACCESS_PROFILE = "URL_TO_ACCESS_PROFILE";
-
- public FlickrTemplate(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret) {
- super(consumerKey, consumerSecret, accessToken, accessTokenSecret);
- }
-
- @Override
- public FlickrProfile getUserProfile() {
- FlickrProfile flickrProfile = getRestTemplate().getForObject(URL_TO_ACCESS_PROFILE, FlickrProfile.class);
- return flickrProfile;
- }
-
- @Override
- protected MappingJacksonHttpMessageConverter getJsonMessageConverter() {
- MappingJacksonHttpMessageConverter converter = super.getJsonMessageConverter();
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.registerModule(new FlickrModule());
- List<MediaType> supportedMediaTypes = new ArrayList<MediaType>();
- supportedMediaTypes.add(MediaType.TEXT_PLAIN);
- supportedMediaTypes.add(MediaType.TEXT_XML);
- converter.setSupportedMediaTypes(supportedMediaTypes);
- converter.setObjectMapper(objectMapper);
- return converter;
- }
-}
@@ -1,4 +0,0 @@
-/**
- * Implementation of Spring Social's Service API for Flickr
- */
-package org.springframework.social.flickr.api.impl;
@@ -1,4 +0,0 @@
-/**
- * Spring Social's Service API for Flickr
- */
-package org.springframework.social.flickr.api;
@@ -1,51 +0,0 @@
-/*
- * Copyright 2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.social.flickr.connect;
-
-import org.springframework.social.connect.ApiAdapter;
-import org.springframework.social.connect.ConnectionValues;
-import org.springframework.social.connect.UserProfile;
-import org.springframework.social.flickr.api.Flickr;
-import org.springframework.web.client.HttpClientErrorException;
-
-public class FlickrAdapter implements ApiAdapter<Flickr> {
-
- public boolean test(Flickr flickr) {
- try {
- flickr.getUserProfile();
- return true;
- } catch (HttpClientErrorException e) {
- e.printStackTrace();
- return false;
- }
- }
-
- @Override
- public UserProfile fetchUserProfile(Flickr api) {
- System.out.println("TODO : Implement fetchUserProfile");
- return null;
- }
-
- @Override
- public void setConnectionValues(Flickr api, ConnectionValues values) {
- // TODO Auto-generated method stub
-
- }
-
- public void updateStatus(Flickr flickr, String message) {
- throw new UnsupportedOperationException();
- }
-}
@@ -1,27 +0,0 @@
-/*
- * Copyright 2011 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.social.flickr.connect;
-
-import org.springframework.social.connect.support.OAuth1ConnectionFactory;
-import org.springframework.social.flickr.api.Flickr;
-
-public class FlickrConnectionFactory extends OAuth1ConnectionFactory<Flickr> {
-
- public FlickrConnectionFactory(String consumerKey, String consumerSecret) {
- super("flickr", new FlickrServiceProvider(consumerKey, consumerSecret), new FlickrAdapter());
- }
-
-}
Oops, something went wrong.

0 comments on commit 4e6198c

Please sign in to comment.