Ignore:
Timestamp:
03/09/10 10:44:22 (2 years ago)
Author:
sys
Message:

OoConnectionPoolLoader : ajout du param profileFilePath pour paramétrage d'un profile personnalisé.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Jav_Transform/src/com/scenari/s/co/transform/oo/OoConnectionPoolLoader.java

    r14999 r15083  
    3939package com.scenari.s.co.transform.oo; 
    4040 
     41import java.io.File; 
     42import java.util.regex.Pattern; 
     43 
    4144import org.xml.sax.Attributes; 
    4245 
    4346import com.scenari.s.fw.properties.loaders.xml.HInitAppSaxHandlerBase; 
     47 
     48import eu.scenari.fw.initapp.SystemPropsParser; 
    4449 
    4550/** 
     
    8893 *                              pluesieurs serveurs OO sur la machine locale. ATTENTION au format du path : pour Windows ne pas oublier 
    8994 *                              le triple "/" : file:///C:/test/pfOo1. 
     95 *  <li>profileFilePath="{java.io.tmpdir}/ooPf1" : en remplacement de profilePath, permet de spécifier le profile par un path 
     96 *                              du file system de l'OS (avec injection de variables système).  
     97 *                              Le code s'occupe de s'assurer que le dossier pointé existe (et le crée au besoin) et transforme le  
     98 *                              FilePath dans le format conforme pour OO. 
    9099 *      <li>headless="false" : pour un serveur local en autolaunch="true" - lance OpenOffice avec l'option "-headless"  
    91100 *                  Cet attribut est utile sous *nix et permet de se dispenser d'un serveur serveur X. 
     
    124133        public static final String TAG_CONN_ATT_RECHECKINTERVAL = "reCheckInterval"; 
    125134 
     135        /** Profile OO à utiliser sous la forme OO : file:///temp/ooPf1. */ 
    126136        public static final String TAG_CONN_ATT_PROFILEPATH = "profilePath"; 
     137 
     138        /**  
     139         * Profile OO à utiliser sous la forme la forme d'un file path classqie de l'OS. 
     140         * Utilisation possible des varaibles d'environnement systèmes entre {}. 
     141         */ 
     142        public static final String TAG_CONN_ATT_PROFILEFILEPATH = "profileFilePath"; 
    127143 
    128144        public static final String TAG_CONN_ATT_HEADLESS = "headless"; 
     
    157173 
    158174                        String vTempDir = pAttributes.getValue(TAG_POOL_ATT_LOCALTEMPDIR); 
    159                         if (vTempDir != null) fPool.setLocaltempDir(vTempDir); 
     175                        if (vTempDir != null) fPool.setLocaltempDir(SystemPropsParser.replaceProps(vTempDir)); 
    160176 
    161177                        String vLocalToDistPathRegex = pAttributes.getValue(TAG_POOL_ATT_LOCALTODISTPATHREGEX); 
     
    163179 
    164180                        String vLocalToDistPathRepl = pAttributes.getValue(TAG_POOL_ATT_LOCALTODISTPATHREPL); 
    165                         if (vLocalToDistPathRepl != null) fPool.setLocalToDistPathRepl(vLocalToDistPathRepl); 
     181                        if (vLocalToDistPathRepl != null) fPool.setLocalToDistPathRepl(SystemPropsParser.replaceProps(vLocalToDistPathRepl)); 
    166182                } 
    167183 
     
    194210 
    195211                        String vProfilePath = pAttributes.getValue(TAG_CONN_ATT_PROFILEPATH); 
    196                         if (vProfilePath != null) vCon.setProfilePath(vProfilePath); 
     212                        if (vProfilePath != null) { 
     213                                vCon.setProfilePath(vProfilePath); 
     214                        } else { 
     215                                String vProfileFilePath = pAttributes.getValue(TAG_CONN_ATT_PROFILEFILEPATH); 
     216                                if (vProfileFilePath != null) { 
     217                                        File vProfile = new File(SystemPropsParser.replaceProps(vProfileFilePath)).getCanonicalFile(); 
     218                                        if (!vProfile.isDirectory()) vProfile.mkdirs(); 
     219                                        String vOoPath = vProfile.toURI().toURL().toExternalForm(); 
     220                                        //Formattage au format OO : file:/// 
     221                                        vOoPath = Pattern.compile("^(file:/)").matcher(vOoPath).replaceFirst("file:///"); 
     222                                        vCon.setProfilePath(vOoPath); 
     223                                } 
     224                        } 
    197225 
    198226                        String vHeadless = pAttributes.getValue(TAG_CONN_ATT_HEADLESS); 
Note: See TracChangeset for help on using the changeset viewer.