Package org.apache.roller.weblogger.pojos

Examples of org.apache.roller.weblogger.pojos.OAuthConsumerRecord


        }
    }

    public OAuthConsumer addConsumer(String username, String consumerKey) throws OAuthException {

        OAuthConsumerRecord record = new OAuthConsumerRecord();
        record.setConsumerKey(consumerKey);
        record.setUserName(username);
        record.setConsumerSecret(UUID.randomUUID().toString());

        try {
            strategy.store(record);
        } catch (WebloggerException ex) {
            throw new OAuthException("ERROR storing accessor", ex);
        }
       
        OAuthConsumer consumer = new OAuthConsumer(
            null,
            record.getConsumerKey(),
            record.getConsumerSecret(),
            getServiceProvider());

        return consumer;
    }
View Full Code Here


            throw new OAuthException("ERROR: cannot have more than one site-wide consumer");
        }
    }

    public OAuthConsumer getConsumer() throws WebloggerException {
        OAuthConsumerRecord record = null;
        try {
            Query q = strategy.getNamedQuery("OAuthConsumerRecord.getSiteWideConsumer");
            record = (OAuthConsumerRecord)q.getSingleResult();

        } catch (Throwable ex) {
            log.debug("ERROR fetching site-wide consumer", ex);
        }
        if (record != null) {
            OAuthConsumer consumer = new OAuthConsumer(
                null,
                record.getConsumerKey(),
                record.getConsumerSecret(),
                getServiceProvider());
            return consumer;
        }
        return null;
    }
View Full Code Here

        }
        return null;
    }

    public OAuthConsumer getConsumerByUsername(String username) throws WebloggerException {
        OAuthConsumerRecord record = null;
        try {
            Query q = strategy.getNamedQuery("OAuthConsumerRecord.getByUsername");
            q.setParameter(1, username);
            record = (OAuthConsumerRecord)q.getSingleResult();

        } catch (Throwable ex) {
            log.debug("ERROR fetching consumer", ex);
        }
        if (record != null) {
            OAuthConsumer consumer = new OAuthConsumer(
                null,
                record.getConsumerKey(),
                record.getConsumerSecret(),
                getServiceProvider());
            consumer.setProperty("userName", record.getUserName());
            return consumer;
        }
        return null;
    }
View Full Code Here

        }
        return accessor;
    }

    OAuthConsumer getConsumerByKey(String consumerKey) {
        OAuthConsumerRecord record = null;
        try {
            Query q = strategy.getNamedQuery("OAuthConsumerRecord.getByConsumerKey");
            q.setParameter(1, consumerKey);
            record = (OAuthConsumerRecord)q.getSingleResult();
View Full Code Here

TOP

Related Classes of org.apache.roller.weblogger.pojos.OAuthConsumerRecord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.