public class

JunctionMaker

extends Object
java.lang.Object
   ↳ edu.stanford.junction.JunctionMaker

Class Overview

This class creates Junction objects, binding JunctionActor objects to an activity.

Summary

Constants
String DIRECTOR_ACTIVITY
Fields
public static final URI CASTING_DIRECTOR
public static final URI SWITCHBOARD_ACTIVITY
protected JunctionProvider mProvider
Public Constructors
JunctionMaker()
Public Methods
static Junction bind(URI uri, JunctionActor actor)
Binds a JunctionActor to a session URI, using the default switchboard for that URI.
static Junction bind(JunctionActor actor)
Binds a JunctionActor to a randomly generated sesssion, using the default switchboard.
void castActor(URI directorURI, URI invitationURI)
Sends a request to a Director activity to cast an actor to accept a given invitation.
URI generateSessionUri()
ActivityScript getActivityScript(URI uri)
static SwitchboardConfig getDefaultSwitchboardConfig(URI uri)
static JunctionMaker getInstance(SwitchboardConfig switchboardConfig)
Returns a new JunctionMaker object with the type specified by the given SwitchboardConfig object.
static String getRoleFromInvitation(URI uri)
Returns the role associated with a given Junction invitation.
static String getSessionIDFromURI(URI uri)
void inviteActorByListenerService(URI invitationURI, URI listenerServiceURI)
void inviteActorService(Junction jx, String role)
Requests a listening service to join this activity as the prescribed role.
Junction newJunction(ActivityScript desc, JunctionActor actor, Cast support)
Creates a new Junction and requests the casting of various roles.
Junction newJunction(URI uri, JunctionActor actor)
This method has been deprecated.
Junction newJunction(ActivityScript desc, JunctionActor actor)
Junction newJunction(URI uri, ActivityScript script, JunctionActor actor)
void sendMessageToActivity(URI activitySession, JSONObject msg)
Sends a message to an activity.
Protected Methods
JunctionProvider getProvider(SwitchboardConfig switchboardConfig)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String DIRECTOR_ACTIVITY

Constant Value: "edu.stanford.junction.director"

Fields

public static final URI CASTING_DIRECTOR

public static final URI SWITCHBOARD_ACTIVITY

protected JunctionProvider mProvider

Public Constructors

public JunctionMaker ()

Public Methods

public static Junction bind (URI uri, JunctionActor actor)

Binds a JunctionActor to a session URI, using the default switchboard for that URI.

public static Junction bind (JunctionActor actor)

Binds a JunctionActor to a randomly generated sesssion, using the default switchboard.

public void castActor (URI directorURI, URI invitationURI)

Sends a request to a Director activity to cast an actor to accept a given invitation.

Parameters
directorURI The director listening for requests
invitationURI The activity to join (potentially including role information)

public URI generateSessionUri ()

public ActivityScript getActivityScript (URI uri)

public static SwitchboardConfig getDefaultSwitchboardConfig (URI uri)

public static JunctionMaker getInstance (SwitchboardConfig switchboardConfig)

Returns a new JunctionMaker object with the type specified by the given SwitchboardConfig object.

public static String getRoleFromInvitation (URI uri)

Returns the role associated with a given Junction invitation.

public static String getSessionIDFromURI (URI uri)

public void inviteActorByListenerService (URI invitationURI, URI listenerServiceURI)

public void inviteActorService (Junction jx, String role)

Requests a listening service to join this activity as the prescribed role. Here, the service must be detailed in the activity description's list of roles. An example platform in the role specification: { role: "dealer", platforms: [ { platform: "jxservice", classname: "edu.stanford.prpl.poker.dealer", switchboard: "my.foreign.switchboard" } ] } If switchboard is not present, it is assumed to be on the same switchboard on which this activity is being run.

public Junction newJunction (ActivityScript desc, JunctionActor actor, Cast support)

Creates a new Junction and requests the casting of various roles. There is no guarantee if and when the roles will be filled. There may or may not be user interaction at the casting director.

public Junction newJunction (URI uri, JunctionActor actor)

This method has been deprecated. Please see newJunction(URI, ActivityScript, JunctionActor)

public Junction newJunction (ActivityScript desc, JunctionActor actor)

public Junction newJunction (URI uri, ActivityScript script, JunctionActor actor)

public void sendMessageToActivity (URI activitySession, JSONObject msg)

Sends a message to an activity. In the unoptimized case, joins an activity, sends a message, and leaves.

Protected Methods

protected JunctionProvider getProvider (SwitchboardConfig switchboardConfig)