text:
jts: Java Transaction Service - Distributed EJB Transactions Across Multiple Containers
======================================================================================
Author: Tom Jenkinson
Level: Intermediate
Technologies: JTS
Summary: Uses Java Transaction Service (JTS) to coordinate distributed transactions
Prerequisites: cmt
Target Product: EAP
Source: <https://github.com/jboss-jdf/jboss-as-quickstart/>

What is it?
-----------

This example demonstrates how to perform distributed transactions in an application. A distributed transaction is a set of operations performed by two or more nodes, participating in an activity coordinated as a single entity of work, and fulfilling the properties of an ACID transaction.

ACID is a set of 4 properties that guarantee the resources are processed in the following manner:

* Atomic - if any part of the transaction fails, all resources remain unchanged.
* Consistent - the state will be consistent across resources after a commit
* Isolated - the execution of the transaction for each resource is isolated from each others
* Durable - the data will persist after the transaction is committed

The example uses Java Transaction Service (JTS) to propagate a transaction context across two Container-Managed Transaction (CMT) EJBs that, although deployed in separate servers, participate in the same transaction. In this example, one server processes the Customer and Account data and the other server processes the Invoice data.

The code base is essentially the same as the _cmt_ quickstart, however in this case the InvoiceManager
has been separated to a different deployment archive to demonstrate the usage of JTS. You can see the changes in the
following ways:

1. `cmt/src/main/java/org/jboss/as/quickstarts/cmt/ejb/InvoiceManagerEJB.java` has been moved to `application-component-2/src/main/java/org/jboss/as/quickstarts/cmt/jts/ejb/InvoiceManagerEJB`
2. `cmt/src/main/java/org/jboss/as/quickstarts/cmt/ejb/CustomerManagerEJB.java` has been moved to `jts/application-component-1/src/main/java/org/jboss/as/quickstarts/cmt/jts/ejb/CustomerManagerEJB.java`

The changes to `CustomerManagerEJB` are purely to accommodate the fact that `InvoiceManager` is now distributed.

You will see that the `CustomerManagerEJB` uses the EJB home for the remote EJB, this is expected to connect to remote EJBs. The example expects the EJBs to be deployed onto the same physical machine. This is not a restriction of JTS and the example can easily be converted to run on separate machines by editing the hostname value for the `InvoiceManagerEJB` in `org.jboss.as.quickstarts.cmt.jts.ejb.CustomerManagerEJB`.

A simple MDB has been provided that prints out the messages sent but this is not a transactional MDB and is purely provided for debugging purposes.

After users complete this quickstart, they are invited to run through the following quickstart:

1. _jts-distributed-crash-rec_ - The crash recovery quickstart builds upon the _jts_ quickstart by demonstrating the fault tolerance of JBossAS.

System requirements
-------------------

All you need to build this project is Java 6.0 (Java SDK 1.6) or better, Maven 3.0 or better.

The application this project produces is designed to be run on JBoss Enterprise Application Platform 6 or JBoss AS 7.

Configure Maven
---------------

If you have not yet done so, you must [Configure Maven](../README.md#mavenconfiguration) before testing the quickstarts.

Prerequisites
------------------

Developers should be familiar with the concepts introduced in the _cmt_ quickstart.

This quickstart requires the configuration of two servers. The first server must be configured to use the PostgreSQL database. Instructions to install and configure PostgreSQL are below.

Install the PostgreSQL Database
-------------------------------

This quickstart requires the PostgreSQL database. Instructions to install an configure PostgreSQL can be found here: [Install and Configure the PostgreSQL Database](../README.md#postgresql)

_Note_: For the purpose of this quickstart, replace the word QUICKSTART_DATABASENAME with `jts-quickstart-database` in the PostgreSQL instructions.

Be sure to start the PostgreSQL database. Unless you have set up the database to automatically start as a service, you must repeat the instructions "Start the database server" for your operating system every time you reboot your machine.

Wait until later in these instructions to add the PostgreSQL module and driver configuration to the first JBoss server.

Configure the JBoss Servers
---------------------------

For this example, you will need two instances of the application server, with a subtle startup configuration difference. Application server 2 must be started up with a port offset parameter provided to the startup script as "-Djboss.socket.binding.port-offset=100".

Since both application servers must be configured in the same way, you must configure the first server and then clone it. After you clone the second server, the first server must be configured for PostgreSQL.

### Modify the Server Configuration file.

You can configure the server by running the  `configure-jts-transactions.cli` script provided in the root directory of this quickstart, by using the JBoss CLI interactively, or by manually editing the configuration file.

_NOTE - Before you begin:_

1. If it is running, stop the JBoss Enterprise Application Platform 6 or JBoss AS 7 Server.
2. Backup the file: `JBOSS_HOME/standalone/configuration/standalone-full.xml`
3. After you have completed testing this quickstart, you can replace this file to restore the server to its original configuration.

#### Modify the Server Configuration by Running the JBoss CLI Script

1. Start the JBoss Enterprise Application Platform 6 or JBoss AS 7 Server with the full profile, passing a unique node ID by typing the following command. Be sure to replace `UNIQUE_NODE_ID` with a node identifier that is unique to both servers.

        For Linux:  JBOSS_HOME/bin/standalone.sh -c standalone-full.xml -Djboss.tx.node.id=UNIQUE_NODE_ID
        For Windows:  JBOSS_HOME\bin\standalone.bat -c standalone-full.xml  -Djboss.tx.node.id=UNIQUE_NODE_ID
2. Open a new command line, navigate to the root directory of this quickstart, and run the following command, replacing JBOSS_HOME with the path to your server:

        JBOSS_HOME/bin/jboss-cli.sh --connect --file=configure-jts-transactions.cli
This script configures the server to use jts transaction processing. You should see the following result when you run the script:

        #1 /subsystem=jacorb:write-attribute(name=transactions,value=on)
        #2 /subsystem=jacorb:write-attribute(name=name,value=${jboss.node.name})
        #3 /subsystem=jacorb:write-attribute(name=root-context,value=${jboss.node.name}/Naming/root)
        #4 /subsystem=transactions:write-attribute(name=jts,value=true)
        #5 /subsystem=transactions:write-attribute(name=node-identifier,value=${jboss.tx.node.id}
        The batch executed successfully.
        {"outcome" => "success"}

#### Modify the Server Configuration Using the JBoss CLI Tool Interactively

1. Start the JBoss Enterprise Application Platform 6 or JBoss AS 7 Server with the full profile, passing a unique node ID by typing the following command. Be sure to replace `UNIQUE_NODE_ID` with a node identifier that is unique to both servers.

        For Linux:  JBOSS_HOME_SERVER_1/bin/standalone.sh -c standalone-full.xml -Djboss.tx.node.id=UNIQUE_NODE_ID
        For Windows:  JBOSS_HOME_SERVER_1\bin\standalone.bat -c standalone-full.xml -Djboss.tx.node.id=UNIQUE_NODE_ID
2. To start the JBoss CLI tool, open a new command line, navigate to the JBOSS_HOME directory, and type the following:

        For Linux: bin/jboss-cli.sh --connect
        For Windows: bin\jboss-cli.bat --connect
3. At the prompt, type the following exactly as it appears. The server will replace ${jboss.node.name} with the actual node name and will replace ${jboss.tx.node.id} with the unique node ID value you passed as a parameter on the server start command line.

        /subsystem=jacorb/:write-attribute(name=transactions,value=on)
        /subsystem=jacorb:write-attribute(name=name,value=${jboss.node.name})
        /subsystem=jacorb:write-attribute(name=root-context,value=${jboss.node.name}/Naming/root)

        /subsystem=transactions/:write-attribute(name=jts,value=true)
        /subsystem=transactions/:write-attribute(name=node-identifier,value=${jboss.tx.node.id})
4. _NOTE:_ When you have completed testing this quickstart, it is important to [Remove the JTS Configuration from the JBoss Server](#remove-jts-configuration).

#### Modify the Server Configuration Manually

1. Make a backup copy of the `JBOSS_HOME/standalone/configuration/standalone-full.xml` file.
2. Open the file JBOSS_HOME/standalone/configuration/standalone-full.xml
3. Enable JTS as follows:
    * Find the orb subsystem and change the configuration to:

            <subsystem xmlns="urn:jboss:domain:jacorb:1.2">
                <orb>
                    <initializers security="on" transactions="on"/>
                </orb>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:jacorb:1.1">
                <orb name="${jboss.node.name}">
                    <initializers security="on" transactions="on"/>
                </orb>
                <naming root-context="${jboss.node.name}/Naming/root"/>
            </subsystem>
    * Find the transaction subsystem and append the `<jts/>` element:

            <subsystem xmlns="urn:jboss:domain:transactions:1.2">
                <core-environment node-identifier="${jboss.tx.node.id}">

                <jts/>
            </subsystem>
4.  _NOTE:_ When you have completed testing this quickstart, it is important to [Remove the JTS Configuration from the JBoss Server](#remove-jts-configuration).

### Clone the JBOSS_HOME Directory

Make a copy of this JBoss directory structure to use for the second server.

### Configure Server1 to use PostgreSQL

2. Application server 1 must be configured to use PostgreSQL as per the instructions in [Install and Configure the PostgreSQL Database] (../README.md#postgresql).
    * Be sure to start the PostgreSQL database.
    * [Add the PostgreSQL Module](../README.md#addpostgresqlmodule) to the Application 1 server `modules/` directory.
    * [Add the PostgreSQL driver](../README.md#addpostgresqldriver) to the Application 1 server configuration file.

Start the JBoss Enterprise Application Platform 6 or JBoss AS 7 Servers
-------------------------

Start the the two JBoss Enterprise Application Platform 6 or JBoss AS 7 Servers with the full profile, passing a unique node ID by typing the following command. You must pass a socket binding port offset on the command to start the second server. Be sure to replace `UNIQUE_NODE_ID` with a node identifier that is unique to both servers.

If you are using Linux:

        Server 1: JBOSS_HOME_SERVER_1/bin/standalone.sh -c standalone-full.xml -Djboss.tx.node.id=UNIQUE_NODE_ID
        Server 2: JBOSS_HOME_SERVER_2/bin/standalone.sh -c standalone-full.xml -Djboss.tx.node.id=UNIQUE_NODE_ID -Djboss.socket.binding.port-offset=100

If you are using Windows

        Server 1: JBOSS_HOME_SERVER_1\bin\standalone.bat -c standalone-full.xml -Djboss.tx.node.id=UNIQUE_NODE_ID
        Server 2: JBOSS_HOME_SERVER_2\bin\standalone.bat -c standalone-full.xml -Djboss.tx.node.id=UNIQUE_NODE_ID -Djboss.socket.binding.port-offset=100

Build and Deploy the Quickstart
-------------------------

Since this quickstart builds two separate components, you can not use the standard *Build and Deploy* commands used by most of the other quickstarts. You must follow these steps to build, deploy, and run this quickstart.

1. Make sure you have started the JBoss server with the PostgreSQL driver
2. Open a command line and navigate to the root directory of this quickstart.
3. Type this command to build and deploy the archive:

        mvn clean package jboss-as:deploy

4. This will deploy `application-component-1/target/jboss-as-jts-application-component-1.war` and `application-component-2/target/jboss-as-jts-application-component-2.jar` to the running instance of the server.

Access the application
---------------------

The application will be running at the following URL: <http://localhost:8080/jboss-as-jts-application-component-1/>.

When you enter a name and click to "Add" that customer, you will see the following in the application server 1 console:

    14:31:48,334 WARNING [javax.enterprise.resource.webcontainer.jsf.renderkit] (http-localhost-127.0.0.1-8080-1) Unable to find component with ID name in view.
    14:31:50,457 ERROR [jacorb.orb] (http-localhost-127.0.0.1-8080-1) no adapter activator exists for jts-quickstart&%InvoiceManagerEJBImpl&%home
    14:31:50,767 INFO  [org.jboss.ejb.client] (http-localhost-127.0.0.1-8080-1) JBoss EJB Client version 1.0.5.Final
    14:31:51,430 WARN  [com.arjuna.ats.jts] (RequestProcessor-5) ARJUNA022261: ServerTopLevelAction detected that the transaction was inactive

You will also see the following in application-server-2 console:

    14:31:50,750 INFO  [org.jboss.ejb.client] (RequestProcessor-10) JBoss EJB Client version 1.0.5.Final
    14:31:51,395 INFO  [class org.jboss.as.quickstarts.cmt.jts.mdb.HelloWorldMDB] (Thread-1 (HornetQ-client-global-threads-1567863645)) Received Message: Created invoice for customer named: Tom

The web page will also change and show you the new list of customers.

Undeploy the Archive
--------------------

1. Make sure you have started the JBoss Server as described above.
2. Open a command line and navigate to the root directory of this quickstart.
3. When you are finished testing, type this command to undeploy the archive:

        mvn package jboss-as:undeploy

Remove the JTS Configuration from the JBoss Server
---------------------------

You must remove the JTS server configuration you did during setup because it interferes with the JTA quickstarts.

You can modify the server configuration by running the `remove-jts-transactions.cli` script provided in the root directory of this quickstart, by using the JBoss CLI interactively, or by manually editing the configuration file.

### Remove the JTS Server Configuration by Running the JBoss CLI Script

1. Start the JBoss Enterprise Application Platform 6 or JBoss AS 7 Server with the full profile.

        For Linux:  JBOSS_HOME_SERVER_1/bin/standalone.sh -c standalone-full.xml
        For Windows:  JBOSS_HOME_SERVER_1\bin\standalone.bat -c standalone-full.xml
2. Open a new command line, navigate to the root directory of this quickstart, and run the following command, replacing JBOSS_HOME with the path to your server:

        JBOSS_HOME/bin/jboss-cli.sh --connect --file=remove-jts-transactions.cli
This script removes the `test` queue from the `messaging` subsystem in the server configuration. You should see the following result when you run the script:

        #1 /subsystem=jacorb:write-attribute(name=transactions,value=spec)
        #2 /subsystem=jacorb:undefine-attribute(name=name)
        #3 /subsystem=transactions:undefine-attribute(name=jts)
        #4 /subsystem=transactions:undefine-attribute(name=node-identifier)
        The batch executed successfully.
        {"outcome" => "success"}

### Remove the JTS Server Configuration using the JBoss CLI Tool

1. Start the JBoss Enterprise Application Platform 6 or JBoss AS 7 Server with the full profile.

        For Linux:  JBOSS_HOME_SERVER_1/bin/standalone.sh -c standalone-full.xml
        For Windows:  JBOSS_HOME_SERVER_1\bin\standalone.bat -c standalone-full.xml
2. To start the JBoss CLI tool, open a new command line, navigate to the JBOSS_HOME directory, and type the following:

        For Linux: bin/jboss-cli.sh --connect
        For Windows: bin\jboss-cli.bat --connect
3. At the prompt, type the following:

        /subsystem=jacorb/:write-attribute(name=transactions,value=spec)
        /subsystem=jacorb/:undefine-attribute(name=name)
        /subsystem=transactions/:undefine-attribute(name=jts)
        /subsystem=transactions/:undefine-attribute(name=node-identifier)

### Remove the JTS Server Configuration Manually

1. Stop the server.
2. If you backed up the JBOSS_HOME/standalone/configuration/standalone-full.xml,simply replace the edited configuration file with the backup copy.
3. If you did not make a backup copy, open the file JBOSS_HOME/standalone/configuration/standalone-full.xml and disable JTS as follows:

    * Find the orb subsystem and change the configuration back to:

            <subsystem xmlns="urn:jboss:domain:jacorb:1.2">
                <orb>
                    <initializers security="on" transactions="spec"/>
                </orb>
            </subsystem>
    * Find the transaction subsystem and remove the `<jts/>` element:

            <subsystem xmlns="urn:jboss:domain:transactions:1.2">

            </subsystem>


text:
import {app} from './components/create3D.js';
import {sphere} from './components/sphere.js';
import {plane} from './components/plane.js';
import {box} from './components/box.js';
import {teapot} from './components/model.js';
import {
    ambientLight,
    directionLight
} from './components/light.js';
// sphere.addTo(app);
// plane.addTo(app);
ambientLight.addTo(app);
directionLight.addTo(app);
// box.addTo(app)
teapot.addTo(app)
app.start();

redpajama_set_name: RedPajamaGithub


text:
namespace catapult {

namespace proto = tracing::tracing::proto;

static constexpr std::pair<const char*, proto::Unit> kJsonUnitToProtoUnit[] = {
    {"ms", proto::MS},
    {"msBestFitFormat", proto::MS_BEST_FIT_FORMAT},
    {"tsMs", proto::TS_MS},
    {"n%", proto::N_PERCENT},
    {"sizeInBytes", proto::SIZE_IN_BYTES},
    {"bytesPerSecond", proto::BYTES_PER_SECOND},
    {"J", proto::J},
    {"W", proto::W},
    {"A", proto::A},
    {"Ah", proto::AH},
    {"V", proto::V},
    {"Hz", proto::HERTZ},
    {"unitless", proto::UNITLESS},
    {"count", proto::COUNT},
    {"sigma", proto::SIGMA}};

// Assume a single bin. The default num sample values is num bins * 10.
static constexpr int kDefaultNumSampleValues = 10;

class HistogramBuilder::Resampler {
 public:
  Resampler() : distribution_(0.0, 1.0) {}

  // When processing a stream of samples, call this method for each new sample
  // in order to decide whether to keep it in |samples|.
  // Modifies |samples| in-place such that its length never exceeds
  // |max_num_samples|. After |stream_length| samples have been processed, each
  // sample has equal probability of being retained in |samples|. The order of
  // samples is not preserved after |stream_length| exceeds |num_samples|.
  void UniformlySampleStream(std::vector<double>* samples,
                             uint32_t stream_length,
                             double new_element,
                             uint32_t max_num_samples) {
    assert(max_num_samples > 0);

    if (stream_length <= max_num_samples) {
      if (samples->size() >= stream_length) {
        (*samples)[stream_length - 1] = new_element;
      } else {
        samples->push_back(new_element);
      }
      return;
    }
    double prob_keep = static_cast<double>(max_num_samples) / stream_length;
    if (random() > prob_keep) {
      // Reject new sample.
      return;
    }

    // Replace a random element.
    int victim = static_cast<int>(std::floor(random() * max_num_samples));
    (*samples)[victim] = new_element;
  }

 private:
  double random() { return distribution_(generator_); }

  std::default_random_engine generator_;
  std::uniform_real_distribution<double> distribution_;
};

HistogramBuilder::HistogramBuilder(
    const std::string& name, proto::UnitAndDirection unit)
    : resampler_(std::make_unique<Resampler>()),
      running_statistics_(std::make_unique<RunningStatistics>()),
      name_(name),
      unit_(unit),
      num_nans_(0) {
  max_num_sample_values_ = kDefaultNumSampleValues;
}

HistogramBuilder::~HistogramBuilder() = default;

void HistogramBuilder::AddSample(double value) {
  if (std::isnan(value)) {
    num_nans_++;
  } else {
    running_statistics_->Add(value);
    int num_values = running_statistics_->count();
    resampler_->UniformlySampleStream(&sample_values_, num_nans_ + num_values,
                                      value, max_num_sample_values_);
  }
}

void HistogramBuilder::AddDiagnostic(
    const std::string& key,
    tracing::tracing::proto::Diagnostic diagnostic) {
  diagnostics_[key] = diagnostic;
}

void HistogramBuilder::SetSummaryOptions(proto::SummaryOptions options) {
  options_ = options;
}

std::unique_ptr<proto::Histogram> HistogramBuilder::toProto() const {
  auto histogram = std::make_unique<proto::Histogram>();
  histogram->set_name(name_);
  *histogram->mutable_unit() = unit_;
  histogram->set_description(description_);

  proto::DiagnosticMap* diagnostics = histogram->mutable_diagnostics();
  for (const auto& pair : diagnostics_) {
    auto* diagnostic_map = diagnostics->mutable_diagnostic_map();
    (*diagnostic_map)[pair.first] = pair.second;
  }

  for (double sample: sample_values_) {
    histogram->add_sample_values(sample);
  }

  histogram->set_max_num_sample_values(max_num_sample_values_);

  histogram->set_num_nans(num_nans_);

  proto::RunningStatistics* running = histogram->mutable_running();
  running->set_count(running_statistics_->count());
  running->set_max(running_statistics_->max());
  if (running_statistics_->meanlogs_valid()) {
    running->set_meanlogs(running_statistics_->meanlogs());
  }
  running->set_mean(running_statistics_->mean());
  running->set_min(running_statistics_->min());
  running->set_sum(running_statistics_->sum());
  running->set_variance(running_statistics_->variance());

  proto::SummaryOptions* options = histogram->mutable_summary_options();
  *options = options_;

  return histogram;
}

tracing::tracing::proto::Unit UnitFromJsonUnit(std::string unit) {
  unit.erase(std::find(unit.begin(), unit.end(), '_'), unit.end());

  for (const auto& pair : kJsonUnitToProtoUnit) {
    if (unit == pair.first) {
      return pair.second;
    }
  }

  return proto::UNITLESS;
}

}  // namespace catapult


text:
using Tailviewer.Collections;
using Tailviewer.Ui.DataSourceTree;

namespace Tailviewer.Ui.Menu
{
	/// <summary>
	///     Represents the main menu of Tailviewer.
	/// </summary>
	/// <remarks>
	///     Responsible for updating the available menu items depending on what the user is currently doing.
	/// </remarks>
	public sealed class MainMenu
	{
		private readonly EditMenuViewModel _edit;
		private readonly FileMenuViewModel _file;
		private readonly HelpMenuViewModel _help;
		private readonly ProjectingObservableCollection<IMenuViewModel, KeyBindingCommand> _keyBindings;
		private readonly ViewMenuViewModel _view;

		public MainMenu(FileMenuViewModel file,
		                EditMenuViewModel edit,
		                ViewMenuViewModel view,
		                HelpMenuViewModel help)
		{
			_file = file;
			_edit = edit;
			_view = view;
			_help = help;

			var allMenuItems = new CompoundObservableCollection<IMenuViewModel>(hasSeparator: false)
			{
				file.Items, _edit.Items, view.Items, help.Items
			};
			_keyBindings =
				new ProjectingObservableCollection<IMenuViewModel, KeyBindingCommand>(allMenuItems,
					menuItem => menuItem?.Command as KeyBindingCommand);
		}

		public IDataSourceViewModel CurrentDataSource
		{
			set
			{
				_file.CurrentDataSource = value;
				_edit.CurrentDataSource = value;
				_view.CurrentDataSource = value;
			}
		}

		/// <summary>
		///     A collection of all key bindings the user may currently press.
		/// </summary>
		public IObservableCollection<KeyBindingCommand> KeyBindings
		{
			get { return _keyBindings; }
		}

		public FileMenuViewModel File
		{
			get { return _file; }
		}

		public EditMenuViewModel Edit
		{
			get { return _edit; }
		}

		public ViewMenuViewModel View
		{
			get { return _view; }
		}

		public HelpMenuViewModel Help
		{
			get { return _help; }
		}
	}
}


text:
/**
 * Write a description of class RedirectChoice here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class RedirectChoice extends AbstractChoice
{

    /**
     * Constructor for objects of class RedirectChoice
     */
    public RedirectChoice(String message)
    {
        super(message);
    }

}


text:
using System.Diagnostics.Contracts;
using System;

namespace System.Reflection
{

    public class ReflectionTypeLoadException
    {

        public Type[] Types
        {
          get;
        }

        public Exception[] LoaderExceptions
        {
          get;
        }

        public void GetObjectData (System.Runtime.Serialization.SerializationInfo! info, System.Runtime.Serialization.StreamingContext context) {
            CodeContract.Requires(info != null);

        }
        public ReflectionTypeLoadException (Type[] classes, Exception[] exceptions, string message) {

          return default(ReflectionTypeLoadException);
        }
          return default(ReflectionTypeLoadException);
        }
        public ReflectionTypeLoadException (Type[] classes, Exception[] exceptions) {
    }
}


text:
local function foo()
	return x
end

setfenv(foo, setmetatable({ x = 10 }, { __index = getfenv() }))

assertEquals(10, foo())


text:
"""
ISCSI Drivers for ETERNUS DX arrays based on SMI-S.

"""
from oslo_concurrency import lockutils
import six

from cinder import context
from cinder import exception
from cinder.i18n import _, _LW
from cinder.openstack.common import log as logging
from cinder.volume import driver
from cinder.volume.drivers.fujitsu import eternus_dx_common

LOG = logging.getLogger(__name__)

class FJDXISCSIDriver(driver.ISCSIDriver):
    """ISCSI Drivers using SMI-S."""

    VERSION = "1.2.0"

    def __init__(self, *args, **kwargs):

        super(FJDXISCSIDriver, self).__init__(*args, **kwargs)
        self.common = \
            eternus_dx_common.\
            FJDXCommon('iSCSI', configuration=self.configuration)

    def check_for_setup_error(self):
        pass

    @lockutils.synchronized('ETERNUS_DX-vol', 'cinder-', True)
    def create_volume(self, volume):
        """Creates a volume."""
        volpath = self.common.create_volume(volume)

        model_update = {}
        volume['provider_location'] = six.text_type(volpath)
        model_update['provider_location'] = volume['provider_location']
        return model_update

    @lockutils.synchronized('ETERNUS_DX-vol', 'cinder-', True)
    def create_volume_from_snapshot(self, volume, snapshot):
        """Creates a volume from a snapshot."""
        volpath = self.common.create_volume_from_snapshot(volume, snapshot)

        model_update = {}
        volume['provider_location'] = six.text_type(volpath)
        model_update['provider_location'] = volume['provider_location']
        return model_update

    @lockutils.synchronized('ETERNUS_DX-vol', 'cinder-', True)
    def create_cloned_volume(self, volume, src_vref):
        """Creates a cloned volume."""
        volpath = self.common.create_cloned_volume(volume, src_vref)

        model_update = {}
        volume['provider_location'] = six.text_type(volpath)
        model_update['provider_location'] = volume['provider_location']
        return model_update

    @lockutils.synchronized('ETERNUS_DX-vol', 'cinder-', True)
    def delete_volume(self, volume):
        """Deletes a volume."""
        self.common.delete_volume(volume)

    @lockutils.synchronized('ETERNUS_DX-vol', 'cinder-', True)
    def create_snapshot(self, snapshot):
        """Creates a snapshot."""
        ctxt = context.get_admin_context()
        volumename = snapshot['volume_name']
        index = volumename.index('-')
        volumeid = volumename[index + 1:]
        volume = self.db.volume_get(ctxt, volumeid)

        volpath = self.common.create_snapshot(snapshot, volume)

        model_update = {}
        snapshot['provider_location'] = six.text_type(volpath)
        model_update['provider_location'] = snapshot['provider_location']
        return model_update

    @lockutils.synchronized('ETERNUS_DX-vol', 'cinder-', True)
    def delete_snapshot(self, snapshot):
        """Deletes a snapshot."""

        self.common.delete_volume(snapshot)

    def ensure_export(self, context, volume):
        """Driver entry point to get the export info for an existing volume."""
        pass

    def create_export(self, context, volume):
        """Driver entry point to get the export info for a new volume."""
        pass

    def remove_export(self, context, volume):
        """Driver entry point to remove an export for a volume."""
        pass

    def check_for_export(self, context, volume_id):
        """Make sure volume is exported."""
        pass

    @lockutils.synchronized('ETERNUS_DX-vol', 'cinder-', True)
    def initialize_connection(self, volume, connector):
        """Initializes the connection and returns connection info.

        The iscsi driver returns a driver_volume_type of 'iscsi'.
        the format of the driver data is defined in smis_get_iscsi_properties.
        Example return value::

            {
                'driver_volume_type': 'iscsi'
                'data': {
                    'target_discovered': True,
                    'target_iqn': 'iqn.2010-10.org.openstack:volume-00000001',
                    'target_portal': '127.0.0.0.1:3260',
                    'volume_id': '12345678-1234-4321-1234-123456789012',
                }
            }

        """
        self.common.initialize_connection(volume, connector)

        iscsi_properties = self.smis_get_iscsi_properties(volume, connector)
        return {
            'driver_volume_type': 'iscsi',
            'data': iscsi_properties
        }

    def _do_iscsi_discovery(self, volume):

        LOG.warn(_LW("ISCSI provider_location not stored, using discovery"))

        (out, _err) = self._execute('iscsiadm', '-m', 'discovery',
                                    '-t', 'sendtargets', '-p',
                                    self.configuration.iscsi_ip_address,
                                    run_as_root=True)
        targets = []
        for target in out.splitlines():
            targets.append(target)

        return targets

    def smis_get_iscsi_properties(self, volume, connector):
        """Gets iscsi configuration.

        We ideally get saved information in the volume entity, but fall back
        to discovery if need be. Discovery may be completely removed in future
        The properties are:

        :target_discovered:    boolean indicating whether discovery was used

        :target_iqn:    the IQN of the iSCSI target

        :target_portal:    the portal of the iSCSI target

        :target_lun:    the lun of the iSCSI target

        :volume_id:    the UUID of the volume

        :auth_method:, :auth_username:, :auth_password:

            the authentication details. Right now, either auth_method is not
            present meaning no authentication, or auth_method == `CHAP`
            meaning use CHAP with the specified credentials.
        """
        iscsiip = self.configuration.iscsi_ip_address
        properties = {}

        location = self._do_iscsi_discovery(volume)
        if not location:
            raise exception.InvalidVolume(_("Could not find iSCSI export "
                                          " for volume %s") %
                                          (volume['name']))

        LOG.debug("ISCSI Discovery: Found %s" % (location))
        properties['target_discovered'] = True

        device_info = self.common.find_device_number(volume, connector)
        if device_info is None or device_info['hostlunid'] is None:
            exception_message = (_("Cannot find device number for volume %s")
                                 % volume['name'])
            raise exception.VolumeBackendAPIException(data=exception_message)

        device_number = device_info['hostlunid']

        for loc in location:
            if iscsiip in loc:
                results = loc.split(" ")
                properties['target_portal'] = results[0].split(",")[0]
                properties['target_iqn'] = results[1]
                break

        properties['target_lun'] = device_number
        properties['volume_id'] = volume['id']

        LOG.debug("ISCSI properties: %s" % (properties))

        auth = volume['provider_auth']
        if auth:
            (auth_method, auth_username, auth_secret) = auth.split()

            properties['auth_method'] = auth_method
            properties['auth_username'] = auth_username
            properties['auth_password'] = auth_secret

        return properties

    @lockutils.synchronized('ETERNUS_DX-vol', 'cinder-', True)
    def terminate_connection(self, volume, connector, **kwargs):
        """Disallow connection from connector."""
        self.common.terminate_connection(volume, connector)

    @lockutils.synchronized('ETERNUS_DX-vol', 'cinder-', True)
    def extend_volume(self, volume, new_size):
        """Extend an existing volume."""
        self.common.extend_volume(volume, new_size)

    def get_volume_stats(self, refresh=False):
        """Get volume stats.

        If 'refresh' is True, run update the stats first.
        """
        if refresh:
            self.update_volume_stats()

        return self._stats

    def update_volume_stats(self):
        """Retrieve stats info from volume group."""
        LOG.debug("Updating volume stats")
        data = self.common.update_volume_stats()
        backend_name = self.configuration.safe_get('volume_backend_name')
        data['volume_backend_name'] = backend_name or 'FJDXISCSIDriver'
        data['storage_protocol'] = 'iSCSI'
        data['driver_version'] = self.VERSION
        self._stats = data


text:
package swf_test

import (
	"bytes"
	"fmt"
	"time"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/aws/aws-sdk-go/aws/awsutil"
	"github.com/aws/aws-sdk-go/service/swf"
)

var _ time.Duration
var _ bytes.Buffer

func ExampleSWF_CountClosedWorkflowExecutions() {
	svc := swf.New(nil)

	params := &swf.CountClosedWorkflowExecutionsInput{
		Domain: aws.String("DomainName"), // Required
		CloseStatusFilter: &swf.CloseStatusFilter{
			Status: aws.String("CloseStatus"), // Required
		},
		CloseTimeFilter: &swf.ExecutionTimeFilter{
			OldestDate: aws.Time(time.Now()), // Required
			LatestDate: aws.Time(time.Now()),
		},
		ExecutionFilter: &swf.WorkflowExecutionFilter{
			WorkflowID: aws.String("WorkflowId"), // Required
		},
		StartTimeFilter: &swf.ExecutionTimeFilter{
			OldestDate: aws.Time(time.Now()), // Required
			LatestDate: aws.Time(time.Now()),
		},
		TagFilter: &swf.TagFilter{
			Tag: aws.String("Tag"), // Required
		},
		TypeFilter: &swf.WorkflowTypeFilter{
			Name:    aws.String("Name"), // Required
			Version: aws.String("VersionOptional"),
		},
	}
	resp, err := svc.CountClosedWorkflowExecutions(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_CountOpenWorkflowExecutions() {
	svc := swf.New(nil)

	params := &swf.CountOpenWorkflowExecutionsInput{
		Domain: aws.String("DomainName"), // Required
		StartTimeFilter: &swf.ExecutionTimeFilter{ // Required
			OldestDate: aws.Time(time.Now()), // Required
			LatestDate: aws.Time(time.Now()),
		},
		ExecutionFilter: &swf.WorkflowExecutionFilter{
			WorkflowID: aws.String("WorkflowId"), // Required
		},
		TagFilter: &swf.TagFilter{
			Tag: aws.String("Tag"), // Required
		},
		TypeFilter: &swf.WorkflowTypeFilter{
			Name:    aws.String("Name"), // Required
			Version: aws.String("VersionOptional"),
		},
	}
	resp, err := svc.CountOpenWorkflowExecutions(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_CountPendingActivityTasks() {
	svc := swf.New(nil)

	params := &swf.CountPendingActivityTasksInput{
		Domain: aws.String("DomainName"), // Required
		TaskList: &swf.TaskList{ // Required
			Name: aws.String("Name"), // Required
		},
	}
	resp, err := svc.CountPendingActivityTasks(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_CountPendingDecisionTasks() {
	svc := swf.New(nil)

	params := &swf.CountPendingDecisionTasksInput{
		Domain: aws.String("DomainName"), // Required
		TaskList: &swf.TaskList{ // Required
			Name: aws.String("Name"), // Required
		},
	}
	resp, err := svc.CountPendingDecisionTasks(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_DeprecateActivityType() {
	svc := swf.New(nil)

	params := &swf.DeprecateActivityTypeInput{
		ActivityType: &swf.ActivityType{ // Required
			Name:    aws.String("Name"),    // Required
			Version: aws.String("Version"), // Required
		},
		Domain: aws.String("DomainName"), // Required
	}
	resp, err := svc.DeprecateActivityType(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_DeprecateDomain() {
	svc := swf.New(nil)

	params := &swf.DeprecateDomainInput{
		Name: aws.String("DomainName"), // Required
	}
	resp, err := svc.DeprecateDomain(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_DeprecateWorkflowType() {
	svc := swf.New(nil)

	params := &swf.DeprecateWorkflowTypeInput{
		Domain: aws.String("DomainName"), // Required
		WorkflowType: &swf.WorkflowType{ // Required
			Name:    aws.String("Name"),    // Required
			Version: aws.String("Version"), // Required
		},
	}
	resp, err := svc.DeprecateWorkflowType(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_DescribeActivityType() {
	svc := swf.New(nil)

	params := &swf.DescribeActivityTypeInput{
		ActivityType: &swf.ActivityType{ // Required
			Name:    aws.String("Name"),    // Required
			Version: aws.String("Version"), // Required
		},
		Domain: aws.String("DomainName"), // Required
	}
	resp, err := svc.DescribeActivityType(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_DescribeDomain() {
	svc := swf.New(nil)

	params := &swf.DescribeDomainInput{
		Name: aws.String("DomainName"), // Required
	}
	resp, err := svc.DescribeDomain(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_DescribeWorkflowExecution() {
	svc := swf.New(nil)

	params := &swf.DescribeWorkflowExecutionInput{
		Domain: aws.String("DomainName"), // Required
		Execution: &swf.WorkflowExecution{ // Required
			RunID:      aws.String("RunId"),      // Required
			WorkflowID: aws.String("WorkflowId"), // Required
		},
	}
	resp, err := svc.DescribeWorkflowExecution(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_DescribeWorkflowType() {
	svc := swf.New(nil)

	params := &swf.DescribeWorkflowTypeInput{
		Domain: aws.String("DomainName"), // Required
		WorkflowType: &swf.WorkflowType{ // Required
			Name:    aws.String("Name"),    // Required
			Version: aws.String("Version"), // Required
		},
	}
	resp, err := svc.DescribeWorkflowType(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_GetWorkflowExecutionHistory() {
	svc := swf.New(nil)

	params := &swf.GetWorkflowExecutionHistoryInput{
		Domain: aws.String("DomainName"), // Required
		Execution: &swf.WorkflowExecution{ // Required
			RunID:      aws.String("RunId"),      // Required
			WorkflowID: aws.String("WorkflowId"), // Required
		},
		MaximumPageSize: aws.Int64(1),
		NextPageToken:   aws.String("PageToken"),
		ReverseOrder:    aws.Bool(true),
	}
	resp, err := svc.GetWorkflowExecutionHistory(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_ListActivityTypes() {
	svc := swf.New(nil)

	params := &swf.ListActivityTypesInput{
		Domain:             aws.String("DomainName"),         // Required
		RegistrationStatus: aws.String("RegistrationStatus"), // Required
		MaximumPageSize:    aws.Int64(1),
		Name:               aws.String("Name"),
		NextPageToken:      aws.String("PageToken"),
		ReverseOrder:       aws.Bool(true),
	}
	resp, err := svc.ListActivityTypes(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_ListClosedWorkflowExecutions() {
	svc := swf.New(nil)

	params := &swf.ListClosedWorkflowExecutionsInput{
		Domain: aws.String("DomainName"), // Required
		CloseStatusFilter: &swf.CloseStatusFilter{
			Status: aws.String("CloseStatus"), // Required
		},
		CloseTimeFilter: &swf.ExecutionTimeFilter{
			OldestDate: aws.Time(time.Now()), // Required
			LatestDate: aws.Time(time.Now()),
		},
		ExecutionFilter: &swf.WorkflowExecutionFilter{
			WorkflowID: aws.String("WorkflowId"), // Required
		},
		MaximumPageSize: aws.Int64(1),
		NextPageToken:   aws.String("PageToken"),
		ReverseOrder:    aws.Bool(true),
		StartTimeFilter: &swf.ExecutionTimeFilter{
			OldestDate: aws.Time(time.Now()), // Required
			LatestDate: aws.Time(time.Now()),
		},
		TagFilter: &swf.TagFilter{
			Tag: aws.String("Tag"), // Required
		},
		TypeFilter: &swf.WorkflowTypeFilter{
			Name:    aws.String("Name"), // Required
			Version: aws.String("VersionOptional"),
		},
	}
	resp, err := svc.ListClosedWorkflowExecutions(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_ListDomains() {
	svc := swf.New(nil)

	params := &swf.ListDomainsInput{
		RegistrationStatus: aws.String("RegistrationStatus"), // Required
		MaximumPageSize:    aws.Int64(1),
		NextPageToken:      aws.String("PageToken"),
		ReverseOrder:       aws.Bool(true),
	}
	resp, err := svc.ListDomains(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_ListOpenWorkflowExecutions() {
	svc := swf.New(nil)

	params := &swf.ListOpenWorkflowExecutionsInput{
		Domain: aws.String("DomainName"), // Required
		StartTimeFilter: &swf.ExecutionTimeFilter{ // Required
			OldestDate: aws.Time(time.Now()), // Required
			LatestDate: aws.Time(time.Now()),
		},
		ExecutionFilter: &swf.WorkflowExecutionFilter{
			WorkflowID: aws.String("WorkflowId"), // Required
		},
		MaximumPageSize: aws.Int64(1),
		NextPageToken:   aws.String("PageToken"),
		ReverseOrder:    aws.Bool(true),
		TagFilter: &swf.TagFilter{
			Tag: aws.String("Tag"), // Required
		},
		TypeFilter: &swf.WorkflowTypeFilter{
			Name:    aws.String("Name"), // Required
			Version: aws.String("VersionOptional"),
		},
	}
	resp, err := svc.ListOpenWorkflowExecutions(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_ListWorkflowTypes() {
	svc := swf.New(nil)

	params := &swf.ListWorkflowTypesInput{
		Domain:             aws.String("DomainName"),         // Required
		RegistrationStatus: aws.String("RegistrationStatus"), // Required
		MaximumPageSize:    aws.Int64(1),
		Name:               aws.String("Name"),
		NextPageToken:      aws.String("PageToken"),
		ReverseOrder:       aws.Bool(true),
	}
	resp, err := svc.ListWorkflowTypes(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_PollForActivityTask() {
	svc := swf.New(nil)

	params := &swf.PollForActivityTaskInput{
		Domain: aws.String("DomainName"), // Required
		TaskList: &swf.TaskList{ // Required
			Name: aws.String("Name"), // Required
		},
		Identity: aws.String("Identity"),
	}
	resp, err := svc.PollForActivityTask(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_PollForDecisionTask() {
	svc := swf.New(nil)

	params := &swf.PollForDecisionTaskInput{
		Domain: aws.String("DomainName"), // Required
		TaskList: &swf.TaskList{ // Required
			Name: aws.String("Name"), // Required
		},
		Identity:        aws.String("Identity"),
		MaximumPageSize: aws.Int64(1),
		NextPageToken:   aws.String("PageToken"),
		ReverseOrder:    aws.Bool(true),
	}
	resp, err := svc.PollForDecisionTask(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_RecordActivityTaskHeartbeat() {
	svc := swf.New(nil)

	params := &swf.RecordActivityTaskHeartbeatInput{
		TaskToken: aws.String("TaskToken"), // Required
		Details:   aws.String("LimitedData"),
	}
	resp, err := svc.RecordActivityTaskHeartbeat(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_RegisterActivityType() {
	svc := swf.New(nil)

	params := &swf.RegisterActivityTypeInput{
		Domain:                      aws.String("DomainName"), // Required
		Name:                        aws.String("Name"),       // Required
		Version:                     aws.String("Version"),    // Required
		DefaultTaskHeartbeatTimeout: aws.String("DurationInSecondsOptional"),
		DefaultTaskList: &swf.TaskList{
			Name: aws.String("Name"), // Required
		},
		DefaultTaskPriority:               aws.String("TaskPriority"),
		DefaultTaskScheduleToCloseTimeout: aws.String("DurationInSecondsOptional"),
		DefaultTaskScheduleToStartTimeout: aws.String("DurationInSecondsOptional"),
		DefaultTaskStartToCloseTimeout:    aws.String("DurationInSecondsOptional"),
		Description:                       aws.String("Description"),
	}
	resp, err := svc.RegisterActivityType(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_RegisterDomain() {
	svc := swf.New(nil)

	params := &swf.RegisterDomainInput{
		Name: aws.String("DomainName"), // Required
		WorkflowExecutionRetentionPeriodInDays: aws.String("DurationInDays"), // Required
		Description:                            aws.String("Description"),
	}
	resp, err := svc.RegisterDomain(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_RegisterWorkflowType() {
	svc := swf.New(nil)

	params := &swf.RegisterWorkflowTypeInput{
		Domain:                              aws.String("DomainName"), // Required
		Name:                                aws.String("Name"),       // Required
		Version:                             aws.String("Version"),    // Required
		DefaultChildPolicy:                  aws.String("ChildPolicy"),
		DefaultExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
		DefaultLambdaRole:                   aws.String("Arn"),
		DefaultTaskList: &swf.TaskList{
			Name: aws.String("Name"), // Required
		},
		DefaultTaskPriority:            aws.String("TaskPriority"),
		DefaultTaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
		Description:                    aws.String("Description"),
	}
	resp, err := svc.RegisterWorkflowType(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_RequestCancelWorkflowExecution() {
	svc := swf.New(nil)

	params := &swf.RequestCancelWorkflowExecutionInput{
		Domain:     aws.String("DomainName"), // Required
		WorkflowID: aws.String("WorkflowId"), // Required
		RunID:      aws.String("RunIdOptional"),
	}
	resp, err := svc.RequestCancelWorkflowExecution(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_RespondActivityTaskCanceled() {
	svc := swf.New(nil)

	params := &swf.RespondActivityTaskCanceledInput{
		TaskToken: aws.String("TaskToken"), // Required
		Details:   aws.String("Data"),
	}
	resp, err := svc.RespondActivityTaskCanceled(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_RespondActivityTaskCompleted() {
	svc := swf.New(nil)

	params := &swf.RespondActivityTaskCompletedInput{
		TaskToken: aws.String("TaskToken"), // Required
		Result:    aws.String("Data"),
	}
	resp, err := svc.RespondActivityTaskCompleted(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_RespondActivityTaskFailed() {
	svc := swf.New(nil)

	params := &swf.RespondActivityTaskFailedInput{
		TaskToken: aws.String("TaskToken"), // Required
		Details:   aws.String("Data"),
		Reason:    aws.String("FailureReason"),
	}
	resp, err := svc.RespondActivityTaskFailed(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_RespondDecisionTaskCompleted() {
	svc := swf.New(nil)

	params := &swf.RespondDecisionTaskCompletedInput{
		TaskToken: aws.String("TaskToken"), // Required
		Decisions: []*swf.Decision{
			{ // Required
				DecisionType: aws.String("DecisionType"), // Required
				CancelTimerDecisionAttributes: &swf.CancelTimerDecisionAttributes{
					TimerID: aws.String("TimerId"), // Required
				},
				CancelWorkflowExecutionDecisionAttributes: &swf.CancelWorkflowExecutionDecisionAttributes{
					Details: aws.String("Data"),
				},
				CompleteWorkflowExecutionDecisionAttributes: &swf.CompleteWorkflowExecutionDecisionAttributes{
					Result: aws.String("Data"),
				},
				ContinueAsNewWorkflowExecutionDecisionAttributes: &swf.ContinueAsNewWorkflowExecutionDecisionAttributes{
					ChildPolicy:                  aws.String("ChildPolicy"),
					ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
					Input:      aws.String("Data"),
					LambdaRole: aws.String("Arn"),
					TagList: []*string{
						aws.String("Tag"), // Required
						// More values...
					},
					TaskList: &swf.TaskList{
						Name: aws.String("Name"), // Required
					},
					TaskPriority:            aws.String("TaskPriority"),
					TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
					WorkflowTypeVersion:     aws.String("Version"),
				},
				FailWorkflowExecutionDecisionAttributes: &swf.FailWorkflowExecutionDecisionAttributes{
					Details: aws.String("Data"),
					Reason:  aws.String("FailureReason"),
				},
				RecordMarkerDecisionAttributes: &swf.RecordMarkerDecisionAttributes{
					MarkerName: aws.String("MarkerName"), // Required
					Details:    aws.String("Data"),
				},
				RequestCancelActivityTaskDecisionAttributes: &swf.RequestCancelActivityTaskDecisionAttributes{
					ActivityID: aws.String("ActivityId"), // Required
				},
				RequestCancelExternalWorkflowExecutionDecisionAttributes: &swf.RequestCancelExternalWorkflowExecutionDecisionAttributes{
					WorkflowID: aws.String("WorkflowId"), // Required
					Control:    aws.String("Data"),
					RunID:      aws.String("RunIdOptional"),
				},
				ScheduleActivityTaskDecisionAttributes: &swf.ScheduleActivityTaskDecisionAttributes{
					ActivityID: aws.String("ActivityId"), // Required
					ActivityType: &swf.ActivityType{ // Required
						Name:    aws.String("Name"),    // Required
						Version: aws.String("Version"), // Required
					},
					Control:          aws.String("Data"),
					HeartbeatTimeout: aws.String("DurationInSecondsOptional"),
					Input:            aws.String("Data"),
					ScheduleToCloseTimeout: aws.String("DurationInSecondsOptional"),
					ScheduleToStartTimeout: aws.String("DurationInSecondsOptional"),
					StartToCloseTimeout:    aws.String("DurationInSecondsOptional"),
					TaskList: &swf.TaskList{
						Name: aws.String("Name"), // Required
					},
					TaskPriority: aws.String("TaskPriority"),
				},
				ScheduleLambdaFunctionDecisionAttributes: &swf.ScheduleLambdaFunctionDecisionAttributes{
					ID:                  aws.String("FunctionId"),   // Required
					Name:                aws.String("FunctionName"), // Required
					Input:               aws.String("FunctionInput"),
					StartToCloseTimeout: aws.String("DurationInSecondsOptional"),
				},
				SignalExternalWorkflowExecutionDecisionAttributes: &swf.SignalExternalWorkflowExecutionDecisionAttributes{
					SignalName: aws.String("SignalName"), // Required
					WorkflowID: aws.String("WorkflowId"), // Required
					Control:    aws.String("Data"),
					Input:      aws.String("Data"),
					RunID:      aws.String("RunIdOptional"),
				},
				StartChildWorkflowExecutionDecisionAttributes: &swf.StartChildWorkflowExecutionDecisionAttributes{
					WorkflowID: aws.String("WorkflowId"), // Required
					WorkflowType: &swf.WorkflowType{ // Required
						Name:    aws.String("Name"),    // Required
						Version: aws.String("Version"), // Required
					},
					ChildPolicy: aws.String("ChildPolicy"),
					Control:     aws.String("Data"),
					ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
					Input:      aws.String("Data"),
					LambdaRole: aws.String("Arn"),
					TagList: []*string{
						aws.String("Tag"), // Required
						// More values...
					},
					TaskList: &swf.TaskList{
						Name: aws.String("Name"), // Required
					},
					TaskPriority:            aws.String("TaskPriority"),
					TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
				},
				StartTimerDecisionAttributes: &swf.StartTimerDecisionAttributes{
					StartToFireTimeout: aws.String("DurationInSeconds"), // Required
					TimerID:            aws.String("TimerId"),           // Required
					Control:            aws.String("Data"),
				},
			},
			// More values...
		},
		ExecutionContext: aws.String("Data"),
	}
	resp, err := svc.RespondDecisionTaskCompleted(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_SignalWorkflowExecution() {
	svc := swf.New(nil)

	params := &swf.SignalWorkflowExecutionInput{
		Domain:     aws.String("DomainName"), // Required
		SignalName: aws.String("SignalName"), // Required
		WorkflowID: aws.String("WorkflowId"), // Required
		Input:      aws.String("Data"),
		RunID:      aws.String("RunIdOptional"),
	}
	resp, err := svc.SignalWorkflowExecution(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_StartWorkflowExecution() {
	svc := swf.New(nil)

	params := &swf.StartWorkflowExecutionInput{
		Domain:     aws.String("DomainName"), // Required
		WorkflowID: aws.String("WorkflowId"), // Required
		WorkflowType: &swf.WorkflowType{ // Required
			Name:    aws.String("Name"),    // Required
			Version: aws.String("Version"), // Required
		},
		ChildPolicy:                  aws.String("ChildPolicy"),
		ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
		Input:      aws.String("Data"),
		LambdaRole: aws.String("Arn"),
		TagList: []*string{
			aws.String("Tag"), // Required
			// More values...
		},
		TaskList: &swf.TaskList{
			Name: aws.String("Name"), // Required
		},
		TaskPriority:            aws.String("TaskPriority"),
		TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
	}
	resp, err := svc.StartWorkflowExecution(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}

func ExampleSWF_TerminateWorkflowExecution() {
	svc := swf.New(nil)

	params := &swf.TerminateWorkflowExecutionInput{
		Domain:      aws.String("DomainName"), // Required
		WorkflowID:  aws.String("WorkflowId"), // Required
		ChildPolicy: aws.String("ChildPolicy"),
		Details:     aws.String("Data"),
		Reason:      aws.String("TerminateReason"),
		RunID:       aws.String("RunIdOptional"),
	}
	resp, err := svc.TerminateWorkflowExecution(params)

	if err != nil {
		if awsErr, ok := err.(awserr.Error); ok {
			// Generic AWS error with Code, Message, and original error (if any)
			fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
			if reqErr, ok := err.(awserr.RequestFailure); ok {
				// A service error occurred
				fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
			}
		} else {
			// This case should never be hit, the SDK should always return an
			// error which satisfies the awserr.Error interface.
			fmt.Println(err.Error())
		}
	}

	// Pretty-print the response data.
	fmt.Println(awsutil.Prettify(resp))
}


text:
package org.kuali.kpme.tklm.api.leave.accrual;

import org.joda.time.DateTime;
import org.kuali.kpme.core.api.calendar.entry.CalendarEntry;

import java.util.List;
import java.util.Map;

/**
 *
RateRangeAggregateContract interface

 *
 */
public interface RateRangeAggregateContract {

	/**
	 * The current RateRange of the RateRangeAggregate
	 *
	 *

	 * currentRate of a RateRangeAggregate
	 *

	 *
	 * @return rateRanges(0) if currentRate is null, else currentRate
	 */
	public RateRangeContract getRate(DateTime date);

	/**
	 * The list of RateRange objects associated with the RateRangeAggregate
	 *
	 *

	 * rateRanges of a RateRangeAggregate
	 *

	 *
	 * @return rateRanges for RateRangeAggregate
	 */
	public List<? extends RateRangeContract> getRateRanges();

	/**
	 * The current RateRange of the RateRangeAggregate
	 *
	 *

	 * currentRate of a RateRangeAggregate
	 *

	 *
	 * @return currentRate for RateRangeAggregate
	 */
	public RateRangeContract getCurrentRate();

	/**
	 * The rateRangeChanged flag of the RateRangeAggregate
	 *
	 *

	 * rateRangeChanged flag of a RateRangeAggregate
	 *

	 *
	 * @return Y if the rate range has changed, N if not
	 */
	public boolean isRateRangeChanged();

	/**
	 * The RateRange of the RateRangeAggregate on a given date
	 *
	 *

	 * RateRange of a RateRangeAggregate
	 *

	 *
	 * @param DateTime object instance to retrieve RateRange for
	 * @return RateRange for RateRangeAggregate on a given date
	 */
	public RateRangeContract getRateOnDate(DateTime date);

	/**
	 * The map of CalendarEntry objects associated with the RateRangeAggregate
	 *
	 *

	 * calEntryMap of a RateRange
	 *

	 *
	 * @return calEntryMap for RateRangeAggregate
	 */
	public Map<String, List<CalendarEntry>> getCalEntryMap();

}


text:
* Web(isode) calendar:
-
 - An RS TV Show Tracker web implementation

 - Episode Calendar (A RS TV Show Tracker but for web)

**This project is ment as an personal episode calendar and not as the rest of them out there that is for multiple users Really the only difference from the Epi calendars like episodecalendar.com is going to be that this has absolutly no reg required, simply add series and go (just as in RS TV Show Tracker).

* Index.php:
("Home" or "Overview", shows all the listed shows, latest episodes and the upcoming episode (if show has ended it will show that "This show has ended"). Each table is sortable by a-z, z-a (Shows list cat.) )


text:
module Main where

import           System.IO.Streams       ( InputStream, OutputStream )
import qualified System.IO.Streams as    Streams
import           System.IO.Streams.HTTP  ( withHTTP, parseUrl, withManager, stream )

import           Network.HTTP.Client.TLS ( tlsManagerSettings )
import           Network.HTTP.Client     ( responseBody, method, requestBody )

main :: IO ()
main = do
  req <- parseUrl "https://www.google.com"
  withManager tlsManagerSettings $ \m ->
    withHTTP req m $ \resp -> do
        Streams.supplyTo Streams.stdout (responseBody resp)

bodyTest :: IO ()
bodyTest = do
  req <- parseUrl "https://google.com"
  let request = req { method = "POST"
                    , requestBody = stream $ Streams.fromLazyByteString "body"
                    }
  withManager tlsManagerSettings $ \m ->
    withHTTP req m $ \resp -> do
        Streams.supplyTo Streams.stdout (responseBody resp)


text:
require 'test/unit'
require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
require 'rubygems/gem_path_searcher'

class Gem::GemPathSearcher
  attr_accessor :gemspecs
  attr_accessor :lib_dirs
end

class TestGemGemPathSearcher < RubyGemTestCase

  def setup
    super

    @foo1 = quick_gem 'foo', '0.1' do |s|
      s.require_paths << 'lib2'
      s.files << 'lib/foo.rb'
    end

    path = File.join 'gems', @foo1.full_name, 'lib', 'foo.rb'
    write_file(path) { |fp| fp.puts "# #{path}" }

    @foo2 = quick_gem 'foo', '0.2'
    @bar1 = quick_gem 'bar', '0.1'
    @bar2 = quick_gem 'bar', '0.2'

    @fetcher = Gem::FakeFetcher.new
    Gem::RemoteFetcher.fetcher = @fetcher

    Gem.source_index = util_setup_spec_fetcher @foo1, @foo2, @bar1, @bar2

    @gps = Gem::GemPathSearcher.new
  end

  def test_find
    assert_equal @foo1, @gps.find('foo')
  end

  def test_find_all
    assert_equal [@foo1], @gps.find_all('foo')
  end

  def test_init_gemspecs
    assert_equal [@bar2, @bar1, @foo2, @foo1], @gps.init_gemspecs
  end

  def test_lib_dirs_for
    lib_dirs = @gps.lib_dirs_for(@foo1)
    expected = File.join @gemhome, 'gems', @foo1.full_name, '{lib,lib2}'

    assert_equal expected, lib_dirs
  end

  def test_matching_file_eh
    assert !@gps.matching_file?(@foo1, 'bar')
    assert @gps.matching_file?(@foo1, 'foo')
  end

  def test_matching_files
    assert_equal [], @gps.matching_files(@foo1, 'bar')

    expected = File.join @foo1.full_gem_path, 'lib', 'foo.rb'

    assert_equal [expected], @gps.matching_files(@foo1, 'foo')
  end

end


text:
<?php

?>

<?php echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle()); ?>

<?php
  if ( $osC_MessageStack->exists($osC_Template->getModule()) ) {
    echo $osC_MessageStack->get($osC_Template->getModule());
  }
?>

  <form id="liveSearchForm"><input type="text" id="liveSearchField" name="search" class="searchField fieldTitleAsDefault" title="Search.." /><?php echo osc_draw_button(array('type' => 'button', 'params' => 'onclick="osC_DataTable.reset();"', 'title' => 'Reset')); ?></form>
  <?php echo osc_draw_button(array('href' => osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), 'icon' => 'triangle-1-w', 'title' => OSCOM::getDef('button_back'))) . ' ' . osc_draw_button(array('href' => osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '=' . $_GET[$osC_Template->getModule()] . '&action=entry_save'), 'icon' => 'plus', 'title' => OSCOM::getDef('button_insert'))); ?>

<form name="batch" action="#" method="post">

      <?php echo OSCOM::getDef('table_heading_actions'); ?>
      <?php echo OSCOM::getDef('table_heading_modules'); ?>
      <?php echo OSCOM::getDef('table_heading_action'); ?>
      <?php echo osc_draw_checkbox_field('batchFlag', null, null, 'onclick="flagCheckboxes(this);"'); ?>

      <?php echo '<input type="image" src="' . osc_icon_raw('trash.png') . '" title="' . OSCOM::getDef('icon_trash') . '" onclick="document.batch.action=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '=' . $_GET[$osC_Template->getModule()] . '&action=batch_delete_entries') . '\';" />'; ?>
      <?php echo osc_draw_checkbox_field('batchFlag', null, null, 'onclick="flagCheckboxes(this);"'); ?>

</form>

  <?php echo '' . OSCOM::getDef('table_action_legend') . ' ' . osc_icon('edit.png') . ' ' . OSCOM::getDef('icon_edit') . '  ' . osc_icon('trash.png') . ' ' . OSCOM::getDef('icon_trash'); ?>


text:
class User(object):

    def __init__(self, user):
        u"""
        @param user : APIの戻り値のdict
        @type  user : dict
        """
        self.user = user

    def get_id(self):
        return self.id

    def get_username(self):
        return self.username

    def get_email(self):
        return self.email()

    def get_name(self):
        return self.name

    def get_state(self):
        return self.state

    def get_created_at(self):
        return self.created_at

    def __getattr__(self, name):
        if self.user is not None:
            return self.user[name] if name in self.user else None
        else:
            return None

class MergeRequest(object):

    def __init__(self, mr):
        u"""
        @param mr : APIの戻り値のdict
        @type  mr : dict
        """
        self.mr = mr

    def get_id(self):
        return self.id

    def get_iid(self):
        return self.iid

    def get_target_branch(self):
        return self.target_branch

    def get_source_branch(self):
        return self.source_branch

    def get_project_id(self):
        return self.project_id

    def get_title(self):
        return self.title

    def get_state(self):
        return self.state

    def get_upvotes(self):
        return self.upvotes

    def get_downvotes(self):
        return self.downvotes

    def get_author(self):
        return User(self.author)

    def get_assignee(self):
        return User(self.assignee)

    def __getattr__(self, name):
        return self.mr[name] if name in self.mr else None

class Note(object):
    def __init__(self, note):
        u"""
        @param note : APIの戻り値のdict
        @type  note : dict
        """
        self.note = note

    def get_id(self):
        return self.id

    def get_body(self):
        return self.body

    def get_attachment(self):
        return self.attachment

    def get_author(self):
        return User(self.author)

    def get_created_at(self):
        return self.created_at

    def __getattr__(self, name):
        return self.note[name] if name in self.note else None


text:
package org.elasticsearch.river.kafka;

import java.util.Map;

import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.support.XContentMapValues;
import org.elasticsearch.river.RiverSettings;

public class KafkaRiverConfig {

	public final String zookeeper;
	public final String factoryClass;	// full class path and name for the concrete message handler class factory
	public final String brokerHost;
	public final int brokerPort;
	public final String topic;
	public final int partition;

	public final String statsdPrefix;
	public final String statsdHost;
	public final int statsdPort;

	public final int bulkSize;
	public final TimeValue bulkTimeout;

    public KafkaRiverConfig(RiverSettings settings)
    {
    	if (settings.settings().containsKey("kafka")) {
            Map<String, Object> kafkaSettings = (Map<String, Object>) settings.settings().get("kafka");

            topic = (String)kafkaSettings.get("topic");
            zookeeper = XContentMapValues.nodeStringValue(kafkaSettings.get("zookeeper"), "localhost");
            factoryClass = XContentMapValues.nodeStringValue(kafkaSettings.get("message_handler_factory_class"), "org.elasticsearch.river.kafka.JsonMessageHandlerFactory");
            brokerHost = XContentMapValues.nodeStringValue(kafkaSettings.get("broker_host"), "localhost");
            brokerPort = XContentMapValues.nodeIntegerValue(kafkaSettings.get("broker_port"), 9092);
            partition = XContentMapValues.nodeIntegerValue(kafkaSettings.get("partition"), 0);
        }
    	else
    	{
    		zookeeper = "localhost";
    		brokerHost = "localhost";
    		brokerPort = 9092;
    		topic = "default_topic";
    		partition = 0;
    		factoryClass = "org.elasticsearch.river.kafka.JsonMessageHandlerFactory";
    	}

        if (settings.settings().containsKey("index")) {
            Map<String, Object> indexSettings = (Map<String, Object>) settings.settings().get("index");
            bulkSize = XContentMapValues.nodeIntegerValue(indexSettings.get("bulk_size_bytes"), 10*1024*1024);
            if (indexSettings.containsKey("bulk_timeout")) {
                bulkTimeout = TimeValue.parseTimeValue(XContentMapValues.nodeStringValue(indexSettings.get("bulk_timeout"), "10ms"), TimeValue.timeValueMillis(10000));
            } else {
                bulkTimeout = TimeValue.timeValueMillis(10);
            }
        } else {
            bulkSize = 10*1024*1024;
            bulkTimeout = TimeValue.timeValueMillis(10000);
        }

        if (settings.settings().containsKey("statsd")) {
            Map<String, Object> statsdSettings = (Map<String, Object>) settings.settings().get("statsd");
            statsdHost = (String)statsdSettings.get("host");
            statsdPort = XContentMapValues.nodeIntegerValue(statsdSettings.get("port"), 8125);
            statsdPrefix = XContentMapValues.nodeStringValue(statsdSettings.get("prefix"), "es-kafka-river");
        }
    	else
    	{
    		statsdHost = null;
    		statsdPort = -1;
    		statsdPrefix = null;
    	}
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;

namespace Phonebook
{
    public class Phonebook
    {
        public static void Main()
        {
            var phonebook = new SortedDictionary<string, string>();
            do
            {
                var inputCommands = Console.ReadLine().Split().ToList();

                if (inputCommands[0] == "END")
                {
                    break;
                }
                else
                {
                    switch (inputCommands[0])
                    {
                        case "A":
                            phonebook[inputCommands[1]] = inputCommands[2];
                            break;
                        case "S":
                            if (phonebook.ContainsKey(inputCommands[1]))
                            {
                                Console.WriteLine($"{inputCommands[1]} -> {phonebook[inputCommands[1]]}");
                            }
                            else
                            {
                                Console.WriteLine($"Contact {inputCommands[1]} does not exist.");
                            }
                            break;
                        case "ListAll":
                            foreach (KeyValuePair<string, string> item in phonebook)
                            {
                                Console.WriteLine($"{item.Key} -> {item.Value}");
                            }
                            break;
                    }
                }

            } while (true);
        }
    }
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Proc. Amer. Acad. Arts & Sci. 35: (1900)

#### Original name
Dichomyces vulgatus Thaxt., 1900

### Remarks
null


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimTemplate.ViewModels.Interfaces
{
    public interface IDialogViewModel
    {
        string Title { get; }
    }
}


text:
package lecimg

import (
	"image"
	"image/color"
	"testing"
)

func testChangeLineSpace(t *testing.T, img image.Image, option ChangeLineSpaceOption, expectedHeight int) {
	// Run Filter
	result := NewChangeLineSpaceFilter(option).Run(NewFilterSource(img, "filename", 0))

	// Test result image size
	destBounds := result.Img().Bounds()
	heightMatch := destBounds.Dy() == expectedHeight

	if !heightMatch {
		t.Errorf("height mismatch. exepcted=%v, actual=%v", expectedHeight, destBounds.Dy())
	}
}

func TestChangeLineSpace(t *testing.T) {
	img := CreateImage(100, 300, color.White)
	FillRect(img, 50, 20, 80, 50, color.Black)
	FillRect(img, 30, 180, 70, 200, color.Black)
	FillRect(img, 60, 250, 100, 280, color.Black)

	opt := ChangeLineSpaceOption{
		WidthRatio:         100,
		HeightRatio:        200,
		LineSpaceScale:     0.1,
		MinSpace:           1,
		MaxRemove:          9999,
		Threshold:          180,
		EmptyLineThreshold: 0,
	}
	testChangeLineSpace(t, img, opt, int(opt.HeightRatio))
}

func TestChangeLineSpaceVerticalLine(t *testing.T) {
	img := CreateImage(100, 300, color.White)
	FillRect(img, 50, 20, 80, 50, color.Black)
	FillRect(img, 30, 180, 70, 200, color.Black)
	FillRect(img, 60, 250, 100, 280, color.Black)
	DrawLine(img, 90, 0, 90, 300, color.Black)

	opt := ChangeLineSpaceOption{
		WidthRatio:         100,
		HeightRatio:        200,
		LineSpaceScale:     0.1,
		MinSpace:           1,
		MaxRemove:          9999,
		Threshold:          180,
		EmptyLineThreshold: 0.02,
	}
	testChangeLineSpace(t, img, opt, int(opt.HeightRatio))
}


text:
using System.ComponentModel;
using System.Windows;
using System.Windows.Media;
using System.Windows.Controls.WpfPropertyGrid;

namespace CategoryEditor
{
  /// <summary>
  /// Sample business object
  /// </summary>
  [CategoryOrder("Text", 0)]
  [CategoryOrder("Misc", 1)]
  public class BusinessObject : INotifyPropertyChanged
  {
    #region Fields

    private string _name;
    private FontFamily _fontFamily = new FontFamily("Arial");
    private double _fontSize = 8;
    private FontWeight _fontWeight = FontWeights.Bold;
    private FontStyle _fontStyle = FontStyles.Italic;

    #endregion

    public string Name
    {
      get { return _name; }
      set
      {
        if (_name == value) return;
        _name = value;
        OnPropertyChanged("Name");
      }
    }

    #region Text-related properties

    [Category("Text")]
    public FontFamily FontFamily
    {
      get { return _fontFamily; }
      set
      {
        if (_fontFamily == value) return;
        _fontFamily = value;
        OnPropertyChanged("FontFamily");
      }
    }

    [Category("Text")]
    public double FontSize
    {
      get { return _fontSize; }
      set
      {
        if (_fontSize == value) return;
        _fontSize = value;
        OnPropertyChanged("FontSize");
      }
    }

    [Category("Text")]
    public FontWeight FontWeight
    {
      get { return _fontWeight; }
      set
      {
        if (_fontWeight == value) return;
        _fontWeight = value;
        OnPropertyChanged("FontWeight");
      }
    }

    [Category("Text")]
    public FontStyle FontStyle
    {
      get { return _fontStyle; }
      set
      {
        if (_fontStyle == value) return;
        _fontStyle = value;
        OnPropertyChanged("FontStyle");
      }
    }

    #endregion

    #region INotifyPropertyChanged Members

    public event PropertyChangedEventHandler PropertyChanged;

    protected void OnPropertyChanged(string propertyName)
    {
      var handler = PropertyChanged;
      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
    }

    #endregion
  }
}


text:
/**
 * Created by Cheng jianhua at 11:10 on 2016/6/6
 */
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { withRouter } from 'react-router';

import TextField from 'material-ui/TextField';
import Dialog from 'material-ui/Dialog';
import RaisedButton from 'material-ui/RaisedButton';
import withStyles from 'isomorphic-style-loader/lib/withStyles';

import s from './LoginPage.scss';

import { authenticate } from '../../actions/Auth';

class LoginPage extends Component {

  constructor(props) {
    super(props);

    this.state = {
      username: '',
      password: '',
      openAlertDialog: false,
    };
  }

  handleUsernameChange = (event, username) => {
    event.stopPropagation();

    this.setState({
      username,
    });
  };

  handlePasswordChange = (event, password) => {
    event.stopPropagation();

    this.setState({
      password,
    });
  };

  handleFormSubmit = (event) => {
    event.preventDefault();

    const { actions } = this.props;
    const { username, password } = this.state;

    actions.authenticate(username, password)
    .then(() => {
      this.setState({
        openAlertDialog: true,
      }, () => {
        this.form.submit();
      });
    });
  };

  render() {
    const { username, password, openAlertDialog } = this.state;
    const { originalUrl } = this.props;

    return (
      <div className={s.root}>
        <form
          ref={(ref) => {this.form = ref;}}
          method="post"
          action={`/manage/login?originalUrl=${originalUrl}`}
          onSubmit={this.handleFormSubmit}
        >
          <TextField
            fullWidth
            key="login-username"
            name="username"
            id="login-username"
            hintText="请输入您的用户名"
            value={username}
            onChange={this.handleUsernameChange}
          />

          <TextField
            fullWidth
            key="login-password"
            name="password"
            id="login-username"
            hintText="请输入您的密码"
            type="password"
            value={password}
            onChange={this.handlePasswordChange}
          />

          <RaisedButton
            key="login-button"
            primary
            label="登录"
            type="submit"
            style={{ width: '100%' }}
          />
        </form>

        <Dialog
          key="submitResult"
          modal={false}
          open={openAlertDialog}
        >
          您已登录成功,用户名为[{username}],即将跳转到主页.
        </Dialog>
      </div>
    );
  }

}

function mapDispatchToProps(dispatch) {
  return {
    actions: bindActionCreators(Object.assign({}, { authenticate }), dispatch),
  };
}

export default connect(null, mapDispatchToProps)(withStyles(s)(withRouter(LoginPage)));


text:
;(function() {
  'use strict';

  angular.module('app')

  .controller('TopBar', function ($scope, $rootScope, UsersFactory) {

    $scope.closeMenus = function () {
      // If I attach this to the entire page, then the
      // toggleUserMenu() won't work.  Hmm.
      // $scope.showUserMenu = false;
    };

    $scope.toggleUserMenu = function () {
      $scope.showUserMenu = !$scope.showUserMenu;
    };

    var updateUserMenuState = function () {
      // $scope.user = UsersFactory.getCookie();
      // $scope.signedIn = ($scope.user) ? true : false;
      $scope.showUserMenu = false;

      var user = UsersFactory.getCookie();
      if (user) {
        $scope.signedIn = true;
        $scope.user = user;
      } else {
        $scope.signedIn = false;
      }
    };

    $scope.signIn = function (user) {
      UsersFactory.signin(user);
    };

    $scope.signOut = function() {
      UsersFactory.signout();
      updateUserMenuState();
      $scope.user = {};
    };

    // Listen for signin broadcast.
    $rootScope.$on('userAuth:signin', function () { updateUserMenuState(); });
    $rootScope.$on('userAuth:signup', function () { updateUserMenuState(); });

    updateUserMenuState();

  });

}());


text:
namespace dialog::editor
{
#define NOSKIPFIELD ((ULONG) 0xffffffff)

	class CSearchEditor : public CEditor
	{
	public:
		enum SearchFields
		{
			PROPNAME,
			SEARCHTERM,
			FUZZYLEVEL,
			FINDROW,
		};

		CSearchEditor(ULONG ulPropTag, _In_opt_ LPMAPIPROP lpMAPIProp, _In_ CWnd* pParentWnd);
		~CSearchEditor();

		_Check_return_ const _SRestriction* GetRestriction() const;

	private:
		_Check_return_ ULONG HandleChange(UINT nID) override;
		void OnEditAction1() override;
		void PopulateFields(ULONG ulSkipField) const;
		_Check_return_ ULONG GetSelectedFuzzyLevel() const;

		LPMAPIPROP m_lpMAPIProp;
		ULONG m_ulPropTag;
		ULONG m_ulFuzzyLevel;
	};
} // namespace dialog::editor