adams.flow.standalone
Class TwitterConnection

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.flow.core.AbstractActor
              extended by adams.flow.standalone.AbstractStandalone
                  extended by adams.flow.standalone.TwitterConnection
All Implemented Interfaces:
AdditionalInformationHandler, CleanUpHandler, Debuggable, DebugOutputHandler, Destroyable, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<AbstractActor>, SizeOfHandler, Stoppable, VariableChangeListener, Actor, ErrorHandler, Serializable, Comparable

public class TwitterConnection
extends AbstractStandalone

Provides access to various twitter services.
For your own twitter account, you can obtain consumer key and access token for ADAMS (= application trying to access twitter) here:
https://dev.twitter.com/apps/
And make sure that ADAMS has READ and WRITE access.

Valid options are:

-D <int> (property: debugLevel)
    The greater the number the more additional info the scheme may output to 
    the console (0 = off).
    default: 0
    minimum: 0
 
-name <java.lang.String> (property: name)
    The name of the actor.
    default: TwitterConnection
 
-annotation <adams.core.base.BaseText> (property: annotations)
    The annotations to attach to this actor.
    default: 
 
-skip (property: skip)
    If set to true, transformation is skipped and the input token is just forwarded 
    as it is.
 
-stop-flow-on-error (property: stopFlowOnError)
    If set to true, the flow gets stopped in case this actor encounters an error;
     useful for critical actors.
 
-consumer-key <java.lang.String> (property: consumerKey)
    The twitter consumer key to use for connecting; leave empty for anonymous 
    access.
    default: 
 
-consumer-secret <adams.core.base.BasePassword> (property: consumerSecret)
    The consumer secret of the twitter application to use for connecting.
    default: {}
 
-access-token <java.lang.String> (property: accessToken)
    The twitter access token to use for connecting.
    default: 
 
-acces-token-secret <adams.core.base.BasePassword> (property: accessTokenSecret)
    The access token secret of the twitter application to use for connecting.
    default: {}
 

Version:
$Revision: 7116 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
protected  String m_AccessToken
          the twitter access token.
protected  BasePassword m_AccessTokenSecret
          the twitter access token secret.
protected  String m_ConsumerKey
          the twitter consumer key.
protected  BasePassword m_ConsumerSecret
          the twitter consumer secret.
 
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_Headless, m_Name, m_Parent, m_Root, m_ScopeHandler, m_Self, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
 
Constructor Summary
TwitterConnection()
           
 
Method Summary
 String accessTokenSecretTipText()
          Returns the tip text for this property.
 String accessTokenTipText()
          Returns the tip text for this property.
 String consumerKeyTipText()
          Returns the tip text for this property.
 String consumerSecretTipText()
          Returns the tip text for this property.
 void defineOptions()
          Adds options to the internal list of options.
protected  String doExecute()
          Executes the flow item.
 String getAccessToken()
          Returns the twitter acess token to use.
 BasePassword getAccessTokenSecret()
          Returns the twitter access token secret to use.
 twitter4j.conf.Configuration getConfiguration()
          Builds a configuration to use for the twitter4j factories.
 String getConsumerKey()
          Returns the twitter consumer key to use.
 BasePassword getConsumerSecret()
          Returns the twitter consumer secret to use.
 twitter4j.Twitter getTwitterConnection()
          Returns the twitter connection object.
 twitter4j.TwitterStream getTwitterStreamConnection()
          Returns the twitter stream connection object.
 String globalInfo()
          Returns a string describing the object.
 void setAccessToken(String value)
          Sets the twitter acess token to use.
 void setAccessTokenSecret(BasePassword value)
          Sets the twitter access token secret to use.
 void setConsumerKey(String value)
          Sets the twitter consumer key to use.
 void setConsumerSecret(BasePassword value)
          Sets the twitter consumer secret to use.
 
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, debug, destroy, equals, execute, findVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getQuickInfo, getRoot, getScopeHandler, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, postExecute, preExecute, pruneBackup, pruneBackup, reset, restoreState, setAnnotations, setErrorHandler, setHeadless, setName, setParent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged, wrapUp
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
 

Field Detail

m_ConsumerKey

protected String m_ConsumerKey
the twitter consumer key.


m_ConsumerSecret

protected BasePassword m_ConsumerSecret
the twitter consumer secret.


m_AccessToken

protected String m_AccessToken
the twitter access token.


m_AccessTokenSecret

protected BasePassword m_AccessTokenSecret
the twitter access token secret.

Constructor Detail

TwitterConnection

public TwitterConnection()
Method Detail

globalInfo

public String globalInfo()
Returns a string describing the object.

Specified by:
globalInfo in class AbstractOptionHandler
Returns:
a description suitable for displaying in the gui

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractActor

setConsumerKey

public void setConsumerKey(String value)
Sets the twitter consumer key to use.

Parameters:
value - the key

getConsumerKey

public String getConsumerKey()
Returns the twitter consumer key to use.

Returns:
the key

consumerKeyTipText

public String consumerKeyTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setConsumerSecret

public void setConsumerSecret(BasePassword value)
Sets the twitter consumer secret to use.

Parameters:
value - the secret

getConsumerSecret

public BasePassword getConsumerSecret()
Returns the twitter consumer secret to use.

Returns:
the secret

consumerSecretTipText

public String consumerSecretTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setAccessToken

public void setAccessToken(String value)
Sets the twitter acess token to use.

Parameters:
value - the token

getAccessToken

public String getAccessToken()
Returns the twitter acess token to use.

Returns:
the token

accessTokenTipText

public String accessTokenTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setAccessTokenSecret

public void setAccessTokenSecret(BasePassword value)
Sets the twitter access token secret to use.

Parameters:
value - the secret

getAccessTokenSecret

public BasePassword getAccessTokenSecret()
Returns the twitter access token secret to use.

Returns:
the secret

accessTokenSecretTipText

public String accessTokenSecretTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

getConfiguration

public twitter4j.conf.Configuration getConfiguration()
Builds a configuration to use for the twitter4j factories.

Returns:
the configuration

getTwitterConnection

public twitter4j.Twitter getTwitterConnection()
Returns the twitter connection object.

Returns:
the connection

getTwitterStreamConnection

public twitter4j.TwitterStream getTwitterStreamConnection()
Returns the twitter stream connection object.

Returns:
the stream connection

doExecute

protected String doExecute()
Executes the flow item.

Specified by:
doExecute in class AbstractActor
Returns:
always null


Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.