Anonymous avatar Anonymous committed be5fca9 Merge

Merge branch 'juanpicado' of jotadeveloper.com:encuestame into dianmorales

Comments (0)

Files changed (137)

 #!/bin/bash
 DOJO_PATH=dojo
-SVN_DOJO=http://svn.dojotoolkit.org/src/tags/release-1.5.0/
-FILE_DOJO=http://download.dojotoolkit.org/release-1.5.0/dojo-release-1.5.0-src.zip
-FILE_NAME=dojo-release-1.5.0-src.zip
+SVN_DOJO=http://svn.dojotoolkit.org/src/tags/release-1.6.0/
+FILE_DOJO=http://download.dojotoolkit.org/release-1.6.0/dojo-release-1.6.0-src.zip
+FILE_NAME=dojo-release-1.6.0-src.zip
 
 function createFromDownload {
         if [ -d ${DOJO_PATH} ]; then
 
 function warningShow {
     echo "****************************************************************"
-    echo "*  WARNING !!! -- DOJO 1.5 IS REQUIRED                         *"
+    echo "*  WARNING !!! -- DOJO 1.6 IS REQUIRED                         *"
     echo "*  Download from http://dojotoolkit.org/download               *"
     echo "*  Copy the content on root folder named DOJO                  *"   
     echo "*  After that run again this script                            *"
     wget ${FILE_DOJO}
     echo "ZIP - Create work path"
     unzip ${FILE_NAME}
-    mv dojo-release-1.5.0-src ${DOJO_PATH}
+    mv dojo-release-1.6.0-src ${DOJO_PATH}
     echo "ZIP - Copy Resources"
     rm ${FILE_NAME}
     copyResources

encuestame-business/pom.xml

         </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
             <artifactId>hibernate-core</artifactId>
         </dependency>
         <dependency>

encuestame-business/src/main/java/org/encuestame/business/config/EncuestameConfig.java

+
+package org.encuestame.business.config;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.log4j.PropertyConfigurator;
+
+/**
+ * Encuestame config file.
+ * @author Picado, Juan juanATencuestame.org
+ * @since Mar 14, 2011
+ */
+public class EncuestameConfig {
+
+    private static String encuestameConfigFileName = "/org/encuestame/config/encuestame-config.properties";
+    private static String encuestameOverwriteConfigFileName = "/encuestame-config-overwrite.properties";
+    private static String overwriteJvmParam = "encuestame.overwrite.config";
+    private static File customEncuestameFile = null;
+
+    private static Properties configHolderProperty;
+
+    private static Log log = LogFactory.getLog(EncuestameConfig.class);
+
+    /*
+     * Static block run once at class loading
+     *
+     * We load the default properties and any custom properties we find
+     */
+    static {
+        configHolderProperty = new Properties();
+
+        try {
+            // we'll need this to get at our properties files in the classpath
+            Class configClass = Class.forName("org.encuestame.business.config.EncuestameConfig");
+
+            // first, lets load our default properties
+            InputStream is = configClass.getResourceAsStream(encuestameConfigFileName);
+            configHolderProperty.load(is);
+
+            // now, see if we can find our custom config
+            is = configClass.getResourceAsStream(encuestameOverwriteConfigFileName);
+            if(is != null) {
+                configHolderProperty.load(is);
+                log.info("Encuestame : Loading custom properties.");
+            } else {
+                log.error("Encuestame : Loading default properties, custom configuration properties not found.");
+            }
+            // finally, check for an external config file
+            final String enviromentPropertyFile = System.getProperty(overwriteJvmParam);
+            if(enviromentPropertyFile != null && enviromentPropertyFile.length() > 0) {
+                customEncuestameFile = new File(enviromentPropertyFile);
+
+                // make sure the file exists, then try and load it
+                if(customEncuestameFile != null && customEncuestameFile.exists()) {
+                    is = new FileInputStream(customEncuestameFile);
+                    configHolderProperty.load(is);
+                    System.out.println("EncuestameConfig file: Successfully loaded custom properties from "+
+                            customEncuestameFile.getAbsolutePath());
+                } else {
+                    System.out.println("EncuestameConfig file: Failed to load custom properties from "+
+                            customEncuestameFile.getAbsolutePath());
+                }
+
+            }
+
+            // Now expand system properties for properties in the config.expandedProperties list,
+            // replacing them by their expanded values.
+            /*String expandedPropertiesDef = (String) configHolderProperty.get("config.expandedProperties");
+            if (expandedPropertiesDef != null) {
+                String[] expandedProperties = expandedPropertiesDef.split(",");
+                for (int i = 0; i < expandedProperties.length; i++) {
+                    String propName = expandedProperties[i].trim();
+                    String initialValue = (String) configHolderProperty.get(propName);
+                    if (initialValue != null) {
+                        String expandedValue = PropertyExpander.expandSystemProperties(initialValue);
+                        configHolderProperty.put(propName,expandedValue);
+                    }
+                }
+            }*/
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.fatal("Encuestame Config: "+e);
+        }
+    }
+
+    /**
+     * Get properties starting with a specified string.
+     */
+    public static Properties getPropertiesStartingWith(String startingWith) {
+        Properties props = new Properties();
+        for (Enumeration it = configHolderProperty.keys(); it.hasMoreElements();) {
+            String key = (String)it.nextElement();
+            props.put(key, configHolderProperty.get(key));
+        }
+        return props;
+    }
+}

encuestame-business/src/main/java/org/encuestame/business/service/AbstractConfigurationService.java

 
     private String proxyPass;
 
-    private @Value("${application.picture.path}") String dataGlobalPath;
+    //private @Value("${dir.data.warehouse}") String dataGlobalPath;
 
+    private String dataGlobalPath;
     /**
      * App Consumer Key.
      */

encuestame-business/src/main/java/org/encuestame/business/service/AbstractSocialService.java

         final List<SocialAccount> socialAccounts = getAccountDao()
                 .getTwitterVerifiedAccountByUser(getUserAccount(username).getAccount(), provider);
         for (SocialAccount socialAccount : socialAccounts) {
+            log.debug("getTwitterService() "+getTwitterService());
             if(getTwitterService().verifyCredentials(socialAccount)){
                 log.debug("Confirmed Account  -- "+socialAccount.getSocialAccountName());
                 comfirmedSocialAccounts.add(ConvertDomainBean.convertSocialAccountToBean(socialAccount));

encuestame-business/src/main/java/org/encuestame/business/service/SearchService.java

     public List<Poll> searchPolls(String searchString, String path, String fieldName,
             int results) throws IOException, ParseException {
         List<Poll> pollList = new ArrayList<Poll>();
-        IndexReader reader = IndexReader.open(path, true);
-        Searcher searcher = new IndexSearcher(reader);
+        //IndexReader reader = IndexReader.open(path, true);
+        //IndexReader reader = IndexReader.open(path);
+        //Searcher searcher = new IndexSearcher(reader);
+        Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         Query query = qp.parse(searchString);
             throws IOException, ParseException {
         Map<String, Object> map = new HashMap<String, Object>();
         List<Poll> articles = new ArrayList<Poll>();
-        Searcher searcher = new IndexSearcher(IndexReader.open(path));
+        //Searcher searcher = new IndexSearcher(IndexReader.open(path));
+        //IndexReader reader = IndexReader.open(path);
+        //Searcher searcher = new IndexSearcher(reader);
+        Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         Query query = qp.parse(searchString);
     public List<Poll> searchArticle(String searchString, String path, String fieldName,
             int results) throws IOException, ParseException {
         List<Poll> articles = new ArrayList<Poll>();
-        IndexReader reader = IndexReader.open(path);
-        Searcher searcher = new IndexSearcher(reader);
+        //IndexReader reader = IndexReader.open(path);
+        //Searcher searcher = new IndexSearcher(reader);
+        Searcher searcher = null;
         QueryParser qp = new QueryParser(Version.LUCENE_29, fieldName,
                 new StandardAnalyzer(Version.LUCENE_29));
         Query query = qp.parse(searchString);

encuestame-business/src/main/java/org/encuestame/business/setup/ApplicationStartup.java

+
+package org.encuestame.business.setup;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Manages encuestame application startup.
+ * @author Picado, Juan juanATencuestame.org
+ * @since Mar 15, 2011
+ */
+public class ApplicationStartup implements Startup {
+
+    public ApplicationStartup() {
+        System.out.println("**********************ApplicationStartup*************************************");
+    }
+
+    protected Logger log = Logger.getLogger(this.getClass());
+
+    @PostConstruct
+    public void init(){
+        log.debug("*******************************");
+        log.debug("*                             *");
+        log.debug("*         STARTUP             *");
+        log.debug("*                             *");
+        log.debug("*******************************");
+    }
+
+    @PreDestroy
+    public void shuthdown(){
+        log.debug("*******************************");
+        log.debug("*                             *");
+        log.debug("*         SHUTHDOWN           *");
+        log.debug("*                             *");
+        log.debug("*******************************");
+    }
+
+    public void startProcess() {
+        // TODO Auto-generated method stub
+
+    }
+}

encuestame-business/src/main/java/org/encuestame/business/setup/SetupFilter.java

+
+package org.encuestame.business.setup;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+
+public class SetupFilter implements Filter {
+
+    public void init(FilterConfig filterConfig) throws ServletException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void doFilter(ServletRequest request, ServletResponse response,
+            FilterChain chain) throws IOException, ServletException {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void destroy() {
+        // TODO Auto-generated method stub
+
+    }
+
+}

encuestame-business/src/main/java/org/encuestame/business/setup/Startup.java

+
+package org.encuestame.business.setup;
+
+
+public interface Startup {
+
+    void startProcess();
+}

encuestame-business/src/main/resources/confirm-your-account.vm

-<html>
-<body>
-    <div style="padding:14px;margin-bottom:4px;background-color:#008eb9">
-        <div style="font-size:16px;font-weidth:bold:padding:5px;">
-            Encuestame Survey System
-        </div>
-    </div>
-    <h2>Hi, ${user.username} </h2>
-    <p>
-    <div>Please confirm your encuestame account by clicking this link:</div>
-    <a href="http://localhost:8080/encuestame/account/confirm/email/${user.username}/${inviteCode}">
-        http://localhost:8080/encuestame/account/confirm/email/${user.username}/${inviteCode}
-    </a><br/>
-    <div>Once you have confirmed your account, you can access full access.</div><br/>
-
-    <div>${app.url}</div><br/>
-
-    <div>If you have received this message in error, please <a href="#">click here.</a></div><br/>
-
-    <div style="font-size:10px;">
-        footer message footer message footer message footer message footer message footer message footer message
-        footer message footer message footer messagefooter message footer message footer message footer message
-         footer message footer message footer message footer messagefooter message footer message
-    </div>
-    </p>
-</body>
-</html>

encuestame-business/src/main/resources/encuestame-report-context.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://www.springframework.org/schema/beans
-       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
-</beans>

encuestame-business/src/main/resources/encuestame-security-context.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-  xmlns:security="http://www.springframework.org/schema/security"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://www.springframework.org/schema/beans
-       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-       http://www.springframework.org/schema/security
-       http://www.springframework.org/schema/security/spring-security-3.0.xsd">
-
-  <!-- To enable @Pre and @Post Annotations -->
-  <security:global-method-security pre-post-annotations="enabled"/>
-
-  <!-- Authentication Manager -->
-  <security:authentication-manager alias="authenticationManager">
-    <security:authentication-provider  user-service-ref="enMeAuthenticationDao">
-        <security:password-encoder ref="passwordEncoder" />
-    </security:authentication-provider>
-  </security:authentication-manager>
-
-  <bean id="passwordEncoder" class="org.jasypt.spring.security3.PasswordEncoder">
-    <property name="passwordEncryptor">
-      <ref bean="jasyptPasswordEncryptor" />
-    </property>
-  </bean>
-
-  <bean id="jasyptPasswordEncryptor" class="org.jasypt.util.password.StrongPasswordEncryptor" />
-
-
-  <bean id="enMeAuthenticationDao" class="org.encuestame.core.security.EnMeUserServiceImp">
-    <property name="roleGroupAuth" value="${spring.sec.roleByGroup}" />
-    <property name="roleUserAuth" value="${spring.sec.roleByAuthor}" />
-  </bean>
-
-  <bean id="authenticationEntryPoint"
-    class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
-    <property name="loginFormUrl" value="${spring.sec.loginPath}" />
-    <property name="forceHttps" value="${spring.sec.forceLoginSSL}" />
-  </bean>
-
-  <security:http auto-config="false"
-                 entry-point-ref="authenticationEntryPoint"
-                 access-decision-manager-ref="voteAccessDecisionManager"
-                 access-denied-page="${spring.sec.login.denied}">
-    <security:intercept-url pattern="index.jsp" filters="none" />
-
-    <!-- Public Paths -->
-    <security:intercept-url pattern="/index.jspx" filters="none"/>
-    <security:intercept-url pattern="/error.jspx" filters="none"/>
-    <security:intercept-url pattern="/home" filters="none"/>
-    <security:intercept-url pattern="/users.jspx" filters="none"/>
-    <security:intercept-url pattern="/tags.jspx" filters="none"/>
-    <security:intercept-url pattern="/signin.jspx" filters="none"/>
-    <security:intercept-url pattern="/forgot.jspx" filters="none"/>
-    <security:intercept-url pattern="/signup.jspx" filters="none"/>
-
-    <!-- Admon Paths -->
-    <security:intercept-url pattern="/admon/**/*" access="ENCUESTAME_ADMIN, ENCUESTAME_USER"/>
-
-    <!-- Account Paths
-    <security:intercept-url pattern="/user/signin.jspx" access="ENCUESTAME_ANONYMOUS"/>
-    <security:intercept-url pattern="/user/forgot.jspx" access="ENCUESTAME_ANONYMOUS" />
-    <security:intercept-url pattern="/user/signup.jspx" access="ENCUESTAME_ANONYMOUS"/>
-    -->
-
-    <security:intercept-url pattern="/user/logout" access="ENCUESTAME_USER"/>
-
-    <!-- Super Admin -->
-    <security:intercept-url pattern="/superAdmin.jspx" access="ENCUESTAME_SUPER"/>
-
-    <!-- Shared areas -->
-    <security:intercept-url pattern="/settings/**/*" access="ENCUESTAME_USER"/>
-
-    <!-- Surveys / Poll / TweetPoll Paths -->
-    <security:intercept-url pattern="/tweetpoll.jspx" access="ENCUESTAME_USER, ENCUESTAME_EDITOR"   />
-    <security:intercept-url pattern="/poll.jspx" access="ENCUESTAME_USER"/>
-    <security:intercept-url pattern="/survey.jspx" access="ENCUESTAME_USER, ENCUESTAME_EDITOR"/>
-
-    <!-- Vote Paths
-    <security:intercept-url pattern="/tweet/*" access="ENCUESTAME_USER" />
-    -->
-
-    <!-- Resources Path -->
-    <security:intercept-url pattern="/resources/*"  filters="none" />
-
-    <security:remember-me key="${spring.sec.rememberMe.key}" services-alias="_rememberMeServices" token-validity-seconds="10080"/>
-    <security:anonymous enabled="true" granted-authority="ENCUESTAME_ANONYMOUS" key="${spring.sec.anonymous.key}" />
-    <security:logout logout-success-url="${spring.sec.logout.sucess}" invalidate-session="true"
-                     logout-url="${spring.sec.logout.url}"/>
-    <security:custom-filter position="FORM_LOGIN_FILTER" ref="authenticationProcessingFilter" />
-  </security:http>
-
-  <!--  Enable OAuth Security.
-  <import resource="encuestame-security-oauth-context.xml"/>
-    -->
-
-  <bean id="authenticationProcessingFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
-      <property name="authenticationManager" ref="authenticationManager"/>
-      <property name="authenticationFailureHandler" ref="authenticationFailureHandler"/>
-      <property name="authenticationSuccessHandler" ref="authenticationSuccessHandler"/>
-      <property name="filterProcessesUrl" value="/j_spring_security_check"/>
-  </bean>
-
-   <bean id="authenticationSuccessHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler">
-       <property name="defaultTargetUrl" value="${spring.sec.defaultLoginUrl}"/>
-   </bean>
-
-   <bean id="authenticationFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
-       <property name="defaultFailureUrl" value="${spring.sec.login.error}"/>
-   </bean>
-
-  <bean id="voteAccessDecisionManager"
-    class="org.springframework.security.access.vote.AffirmativeBased">
-    <property name="allowIfAllAbstainDecisions">
-      <value>false</value>
-    </property>
-    <property name="decisionVoters">
-      <list>
-        <ref bean="roleVoter" />
-      </list>
-    </property>
-  </bean>
-
-  <bean id="roleVoter" class="org.encuestame.core.security.EnMeRoleVoter">
-    <property name="rolePrefix" value="${spring.sec.role.prefix}" />
-  </bean>
-
-  <!--  reCaptcha -->
-
-   <bean id="reCaptcha" class="net.tanesha.recaptcha.ReCaptchaImpl" scope="singleton">
-        <property name="privateKey" value="6LdyFwUAAAAAAGB3BsjX-j5EgYzULsR3ftiUvwUd" />
-        <property name="publicKey" value="6LdyFwUAAAAAAP6p1IeqUM7uMKUYyPazw-haEAUU" />
-        <property name="recaptchaServer" value="${encuestame.recaptcha.recaptchaserver}" />
-        <property name="includeNoscript" value="${encuestame.recaptcha.includenoscript}" />
-   </bean>
-
-</beans>

encuestame-business/src/main/resources/encuestame-security-oauth-context.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:oauth="http://www.springframework.org/schema/security/oauth"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-        http://www.springframework.org/schema/security/oauth
-        http://www.springframework.org/schema/security/spring-security-oauth.xsd">
-
-    <!-- Steps of OAuth 1.0
-        POST /oauth/request_token?oauth_consumer_key&oauth_callback (returns unauthorized token)
-        GET /oauth/confirm_access?oauth_token (returns secure authorization form)
-        (User) POST /oauth/authorize?requestToken&callbackUrl (authorizes oauth token, redirect to callbackUrl)
-        POST /oauth/access_token?oauth_consumer_key&oauth_token&oauth_verifier
-     -->
-
-    <!-- Spring Security OAuth 1.0 Provider Configuration -->
-    <oauth:provider
-        consumer-details-service-ref="oauthConsumerDetails"
-        token-services-ref="oauthProviderTokenServices"
-        request-token-url="/oauth/request_token"
-        authenticate-token-url="/oauth/authorize"
-        authentication-failed-url="/oauth/confirm_access"
-        access-token-url="/oauth/access_token"
-        require10a="false" />
-
-    <!-- ConsumerDetailsService that constructs ConsumerDetails objects from Apps loaded by App Dao. -->
-    <bean id="oauthConsumerDetails"
-          autowire="byName"
-          class="org.encuestame.business.security.oauth.EnMeConsumerDetailsService" />
-
-    <!-- OAuthProviderTokenServices that uses a OAuthSessionManager to manage OAuthSession storage -->
-    <bean id="oauthProviderTokenServices"
-          autowire="byName"
-          class="org.encuestame.business.security.oauth.EnMeOAuthSessionManagerProviderTokenService">
-    </bean>
-
-    <!-- Stores OAuthSessions in a ConcurrentMap with soft values and 2 minutes time idle -->
-    <bean id="oauthSessionManager"
-          autowire="byName"
-          class="org.encuestame.business.security.oauth.ConcurrentMapOAuthSessionManager" />
-
-    <!-- Sends a UNAUTHORIZED response back to clients attempting to access protected resources but who have not yet authenticated via OAuth -->
-    <bean id="oauthAuthenticationEntryPoint" autowire="byName"
-        class="org.springframework.security.oauth.provider.OAuthProcessingFilterEntryPoint">
-        <property name="realmName" value="encuestame" />
-    </bean>
-
-</beans>

encuestame-business/src/main/resources/encuestame-service-context.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xmlns:context="http://www.springframework.org/schema/context"
-  xsi:schemaLocation="http://www.springframework.org/schema/beans
-       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-       http://www.springframework.org/schema/context
-       http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
-  <!-- Message Resources -->
-  <bean id="resourceBundleMessageSource"
-    class="org.springframework.context.support.ResourceBundleMessageSource">
-    <property name="basename">
-      <value>messages</value>
-    </property>
-  </bean>
-
-  <bean id="chartService" class="org.encuestame.business.service.ChartService" parent="abstractchart"/>
-
-  <bean id="abstractchart" class="org.encuestame.business.service.AbstractChartService"
-        abstract="true" parent="service">
-  </bean>
-
-  <bean id="abstractsurvey" class="org.encuestame.business.service.AbstractSurveyService"
-        abstract="true" parent="abstractchart">
-        <property name="twitterService">
-          <ref bean="twitterService" />
-        </property>
-        <property name="tweetPollDao">
-          <ref bean="tweetPollDao" />
-        </property>
-         <property name="hashTagDao">
-          <ref bean="hashTagDao" />
-        </property>
-  </bean>
-
-   <bean id="tweetPollService" class="org.encuestame.business.service.TweetPollService"
-       parent="abstractsurvey">
-       <property name="answerPollPath">
-           <value>${answers.answerPoll}</value>
-       </property>
-       <property name="tweetPollResultsPath">
-           <value>${answers.tweetPollResults}</value>
-       </property>
-       <property name="tweetPath">
-           <value>${answers.tweetPath}/</value>
-       </property>
-       <property name="twitterDomain">
-            <value>${twitter.url.domain}</value>
-       </property>
-   </bean>
-
-    <bean id="abstractConfig" class="org.encuestame.business.service.AbstractBaseService"
-     abstract="true" parent="dataEnMeSource">
-       <property name="domainUrl">
-           <value>${application.domain}</value>
-       </property>
-       <property name="proxyPass">
-           <value>${application.proxyPass}</value>
-       </property>
-       <property name="name">
-            <value>${application.name}</value>
-       </property>
-       <property name="encoding">
-            <value>${application.encoding}</value>
-       </property>
-       <property name="apiKeygoogle">
-            <value>${application.apiKeygoogle}</value>
-       </property>
-     </bean>
-
-  <bean id="service" class="org.encuestame.business.service.AbstractBaseService"
-      abstract="true" parent="abstractConfig">
-      <property name="messageSource">
-          <ref bean="messageSource" />
-      </property>
-      <property name="serviceMail">
-           <ref bean="serviceMail"></ref>
-      </property>
-  </bean>
-
-  <bean id="dataEnMeSource" class="org.encuestame.business.service.AbstractDataSource" abstract="true">
-  </bean>
-
-  <bean id="messageSource"
-    class="org.encuestame.core.util.MessageSourceFactoryBean">
-    <property name="messagesource" ref="resourceBundleMessageSource" />
-  </bean>
-
-  <bean id="servicesManager" class="org.encuestame.business.service.ServiceManager">
-    <property name="applicationServices">
-      <ref bean="applicationServices"></ref>
-    </property>
-    <property name="messageSource">
-          <ref bean="messageSource" />
-    </property>
-  </bean>
-
-  <bean id="twitterService" class="org.encuestame.business.service.social.provider.TwitterService"
-        parent="service">
-    <property name="tinyApi" value="${twitter.tinyUrl}" />
-  </bean>
-
-  <bean id="linkedInService" class="org.encuestame.business.service.social.provider.LinkedInService"
-        parent="service">
-  </bean>
-
-  <bean id="surveyService" class="org.encuestame.business.service.SurveyService"
-    parent="abstractsurvey">
-  </bean>
-
-  <bean id="securityService" class="org.encuestame.business.service.SecurityService"
-    parent="service">
-    <property name="suspendedNotification">
-      <value>${sec.suspendedNotification}</value>
-    </property>
-  </bean>
-
-  <bean id="frontEndService" class="org.encuestame.business.service.FrontEndService" parent="service"/>
-
-  <bean id="pollService" class="org.encuestame.business.service.PollService" parent="abstractsurvey"/>
-
-  <bean id="projectService" class="org.encuestame.business.service.ProjectService" parent="service"/>
-
-  <bean id="locationService" class="org.encuestame.business.service.LocationService" parent="service"/>
-
-  <bean id="pictureService" class="org.encuestame.business.service.PictureService" parent="service"/>
-
-  <bean id="applicationServices" class="org.encuestame.business.service.ApplicationServices" parent="service">
-    <property name="securityService">
-      <ref bean="securityService"></ref>
-    </property>
-    <property name="surveyService">
-        <ref bean="surveyService"></ref>
-    </property>
-    <property name="pollService">
-        <ref bean="pollService"></ref>
-    </property>
-    <property name="tweetPollService">
-         <ref bean="tweetPollService"></ref>
-    </property>
-    <property name="locationService">
-         <ref bean="locationService"></ref>
-    </property>
-     <property name="projectService">
-         <ref bean="projectService"></ref>
-    </property>
-    <property name="chartService">
-         <ref bean="chartService"></ref>
-    </property>
-    <property name="frontEndService">
-         <ref bean="frontEndService"/>
-    </property>
-    <property name="pictureService">
-         <ref bean="pictureService"/>
-    </property>
-  </bean>
-
-  <bean id="serviceMail" class="org.encuestame.business.mail.MailServiceImpl"  parent="service">
-      <property name="mailSender" ref="mailSender" />
-      <property name="templateMessage" ref="templateMessage" />
-      <property name="noEmailResponse" value="${mail.noresponse}" />
-      <property name="velocityEngine" ref="velocityEngine"/>
-  </bean>
-
-  <!--
-        Social Accounts Beans
-        This beans provide next features:
-        * Facebook Connect
-        * Twitter Connect
-        * LinkedIn Connect
-        Future
-        * TripIt
-  -->
-
-     <bean id="abstractSocialProvider" class="org.encuestame.business.service.social.connect.AbstractSocialProvider"
-          abstract="true">
-    </bean>
-
-    <!-- Twitter Service Provider Consumer -->
-    <bean id="twitterServiceConnect" autowire="byName"
-          class="org.encuestame.business.service.social.connect.TwitterSocialService" parent="abstractSocialProvider">
-    </bean>
-
-    <!-- Facebook OAuth Consumer -->
-    <bean id="facebookServiceConnect" autowire="byName"
-          class="org.encuestame.business.service.social.connect.FacebookSocialService"
-          parent="abstractSocialProvider">
-    </bean>
-
-    <!-- LinkedIn OAuth Consumer
-    <bean id="linkedInServiceConnect" autowire="byName"
-          class="org.encuestame.business.service.social.connect.LinkedInSocialService"
-          parent="abstractSocialProvider">
-    </bean>
-    -->
-
-</beans>

encuestame-business/src/main/resources/invitation.vm

-<html>
-<body>
-    <h3>Hi, You received this message because you are subscribed to ${invitation.listName} in "Encuestame"</h3>
-    <div>
-       To subscribe to this Email List, follow this link ${invitation.urlInvitation}
-    </div>
-</body>
-</html>
-

encuestame-business/src/main/resources/notification.vm

-<html>
-<body>
-    <h3>Hi, This notification has sended to you from Encuestame </h3>
-    <div>
-     ${notification.message}
-    </div>
-
-    <div>
-       To Unsubscribe to this Email List, follow this link ${notification.urlUnsuscribe}
-    </div>
-</body>
-</html>
-
-ml>

encuestame-business/src/main/resources/org/encuestame/config/encuestame-config.properties

+#
+# License Agreement.
+#
+# encuestame system online surveys
+# Copyright (C) 2005-2008 encuestame Development Team
+#
+# This product is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1 as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+#
+
+#-----------------------------------------------------------------------------
+# Required configuration settings
+#-----------------------------------------------------------------------------
+
+# Installation type 'auto' or 'manual'
+setup.installation.type = manual
+# Installation type 'sql' or 'hibernate'
+setup.installation.handler = sql
+
+#----------------------------------------------------------------------------
+# Database configuration settings
+#----------------------------------------------------------------------------
+
+datasource.userbd =
+datasource.pass =
+datasource.classname =
+datasource.dialect =
+datasource.showsql = false
+datasource.delimited =
+## In production this property should change to "none"
+datasource.hbm2ddl.auto = none
+
+#---------------------------------------------------------------
+# Security Config
+#---------------------------------------------------------------
+#Force SSL on login
+spring.sec.forceLoginSSL=false
+#Retrieve permission by group
+spring.sec.roleByGroup = true
+#Retrieve permission by author
+spring.sec.roleByAuthor = true
+#Default Rol
+spring.sec.role.prefix = ENCUESTAME_
+#Path to login
+spring.sec.loginPath=/user/signin
+#After success log in this is the default path user will sent
+spring.sec.defaultLoginUrl=/account/dashboard
+#Path if login fail
+spring.sec.login.error=/user/signin?failure=true
+#Path if recourse is denided
+spring.sec.login.denied=/error
+#Log out
+spring.sec.logout.url=/user/logout
+#After log out the path will send user
+spring.sec.logout.sucess=/home
+#spring.sec.invalidate.session=true
+# Security Keys
+spring.sec.rememberMe.key=9Mdj7MVvkXOXJ8uRgtg/Xb/3eJyW0
+spring.sec.anonymous.key=MU7kyU0he1MvXEDZ9Mdj7MVvkXOXJ8uRgtg/Xb/3eJyW0HZa3csBoyvinGEC4vmi
+spring.sec.encrypt.algorithm.key=PBEWithMD5AndTripleDES
+spring.sec.encrypt.password.key=password
+sec.suspendedNotification = true
+sec.forceLogin = true
+sec.reCaptcha = ${encuestame.recaptcha}
+
+#----------------------------------------------------------------------
+# Required app config.
+#----------------------------------------------------------------------
+application.name = encuestame
+application.context = true
+application.urlImg = /images
+application.encoding = UTF-8
+application.apiKeygoogle = ${google.maps.key}
+application.domain = http://localhost:8080/
+
+#----------------------------------
+# Proxy configuration
+#----------------------------------
+
+application.proxyPass = ${app.proxypass}
+
+#-----------------------------------------------------------------------------
+# Social Provider Configuration
+#-----------------------------------------------------------------------------
+
+# Twitter Provider
+twitter.tinyUrl = http://tinyurl.com/api-create.php
+twitter.oauth.request.token = http://twitter.com/oauth/request_token
+twitter.oauth.access.token = http://twitter.com/oauth/access_token
+twitter.oauth.authorize = http://twitter.com/oauth/authorize?oauth_token={token}
+twitter.url.domain = http://twitter.com/
+## Should be update with your twitter account.
+twitter.oauth.consumerKey = nFboU4T1Zhv8cqMC4cP0ug
+twitter.oauth.consumerSecret = GwOPUEJEaCbNBiBzq6J8StDhb7FOmwDcjfX6zMe0
+## value no required. --------------------------------------------------------
+twitter.oauth.accessToken = 114054787-I17YXofo0576XoQe76I0xI2ecjgNWn9YDJRW8gQI
+twitter.oauth.accessTokenSecret = 1YzYMWOobF2EfegPQXKpmkWqNc6W8sLOQI6vtZFpbQs
+# ----------------------------------------------------------------------------
+# LinkedIn Provider
+linkedIn.oauth.api.key = 5hkdPhtfkRwR0uRhIftai57FA0xbpH7m2fsBFfELvVLf6KMqw1X_FdzsgPkFORuS
+linkedIn.oauth.api.secret = 3Tuj7nXvACdCwffnbh-NkUXQ_Re0t1FPakogEPApw_3DBsfowdQuoggCCTd38a9o
+linkedIn.oauth.authorize.url = https://www.linkedin.com/uas/oauth/authorize?oauth_token={token}
+linkedIn.oauth.request.token = https://api.linkedin.com/uas/oauth/requestToken
+# Facebook Provider
+facebook.api.key = db89ecfed3c7f3e212e01b3fc919838ff04049503d8402034b7148d5d3b7976fe4a314a31db0a42d
+facebook.api.secret = f85145c9f11fd9d920759b89a29c8e3f4ca05864257eeb4e394557f21588ad41a5f44f16242b14d7
+facebook.api.id = 140372495981006
+# TripIt
+tripIt.oauth.api.key = ed00208afc958b1d6fbd06f7a20faa03e810fa27
+tripIt.oauth.api.secret = 47c29a0bb66df8c633580e3810536b9b25ff3a59
+tripIt.oauth.api.request.url = https://api.tripit.com/oauth/request_token
+tripIt.oauth.api.authorize.url = https://www.tripit.com/oauth/authorize?oauth_token={token}&oauth_callback=https://xxxx.com/connect/tripit
+tripIt.oauth.api.accessToken.url = https://api.tripit.com/oauth/access_token
+# Google Api Key
+google.api.key = AIzaSyCvEMnlGa4q4Suayx1bMYXg-Wkf1jYmmaQ
+
+
+# -----------------------------------------------------------------------------
+# Survey/TweetPoll/Poll vote configuration
+# -----------------------------------------------------------------------------
+
+answers.answerPoll = /poll/view
+answers.tweetPollResults = /tweet/view
+answers.tweetPath = /tweet/vote
+answers.tweetPathVote = /tweet/vote
+
+
+#-----------------------------------------------------------------------------
+# Directory settings
+#-----------------------------------------------------------------------------
+dir.data.warehouse = ${user.home}/encuestame
+dir.data.picture = dir.data.warehouse/pictures
+dir.data.profiles = dir.data.warehouse/profiles
+dir.data.index = dir.data.warehouse/indexes

encuestame-business/src/main/resources/org/encuestame/email/templates/confirm-your-account.vm

+<html>
+<body>
+    <div style="padding:14px;margin-bottom:4px;background-color:#008eb9">
+        <div style="font-size:16px;font-weidth:bold:padding:5px;">
+            Encuestame Survey System
+        </div>
+    </div>
+    <h2>Hi, ${user.username} </h2>
+    <p>
+    <div>Please confirm your encuestame account by clicking this link:</div>
+    <a href="http://localhost:8080/encuestame/account/confirm/email/${user.username}/${inviteCode}">
+        http://localhost:8080/encuestame/account/confirm/email/${user.username}/${inviteCode}
+    </a><br/>
+    <div>Once you have confirmed your account, you can access full access.</div><br/>
+
+    <div>${app.url}</div><br/>
+
+    <div>If you have received this message in error, please <a href="#">click here.</a></div><br/>
+
+    <div style="font-size:10px;">
+        footer message footer message footer message footer message footer message footer message footer message
+        footer message footer message footer messagefooter message footer message footer message footer message
+         footer message footer message footer message footer messagefooter message footer message
+    </div>
+    </p>
+</body>
+</html>

encuestame-business/src/main/resources/org/encuestame/email/templates/invitation.vm

+<html>
+<body>
+    <h3>Hi, You received this message because you are subscribed to ${invitation.listName} in "Encuestame"</h3>
+    <div>
+       To subscribe to this Email List, follow this link ${invitation.urlInvitation}
+    </div>
+</body>
+</html>
+

encuestame-business/src/main/resources/org/encuestame/email/templates/notification.vm

+<html>
+<body>
+    <h3>Hi, This notification has sended to you from Encuestame </h3>
+    <div>
+     ${notification.message}
+    </div>
+
+    <div>
+       To Unsubscribe to this Email List, follow this link ${notification.urlUnsuscribe}
+    </div>
+</body>
+</html>
+
+ml>

encuestame-business/src/main/resources/org/encuestame/email/templates/password-confirmation.vm

+<html>
+<body>
+    <h3>Hi ${user.username}, welcome to Encuestame!</h3>
+    <div>
+       Your new password  is <b>${user.password}</b>
+    </div>
+    <div>
+        Login <a href="#">here !!</a>
+    </div>
+</body>
+</html>

encuestame-business/src/main/resources/org/encuestame/email/templates/renew-password.vm

+<html>
+<body>
+    <h3>Hi ${user.username}, we send your new passowrd!</h3>
+    <div>
+       Your new password  is <b>${user.password}</b>
+    </div>
+    <div>
+        Login <a href="#">here !!</a>
+    </div>
+</body>
+</html>

encuestame-business/src/main/resources/password-confirmation.vm

-<html>
-<body>
-    <h3>Hi ${user.username}, welcome to Encuestame!</h3>
-    <div>
-       Your new password  is <b>${user.password}</b>
-    </div>
-    <div>
-        Login <a href="#">here !!</a>
-    </div>
-</body>
-</html>

encuestame-business/src/main/resources/renew-password.vm

-<html>
-<body>
-    <h3>Hi ${user.username}, we send your new passowrd!</h3>
-    <div>
-       Your new password  is <b>${user.password}</b>
-    </div>
-    <div>
-        Login <a href="#">here !!</a>
-    </div>
-</body>
-</html>

encuestame-business/src/main/resources/test-config.properties

-## Twitter Account for Test Cases.
-twitter.test.account = testEncuesta
-twitter.test.password = testEncuesta123
-#OAuth Data
-twitter.test.consumerKey = nFboU4T1Zhv8cqMC4cP0ug
-twitter.test.consumerSecret = GwOPUEJEaCbNBiBzq6J8StDhb7FOmwDcjfX6zMe0
-twitter.test.token = 114054787-I17YXofo0576XoQe76I0xI2ecjgNWn9YDJRW8gQI
-twitter.test.tokenSecret = 1YzYMWOobF2EfegPQXKpmkWqNc6W8sLOQI6vtZFpbQs
-twitter.test.pin = 1393800
-
-
-# Second Account
-twitter.test.account2 = testEncuesta2
-twitter.test.password2 = testEncuesta2123
-#OAuth Data
-twitter.test.consumerKey2 = nFboU4T1Zhv8cqMC4cP0ug
-twitter.test.consumerSecret2 = GwOPUEJEaCbNBiBzq6J8StDhb7FOmwDcjfX6zMe0
-twitter.test.token2 = 114054787-1AqKm4jQRRCYSpKzXqyMfC3ZGHcylvTM9ldf7zJ0
-twitter.test.tokenSecret2 = dSbWWsDrGEv8qKLT2JlPkkvHTTyRL6rh56KcpArVh0
-twitter.test.pin2 = 4129201
-
-# Test Cases email
-mail.test.email = encuestamettest@gmail.com
-mail.test.email2 = encuestametest2@gmail.com
-mail.test.email3 = encuestametest3@gmail.com

encuestame-business/src/test/resources/encuestame-report-context.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+</beans>

encuestame-business/src/test/resources/encuestame-security-context.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:security="http://www.springframework.org/schema/security"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+       http://www.springframework.org/schema/security
+       http://www.springframework.org/schema/security/spring-security-3.0.xsd">
+
+  <!-- To enable @Pre and @Post Annotations -->
+  <security:global-method-security pre-post-annotations="enabled"/>
+
+  <!-- Authentication Manager -->
+  <security:authentication-manager alias="authenticationManager">
+    <security:authentication-provider  user-service-ref="enMeAuthenticationDao">
+        <security:password-encoder ref="passwordEncoder" />
+    </security:authentication-provider>
+  </security:authentication-manager>
+
+  <bean id="passwordEncoder" class="org.jasypt.spring.security3.PasswordEncoder">
+    <property name="passwordEncryptor">
+      <ref bean="jasyptPasswordEncryptor" />
+    </property>
+  </bean>
+
+  <bean id="jasyptPasswordEncryptor" class="org.jasypt.util.password.StrongPasswordEncryptor" />
+
+
+  <bean id="enMeAuthenticationDao" class="org.encuestame.core.security.EnMeUserServiceImp">
+    <property name="roleGroupAuth" value="${spring.sec.roleByGroup}" />
+    <property name="roleUserAuth" value="${spring.sec.roleByAuthor}" />
+  </bean>
+
+  <bean id="authenticationEntryPoint"
+    class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
+    <property name="loginFormUrl" value="${spring.sec.loginPath}" />
+    <property name="forceHttps" value="${spring.sec.forceLoginSSL}" />
+  </bean>
+
+  <security:http auto-config="false"
+                 entry-point-ref="authenticationEntryPoint"
+                 access-decision-manager-ref="voteAccessDecisionManager"
+                 access-denied-page="${spring.sec.login.denied}">
+    <security:intercept-url pattern="index.jsp" filters="none" />
+
+    <!-- Public Paths -->
+    <security:intercept-url pattern="/index.jspx" filters="none"/>
+    <security:intercept-url pattern="/error.jspx" filters="none"/>
+    <security:intercept-url pattern="/home" filters="none"/>
+    <security:intercept-url pattern="/users.jspx" filters="none"/>
+    <security:intercept-url pattern="/tags.jspx" filters="none"/>
+    <security:intercept-url pattern="/signin.jspx" filters="none"/>
+    <security:intercept-url pattern="/forgot.jspx" filters="none"/>
+    <security:intercept-url pattern="/signup.jspx" filters="none"/>
+
+    <!-- Admon Paths -->
+    <security:intercept-url pattern="/admon/**/*" access="ENCUESTAME_ADMIN, ENCUESTAME_USER"/>
+
+    <!-- Account Paths
+    <security:intercept-url pattern="/user/signin.jspx" access="ENCUESTAME_ANONYMOUS"/>
+    <security:intercept-url pattern="/user/forgot.jspx" access="ENCUESTAME_ANONYMOUS" />
+    <security:intercept-url pattern="/user/signup.jspx" access="ENCUESTAME_ANONYMOUS"/>
+    -->
+
+    <security:intercept-url pattern="/user/logout" access="ENCUESTAME_USER"/>
+
+    <!-- Super Admin -->
+    <security:intercept-url pattern="/superAdmin.jspx" access="ENCUESTAME_SUPER"/>
+
+    <!-- Shared areas -->
+    <security:intercept-url pattern="/settings/**/*" access="ENCUESTAME_USER"/>
+
+    <!-- Surveys / Poll / TweetPoll Paths -->
+    <security:intercept-url pattern="/tweetpoll.jspx" access="ENCUESTAME_USER, ENCUESTAME_EDITOR"   />
+    <security:intercept-url pattern="/poll.jspx" access="ENCUESTAME_USER"/>
+    <security:intercept-url pattern="/survey.jspx" access="ENCUESTAME_USER, ENCUESTAME_EDITOR"/>
+
+    <!-- Vote Paths
+    <security:intercept-url pattern="/tweet/*" access="ENCUESTAME_USER" />
+    -->
+
+    <!-- Resources Path -->
+    <security:intercept-url pattern="/resources/*"  filters="none" />
+
+    <security:remember-me key="${spring.sec.rememberMe.key}" services-alias="_rememberMeServices" token-validity-seconds="10080"/>
+    <security:anonymous enabled="true" granted-authority="ENCUESTAME_ANONYMOUS" key="${spring.sec.anonymous.key}" />
+    <security:logout logout-success-url="${spring.sec.logout.sucess}" invalidate-session="true"
+                     logout-url="${spring.sec.logout.url}"/>
+    <security:custom-filter position="FORM_LOGIN_FILTER" ref="authenticationProcessingFilter" />
+  </security:http>
+
+  <!--  Enable OAuth Security.
+  <import resource="encuestame-security-oauth-context.xml"/>
+    -->
+
+  <bean id="authenticationProcessingFilter" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter">
+      <property name="authenticationManager" ref="authenticationManager"/>
+      <property name="authenticationFailureHandler" ref="authenticationFailureHandler"/>
+      <property name="authenticationSuccessHandler" ref="authenticationSuccessHandler"/>
+      <property name="filterProcessesUrl" value="/j_spring_security_check"/>
+  </bean>
+
+   <bean id="authenticationSuccessHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler">
+       <property name="defaultTargetUrl" value="${spring.sec.defaultLoginUrl}"/>
+   </bean>
+
+   <bean id="authenticationFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
+       <property name="defaultFailureUrl" value="${spring.sec.login.error}"/>
+   </bean>
+
+  <bean id="voteAccessDecisionManager"
+    class="org.springframework.security.access.vote.AffirmativeBased">
+    <property name="allowIfAllAbstainDecisions">
+      <value>false</value>
+    </property>
+    <property name="decisionVoters">
+      <list>
+        <ref bean="roleVoter" />
+      </list>
+    </property>
+  </bean>
+
+  <bean id="roleVoter" class="org.encuestame.core.security.EnMeRoleVoter">
+    <property name="rolePrefix" value="${spring.sec.role.prefix}" />
+  </bean>
+
+  <!--  reCaptcha -->
+
+   <bean id="reCaptcha" class="net.tanesha.recaptcha.ReCaptchaImpl" scope="singleton">
+        <property name="privateKey" value="6LdyFwUAAAAAAGB3BsjX-j5EgYzULsR3ftiUvwUd" />
+        <property name="publicKey" value="6LdyFwUAAAAAAP6p1IeqUM7uMKUYyPazw-haEAUU" />
+        <property name="recaptchaServer" value="${encuestame.recaptcha.recaptchaserver}" />
+        <property name="includeNoscript" value="${encuestame.recaptcha.includenoscript}" />
+   </bean>
+
+</beans>

encuestame-business/src/test/resources/encuestame-security-oauth-context.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:oauth="http://www.springframework.org/schema/security/oauth"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+        http://www.springframework.org/schema/security/oauth
+        http://www.springframework.org/schema/security/spring-security-oauth.xsd">
+
+    <!-- Steps of OAuth 1.0
+        POST /oauth/request_token?oauth_consumer_key&oauth_callback (returns unauthorized token)
+        GET /oauth/confirm_access?oauth_token (returns secure authorization form)
+        (User) POST /oauth/authorize?requestToken&callbackUrl (authorizes oauth token, redirect to callbackUrl)
+        POST /oauth/access_token?oauth_consumer_key&oauth_token&oauth_verifier
+     -->
+
+    <!-- Spring Security OAuth 1.0 Provider Configuration -->
+    <oauth:provider
+        consumer-details-service-ref="oauthConsumerDetails"
+        token-services-ref="oauthProviderTokenServices"
+        request-token-url="/oauth/request_token"
+        authenticate-token-url="/oauth/authorize"
+        authentication-failed-url="/oauth/confirm_access"
+        access-token-url="/oauth/access_token"
+        require10a="false" />
+
+    <!-- ConsumerDetailsService that constructs ConsumerDetails objects from Apps loaded by App Dao. -->
+    <bean id="oauthConsumerDetails"
+          autowire="byName"
+          class="org.encuestame.business.security.oauth.EnMeConsumerDetailsService" />
+
+    <!-- OAuthProviderTokenServices that uses a OAuthSessionManager to manage OAuthSession storage -->
+    <bean id="oauthProviderTokenServices"
+          autowire="byName"
+          class="org.encuestame.business.security.oauth.EnMeOAuthSessionManagerProviderTokenService">
+    </bean>
+
+    <!-- Stores OAuthSessions in a ConcurrentMap with soft values and 2 minutes time idle -->
+    <bean id="oauthSessionManager"
+          autowire="byName"
+          class="org.encuestame.business.security.oauth.ConcurrentMapOAuthSessionManager" />
+
+    <!-- Sends a UNAUTHORIZED response back to clients attempting to access protected resources but who have not yet authenticated via OAuth -->
+    <bean id="oauthAuthenticationEntryPoint" autowire="byName"
+        class="org.springframework.security.oauth.provider.OAuthProcessingFilterEntryPoint">
+        <property name="realmName" value="encuestame" />
+    </bean>
+
+</beans>

encuestame-business/src/test/resources/encuestame-service-context.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+       http://www.springframework.org/schema/context
+       http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+  <!-- Message Resources -->
+  <bean id="resourceBundleMessageSource"
+    class="org.springframework.context.support.ResourceBundleMessageSource">
+    <property name="basename">
+      <value>messages</value>
+    </property>
+  </bean>
+
+  <bean id="chartService" class="org.encuestame.business.service.ChartService" parent="abstractchart"/>
+
+  <bean id="abstractchart" class="org.encuestame.business.service.AbstractChartService"
+        abstract="true" parent="service">
+  </bean>
+
+  <bean id="abstractsurvey" class="org.encuestame.business.service.AbstractSurveyService"
+        abstract="true" parent="abstractchart">
+        <property name="twitterService">
+          <ref bean="twitterService" />
+        </property>
+        <property name="tweetPollDao">
+          <ref bean="tweetPollDao" />
+        </property>
+         <property name="hashTagDao">
+          <ref bean="hashTagDao" />
+        </property>
+  </bean>
+
+   <bean id="tweetPollService" class="org.encuestame.business.service.TweetPollService"
+       parent="abstractsurvey">
+       <property name="answerPollPath">
+           <value>${answers.answerPoll}</value>
+       </property>
+       <property name="tweetPollResultsPath">
+           <value>${answers.tweetPollResults}</value>
+       </property>
+       <property name="tweetPath">
+           <value>${answers.tweetPath}/</value>
+       </property>
+       <property name="twitterDomain">
+            <value>${twitter.url.domain}</value>
+       </property>
+   </bean>
+
+    <bean id="abstractConfig" class="org.encuestame.business.service.AbstractBaseService"
+     abstract="true" parent="dataEnMeSource">
+       <property name="domainUrl">
+           <value>${application.domain}</value>
+       </property>
+       <property name="proxyPass">
+           <value>${application.proxyPass}</value>
+       </property>
+       <property name="name">
+            <value>${application.name}</value>
+       </property>
+       <property name="encoding">
+            <value>${application.encoding}</value>
+       </property>
+       <property name="apiKeygoogle">
+            <value>${application.apiKeygoogle}</value>
+       </property>
+     </bean>
+
+  <bean id="service" class="org.encuestame.business.service.AbstractBaseService"
+      abstract="true" parent="abstractConfig">
+      <property name="messageSource">
+          <ref bean="messageSource" />
+      </property>
+      <property name="serviceMail">
+           <ref bean="serviceMail"></ref>
+      </property>
+  </bean>
+
+  <bean id="dataEnMeSource" class="org.encuestame.business.service.AbstractDataSource" abstract="true">
+  </bean>
+
+  <bean id="messageSource"
+    class="org.encuestame.core.util.MessageSourceFactoryBean">
+    <property name="messagesource" ref="resourceBundleMessageSource" />
+  </bean>
+
+  <bean id="servicesManager" class="org.encuestame.business.service.ServiceManager">
+    <property name="applicationServices">
+      <ref bean="applicationServices"></ref>
+    </property>
+    <property name="messageSource">
+          <ref bean="messageSource" />
+    </property>
+  </bean>
+
+  <bean id="twitterService" class="org.encuestame.business.service.social.provider.TwitterService"
+        parent="service">
+    <property name="tinyApi" value="${twitter.tinyUrl}" />
+  </bean>
+
+  <bean id="linkedInService" class="org.encuestame.business.service.social.provider.LinkedInService"
+        parent="service">
+  </bean>
+
+  <bean id="surveyService" class="org.encuestame.business.service.SurveyService"
+    parent="abstractsurvey">
+  </bean>
+
+  <bean id="securityService" class="org.encuestame.business.service.SecurityService"
+    parent="service">
+    <property name="suspendedNotification">
+      <value>${sec.suspendedNotification}</value>
+    </property>
+  </bean>
+
+  <bean id="frontEndService" class="org.encuestame.business.service.FrontEndService" parent="service"/>
+
+  <bean id="pollService" class="org.encuestame.business.service.PollService" parent="abstractsurvey"/>
+
+  <bean id="projectService" class="org.encuestame.business.service.ProjectService" parent="service"/>
+
+  <bean id="locationService" class="org.encuestame.business.service.LocationService" parent="service"/>
+
+  <bean id="pictureService" class="org.encuestame.business.service.PictureService" parent="service"/>
+
+  <bean id="applicationServices" class="org.encuestame.business.service.ApplicationServices" parent="service">
+    <property name="securityService">
+      <ref bean="securityService"></ref>
+    </property>
+    <property name="surveyService">
+        <ref bean="surveyService"></ref>
+    </property>
+    <property name="pollService">
+        <ref bean="pollService"></ref>
+    </property>
+    <property name="tweetPollService">
+         <ref bean="tweetPollService"></ref>
+    </property>
+    <property name="locationService">
+         <ref bean="locationService"></ref>
+    </property>
+     <property name="projectService">
+         <ref bean="projectService"></ref>
+    </property>
+    <property name="chartService">
+         <ref bean="chartService"></ref>
+    </property>
+    <property name="frontEndService">
+         <ref bean="frontEndService"/>
+    </property>
+    <property name="pictureService">
+         <ref bean="pictureService"/>
+    </property>
+  </bean>
+
+  <bean id="serviceMail" class="org.encuestame.business.mail.MailServiceImpl"  parent="service">
+      <property name="mailSender" ref="mailSender" />
+      <property name="templateMessage" ref="templateMessage" />
+      <property name="noEmailResponse" value="${mail.noresponse}" />
+      <property name="velocityEngine" ref="velocityEngine"/>
+  </bean>
+
+  <!--
+        Social Accounts Beans
+        This beans provide next features:
+        * Facebook Connect
+        * Twitter Connect
+        * LinkedIn Connect
+        Future
+        * TripIt
+  -->
+
+     <bean id="abstractSocialProvider" class="org.encuestame.business.service.social.connect.AbstractSocialProvider"
+          abstract="true">
+    </bean>
+
+    <!-- Twitter Service Provider Consumer -->
+    <bean id="twitterServiceConnect" autowire="byName"
+          class="org.encuestame.business.service.social.connect.TwitterSocialService" parent="abstractSocialProvider">
+    </bean>
+
+    <!-- Facebook OAuth Consumer -->
+    <bean id="facebookServiceConnect" autowire="byName"
+          class="org.encuestame.business.service.social.connect.FacebookSocialService"
+          parent="abstractSocialProvider">
+    </bean>
+
+    <!-- LinkedIn OAuth Consumer
+    <bean id="linkedInServiceConnect" autowire="byName"
+          class="org.encuestame.business.service.social.connect.LinkedInSocialService"
+          parent="abstractSocialProvider">
+    </bean>
+    -->
+
+  <bean id="applicationStartup" class="org.encuestame.business.setup.ApplicationStartup"/>
+
+
+</beans>

encuestame-business/src/test/resources/test-config.properties

+## Twitter Account for Test Cases.
+twitter.test.account = testEncuesta
+twitter.test.password = testEncuesta123
+#OAuth Data
+twitter.test.consumerKey = nFboU4T1Zhv8cqMC4cP0ug
+twitter.test.consumerSecret = GwOPUEJEaCbNBiBzq6J8StDhb7FOmwDcjfX6zMe0
+twitter.test.token = 114054787-I17YXofo0576XoQe76I0xI2ecjgNWn9YDJRW8gQI
+twitter.test.tokenSecret = 1YzYMWOobF2EfegPQXKpmkWqNc6W8sLOQI6vtZFpbQs
+twitter.test.pin = 1393800
+
+
+# Second Account
+twitter.test.account2 = testEncuesta2
+twitter.test.password2 = testEncuesta2123
+#OAuth Data
+twitter.test.consumerKey2 = nFboU4T1Zhv8cqMC4cP0ug
+twitter.test.consumerSecret2 = GwOPUEJEaCbNBiBzq6J8StDhb7FOmwDcjfX6zMe0
+twitter.test.token2 = 114054787-1AqKm4jQRRCYSpKzXqyMfC3ZGHcylvTM9ldf7zJ0
+twitter.test.tokenSecret2 = dSbWWsDrGEv8qKLT2JlPkkvHTTyRL6rh56KcpArVh0
+twitter.test.pin2 = 4129201
+
+# Test Cases email
+mail.test.email = encuestamettest@gmail.com
+mail.test.email2 = encuestametest2@gmail.com
+mail.test.email3 = encuestametest3@gmail.com

encuestame-core/pom.xml

         </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
-            <artifactId>hibernate-annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.hibernate</groupId>
             <artifactId>hibernate-core</artifactId>
         </dependency>
         <dependency>

encuestame-core/src/main/resources/TwitterSearch-context.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
-		http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
-		http://www.springframework.org/schema/integration/twitter http://www.springframework.org/schema/integration/twitter/spring-integration-twitter-2.0.xsd"
-	xmlns:context="http://www.springframework.org/schema/context"
-	xmlns:int="http://www.springframework.org/schema/integration"
-	xmlns:int-twitter="http://www.springframework.org/schema/integration/twitter">
-	
-	<context:property-placeholder location="classpath:oauth.properties"/>
-
-	<bean id="twitterTemplate"
-		class="org.springframework.integration.twitter.core.Twitter4jTemplate">
-		<constructor-arg value="${twitter.oauth.consumerKey}" />
-		<constructor-arg value="${twitter.oauth.consumerSecret}" />
-		<constructor-arg value="${twitter.oauth.accessToken}" />
-		<constructor-arg value="${twitter.oauth.accessTokenSecret}" />
-	</bean>
-	
-	<int-twitter:search-inbound-channel-adapter id="searchAdapter" channel="sourceExtractor" query="#springintegration">
-    	<int:poller fixed-rate="3000" max-messages-per-poll="5" />
-    </int-twitter:search-inbound-channel-adapter>
-   
-	<int:transformer input-channel="sourceExtractor" output-channel="twitterOut" expression="payload.getText()"/>
-	
-	<int:logging-channel-adapter id="twitterOut"/>
-</beans>

encuestame-core/src/main/resources/TwitterSendUpdates-context.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
-        http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
-        http://www.springframework.org/schema/integration/twitter http://www.springframework.org/schema/integration/twitter/spring-integration-twitter-2.0.xsd"
-    xmlns:context="http://www.springframework.org/schema/context"
-    xmlns:i="http://www.springframework.org/schema/integration"
-    xmlns:twitter="http://www.springframework.org/schema/integration/twitter">
-
-    <context:property-placeholder location="classpath:twitter-config.properties"/>
-
-
-    <bean id="twitterTemplate"
-        class="org.springframework.integration.twitter.core.Twitter4jTemplate">
-        <constructor-arg value="${twitter.oauth.consumerKey}" />
-        <constructor-arg value="${twitter.oauth.consumerSecret}" />
-        <constructor-arg value="${twitter.oauth.accessToken}" />
-        <constructor-arg value="${twitter.oauth.accessTokenSecret}" />
-    </bean>
-
-    <bean id="twitterRejector" class="org.encuestame.core.integration.TwitterMessageSelector"></bean>
-
-    <i:channel id="twitterChannel" />
-
-    <i:transformer id="tinyUrlTransformer" ref="tinyUrlTransformerBean"
-        input-channel="twitterChannel" method="transform" output-channel="twitterTransformedChannel" />
-
-    <bean id="tinyUrlTransformerBean"
-        class="org.encuestame.core.integration.transformer.TinyUrlTransformer" />
-
-    <i:channel id="twitterTransformedChannel">
-        <i:queue capacity="25" />
-    </i:channel>
-
-    <twitter:outbound-channel-adapter id="twitterAdapter"
-        twitter-template="twitterTemplate" channel="twitterChannel" />
-        <i:poller max-messages-per-poll="1" id="defaultPoller"
-        default="true">
-        <i:interval-trigger interval="30000" />
-    </i:poller>
-
-    <i:channel id="errorChannel">
-         <i:queue capacity="500"/>
-    </i:channel>
-
-</beans>

encuestame-core/src/main/resources/TwitterTimelineUpdates-context.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
-		http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
-		http://www.springframework.org/schema/integration/twitter http://www.springframework.org/schema/integration/twitter/spring-integration-twitter-2.0.xsd"
-	xmlns:context="http://www.springframework.org/schema/context"
-	xmlns:int="http://www.springframework.org/schema/integration"
-	xmlns:int-twitter="http://www.springframework.org/schema/integration/twitter">
-	
-	<context:property-placeholder location="classpath:oauth.properties"/>
-
-	<bean id="twitterTemplate"
-		class="org.springframework.integration.twitter.core.Twitter4jTemplate">
-		<constructor-arg value="${twitter.oauth.consumerKey}" />
-		<constructor-arg value="${twitter.oauth.consumerSecret}" />
-		<constructor-arg value="${twitter.oauth.accessToken}" />
-		<constructor-arg value="${twitter.oauth.accessTokenSecret}" />
-	</bean>
-	
-	<int-twitter:inbound-channel-adapter id="twitterInbound"
-		twitter-template="twitterTemplate" channel="sourceExtractor">
-		<int:poller fixed-rate="1000" max-messages-per-poll="3" />
-	</int-twitter: