25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Class Projections<br />

class MyApp.Person extends %Persistent [ClassType = persistent]<br />

{<br />

Projection JavaClient As %Projection.Java(ROOTDIR="c:\java");<br />

}<br />

This example defines a projection named “JavaClient” that will use the %Projection.Java<br />

projection class. When the methods of the projection class are called they will be passed the<br />

value of the ROOTDIR parameter.<br />

Note that if you omit the ROOTDIR parameter, your Java or C++ classes will be created<br />

under the default directory specified by your <strong>Caché</strong> configuration. To set this default directory,<br />

go to the Advanced Settings page of the Portal ([Home] > [Configuration] > [Advanced Settings]);<br />

in the Projections category, for setting you want, click Contents; on the Configuration Settings<br />

page that appears ([Home] > [Configuration] > [Advanced Settings] > [Configuration Settings]),<br />

click Add New Item to display a page where you can specify the default directory for a<br />

namespace.<br />

A class may have any number of uniquely named projections. In the case of multiple projections,<br />

the methods of each projection class will be invoked when a class is compiled or deleted.<br />

The order in which multiple projections are handled is undefined.<br />

16.2 Projection Classes<br />

The behavior of a projection is provided by its corresponding projection class. The projection<br />

class implements a set of methods (the projection interface, q.v.) that are called in response<br />

to certain events during a class' life-cycle.<br />

16.2.1 The Projection Interface<br />

Every projection class implements the projection interface. This interface consists of the<br />

following methods:<br />

CreateProjection<br />

The CreateProjection method is a class method that is invoked by the Class Compiler<br />

after it completes the compilation of a class definition. This method is passed the<br />

name of the class being compiled as well as an array containing the parameter values<br />

(subscripted by parameter name) defined for the projection.<br />

142 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!