Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

Distribution options



The simplest way to distribute a framework configuration is to put the Configuration files and the libraries used by the configuration on the disk. However there are alternative ways to distribute the content of a configuration. For example, youc an:
  • Distribute the configuration, including the deployment libraries, in a jar or zip file, each library is bundled in a jar file nested inside the parent jar or zip file
  • Distribute the configuration, including the deployment libraries, in a jar file, containing both the XML files specifying the configuration and the classes used in the libraries

Default distribution

By default you can distribute a configuration by putting the Configuration files and the deployment libraries used by the configuration on the disk. For example for the first tutorial:
      L:\my\directory
         - filelist.xml 
         - applications.xml 
         - services.xml             
         - types.xml                   
         - samplesPublish.jar   
         - samplesEvent.jar                               
In that case, just performing:
      java -jar protoframework.jar config=L:\my\directory\filelist.xml
will start the framework.

Bundling the libraries in jar files nested inside the parent jar or zip file

In that case all the XML files specifying the configuration, and the libraries, are bundled in a jar or zip file. For example:
      L:\my\directory
         - myZipFile.zip      
            - filelist.xml 
            - applications.xml 
            - services.xml             
            - types.xml                   
            - samplesPublish.jar   
            - samplesEvent.jar                               

Relative URLs

In order for the URLs to work, the references in the XML configuration files must be relative URLs.

For example for the filelist configuration:
      <files>
         <file url="applications.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
      </files>
And for the applications configuration:
      <applications>
         <application name="eventAppli">
            <deployment>
               <lib url="samplesEvent.jar" />
            </deployment>
            <modules>
      ...
            </modules>
         </application>
         <application name="publishAppli">
            <deployment>
               <lib url="samplesPublish.jar" />
            </deployment>
            <modules>
      ...
            </modules>
         </application>
      </applications>

Configuration of the ClassLoading mechanism

Main Article: framework properties

By default Java ClassLoaders are not able to load classes in jar files nested inside another jar or zip file. To allow to load classes in the nested libraries, you must set the allowNestedClassLoaders to true:
      <files>
         <file url="applications.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
         <property key="allowNestedClassLoaders" value="true" />
      </files>

Starting the framework

In that case, performing:
      java -jar protoframework.jar config=jar:file:/L:/my/directory/myZipFile.zip!/filelist.xml
will start the framework.

Distribute the configuration files and classes in a jar file

In that case both the classes and the XML files specifying the configuration are in a jar file. For example:
      L:\my\directory
         - samples.jar    
            - META-INF  
               - MANIFEST-MF    
            - applications.xml 
            - services.xml             
            - types.xml                   
            - org
               - da 
                  - samples     
                     - protoframework  
                        - publish        
                           - PublishModule.class        
                        - event        
                           - EventGUI$1.class                            
                           - EventGUI.class    
                           - EventModule.class                                       

Relative URLs

In order for the URLs to work, the references in the XML configuration files must be relative URLs.

For example for the filelist configuration:
      <files>
         <file url="applications.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
      </files>

Configuration of the ClassLoading mechanism


The useGlobalClassLoaders will specify that if the configuration is specified as an entry of a jar file, the jar file will be automatically added to the general ClassLoader:
      <files>
         <file url="applications.xml" />
         <file url="services.xml" />
         <file url="types.xml" />
         <property key="useGlobalClassLoaders" value="true" />
      </files>

Starting the framework

In that case, performing:
      java -jar protoframework.jar config=jar:file:/L:/my/directory/samples.jar!/filelist.xml
will start the framework.

See also


Categories: general

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence