# Installing the WallStreet Adapter

This page describes how to install the WallStreet Adapter.

## Requirements

To deploy the WallStreet Adapter, you require the following:

* WallStreet Adapter installation kit (`WallstreetAdapter-<version>.zip`)
* Wall Street Systems (WSS) client licence files (`license.txt`, `signature.txt`, and `wsscore.xml`). Contact Wall Street Systems if you do not have these files.
* Caplin Deployment Framework 7
* Liberator 7
* Transformer 7 with the Refiner 7 module
* Java 8 64-bit: Oracle Java 8 (\&lt;= 8u202) or Red Hat OpenJDK 8

To ease log-file analysis across servers, time zones, and daylight savings transitions, we recommend that you set the system clocks of all hosts in a Caplin stack to UTC.

## Pre-deployment tasks

Perform the following tasks before deploying the adapter:

1. Install Java 8.
2. Install the Deployment Framework. For more information, see [Installing the Deployment Framework](../caplin-platform/deployment-framework/cdf-installing-the-deployment-framework.md).
3. Deploy Liberator 7. For more information, see [Installing Liberator](../caplin-platform/liberator/liberator-installing-liberator.md).
4. Deploy Transformer 7. For more information, see [Installing Transformer](../caplin-platform/transformer/transformer-installing-transformer.md).
5. Deploy Refiner 7. For more information, see [Installing the Refiner Service](../caplin-platform/transformer/transformer-deploy-the-refiner-service-module.md).

## Deploying the adapter

Follow the steps below to deploy the WallStreet Adapter:

1. Copy the installation kit (`WallStreetAdapter-<version>.zip`) to your Deployment Framework’s `<framework-root>/kits` directory.
2. From the root of your deployment framework, run the command below to stop all running components in the Deployment Framework:

   ```
   ./dfw stop
   ```
3. From the root of your deployment framework, run the command below to deploy the WallStreet Adapter:

   ```
   ./dfw deploy
   ```
4. Run the command below to specify the hostnames of the primary and secondary server on which the adapter should run (for more information on this command, see [dfw hosts](../caplin-platform/deployment-framework/cdf-the-deployment-framework-command-utility-dfw.md#hosts)):

   ```
   ./dfw hosts WallStreetAdapter <primary-server> <secondary-server>
   ```

   **💡 TIP**\
   If you are installing the adapter on a developer’s machine, you can specify localhost for both the primary and secondary servers: `./dfw hosts WallStreetAdapter localhost localhost`

## Configuring the adapter

Follow the steps below to configure the deployed adapter:

1. Configure the WallStreet Adapter’s connection to WallStreet in the file `<framework_root>/global_config/overrides/WallStreetAdapter/etc/app.properties`
2. Copy your WallStreet client licence files (`license.txt`, `signature.txt`, and `wsscore.xml`) to the `<framework_root>/global_config/overrides/WallStreetAdapter/etc/` directory

   **💡 TIP**\
   You can specify a custom location for the licence files. For more details, see [Configuration files](wallstreet-configuration-files.md).
3. To enable the WallStreet Adapter to read settlement instructions in WallStreet, make the highlighted changes below to the file `wsscore.xml`:

   ```xml
   <wsscore>
     <!-- Elements omitted -->
     <bo>
       <preferredAllowed>yes</preferredAllowed>
       <fsiGroup>ALL</fsiGroup><!-- STI MAINGP-->
       <fsiCity>ALL</fsiCity><!-- ATLOPS OPS-->
       <fsiCityFromCustomerProfile>no</fsiCityFromCustomerProfile>
       <fxProductCategory>FX</fxProductCategory>
       <!-- Elements omitted -->
     </bo>
     <!-- Elements omitted -->
   </wsscore>
   ```

   Non-highlighted rows are shown for context only and should not be changed.
4. To configure sharing of correspondent charges, make the highlighted changes below to the file `wsscore.xml`:

   ```xml
   <wsscore>
     <!-- Elements omitted -->
     <bo>
       <!-- Elements omitted -->
       <useSWIFTBICDirectory enabled="no">
           <url>https://www.swift.com/bsl</url>
       </useSWIFTBICDirectory>
       <correspondentCharges>yes</correspondentCharges>
       <correspondentChargesSHA>yes</correspondentChargesSHA>
       <correspondentChargesDefault>no</correspondentChargesDefault>
       <ibanValidation>no</ibanValidation>
       <!-- Elements omitted -->
     </bo>
     <!-- Elements omitted -->
   </wsscore>
   ```

   Non-highlighted rows are shown for context only and should not be changed.

## Configuring Refiner

Transformer’s Refiner service sorts the published output of the WallStreet Adapter before it is consumed by front end applications.

Values in the Confirmations Blotter’s `Deadline` and `ConfirmationStatus` fields are strings but their natural sort order is not alphabetical.

To configure Refiner to correctly sort `Deadline` values, follow the steps below:

1. Add the following line to Transformer’s `java.conf` file, located at `<deployment-framewrok>/global_config/overrides/RefinerService/Transformer/etc/java.conf`:

   ```
   classpath "${BASE}/active_blades/WallStreetAdapter/DataSource/lib/DeadlineComparator*.jar"
   ```
2. Add the following line to the file `<deployment-framework>/global_config/overrides/RefinerService/Transformer/etc/refiner.properties`:

   ```
   sorting.algorithm.Deadline=class:com.caplin.deadline.DeadlineComparator
   ```

To configure Refiner to correctly sort `ConfirmationStatus` values, add the following line to the file `<deployment-framework>/global_config/overrides/RefinerService/Transformer/etc/refiner.properties`:

```
sorting.algorithm.ConfirmationStatus=list:REPLACED,CANCELLED,CONFIRMED,PROCESSING,AFFIRMED,PENDING
```

## Starting and stopping the adapter

To start the adapter, run the command below from the root directory of your Deployment Framework:

```
./dfw start WallStreetAdapter
```

To stop the adapter, run the command below from the root directory of your Deployment Framework:

```
./dfw stop WallStreetAdapter
```
