Most adapters supplied by Sybase CEP have properties that the user can modify.
Some of these properties have default values and some do not. Set the properties to values that are appropriate for your data.
You can set adapter properties using the CCL Attach Adapter statement or through the user interface of . See the Sybase CEP CCL Reference Guide and the for more information.
Each adapter and its properties are described in more detail later in this chapter. Some adapter properties may interact with server parameters that are set in the server configuration file, named c8-server.conf.
Setting the Base Folder for File Input/Output Adapters
Specify a directory as the adapters base folder when you install Sybase CEP Server. You can change the base folder by editing the configuration file and modifying the value for the "C8/Adapters/ReadWriteBaseFolder" preference. The adapters base folder tells Sybase CEP Server where to find the data files that an input or output adapter reads or writes. The data files for such adapters must be stored somewhere under the adapters base folder on . This prevents Sybase CEP Server from accidentally interfering with files used by other software.
Adapters supplied by Sybase that access data files include:
ReadFromCSVFile
WriteToCSVFile
ReadFromXMLFile
WriteToXMLFile
ReadFromRegularExpressionFile
In addition to restricting where data files can be stored, the adapters base folder allows you to specify relative paths to data files in your projects. Most people build their projects on a different computer than the one where the project will ultimately be deployed. Because the directory structure on the two computers may be entirely different (they may be running different operating systems, for example), using relative paths for data files allows you to deploy your project without having to modify the file name adapter properties.
When you attach a file adapter to a data stream, you must specify the path to and name of the file that the adapter reads from or writes to. You start the path with one of two variables: $BaseFolder or $ProjectFolder. Sybase CEP Server replaces $BaseFolder with the value of the "C8/Adapters/ReadWriteBaseFolder" preference in the server configuration file. It replaces $ProjectFolder by linking $BaseFolder with the path to your project .cpp file on the client, relative to the SybaseC8Repository. The repository is the directory uses for its preferences file, environment file, security file, the examples directory, and its temporary directory.
If you use the Sybase CEP Eclipse Plug-In, the workspace directory is equivalent to the repository directory. By default, if you install and Sybase CEP Studio on the same computer, the repository and the adapters base folder are set to the same directory. If you create your project in a directory outside of the repository, replaces $ProjectFolder with the absolute path to the project directory without inserting $BaseFolder.
If the repository on your client Windows computer is set to
C:\Documents and Settings\jsmith\My Documents\SybaseC8Repository\3.0
and you create a project under the repository in the directory MyProjects\Project1, then the full path to your project on the client computer is
C:\Documents and Settings\jsmith\My Documents\SybaseC8Repository\3.0\MyProjects\Project1
Put your adapter's data file in a subdirectory named Data. When you attach an input adapter to one of your data streams, you specify the data file name as $ProjectFolder/Data/MyData.csv.
On your Linux Sybase CEP Server, set your adapters base folder to /var/C8/BaseFolder.
When you compile and run your project on , it looks for the data file with the following path:
/var/C8/BaseFolder/MyProjects/Project1/Data/MyData.csv
This is the adapters base folder on the server (/var/C8/BaseFolder) plus the relative path of the project (/MyProjects/Project1) plus the rest of the path and file name specified in the project (/Data/MyData.csv).
Now say that you create a project outside of the repository in this directory:
C:\Documents and Settings\jsmith\My Documents\MyProjects\Project1
In this situation Sybase CEP Server would replace $ProjectFolder/Data/MyData.csv with
/Documents and Settings/jsmith/My Documents/MyProjects/Project1/Data/MyData.csv
If you instead specify $BaseFolder/Data/MyData.csv as the file name, regardless of where the project is stored on the client computer, would look for the data file with this path:
/var/C8/BaseFolder/Data/MyData.csv
This is the adapter's base folder followed by the rest of the path and file name specified in the project.