Chapter 3. Accessing and Creating External Services

Table of Contents

3.1. Introduction
3.2. class Sites
3.2.1. Dot Operator
3.2.2. Direct Calls
3.2.3. Pattern Matching
3.2.4. Method Resolution
3.2.5. Orc values in Java
3.2.6. Java Values in Orc
3.2.7. Cooperative Scheduling and Concurrency
3.3. site Sites
3.3.1. Fundamentals
3.3.2. More Site Classes
3.3.3. Tutorial Example
3.4. Web Services
3.4.1. Introduction
3.4.2. Downloading and Running Examples
3.4.3. Protocols Supported
3.4.4. REST

3.1. Introduction

There are two primary ways to create sites which can be used in Orc:

  1. Implement sites as regular Java classes. Orc programs can import and use these classes directly with the class declaration. This approach is easy for anyone already familiar with Java, and such sites are straightforward to share between Orc and Java code. However such sites are limited in how they can interact with the Orc engine.
  2. Implement sites using Orc's low-level site API. Orc programs can import and use these sites with the site declaration. This approach provides full access to the features of the Orc engine. However such sites are difficult to use from Java code.

External services (including web services) are handled using the Proxy pattern. A site implemented in Java (using one of the two techniques above) must act as the local proxy for the service, translating Orc site calls into the appropriate requests and translating responses into site return values, halts, or errors.