org.eclipse.lyo.server.oauth.consumerstore
Class FileSystemConsumerStore

java.lang.Object
  extended by org.eclipse.lyo.server.oauth.core.consumer.AbstractConsumerStore
      extended by org.eclipse.lyo.server.oauth.consumerstore.FileSystemConsumerStore
All Implemented Interfaces:
ConsumerStore

public class FileSystemConsumerStore
extends AbstractConsumerStore

A simple RDF consumer store backed by an XML file on the filesystem. NOTE: The shared consumer secret is stored as Base64 and is only obfuscated, not encrypted.

Author:
Samuel Padgett

Field Summary
protected static String CALLBACK_URL
           
protected static String CONSUMER_KEY
           
protected static String CONSUMER_NAME
           
protected static String CONSUMER_RESOURCE
           
protected static String CONSUMER_SECRET
           
protected static String LYO_OAUTH_NAMESPACE
           
protected static String PROVISIONAL
           
protected static String TRUSTED
           
 
Constructor Summary
FileSystemConsumerStore(com.hp.hpl.jena.rdf.model.Model model, String oauthStoreRoot)
           
FileSystemConsumerStore(String oauthStoreRoot)
           
 
Method Summary
 LyoOAuthConsumer addConsumer(LyoOAuthConsumer consumer)
          Adds a new consumer.
 void closeConsumerStore()
          Closes the consumer store.
protected  void createModel()
           
protected  LyoOAuthConsumer fromResource(com.hp.hpl.jena.rdf.model.Resource resource)
           
protected  void loadConsumers()
           
 LyoOAuthConsumer removeConsumer(String consumerKey)
          Removes a consumer.
protected  void removeProperties(LyoOAuthConsumer consumer)
          Removes any properties previously associated with the consumer.
protected  void removeProperties(String consumerKey)
          Removes any properties previously associated with the consumer.
protected  com.hp.hpl.jena.rdf.model.Resource toResource(LyoOAuthConsumer consumer)
           
 LyoOAuthConsumer updateConsumer(LyoOAuthConsumer consumer)
          Updates a consumer.
protected  void writeModel()
           
 
Methods inherited from class org.eclipse.lyo.server.oauth.core.consumer.AbstractConsumerStore
add, addAll, getAllConsumers, getConsumer, getConsumer, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LYO_OAUTH_NAMESPACE

protected static final String LYO_OAUTH_NAMESPACE
See Also:
Constant Field Values

CONSUMER_RESOURCE

protected static final String CONSUMER_RESOURCE
See Also:
Constant Field Values

CALLBACK_URL

protected static final String CALLBACK_URL
See Also:
Constant Field Values

CONSUMER_NAME

protected static final String CONSUMER_NAME
See Also:
Constant Field Values

CONSUMER_KEY

protected static final String CONSUMER_KEY
See Also:
Constant Field Values

CONSUMER_SECRET

protected static final String CONSUMER_SECRET
See Also:
Constant Field Values

PROVISIONAL

protected static final String PROVISIONAL
See Also:
Constant Field Values

TRUSTED

protected static final String TRUSTED
See Also:
Constant Field Values
Constructor Detail

FileSystemConsumerStore

public FileSystemConsumerStore(String oauthStoreRoot)
                        throws SQLException,
                               ConsumerStoreException,
                               ClassNotFoundException
Throws:
SQLException
ConsumerStoreException
ClassNotFoundException

FileSystemConsumerStore

public FileSystemConsumerStore(com.hp.hpl.jena.rdf.model.Model model,
                               String oauthStoreRoot)
                        throws ConsumerStoreException
Throws:
ConsumerStoreException
Method Detail

createModel

protected void createModel()

writeModel

protected void writeModel()
                   throws FileNotFoundException
Throws:
FileNotFoundException

loadConsumers

protected void loadConsumers()
                      throws ConsumerStoreException
Throws:
ConsumerStoreException

addConsumer

public LyoOAuthConsumer addConsumer(LyoOAuthConsumer consumer)
                             throws ConsumerStoreException
Description copied from interface: ConsumerStore
Adds a new consumer.

Parameters:
consumer - the consumer
Returns:
the previous consumer associated with this key or null if there wasn't one
Throws:
ConsumerStoreException

removeConsumer

public LyoOAuthConsumer removeConsumer(String consumerKey)
                                throws ConsumerStoreException
Description copied from interface: ConsumerStore
Removes a consumer.

Returns:
the removed consumer or null if it wasn't previously in the store
Throws:
ConsumerStoreException - on errors

updateConsumer

public LyoOAuthConsumer updateConsumer(LyoOAuthConsumer consumer)
                                throws ConsumerStoreException
Description copied from interface: ConsumerStore
Updates a consumer.

Parameters:
consumer - the consumer
Returns:
the same consumer or null if it wasn't previously in the store
Throws:
ConsumerStoreException - on errors

closeConsumerStore

public void closeConsumerStore()
Description copied from interface: ConsumerStore
Closes the consumer store. It is unavailable for further use.

Specified by:
closeConsumerStore in interface ConsumerStore
Specified by:
closeConsumerStore in class AbstractConsumerStore

removeProperties

protected void removeProperties(String consumerKey)
Removes any properties previously associated with the consumer.

Parameters:
consumerKey - the consumer key

removeProperties

protected void removeProperties(LyoOAuthConsumer consumer)
Removes any properties previously associated with the consumer.

Parameters:
consumer - the consumer

toResource

protected com.hp.hpl.jena.rdf.model.Resource toResource(LyoOAuthConsumer consumer)
                                                 throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

fromResource

protected LyoOAuthConsumer fromResource(com.hp.hpl.jena.rdf.model.Resource resource)
                                 throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException


Copyright © 2013. All Rights Reserved.