Changeset 9842

Show
Ignore:
Timestamp:
08/13/07 12:20:44 (3 years ago)
Author:
rcmatthews
Message:
 
Location:
documents/trunk/documentation/src
Files:
1 removed
2 modified

Legend:

Unmodified
Added
Removed
  • documents/trunk/documentation/src/app-dev/build-app.xml

    r9830 r9842  
    1414  <para>How you organise your project and its dependencies is a matter of 
    1515  personal preference, but for this section we will assume the following 
    16   directory structure, where <ital>nakedobjects-3.0</ital> is the unzipped 
    17   distribution and <ital>project/src</ital> is the directory containing the 
    18   application you are working on.</para> 
     16  directory structure, where <path><ital>nakedobjects-3.0</ital></path> is the 
     17  unzipped distribution and <path>project</path> is the directory containing 
     18  the application you are working on.</para> 
    1919 
    2020  <command-listing>nakedobjects-3.0/ 
     
    2626    src/ 
    2727    xat/ 
     28    resources/ 
    2829    config/ 
    2930    build.xml 
    3031    : 
    3132    :</command-listing> 
     33 
     34  <para>The source code for the domain objects is contained in the 
     35  <path>src</path> directory and the tests are in <path>xat</path>. Resources 
     36  to be made available via the class path (rather than loaded via the file 
     37  system) should be added to the <path>project/resources</path> directory, 
     38  while configuration files should be placed in <path>config</path>. The file 
     39  <path>build.xml</path> should be copied across from the 
     40  <path>nakedobjects-3.0/resources</path> directory.</para> 
    3241 
    3342  <heading>Compilation</heading> 
  • documents/trunk/documentation/src/enterprise/running.xml

    r9830 r9842  
    44  <title>Running enterprise Naked Objects</title> 
    55 
    6   <heading>Basic server</heading> 
     6  <heading>Running as Client-Server</heading> 
     7 
     8  <subheading>Basic server</subheading> 
    79 
    810  <command-listing>$ run.sh --type server --connection xstream --persistor xml</command-listing> 
     
    1214  the XStream serialization library.</para> 
    1315 
    14   <heading>Basic DND client</heading> 
     16  <subheading>Basic DND client</subheading> 
    1517 
    1618  <command-listing>$ run.sh --type client --connection xstream</command-listing> 
     
    3234  <property-listing>nakedobjects.remoting.command.address = nof.acme.com</property-listing> 
    3335 
    34   <heading>Integrated web server</heading> 
     36  <subheading>Integrated web server</subheading> 
    3537 
    3638  <command-listing>$ run.sh --type server --viewer html --persistor xml 
     
    4244  <para>This command runs up the NOF as a web server, allowing multiple 
    4345  clients to access Naked Objects via a browser. This server is also using a 
    44   basic persistance mechanism, but it does not provide access for remote 
    45   client using the DND viewer. As for the standalone verision the users need 
    46   to access the URL http://<ital>server</ital>/ to access the logon 
    47   page.</para> 
     46  basic persistence mechanism, but it does not provide access for remote 
     47  client using the DND viewer. As for the standalone version the users need to 
     48  access the URL http://<ital>server</ital>/ to access the log on page.</para> 
    4849 
    49   <heading>Running the server and web server together</heading> 
     50  <subheading>Running the server and web server together</subheading> 
    5051 
    5152  <command-listing>$ run.sh --type server --connection xstream --viewer html --persistor xml 
     
    5758  <para>By specifying a connection and the html view the server can be access 
    5859  by both web browsers and remote clients.</para> 
     60 
     61  <heading>Persistence with Hibernate</heading> 
     62 
     63  <para>The above examples provide basic persistence via a file based 
     64  persistence layer. To use a persistence layer based on Hibernate a small 
     65  amount of configuration is required. First copy across the hibernate 
     66  configuration file - <path>hibernate.cfg.xml</path> - from the 
     67  distribution's resource directory. In its newly copied state this file 
     68  specifies that the database is HSQLDB, but it does contain other 
     69  configurations that can be uncommented so you can use other databases such 
     70  as MySQL and SQLServer.</para> 
     71 
     72  <command-listing>resources/ 
     73   <em>hibernate.cfg.xml</em> 
     74   :</command-listing> 
     75 
     76  <para>The only other task is to list the classes that need to be mapped to 
     77  database tables so that object store can set up the database and the 
     78  Hibernate mappings for you. This list need only name the root objects as any 
     79  reachable class will also be mapped. This can be added to the 
     80  <path>nakedobjects.properties</path> file for simplicity, or a new file, 
     81  <path>hibernate.properties</path>, can be added to the <path>config</path> 
     82  directory, which will only be loaded when the Hibernate persistor is used. 
     83  The following properties setting simply register two classes that are to be 
     84  persisted using Hibernate.</para> 
     85 
     86  <property-listing>nakedobjects.persistence.hibernate.classes = example.dom.Contact, example.dom.PhoneNumber</property-listing> 
     87 
     88  <para>To run Naked Objects with the Hibernate persistor change the persistor 
     89  type to <em>hibernate</em> when starting up the NOF. The following shows the 
     90  integrated web server from above being run with the Hibernate 
     91  persistor.</para> 
     92 
     93  <command-listing>$ run.sh --type server --viewer html <em>--persistor hibernate</em></command-listing> 
     94 
     95  <para>During start up the Hibernate persistor will generate Hibernate 
     96  mapping files and add them to a newly created directory called 
     97  <path>mappings</path>. Assuming that you used the default configuration in 
     98  <path>hibernate.cfg.xml</path> the HSQLDB engine will be used and a 
     99  directory, <path>hsql</path>, for its files will be created. </para> 
     100 
     101  <heading>Adding support for internationalisation</heading> 
     102 
     103  <para>All the text that appears to the user comes from the domain object 
     104  model. Text within the code can be externalised and so localised via the 
     105  resource bundles that Java allows you to work with. However as all field and 
     106  menu names are derived from the method names the framework provides a 
     107  mechanism to adapt these names using resource bundles as well.</para> 
     108 
     109  <subheading>Localisation files</subheading> 
     110 
     111  <para>Create a file for each language to be provided for, e.g., 
     112  <path>i18n_en_GB.properties</path> for English in Great Britain, and place 
     113  them into project where they will be included in the class path. For the 
     114  project structures we have already seen the files could be added to the 
     115  <path>resources</path> directory as the following example shows.</para> 
     116 
     117  <command-listing>resources/ 
     118   <em>i18n_en_GB.properties 
     119   i18n_de_DE.properties 
     120   i18n_fr_FR.properties</em> 
     121</command-listing> 
     122 
     123  <para>The following example is part of one of those translation file and 
     124  shows how property and action names and descriptions can be 
     125  specified.</para> 
     126 
     127  <property-listing>example.dom.Contact.property.FullName.name=Nom 
     128example.dom.Contact.property.Phone.name=Téléphones 
     129example.dom.Contact.action.CreatePhone.name=Nouveau téléphone 
     130example.dom.Contact.property.FullName.description=Le nom complet du client</property-listing> 
     131 
     132  <subheading>Configuration</subheading> 
     133 
     134  <para>To make this work the reflector needs to be decorated to look up the 
     135  translated names every time the framework needs information about the fields 
     136  and menus. To include the peer add the following to a properties 
     137  files.</para> 
     138 
     139  <property-listing>nakedobjects.reflector.peers=resource-i18n</property-listing> 
     140 
     141  <para>If the server does not need to do any localisation - that is it is not 
     142  running the web server - then this property is best specified in the 
     143  <path>client.properties</path> so it is only read in by the client.</para> 
    59144</section>