For services beyond those available as library sites, Java sites, and Web service sites,
Orc programs may call sites developed specifically as Orc sites.
The calling Orc program names the site with an import site declaration.
This declaration causes the Orc engine to load the Java class of the given name from
the Orc site classpath or JVM classpath.
Calls to this site are dispatched via Orc's site interface,
which permit the site to interact with the calling program natively.
Orc sites may be implemented in any language that can produce Java class files. However, the Orc team rec ommends the Scala programming language from Martin Odersky and his team at EPFL (École Polytechnique Fédérale de Lausanne). For information on Scala, see http://www.scala-lang.org/.
The Orc runtime engine provides a basic Site interface which a site must implement.
This interface specifies an abstract call method that receives a call handle
for the site to respond to the site call. The Handle interface provides methods
to respond by either:
Publishing a value
Throwing an exception
Additionally, sites may notify the Orc runtime engine of events via the Handle,
such as the need to write a string to the standard output stream.
Site call arguments and return values are not subject to Orc-Java conversions, so the site must work with native Orc values. Sites are also responsible for enforcing arity and type requirements on the argument lists of calls.
Orc provides a number of convenience mix-in traits for site implementors:
Site interface mix-in traits
orc.values.sites.SiteThe basic site trait -- a site that can be called. Implement the call method.
orc.values.sites.TotalSiteA site that always publishes. Implement the evaluate method instead of the call method.
orc.values.sites.PartialSiteA site that sometimes publishes and sometimes halts silently. Implement the evaluate method instead of the call method. evaluate should return an Option, Some(x) to publish x, or None to halt.
orc.values.sites.UnimplementedSiteA site that throws orc.error.NotYetImplementedException when called or type checked.
orc.values.sites.TypedSiteA site that declares its type to the Orc type checker.
orc.values.sites.UntypedSiteA site that does not participate in type checking. Use sparingly.
For a detailed description of the Orc-site interface, refer to the Orc implementation Javadoc.
Related Reference Topics
Related Tutorial Sections