<?xml version="1.0" encoding="UTF-8"?>
<chapter version="5.0" xml:id="deployment-plan-repositories" xml:lang="en"
         xmlns="http://docbook.org/ns/docbook"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:svg="http://www.w3.org/2000/svg"
         xmlns:mml="http://www.w3.org/1998/Math/MathML"
         xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns:db="http://docbook.org/ns/docbook">
  <title>Repositories</title>

  <para>The server maintains a list of repositories that can store the resources to be deployed using
  deployment plans.</para>

  <section>
    <title>Creating the repository list</title>

    <para>The repositories list is an XML document with syntax described
    in <link
    xlink:href="http://jonas.ow2.org/ns/deployment-plan/repositories-1.0.xsd">
    the XML Schema Definition</link>.</para>

    <para>An example of a repository list file can be seen <link
    linkend="repositories-example">here</link>.</para>

    <para>The root node is <varname>repositories</varname> and must specify
    the following namespace:
    <emphasis>http://jonas.ow2.org/ns/deployment-plan/repositories/1.0</emphasis>.
    </para>

    <para>Each child of the <varname>repositories</varname> node is a
    <varname>repository</varname> node and describes one repository. The
    <varname>repository</varname> nodes have a mandatory <varname>id</varname>
    attribute that identifies globally (i.e. at the server level) the repository.</para>

    <para>The <varname>repository</varname> node then has two children nodes :
    <itemizedlist>
        <listitem>
          <para><varname>type</varname> that specifies how the server can
          communicate with the repository (for example maven2, obr,
          url);</para>
        </listitem>

        <listitem>
          <para><varname>url</varname> that gives the repository location.</para>
        </listitem>
      </itemizedlist></para>

    <example xml:id="repositories-example">
      <title>Example of a repository file with three repositories.</title>

      <literallayout language="xml">  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;repositories 
    xmlns="http://jonas.ow2.org/ns/deployment-plan/repositories/1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="repositories-1.0.xsd"&gt;

     &lt;repository id="maven-repository"&gt;
        &lt;type&gt;maven2&lt;/type&gt;
        &lt;url&gt;http://repo1.maven.org/maven2/&lt;/url&gt;
     &lt;/repository&gt;

     &lt;repository id="http-repo"&gt;
        &lt;type&gt;url&lt;/type&gt;
        &lt;url&gt;http://localhost/&lt;/url&gt;
     &lt;/repository&gt;

     &lt;repository id="obr-repo"&gt;
        &lt;type&gt;obr&lt;/type&gt;
        &lt;url&gt;file:///C:/obr/&lt;/url&gt;
     &lt;/repository&gt;

  &lt;/repositories&gt;</literallayout>
    </example>
  </section>

  <section>
    <title>Using the repository lists</title>

    <para>The repository lists can be deployed on a server in the same way as
    usual deployable resources (EAR, EJB-JAR, WAR...). This has to be done before deploying the deployment plan.
    </para>

    <note>
      <para>In Easybeans, repositories lists can be deployed by copying the
      file into the easybeans-deploy directory like any other resource.</para>
    </note>

    <para>In JOnAS, there are two ways to manage the repository lists.
      <itemizedlist>
          <listitem>
            <para>You can deploy a repository list like any other
            resource, either by copying it into the deploy directory
            (if the development mode is active), or using Admin tools
            (JonasAdmin web interface or <userinput>jonas admin -a
            filename</userinput> command).</para>
          </listitem>

          <listitem>
            <para>You can use it as a configuration file, named
            <filename>conf/initial-repositories.xml</filename>.</para>
          </listitem>
        </itemizedlist></para>
  </section>
  
  <section>
    <title>Accessing repositories through a proxy</title>
    
    <para>Proxy can be specified by setting the Java properties <property>http.proxyHost</property> and <property>http.proxyPort</property>.
      These properties are described in <link xlink:href="http://java.sun.com/javase/6/docs/technotes/guides/net/properties.html"> the Java SE documentation</link>.</para>
    
    <note><para>These properties have to be set even if only some Maven repositories are used: the global Maven configuration is ignored.</para></note>
  </section>
  
</chapter>
