<!--
* 
*
*  ProLinga-Data
*
*  Copyright (C) 2002-2009 Xobas Software.
*  All rights reserved.
*  
*  This file is part of ProLinga-Data.
*
*  ProLinga-Data is free software: you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation, either version 3 of the License, or
*  (at your option) any later version.
*
*  ProLinga-Data is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with ProLinga-Data.  If not, see <http://www.gnu.org/licenses/>.
*
*  More information is available at the following addresses:
*
*  Website     : http://www.prolinga.org
*
*  Email       : prolinga-list@prolinga.org
*
*
-->
<refentry id="prolinga-data-prolingadatclient">
  <refmeta>
    <refentrytitle>prolingadatclient</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>prolingadatclient</refname>
    <refpurpose>command line Data network/SOAP client tool</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>prolingadatclient</command>
        <arg choice='opt'>
          <arg choice='plain'><option>--config</option></arg>
          <arg choice='plain'><option><replaceable>config_file_name.xml</replaceable></option></arg>
        </arg>
        <arg choice='plain'><option>--in</option></arg>
        <arg choice='plain'><option><replaceable>input_DC_file_name.xml</replaceable></option></arg>
        <arg choice='plain'><option>--out</option></arg>
        <arg choice='plain'><option><replaceable>output_DC_file_name.xml</replaceable></option></arg>
  </cmdsynopsis>
    <cmdsynopsis>
      <command>prolingadatclient</command>
      <arg choice='plain'><option>--version</option></arg>
  </cmdsynopsis>
  </refsynopsisdiv>

  <refsect1 id="prolingadatclient_introduction">
    <title>Introduction</title>
    <para>
      The prolingadatclient program parses the input Data Command XML file and
      sends this as a request to the Data Web Service. The response of
      this request is placed in the output XML file as specified as the 2nd argument.
      <parameter>prolingadatclient</parameter> will get the information as hostname 
      and TCP portnumber of the
      Web Service from the configuration file etc/prolingadatcfg.xml.
    </para>
  </refsect1>
  <refsect1 id="prolingadatclient_options">
    <title>Options</title>
    <variablelist>
      <varlistentry>
        <term><option>config_file_name.xml</option></term>
        <listitem>
          <simpara>
            The name of the XML file containing the configuration. If no file is
            specified, the default will be used.
          </simpara>
        </listitem>
      </varlistentry>

      <varlistentry>
	<term><option>input_DC_filename.xml</option></term>
	<listitem>
	  <simpara>
	    The name of the XML file containing a Data Command.
	  </simpara>
	</listitem>
      </varlistentry>

      <varlistentry>
	<term><option>output_DC_filename.xml</option></term>
	<listitem>
	  <simpara>
	    The name of the XML file containing the result of a Data Command.
	  </simpara>
	</listitem>
      </varlistentry>

    </variablelist>
  </refsect1>
</refentry>
<refentry id="prolinga-data-prolingadatd">
  <refmeta>
    <refentrytitle>prolingadatd</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>prolingadatd</refname>
    <refpurpose>Data Web Service daemon</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>prolingadatd</command>
  </cmdsynopsis>
    <cmdsynopsis>
      <command>prolingadatd</command>
      <arg choice='plain'><option>--version</option></arg>
  </cmdsynopsis>
  </refsynopsisdiv>

  <refsect1 id="prolingadatd-introduction">
    <title>Introduction</title>
    <para>
      The prolingadatd program can be called from the command line without any arguments.
      The program will then initialize and run as a daemon in memory waiting for Data
      Command requests to arrive. Since the process
      is a fork, the prompt will return. Programs like
      <link linkend="prolinga-data-prolingadatclient">prolingadatclient</link> can
      now be used to send requests to this Web Service. <parameter>prolingadatd</parameter>
      will get the information 
      as hostname and TCP portnumber where the service needs to bind to 
      from the configuration file etc/prolingadatcfg.xml.</para>

      <para>An example automatic Data startup script for Linux is available as 
      file <parameter>prolingadatd.init</parameter>. This file can be copied and renamed to
      <parameter>/etc/rc.d/init.d/prolingadatd</parameter> and initialized using /sbin/chkconfig.
      Make sure all paths are correct in this file.
      The Web Service can then be started as <parameter>/etc/rc.d/init.d/prolingadatd
      start</parameter>. To stop the 
      argument <parameter>stop</parameter> can be used.
      You need to have root access for this. The binary rpm installation will perform
      all these steps automatically.</para>

  </refsect1>
  <refsect1 id="prolingavald_options">
    <title>Options</title>
    <variablelist>
      <varlistentry>
	<term><option></option></term>
	<listitem>
	  <simpara>
	  </simpara>
	</listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
</refentry>

<refentry id="prolinga-data-configuration_file">
  <refmeta>
    <refentrytitle>Configuration File</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>Configuration File</refname>
    <refpurpose>File containing settings for the Data environment</refpurpose>
  </refnamediv>

  <refsect1 id="prolinga-data-conf_file_introduction">
    <title>Introduction</title>
    <para>
      ProLinga-Data comes with a configuration file where various variable
      settings can be entered. Variables like 
      the name of the host where the Data Web Service is running for instance.
      Default installation of ProLinga-Data will put the default configuration file 
      <parameter>prolingadatcfg.xml</parameter> in the etc directory.</para>

      <para>A default configuration file looks like this:</para>

<programlisting><![CDATA[
<?xml version="1.0" encoding="utf-8" ?>
                                                                                                                                             
<!-- ProLinga Configuration File -->
<!-- Copyright (C) 2002-2009 The ProLinga Team. -->
<!-- All Rights Reserved. -->
                                                                                                                                             
<ProLinga>
        <Configuration>
                <Service Name="Data">
                        <!-- Settings for prolingadatclient. -->
                        <Client>
                                <ClientHost>localhost</ClientHost>
                                <ClientPort>8007</ClientPort>
                                <ClientCompressionLevel>0</ClientCompressionLevel>
                        </Client>
                                                                                                                                             
                        <!-- Settings for prolingadatd. -->
                        <Server>
                                <ServerHost>localhost</ServerHost>
                                <ServerPort>8007</ServerPort>
                                <NumberOfThreads>3</NumberOfThreads>
                                <LogFile>/tmp/prolingadat.log</LogFile>
                                <LogLevel>5</LogLevel>
                                <ServerCompressionLevel>0</ServerCompressionLevel>
                        </Server>
                </Service>
        </Configuration>
</ProLinga>
]]></programlisting>

      <para>
        There is a main section for the client program and for the local/stand alone
        programs. The setup of this configuration file is such that it can be combined with
        configuration files from other ProLinga projects.
      </para>

  </refsect1>
  <refsect1 id="prolinga-data-client_configuration_options">
    <para/>
    <title>Client Options</title>
    <variablelist>
      <varlistentry>
	<term><option>ClientHost</option></term>
	<listitem>
	  <simpara>
	    The name or IP number of the host where to connect to, to present
            a Validation Command.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>ClientPort</option></term>
	<listitem>
	  <simpara>
	    The TCP port of the host where to connect to, to present
            a Validation Command.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>ClientCompressionLevel</option></term>
	<listitem>
	  <simpara>
	    Level of compression to be used on the Data Command XML
            document before it is send off over the network to the 
            Data Web Service. 0=No Compression, 9=Best Compression. 
	  </simpara>
	</listitem>
      </varlistentry>
    </variablelist>
  </refsect1>

  <refsect1 id="prolinga-data-server_configuration_options">
    <para/>
    <title>Server Options</title>
    <variablelist>
      <varlistentry>
	<term><option>ServerHost</option></term>
	<listitem>
	  <simpara>
	    The name or IP number of the host where to bind to when
            starting <parameter>prolingavald</parameter> as a Web Service.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>ServerPort</option></term>
	<listitem>
	  <simpara>
	    The TCP port of the host where to bind to when starting
            <parameter>prolingavald</parameter> as a Web Service.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>NumberOfThreads</option></term>
	<listitem>
	  <simpara>
            Number of threads when starting <parameter>prolingadatd</parameter>
            as a Web Service. This means that up to <parameter>NumberOfThreads</parameter>
            requests can be served simultanously, before they are queued.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>LogFile</option></term>
	<listitem>
	  <simpara>
            Name of the file where logging and debug info will be written to.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>LogLevel</option></term>
	<listitem>
	  <simpara>
            The level of logging. 0=No Logging, 2= +Messages/Errors, 3= +Soap request/response info.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>ServerCompressionLevel</option></term>
	<listitem>
	  <simpara>
	    Level of compression to be used on the Data Command XML
            document before it is returned over the network to the 
            Data caller/client. 0=No Compression, 9=Best Compression. 
	  </simpara>
	</listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
</refentry>

<refentry id="prolinga-data-datasource_configuration_file">
  <refmeta>
    <refentrytitle>Data Source Configuration File</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>Data Source Configuration File</refname>
    <refpurpose>File containing (access) settings for the data providers.</refpurpose>
  </refnamediv>

  <refsect1 id="prolinga-data-dsrcconf_file_introduction">
    <title>Introduction</title>
    <para> One of the problem LibGDA solves is the naming of data sources. Every 
    database system has it's own way of defining names for it's databases. For 
    example MySQL uses the hostname, port number, and the name of the database. 
    Other databases, like Solid use the hostname and port number only. Because 
    the client does not need all these details, the libgda configuration defines 
    all the properties of such a data source, so that the correct data base server 
    can be contacted. This information is accessed by the client library and sent 
    to the provider, which in turn will parse the string to decide which database 
    must be connected to.</para>

    <para>An example data source configuration looks like this:</para>

<programlisting><![CDATA[
<?xml version="1.0"?>
<libgda-config>
  <section path="/apps/libgda/Datasources/stock_msql">
    <entry name="DSN" type="string" value="PORT=3306;USER=prolinga;DATABASE=stock;HOST=localhost"/>
    <entry name="Description" type="string" value="ProLinga MySQL."/>
    <entry name="Password" type="string" value=""/>
    <entry name="Provider" type="string" value="MySQL"/>
    <entry name="Username" type="string" value=""/>
  </section>
  <section path="/apps/libgda/Datasources/stock_psql">
    <entry name="DSN" type="string" value="HOSTADDR=127.0.0.1;PORT=5432;USER=prolinga;DATABASE=stock;HOST=localhost"/>
    <entry name="Description" type="string" value="Stock database in PostgreSQL"/>
    <entry name="Password" type="string" value=""/>
    <entry name="Provider" type="string" value="PostgreSQL"/>
    <entry name="Username" type="string" value=""/>
  </section>
</libgda-config>
]]></programlisting>
   
    <para>This example shows two different data sources. The first one connects to a
    MySQL database and the second one to a PostgreSQL database. LibGDA requires that
    the name of this file is <parameter>config</parameter> and lives as either an user
    file ~/.libgda/config or as a global file in [libgdainstalldir]/etc/libgda/config. 
    Since it is advised to run the ProLinga-Data Web Service as the root user and if you
    want to configure as a user file for Linux the path and name of this file is 
    then /root/.libgda/config.
    Future releases will include more help and possibly an utility to configure data sources.
    </para>

   <para>To configure data sources other than the examples given, please look at the 
   <ulink type="http"
   url="http://www.gnome-db.org/docs/libgda/installation-configuring.html">
   LibGDA configuration</ulink> documentation for more information. Alternatively, the product
   <parameter>libgnomedb</parameter> can be build. This product comes with a binary 
   called <parameter>
   gnome-database-properties</parameter> that can be used for configuration. 
   <parameter>libgnomedb</parameter> is available at the <ulink type="http"
   url="http://www.gnome-db.org">
   GNOME DB</ulink> website.</para>

  </refsect1>
  <refsect1 id="prolinga-data-dsrcconf_file_options">
    <para/>
    <title>Data Source Configuration Options</title>
    <variablelist>
      <varlistentry>
	<term><option>DSN</option></term>
	<listitem>
	  <simpara>
            This is the most important entry. The value of this entry is the string 
            sent to the provider so that it knows which datasource to access. How 
            this entry is interpreted by the providers is provider dependent.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>Description</option></term>
	<listitem>
	  <simpara>
            The value of this entry is a short description of the datasource. It is 
            here for convenience only and it is not used for any purpose.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>Password</option></term>
	<listitem>
	  <simpara>
            The password to be used when connecting to (=not logging on to) the database. 
            This is stored 
            in plain text, so be sure you restrict access to the configuration file 
            (~/.libgda/config) to any "dangerous" users.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>Provider</option></term>
	<listitem>
	  <simpara>
            The value of this entry is used as the object ID for the plug-in activation.
	  </simpara>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term><option>Username</option></term>
	<listitem>
	  <simpara>
             The user name to be used when connecting to (=not logging on to) the database.
	  </simpara>
	</listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
</refentry>

<refentry id="prolinga-data-provider_notes">
  <refmeta>
    <refentrytitle>Provider Notes</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>Provider Notes</refname>
    <refpurpose>Provider dependent notes.</refpurpose>
  </refnamediv>

  <refsect1 id="prolinga-data-provider_introduction">
    <title>Introduction</title>
    <para>This section contains some provider dependent notes.</para> 
  </refsect1>

  <refsect1 id="prolinga-data-provider_notes_psql">
    <title>PostgreSQL</title>

    <para>Default configuration files live in /var/lib/pgsql/data on Linux</para>

    <refsect2 id="prolinga-data-provider_notes_psql_1">
      <title>Enable TCP/IP connections</title>

      <para>
            Edit file postgresql.conf and search for the setting 
            <parameter>tcpip_socket</parameter> and set this to true.
      </para>
<programlisting>
tcpip_socket = true
</programlisting>
      <para/>

    </refsect2>

    <refsect2 id="prolinga-data-provider_notes_psql_2">
      <title>Enable hosts to connect from to PostgreSQL server.</title>

      <para>
            Edit file pg_hba.conf and add a line similar as this:
      </para>
<programlisting>
host    all         all         127.0.0.1/32        trust
</programlisting>
      <para/>

    </refsect2>


    <refsect2 id="prolinga-data-provider_notes_psql_3">
      <title>Change message display</title>

      <para>
            Edit file postgresql.conf and add a line like this:
      </para>
<programlisting>
client_min_messages = warning
</programlisting>
      <para>
        Messages of the type "NOTICE" must be avoided.
      </para>
    </refsect2>
  </refsect1>
</refentry>



