com.pluraprocessing.node.affiliate.web
Class AffiliatePluraConnector

java.lang.Object
  extended by com.pluraprocessing.node.affiliate.web.AffiliatePluraConnector

public class AffiliatePluraConnector
extends java.lang.Object

Class AffiliatePluraConnector.

This class manages an instance of Plura that runs on your Applet's webpage. Because JavaScript is invoked by this class to control Plura's settings, your Applet MUST have 'mayscript' enabled on the applet tag in the HTML of the webpage. You must also include a Plura JavaScript source file and a Plura iframe on your webpage.


Constructor Summary
AffiliatePluraConnector(java.applet.Applet applet, java.lang.String affiliateId, double percentCpu, java.lang.String clientId)
          Instantiates a new AffiliatePluraConnector.
 
Method Summary
 void changeCpuUsage(double percentCpu)
          Change CPU usage on the client computer and start running Plura if it is not already running.
 void startPlura()
          Start running Plura on the client's computer.
 void stopPlura()
          Stop running Plura on the client's computer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AffiliatePluraConnector

public AffiliatePluraConnector(java.applet.Applet applet,
                               java.lang.String affiliateId,
                               double percentCpu,
                               java.lang.String clientId)
                        throws PluraParameterException
Instantiates a new AffiliatePluraConnector.

Parameters:
applet - The Applet from which Plura is being run. This is necessary for invoking the javascript methods that communicate with Plura. The Applet passed in MUST have 'mayscript' enabled on the applet tag in the HTML.
affiliateId - The affiliate id to be credited with the work units completed. This parameter is optional; null may be passed in. If not null, it must be a String that is 36 characters or less.
percentCpu - The percentage of the client computer's CPU to use. Must be less than 1 and greater than 0.
clientId - The id of the current client. This parameter is optional; if null or "" are passed in, a random id will be generated for the client. Must be less than 40 characters in length.
Throws:
PluraParameterException - If at least one of the inputs passed into this method is invalid.
Method Detail

startPlura

public void startPlura()
                throws JavascriptMissingException,
                       PluraCommunicationException
Start running Plura on the client's computer.

Throws:
JavascriptMissingException - If the Javascript required to communicate with Plura does not exist on the HTML page.
PluraCommunicationException - If there is an error setting the Plura iframe URL.

stopPlura

public void stopPlura()
               throws JavascriptMissingException,
                      PluraCommunicationException
Stop running Plura on the client's computer.

Throws:
JavascriptMissingException - If the Javascript required to communicate with Plura does not exist on the HTML page.
PluraCommunicationException - If there is an error setting the Plura iframe URL.

changeCpuUsage

public void changeCpuUsage(double percentCpu)
                    throws JavascriptMissingException,
                           PluraCommunicationException,
                           PluraParameterException
Change CPU usage on the client computer and start running Plura if it is not already running.

Parameters:
percentCpu - The percentage of the client computer's CPU to use. Must be less than 1 and greater than 0.
Throws:
JavascriptMissingException - If the Javascript required to communicate with Plura does not exist on the HTML page.
PluraCommunicationException - If there is an error setting the Plura iframe URL.
PluraParameterException - If at least one of the inputs passed into this method is invalid.