Changeset 7466


Ignore:
Timestamp:
11/23/06 18:21:31 (5 years ago)
Author:
sys
Message:

api Data + AgentLinker

Location:
trunk/Jav_CO/com/scenari/m/co
Files:
26 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Jav_CO/com/scenari/m/co/agent/IWAgentLinker.java

    r1710 r7466  
    4444 * Agents possédant des liens vers d'autres composants principaux comme les SP. 
    4545 */ 
    46 public interface IWAgentAvecLiens { 
     46public interface IWAgentLinker { 
    4747     
    48     /** 
    49      * Renvoit la liste statique de tous les agents liés. 
    50      */ 
    51     public IWAgent[] hGetAgentsLies() throws Exception; 
    52  
    53     /** 
    54      * Renvoit la liste dynamique des agents Liés. 
    55      *  
    56      * @return com.scenari.m.co.agent.IWAgent[] 
    57      * @param pDialog 
    58      *            com.scenari.m.co.agent.IHDialog 
    59      */ 
    60     public IWAgent[] hGetAgentsLies(IHDialog pDialog) throws Exception; 
    61  
    6248    /** 
    6349     * Renvoit la liste dynamique des agents liés avec certains critères en paramètre. La structure des critères est 
     
    6955     */ 
    7056    public IWAgent[] hGetAgentsLies(IHDialog pDialog, Object pCriteres) throws Exception; 
    71  
    72     /** 
    73      * Renvoit la liste statique de tous les agents liés avec certains critères en paramètre. La structure des critères 
    74      * est spécifique à chaque classe de composant. 
    75      *  
    76      * @return com.scenari.m.co.agent.IWAgent[] 
    77      */ 
    78     public IWAgent[] hGetAgentsLies(Object pCritères) throws Exception; 
    7957} 
  • trunk/Jav_CO/com/scenari/m/co/agent/redirect/HAgentRedirect.java

    r7458 r7466  
    8787 
    8888        /** 
    89          * @see com.scenari.m.co.agent.IWAgentComputor#computeAsData(com.scenari.m.co.dialog.IHDialog, 
    90          *      java.lang.Object) 
     89         *  
    9190         */ 
    9291        public IComputedData computeAsData(IHDialog pDialog, Object pArguments) throws Exception { 
  • trunk/Jav_CO/com/scenari/m/co/agent/sortie/HAgentSortie.java

    r7458 r7466  
    5252import com.scenari.m.co.donnee.IComputedData; 
    5353import com.scenari.m.co.instance.IWInstFormation; 
     54import com.scenari.s.fw.log.HLogMgr; 
    5455import com.scenari.s.fw.log.HTrace; 
    5556import com.scenari.s.fw.log.HTraceMgr; 
     
    6162 
    6263        /** Cache en mémoire du résultat. */ 
    63         protected transient IComputedData fResultatCache = null; 
     64        protected transient IComputedData fDataCache = null; 
    6465 
    6566        /** Trace. */ 
     
    8384        public IComputedData computeAsData(IHDialog pDialog, Object pArguments) throws Exception { 
    8485 
    85                 if (fResultatCache != null) return fResultatCache; 
     86                if (fDataCache != null) return fDataCache; 
    8687 
    8788                IComputedData vResult = IComputedData.NULL; 
     
    102103 
    103104                String vCache = ((HComposantTypeSortie) fComposant.hGetComposantType()).hGetResultatCache(); 
    104                 if(vCache != null) { 
     105                if (vCache != null) { 
    105106                        if ("*".equals(vCache)) { 
    106                                 fResultatCache = new DataVolatileString(vResult.getString(), vResult.getMime()); 
    107                                 return fResultatCache; 
     107                                fDataCache = new DataVolatileString(vResult.getString(), vResult.getMime()); 
     108                                return fDataCache; 
    108109                        } else if ("node".equals(vCache)) { 
    109                                 fResultatCache = new DataVolatileNode(vResult.getNode(), vResult.getMime()); 
    110                                 return fResultatCache; 
     110                                fDataCache = new DataVolatileNode(vResult.getNode(), vResult.getMime()); 
     111                                return fDataCache; 
    111112                        } 
    112113                } 
     
    115116 
    116117        public Node computeAsNode(IHDialog pDialog, Object pArguments) throws Exception { 
    117                 return computeAsData(pDialog, pArguments).getNode(); 
     118 
     119                if (fDataCache != null) return fDataCache.getNode(); 
     120                String vCache = ((HComposantTypeSortie) fComposant.hGetComposantType()).hGetResultatCache(); 
     121                if (vCache != null) { 
     122                        xComputeCache(vCache, pDialog, pArguments); 
     123                        return fDataCache.getNode(); 
     124                } 
     125 
     126                IData vSource = ((WComposantSortie) fComposant).hGetSource(); 
     127 
     128                if (!hIsActif(pDialog)) { 
     129                        return IData.NULL_NODE; 
     130                } else if (vSource.getLevel() <= IData.LEVEL_STATIQUE) { 
     131                        return ((WComposantSortie) fComposant).hGetSource().getNode(pDialog, this, pArguments); 
     132                } else { 
     133                        if (((HComposantTypeSortie) fComposant.hGetComposantType()).hGetTransformsList() == null) { 
     134                                return vSource.getNode(pDialog, this, pArguments); 
     135                        } else { 
     136                                return new XDonneeResultatSortie(this, pDialog, pArguments).getNode(); 
     137                        } 
     138                } 
    118139        } 
    119140 
     
    122143         */ 
    123144        public String computeAsString(IHDialog pDialog, Object pArguments) throws Exception { 
    124                 return computeAsData(pDialog, pArguments).getString(); 
     145 
     146                if (fDataCache != null) return fDataCache.getString(); 
     147 
     148                String vCache = ((HComposantTypeSortie) fComposant.hGetComposantType()).hGetResultatCache(); 
     149                if (vCache != null) { 
     150                        xComputeCache(vCache, pDialog, pArguments); 
     151                        return fDataCache.getString(); 
     152                } 
     153 
     154                IData vSource = ((WComposantSortie) fComposant).hGetSource(); 
     155 
     156                if (!hIsActif(pDialog)) { 
     157                        return IData.NULL_STRING; 
     158                } else if (vSource.getLevel() <= IData.LEVEL_STATIQUE) { 
     159                        return ((WComposantSortie) fComposant).hGetSource().getString(pDialog, this, pArguments); 
     160                } else { 
     161                        if (((HComposantTypeSortie) fComposant.hGetComposantType()).hGetTransformsList() == null) { 
     162                                return vSource.getString(pDialog, this, pArguments); 
     163                        } else { 
     164                                return new XDonneeResultatSortie(this, pDialog, pArguments).getString(); 
     165                        } 
     166                } 
     167        } 
     168 
     169        protected void xComputeCache(String pCache, IHDialog pDialog, Object pArguments) throws Exception { 
     170                if (!hIsActif(pDialog)) { 
     171                        fDataCache = IComputedData.NULL; 
     172                } 
     173                IData vSource = ((WComposantSortie) fComposant).hGetSource(); 
     174                if ("*".equals(pCache)) { 
     175                        if (vSource.getLevel() <= IData.LEVEL_STATIQUE) { 
     176                                fDataCache = new DataVolatileString(vSource.getString(pDialog, this, pArguments)); 
     177                        } else { 
     178                                if (((HComposantTypeSortie) fComposant.hGetComposantType()).hGetTransformsList() == null) { 
     179                                        try { 
     180                                                pDialog.hExecStackPush(this); 
     181                                                fDataCache = new DataVolatileString(vSource.getString(pDialog, this, pArguments)); 
     182                                        } finally { 
     183                                                pDialog.hExecStackPop(); 
     184                                        } 
     185                                } else { 
     186                                        fDataCache = new DataVolatileString(new XDonneeResultatSortie(this, pDialog, pArguments).getString()); 
     187                                } 
     188                        } 
     189                } else if ("node".equals(pCache)) { 
     190                        if (vSource.getLevel() <= IData.LEVEL_STATIQUE) { 
     191                                fDataCache = new DataVolatileNode(vSource.getNode(pDialog, this, pArguments)); 
     192                        } else { 
     193                                if (((HComposantTypeSortie) fComposant.hGetComposantType()).hGetTransformsList() == null) { 
     194                                        try { 
     195                                                pDialog.hExecStackPush(this); 
     196                                                fDataCache = new DataVolatileNode(vSource.getNode(pDialog, this, pArguments)); 
     197                                        } finally { 
     198                                                pDialog.hExecStackPop(); 
     199                                        } 
     200                                } else { 
     201                                        fDataCache = new DataVolatileNode(new XDonneeResultatSortie(this, pDialog, pArguments).getNode()); 
     202                                } 
     203                        } 
     204                } else { 
     205                        throw HLogMgr.hNewException("Valeur de cache inconnue '" + pCache + "' définie dans " + this); 
     206                } 
    125207        } 
    126208 
  • trunk/Jav_CO/com/scenari/m/co/agent/sortie/HDialogSortie.java

    r7458 r7466  
    8989            //On force le calcul jusque "hGetValue()" pour forcer la calcul cmplete de la donnée et l'execution 
    9090            //des ressources sousjacentes. 
    91             fResult = ((HAgentSortie) fAgent).computeAsData(this, hGetParam()).getString(); 
     91            fResult = ((HAgentSortie) fAgent).computeAsString(this, hGetParam()); 
    9292        } else { 
    9393            return super.xExecute(); 
  • trunk/Jav_CO/com/scenari/m/co/agent/source/HAgentSource.java

    r7458 r7466  
    6767 
    6868        /** 
    69          * @see com.scenari.m.co.agent.IWAgentComputor#computeAsData(com.scenari.m.co.dialog.IHDialog, java.lang.Object) 
     69         *  
    7070         */ 
    7171        public IComputedData computeAsData(IHDialog pDialog, Object pArguments) throws Exception { 
  • trunk/Jav_CO/com/scenari/m/co/ant/ResultatTask.java

    r7458 r7466  
    5656 
    5757                if (vAgent != null) { 
    58                     vResult = ((IWAgentComputor) vAgent).computeAsData(vDialog, fArguments).getString(); 
     58                    vResult = ((IWAgentComputor) vAgent).computeAsString(vDialog, fArguments); 
    5959                    if (fResult != null) { 
    6060                        vProject.setProperty(fResult, vResult); 
  • trunk/Jav_CO/com/scenari/m/co/donnee/IData.java

    r7458 r7466  
    9494        /** Donnée null définie par défaut. */ 
    9595        public static final IAgentData NULL = new WDonneeNull(); 
     96         
     97        /** Donnée null définie par défaut. */ 
     98        public static final String NULL_STRING = ""; 
     99         
     100        /** Donnée null définie par défaut. */ 
     101        public static final Node NULL_NODE = null; 
    96102 
    97103        /** 
  • trunk/Jav_CO/com/scenari/m/co/donnee/composition/XContainerAgentsLies.java

    r2271 r7466  
    4141import com.scenari.m.co.agent.IWADialog; 
    4242import com.scenari.m.co.agent.IWAgent; 
    43 import com.scenari.m.co.agent.IWAgentAvecLiens; 
     43import com.scenari.m.co.agent.IWAgentLinker; 
    4444 
    4545/** 
     
    8080        IWAgent vAgent = pContext.wGetAgent(); 
    8181        if(fRefAgent != null) vAgent = fIsRefAgentFromDialog ? ((IWADialog)pContext.wGetDialog()).hGoToAgent(fRefAgent) : vAgent.hGetAgentParRef(fRefAgent); 
    82         while (vAgent != null && !(vAgent instanceof IWAgentAvecLiens)) { 
     82        while (vAgent != null && !(vAgent instanceof IWAgentLinker)) { 
    8383            vAgent = vAgent.hGetAgentPere(); 
    8484        } 
     
    8686        //On récupere la liste des agents lies 
    8787        if (vAgent != null) { 
    88             IWAgent[] vList = ((IWAgentAvecLiens) vAgent).hGetAgentsLies(pContext.fDialog); 
     88            IWAgent[] vList = ((IWAgentLinker) vAgent).hGetAgentsLies(pContext.fDialog, null); 
    8989            if (vList != null) { 
    9090                XContextElement vNewContext = new XContextElement(pContext); 
  • trunk/Jav_CO/com/scenari/m/co/donnee/inclusion/XWriter.java

    r7458 r7466  
    4949import com.scenari.m.co.dialog.IHDialog; 
    5050import com.scenari.m.co.donnee.HDonneeUtils; 
    51 import com.scenari.m.co.donnee.IComputedData; 
    5251import com.scenari.m.co.service.IWSDialog; 
    5352import com.scenari.m.co.service.IWService; 
     
    7776public class XWriter extends Writer { 
    7877 
    79     protected static final int STATUT_TEXT = 0; 
    80  
    81     protected static final int STATUT_TAGOUV = 1; 
    82  
    83     protected static final int STATUT_TAGIN = 2; 
    84  
    85     protected static final int STATUT_TAGFERM = 3; 
    86  
    87     protected static final char[] TAGOUV_DEFAUT = { '[', '!', '[' }; 
    88  
    89     protected static final char[] TAGFERM_DEFAUT = { ']', '!', ']' }; 
    90  
    91     /** Writer de destination.*/ 
    92     protected Writer fWriterDest = null; 
    93  
    94     /** Dialog en cours.*/ 
    95     protected IHDialog fDialog = null; 
    96  
    97     /** Owner de cette données.*/ 
    98     protected Object fOwner = null; 
    99  
    100     /** Arguments associés à l'appel de la donnée.*/ 
    101     protected Object fArguments = null; 
    102  
    103     /** Statut correspondant au dernier caractere lu.*/ 
    104     protected int fStatut = STATUT_TEXT; 
    105  
    106     /** Nombre de caractères lus du tag.*/ 
    107     protected int fPosTagCourant = 0; 
    108  
    109     /** Tag d'ouverture d'une inclusion.*/ 
    110     protected char[] fTagOuv = TAGOUV_DEFAUT; 
    111  
    112     /** Tag de fermeture d'une inclusion.*/ 
    113     protected char[] fTagFerm = TAGFERM_DEFAUT; 
    114  
    115     /** Buffer de l'inclusion.*/ 
    116     protected StringBuffer fBuff = null; 
    117  
    118     /** Flag si le flux doit être envoyé dans la dest. */ 
    119     protected boolean fWriteDest = true; 
    120  
    121     /** Flag si la source est XML, donc nécessité de décoder les entitées XML avant de traiter les inclusions. */ 
    122     protected boolean fSrcIsXml = true; 
    123  
    124     /** Stack des if imbriqués. */ 
    125     protected List fStackCond = null; 
    126  
    127     /** 
    128      *  
    129      */ 
    130     public XWriter(Writer pWriterDest, IHDialog pDialog, Object pOwner, Object pArguments, boolean pSrcIsXml) { 
    131         super(); 
    132         fWriterDest = pWriterDest; 
    133         fDialog = pDialog; 
    134         fOwner = pOwner; 
    135         fArguments = pArguments; 
    136         fSrcIsXml = pSrcIsXml; 
    137     } 
    138  
    139     /** 
    140      * Close the stream, flushing it first.  Once a stream has been closed, 
    141      * further write() or flush() invocations will cause an IOException to be 
    142      * thrown.  Closing a previously-closed stream, however, has no effect. 
    143      * 
    144      * @exception  IOException  If an I/O error occurs 
    145      */ 
    146     public void close() throws IOException { 
    147  
    148         if (fStatut == STATUT_TAGIN || fStatut == STATUT_TAGFERM) { 
    149             String vInc = fBuff.toString(); 
    150             fWriterDest.write(fTagOuv); 
    151             fWriterDest.write(vInc); 
    152             if (fStatut == STATUT_TAGFERM) { 
    153                 fWriterDest.write(fTagFerm, 0, fPosTagCourant); 
    154             } 
    155             HLogMgr.hPublishException("Terminaison anormale d'une donnée de type 'inclusion-dynamique' dans le dialogue : " + fDialog + ". L'inclusion '" + vInc + "' n'a pu être exécutée."); 
    156         } 
    157  
    158         fWriterDest.close(); 
    159     } 
    160  
    161     /** 
    162      * Flush the stream.  If the stream has saved any characters from the 
    163      * various write() methods in a buffer, write them immediately to their 
    164      * intended destination.  Then, if that destination is another character or 
    165      * byte stream, flush it.  Thus one flush() invocation will flush all the 
    166      * buffers in a chain of Writers and OutputStreams. 
    167      * 
    168      * @exception  IOException  If an I/O error occurs 
    169      */ 
    170     public void flush() throws IOException { 
    171         fWriterDest.flush(); 
    172     } 
    173  
    174     /** 
    175      * Write a portion of an array of characters. 
    176      * 
    177      * @param  pBuf  Array of characters 
    178      * @param  pOffset   Offset from which to start writing characters 
    179      * @param  pLength   Number of characters to write 
    180      * 
    181      * @exception  IOException  If an I/O error occurs 
    182      */ 
    183     public void write(char[] pBuf, int pOffset, int pLength) throws IOException { 
    184  
    185         int vEnd = pOffset + pLength; 
    186         for (int i = pOffset; i < vEnd; i++) { 
    187             write(pBuf[i]); 
    188         } 
    189  
    190     } 
    191  
    192     public void write(int pChar) throws IOException { 
    193  
    194         switch (fStatut) { 
    195         case STATUT_TEXT: { 
    196             if (pChar == fTagOuv[0]) { 
    197                 if (fTagOuv.length == 1) { 
    198                     //On a trouvé un tag d'ouverture 
    199                     if (fBuff == null) { 
    200                         fBuff = new StringBuffer(64); 
    201                     } 
    202                     fStatut = STATUT_TAGIN; 
    203                 } else { 
    204                     fStatut = STATUT_TAGOUV; 
    205                     fPosTagCourant = 1; 
    206                 } 
    207  
    208             } else { 
    209                 if (fWriteDest) fWriterDest.write(pChar); 
    210             } 
    211             break; 
    212         } 
    213         case STATUT_TAGOUV: { 
    214             if (pChar == fTagOuv[fPosTagCourant]) { 
    215                 fPosTagCourant++; 
    216                 if (fTagOuv.length == fPosTagCourant) { 
    217                     //On a trouvé un tag d'ouverture 
    218                     if (fBuff == null) { 
    219                         fBuff = new StringBuffer(64); 
    220                     } 
    221                     fStatut = STATUT_TAGIN; 
    222                 } 
    223             } else { 
    224                 //On n'est pas sur un tag d'ouverture 
    225                 if (fWriteDest) fWriterDest.write(fTagOuv, 0, fPosTagCourant); 
    226                 if (pChar == fTagOuv[0]) { 
    227                     fPosTagCourant = 1; 
    228                 } else { 
    229                     fStatut = STATUT_TEXT; 
    230                     if (fWriteDest) fWriterDest.write((char) pChar); 
    231                 } 
    232             } 
    233             break; 
    234         } 
    235         case STATUT_TAGIN: { 
    236             if (pChar == fTagFerm[0]) { 
    237                 if (fTagFerm.length == 1) { 
    238                     //On a trouvé le tag de fermeture 
    239                     xExecuteInclusion(); 
    240                 } else { 
    241                     //On entame peut-être le tag de fermeture 
    242                     fStatut = STATUT_TAGFERM; 
    243                     fPosTagCourant = 1; 
    244                 } 
    245             } else { 
    246                 fBuff.append((char) pChar); 
    247             } 
    248             break; 
    249         } 
    250         case STATUT_TAGFERM: { 
    251             if (pChar == fTagFerm[fPosTagCourant]) { 
    252                 fPosTagCourant++; 
    253                 if (fTagFerm.length == fPosTagCourant) { 
    254                     //On a trouvé le tag de fermeture 
    255                     xExecuteInclusion(); 
    256                 } 
    257             } else { 
    258                 //On n'est pas encore sur le tag de fermeture 
    259                 fBuff.append(fTagFerm, 0, fPosTagCourant); 
    260                 if (pChar == fTagFerm[0]) { 
    261                     fPosTagCourant = 1; 
    262                 } else { 
    263                     fStatut = STATUT_TAGIN; 
    264                     fBuff.append((char) pChar); 
    265                 } 
    266             } 
    267             break; 
    268         } 
    269         } 
    270     } 
    271  
    272     public void write(String pStr) throws IOException { 
    273         int vEnd = pStr.length(); 
    274         for (int i = 0; i < vEnd; i++) { 
    275             write(pStr.charAt(i)); 
    276         } 
    277     } 
    278  
    279     public void write(String pStr, int pOffset, int pLength) throws IOException { 
    280         int vEnd = Math.min(pOffset + pLength, pStr.length()); 
    281         for (int i = pOffset; i < vEnd; i++) { 
    282             write(pStr.charAt(i)); 
    283         } 
    284     } 
    285  
    286     /** 
    287      * NOTE : l'atribut "argument" DOIT être en derniere position après les 
    288      * les attrributs "agent" "service" et/ou "dialogue". 
    289      * NOTE : si le contenu de l'inclusion est vide, le tag d'ouverture est recopié  
    290      * dans le résultat (escape du tag d'ouveture). 
    291      *  
    292      */ 
    293     public void xExecuteInclusion() throws IOException { 
    294  
    295         fStatut = STATUT_TEXT; 
    296  
    297         String vInc; 
    298         if (fSrcIsXml) { 
    299             int vLen = fBuff.length(); 
    300             StringBuffer vBuf = new StringBuffer(vLen); 
    301             for (int i = 0; i < vLen; i++) { 
    302                 char vCh = fBuff.charAt(i); 
    303                 if (vCh == '&' && i < vLen - 3) { 
    304                     char vCh2 = fBuff.charAt(i + 1); 
    305                     if (vCh2 == 'a') { 
    306                         if (fBuff.charAt(i + 2) == 'm' && fBuff.charAt(i + 3) == 'p' && i < vLen - 4 && fBuff.charAt(i + 4) == ';') { 
    307                             vBuf.append('&'); 
    308                             i = i + 4; 
    309                             continue; 
    310                         } 
    311                         if (fBuff.charAt(i + 2) == 'p' && fBuff.charAt(i + 3) == 'o' && i < vLen - 5 && fBuff.charAt(i + 4) == 's' && fBuff.charAt(i + 5) == ';') { 
    312                             vBuf.append('\''); 
    313                             i = i + 5; 
    314                             continue; 
    315                         } 
    316                     } else if (vCh2 == 'l' && fBuff.charAt(i + 2) == 't' && fBuff.charAt(i + 3) == ';') { 
    317                         vBuf.append('<'); 
    318                         i = i + 3; 
    319                         continue; 
    320                     } else if (vCh2 == 'g'&& fBuff.charAt(i + 2) == 't' && fBuff.charAt(i + 3) == ';') { 
    321                         vBuf.append('>'); 
    322                         i = i + 3; 
    323                         continue; 
    324                     } else if (vCh2 == 'q'&& fBuff.charAt(i + 2) == 'u' && i < vLen - 5 && fBuff.charAt(i + 3) == 'o' && fBuff.charAt(i + 4) == 't' && fBuff.charAt(i + 5) == ';') { 
    325                         vBuf.append('\"'); 
    326                         i = i + 5; 
    327                         continue; 
    328                     } 
    329                 } 
    330                 vBuf.append(vCh); 
    331             } 
    332             vInc = vBuf.toString(); 
    333         } else { 
    334             vInc = fBuff.toString(); 
    335         } 
    336  
    337         try { 
    338             if (vInc.equals("")) { 
    339                 fWriterDest.write(fTagOuv); 
    340             } else if (vInc.equals("endif")) { 
    341                 fWriteDest = true; 
    342                 if (fStackCond != null && fStackCond.size() > 0) { 
    343                     //On supprime le dernier if 
    344                     fStackCond.remove(fStackCond.size() - 1); 
    345                     //Si il existe encore un test faux, on bloque toujours l'écriture. 
    346                     for (int i = 0; i < fStackCond.size(); i++) { 
    347                         Boolean vResultIf = (Boolean) fStackCond.get(i); 
    348                         if (vResultIf == Boolean.FALSE) { 
    349                             fWriteDest = false; 
    350                             break; 
    351                         } 
    352                     } 
    353                 } 
    354             } else if (vInc.equals("else")) { 
    355                 fWriteDest = true; 
    356                 if (fStackCond != null && fStackCond.size() > 0) { 
    357                     //On supprime le dernier if 
    358                     int vPos = fStackCond.size() - 1; 
    359                     Boolean vNewVal = ((Boolean) fStackCond.get(vPos)).booleanValue() ? Boolean.FALSE : Boolean.TRUE; 
    360                     fStackCond.set(vPos, vNewVal); 
    361                     fWriteDest = vNewVal.booleanValue(); 
    362                     if (fWriteDest) { 
    363                         //Si il existe encore un test faux, on bloque toujours l'écriture. 
    364                         for (int i = 0; i < fStackCond.size(); i++) { 
    365                             Boolean vResultIf = (Boolean) fStackCond.get(i); 
    366                             if (vResultIf == Boolean.FALSE) { 
    367                                 fWriteDest = false; 
    368                                 break; 
    369                             } 
    370                         } 
    371                     } 
    372                 } 
    373             } else if (fWriteDest) { 
    374  
    375                 IWAgent vAgent = null; 
    376                 IWService vService = null; 
    377                 IHDialog vDialog = fDialog; 
    378                 String vArgument = null; 
    379  
    380                 int vOffset = -1; 
    381                 int vEnd = 0; 
    382  
    383                 vOffset = vInc.indexOf(";arguments="); 
    384                 if (vOffset > 0) { 
    385                     vArgument = vInc.substring(vOffset + 11); 
    386                     vInc = vInc.substring(0, vOffset); 
    387                 } 
    388  
    389                 // 'argument=' = OBSOLET A VIRER ! 
    390                 vOffset = vInc.indexOf(";argument="); 
    391                 if (vOffset > 0) { 
    392                     vArgument = vInc.substring(vOffset + 10); 
    393                     vInc = vInc.substring(0, vOffset); 
    394                     HLogMgr.hPublishTrace("La syntaxe 'argument=' dans une inclusion dynamique est obsolete et doit etre remplacée par 'arguments='."); 
    395                 } 
    396  
    397                 if (vInc.startsWith("agent=")) { 
    398                     vOffset = 6; 
    399                 } else { 
    400                     vOffset = vInc.indexOf(";agent="); 
    401                     if (vOffset >= 0) { 
    402                         vOffset += 7; 
    403                     } 
    404                 } 
    405                 if (vOffset > 0) { 
    406                     vEnd = Math.max(vInc.indexOf(';', vOffset), vInc.length()); 
    407                     String vUrl = vInc.substring(vOffset, vEnd); 
    408                     if (fOwner instanceof IWAgent) { 
    409                         vAgent = ((IWAgent) fOwner).hGetAgentParRef(vUrl); 
    410                     } else { 
    411                         throw HLogMgr.hNewException("Impossible d'accéder à un agent dans le contexte de service."); 
    412                     } 
    413                     if (vAgent == null) { 
    414                         //throw HLogMgr.hNewException("L'url '" + vUrl + "' ne pointe sur aucun agent."); 
    415                         return; 
    416                     } else if (!(vAgent instanceof IWAgentComputor)) { 
    417                         throw HLogMgr.hNewException("L'url '" + vUrl + "' pointe sur l'agent '" + vAgent + "' qui ne peut produire de résultat"); 
    418                     } 
    419                 } 
    420  
    421                 if (vInc.startsWith("service=")) { 
    422                     vOffset = 8; 
    423                 } else { 
    424                     vOffset = vInc.indexOf(";service="); 
    425                     if (vOffset >= 0) { 
    426                         vOffset += 9; 
    427                     } 
    428                 } 
    429                 if (vOffset > 0) { 
    430                     vEnd = Math.max(vInc.indexOf(';', vOffset), vInc.length()); 
    431                     String vUrl = vInc.substring(vOffset, vEnd); 
    432                     vService = ((IWSDialog) fDialog.hGoTo(vUrl)).hGetService(); 
    433                     if (vService == null) { 
    434                         //throw HLogMgr.hNewException("L'url '" + vUrl + "' ne pointe sur aucun service."); 
    435                         return; 
    436                     } else if (!(vService instanceof IWServiceAvecResultat)) { 
    437                         throw HLogMgr.hNewException("L'url '" + vUrl + "' pointe sur le service '" + vService + "' qui ne peut produire de résultat"); 
    438                     } 
    439                 } 
    440  
    441                 if (vInc.startsWith("dialog=")) { 
    442                     vOffset = 7; 
    443                 } else { 
    444                     vOffset = vInc.indexOf(";dialog="); 
    445                     if (vOffset >= 0) { 
    446                         vOffset += 8; 
    447                     } 
    448                 } 
    449  
    450                 //'dialogue=' = OBSOLET A VIRER ! 
    451                 //              if (vInc.startsWith("dialogue=")) { 
    452                 //                      vOffset = 9; 
    453                 //                      HLogMgr.hPublishTrace("La syntaxe 'dialogue=' dans une inclusion dynamique est obsolete et doit etre remplacée par 'dialog='."); 
    454                 //              } else { 
    455                 //                      vOffset = vInc.indexOf(";dialogue="); 
    456                 //                      if (vOffset >= 0) { 
    457                 //                              vOffset += 10; 
    458                 //                              HLogMgr.hPublishTrace("La syntaxe 'dialogue=' dans une inclusion dynamique est obsolete et doit etre remplacée par 'dialog='."); 
    459                 //                      } 
    460                 //              } 
    461  
    462                 if (vOffset > 0) { 
    463                     vEnd = Math.max(vInc.indexOf(';', vOffset), vInc.length()); 
    464                     String vUrl = vInc.substring(vOffset, vEnd); 
    465                     vDialog = fDialog.hGoTo(vUrl); 
    466                     if (vDialog == null) { 
    467                         //throw HLogMgr.hNewException("L'url '" + vUrl + "' ne pointe sur aucun dialogue."); 
    468                         return; 
    469                     } 
    470                 } 
    471  
    472                 if (vInc.startsWith("if;")) { 
    473                     IComputedData vRes = IComputedData.NULL; 
    474                     if (vAgent != null) { 
    475                         vRes = ((IWAgentComputor) vAgent).computeAsData(vDialog, vArgument); 
    476                     } else if (vService != null) { 
    477                         vRes = ((IWServiceAvecResultat) vService).hGetResultat(vDialog, vArgument); 
    478                     } else if (vDialog instanceof IWADialog) { 
    479                         if (!(((IWADialog) vDialog).hGetAgent() instanceof IWAgentComputor)) { 
    480                             throw HLogMgr.hNewException("Le dialogue d'agent '" + vDialog + "' ne peut pas produire de résultat"); 
    481                         } 
    482                         vRes = ((IWAgentComputor) ((IWADialog) vDialog).hGetAgent()).computeAsData(vDialog, vArgument); 
    483                     } else if (vDialog instanceof IWSDialog) { 
    484                         if (!(((IWSDialog) vDialog).hGetService() instanceof IWServiceAvecResultat)) { 
    485                             throw HLogMgr.hNewException("Le dialogue de service '" + vDialog + "' ne peut pas produire de résultat"); 
    486                         } 
    487                         vRes = ((IWServiceAvecResultat) ((IWSDialog) vDialog).hGetService()).hGetResultat(vDialog, vArgument); 
    488                     } 
    489                     if (fStackCond == null) fStackCond = new ArrayList(); 
    490                     if (HDonneeUtils.hGetBooleanEvalTrue(vRes.getString())) { 
    491                         fStackCond.add(Boolean.TRUE); 
    492                     } else { 
    493                         fStackCond.add(Boolean.FALSE); 
    494                         fWriteDest = false; 
    495                     } 
    496                 } else { 
    497                     Writer vWriter = fWriterDest; 
    498                     if (vInc.startsWith("escapeXml;")) { 
    499                         vWriter = new HWriterEscapeXml(vWriter, HWriterEscapeXml.ESCAPE_ATTR); 
    500                     } 
    501                     if (vAgent != null) { 
    502                         ((IWAgentComputor) vAgent).computeAsData(vDialog, vArgument).writeValue(vWriter); 
    503                     } else if (vService != null) { 
    504                         ((IWServiceAvecResultat) vService).hGetResultat(vDialog, vArgument).writeValue(vWriter); 
    505                     } else if (vDialog instanceof IWADialog) { 
    506                         if (!(((IWADialog) vDialog).hGetAgent() instanceof IWAgentComputor)) { 
    507                             throw HLogMgr.hNewException("Le dialogue d'agent '" + vDialog + "' ne peut pas produire de résultat"); 
    508                         } 
    509                         ((IWAgentComputor) ((IWADialog) vDialog).hGetAgent()).computeAsData(vDialog, vArgument).writeValue(vWriter); 
    510                     } else if (vDialog instanceof IWSDialog) { 
    511                         if (!(((IWSDialog) vDialog).hGetService() instanceof IWServiceAvecResultat)) { 
    512                             throw HLogMgr.hNewException("Le dialogue de service '" + vDialog + "' ne peut pas produire de résultat"); 
    513                         } 
    514                         ((IWServiceAvecResultat) ((IWSDialog) vDialog).hGetService()).hGetResultat(vDialog, vArgument).writeValue(vWriter); 
    515                     } 
    516                 } 
    517             } 
    518  
    519             //  
    520             else { 
    521                 //Cas : fWriteDest == false 
    522                 if (vInc.startsWith("if;")) { 
    523                     //Un père est déjà faux, on ajoute une condition à la stack, la valeur n'a aucune importance. 
    524                     fStackCond.add(Boolean.TRUE); 
    525                 } 
    526             } 
    527  
    528         } catch (IOException e) { 
    529             throw (IOException) HLogMgr.hAddMessage(e, "Echec à l'insertion d'une inclusion : '" + vInc + "'."); 
    530         } catch (Exception e) { 
    531             throw (IOException) HLogMgr.hAddMessage(new IOException("Echec à l'insertion d'une inclusion : '" + vInc + "'."), HLogMgr.hGetMessage(e)); 
    532         } finally { 
    533             fBuff.setLength(0); 
    534         } 
    535  
    536     } 
     78        protected static final int STATUT_TEXT = 0; 
     79 
     80        protected static final int STATUT_TAGOUV = 1; 
     81 
     82        protected static final int STATUT_TAGIN = 2; 
     83 
     84        protected static final int STATUT_TAGFERM = 3; 
     85 
     86        protected static final char[] TAGOUV_DEFAUT = { '[', '!', '[' }; 
     87 
     88        protected static final char[] TAGFERM_DEFAUT = { ']', '!', ']' }; 
     89 
     90        /** Writer de destination.*/ 
     91        protected Writer fWriterDest = null; 
     92 
     93        /** Dialog en cours.*/ 
     94        protected IHDialog fDialog = null; 
     95 
     96        /** Owner de cette données.*/ 
     97        protected Object fOwner = null; 
     98 
     99        /** Arguments associés à l'appel de la donnée.*/ 
     100        protected Object fArguments = null; 
     101 
     102        /** Statut correspondant au dernier caractere lu.*/ 
     103        protected int fStatut = STATUT_TEXT; 
     104 
     105        /** Nombre de caractères lus du tag.*/ 
     106        protected int fPosTagCourant = 0; 
     107 
     108        /** Tag d'ouverture d'une inclusion.*/ 
     109        protected char[] fTagOuv = TAGOUV_DEFAUT; 
     110 
     111        /** Tag de fermeture d'une inclusion.*/ 
     112        protected char[] fTagFerm = TAGFERM_DEFAUT; 
     113 
     114        /** Buffer de l'inclusion.*/ 
     115        protected StringBuffer fBuff = null; 
     116 
     117        /** Flag si le flux doit être envoyé dans la dest. */ 
     118        protected boolean fWriteDest = true; 
     119 
     120        /** Flag si la source est XML, donc nécessité de décoder les entitées XML avant de traiter les inclusions. */ 
     121        protected boolean fSrcIsXml = true; 
     122 
     123        /** Stack des if imbriqués. */ 
     124        protected List fStackCond = null; 
     125 
     126        /** 
     127         *  
     128         */ 
     129        public XWriter(Writer pWriterDest, IHDialog pDialog, Object pOwner, Object pArguments, boolean pSrcIsXml) { 
     130                super(); 
     131                fWriterDest = pWriterDest; 
     132                fDialog = pDialog; 
     133                fOwner = pOwner; 
     134                fArguments = pArguments; 
     135                fSrcIsXml = pSrcIsXml; 
     136        } 
     137 
     138        /** 
     139         * Close the stream, flushing it first.  Once a stream has been closed, 
     140         * further write() or flush() invocations will cause an IOException to be 
     141         * thrown.  Closing a previously-closed stream, however, has no effect. 
     142         * 
     143         * @exception  IOException  If an I/O error occurs 
     144         */ 
     145        public void close() throws IOException { 
     146 
     147                if (fStatut == STATUT_TAGIN || fStatut == STATUT_TAGFERM) { 
     148                        String vInc = fBuff.toString(); 
     149                        fWriterDest.write(fTagOuv); 
     150                        fWriterDest.write(vInc); 
     151                        if (fStatut == STATUT_TAGFERM) { 
     152                                fWriterDest.write(fTagFerm, 0, fPosTagCourant); 
     153                        } 
     154                        HLogMgr.hPublishException("Terminaison anormale d'une donnée de type 'inclusion-dynamique' dans le dialogue : " + fDialog + ". L'inclusion '" + vInc + "' n'a pu être exécutée."); 
     155                } 
     156 
     157                fWriterDest.close(); 
     158        } 
     159 
     160        /** 
     161         * Flush the stream.  If the stream has saved any characters from the 
     162         * various write() methods in a buffer, write them immediately to their 
     163         * intended destination.  Then, if that destination is another character or 
     164         * byte stream, flush it.  Thus one flush() invocation will flush all the 
     165         * buffers in a chain of Writers and OutputStreams. 
     166         * 
     167         * @exception  IOException  If an I/O error occurs 
     168         */ 
     169        public void flush() throws IOException { 
     170                fWriterDest.flush(); 
     171        } 
     172 
     173        /** 
     174         * Write a portion of an array of characters. 
     175         * 
     176         * @param  pBuf  Array of characters 
     177         * @param  pOffset   Offset from which to start writing characters 
     178         * @param  pLength   Number of characters to write 
     179         * 
     180         * @exception  IOException  If an I/O error occurs 
     181         */ 
     182        public void write(char[] pBuf, int pOffset, int pLength) throws IOException { 
     183 
     184                int vEnd = pOffset + pLength; 
     185                for (int i = pOffset; i < vEnd; i++) { 
     186                        write(pBuf[i]); 
     187                } 
     188 
     189        } 
     190 
     191        public void write(int pChar) throws IOException { 
     192 
     193                switch (fStatut) { 
     194                case STATUT_TEXT: { 
     195                        if (pChar == fTagOuv[0]) { 
     196                                if (fTagOuv.length == 1) { 
     197                                        //On a trouvé un tag d'ouverture 
     198                                        if (fBuff == null) { 
     199                                                fBuff = new StringBuffer(64); 
     200                                        } 
     201                                        fStatut = STATUT_TAGIN; 
     202                                } else { 
     203                                        fStatut = STATUT_TAGOUV; 
     204                                        fPosTagCourant = 1; 
     205                                } 
     206 
     207                        } else { 
     208                                if (fWriteDest) fWriterDest.write(pChar); 
     209                        } 
     210                        break; 
     211                } 
     212                case STATUT_TAGOUV: { 
     213                        if (pChar == fTagOuv[fPosTagCourant]) { 
     214                                fPosTagCourant++; 
     215                                if (fTagOuv.length == fPosTagCourant) { 
     216                                        //On a trouvé un tag d'ouverture 
     217                                        if (fBuff == null) { 
     218                                                fBuff = new StringBuffer(64); 
     219                                        } 
     220                                        fStatut = STATUT_TAGIN; 
     221                                } 
     222                        } else { 
     223                                //On n'est pas sur un tag d'ouverture 
     224                                if (fWriteDest) fWriterDest.write(fTagOuv, 0, fPosTagCourant); 
     225                                if (pChar == fTagOuv[0]) { 
     226                                        fPosTagCourant = 1; 
     227                                } else { 
     228                                        fStatut = STATUT_TEXT; 
     229                                        if (fWriteDest) fWriterDest.write((char) pChar); 
     230                                } 
     231                        } 
     232                        break; 
     233                } 
     234                case STATUT_TAGIN: { 
     235                        if (pChar == fTagFerm[0]) { 
     236                                if (fTagFerm.length == 1) { 
     237                                        //On a trouvé le tag de fermeture 
     238                                        xExecuteInclusion(); 
     239                                } else { 
     240                                        //On entame peut-être le tag de fermeture 
     241                                        fStatut = STATUT_TAGFERM; 
     242                                        fPosTagCourant = 1; 
     243                                } 
     244                        } else { 
     245                                fBuff.append((char) pChar); 
     246                        } 
     247                        break; 
     248                } 
     249                case STATUT_TAGFERM: { 
     250                        if (pChar == fTagFerm[fPosTagCourant]) { 
     251                                fPosTagCourant++; 
     252                                if (fTagFerm.length == fPosTagCourant) { 
     253                                        //On a trouvé le tag de fermeture 
     254                                        xExecuteInclusion(); 
     255                                } 
     256                        } else { 
     257                                //On n'est pas encore sur le tag de fermeture 
     258                                fBuff.append(fTagFerm, 0, fPosTagCourant); 
     259                                if (pChar == fTagFerm[0]) { 
     260                                        fPosTagCourant = 1; 
     261                                } else { 
     262                                        fStatut = STATUT_TAGIN; 
     263                                        fBuff.append((char) pChar); 
     264                                } 
     265                        } 
     266                        break; 
     267                } 
     268                } 
     269        } 
     270 
     271        public void write(String pStr) throws IOException { 
     272                int vEnd = pStr.length(); 
     273                for (int i = 0; i < vEnd; i++) { 
     274                        write(pStr.charAt(i)); 
     275                } 
     276        } 
     277 
     278        public void write(String pStr, int pOffset, int pLength) throws IOException { 
     279                int vEnd = Math.min(pOffset + pLength, pStr.length()); 
     280                for (int i = pOffset; i < vEnd; i++) { 
     281                        write(pStr.charAt(i)); 
     282                } 
     283        } 
     284 
     285        /** 
     286         * NOTE : l'atribut "argument" DOIT être en derniere position après les 
     287         * les attrributs "agent" "service" et/ou "dialogue". 
     288         * NOTE : si le contenu de l'inclusion est vide, le tag d'ouverture est recopié  
     289         * dans le résultat (escape du tag d'ouveture). 
     290         *  
     291         */ 
     292        public void xExecuteInclusion() throws IOException { 
     293 
     294                fStatut = STATUT_TEXT; 
     295 
     296                String vInc; 
     297                if (fSrcIsXml) { 
     298                        int vLen = fBuff.length(); 
     299                        StringBuffer vBuf = new StringBuffer(vLen); 
     300                        for (int i = 0; i < vLen; i++) { 
     301                                char vCh = fBuff.charAt(i); 
     302                                if (vCh == '&' && i < vLen - 3) { 
     303                                        char vCh2 = fBuff.charAt(i + 1); 
     304                                        if (vCh2 == 'a') { 
     305                                                if (fBuff.charAt(i + 2) == 'm' && fBuff.charAt(i + 3) == 'p' && i < vLen - 4 && fBuff.charAt(i + 4) == ';') { 
     306                                                        vBuf.append('&'); 
     307                                                        i = i + 4; 
     308                                                        continue; 
     309                                                } 
     310                                                if (fBuff.charAt(i + 2) == 'p' && fBuff.charAt(i + 3) == 'o' && i < vLen - 5 && fBuff.charAt(i + 4) == 's' && fBuff.charAt(i + 5) == ';') { 
     311                                                        vBuf.append('\''); 
     312                                                        i = i + 5; 
     313                                                        continue; 
     314                                                } 
     315                                        } else if (vCh2 == 'l' && fBuff.charAt(i + 2) == 't' && fBuff.charAt(i + 3) == ';') { 
     316                                                vBuf.append('<'); 
     317                                                i = i + 3; 
     318                                                continue; 
     319                                        } else if (vCh2 == 'g' && fBuff.charAt(i + 2) == 't' && fBuff.charAt(i + 3) == ';') { 
     320                                                vBuf.append('>'); 
     321                                                i = i + 3; 
     322                                                continue; 
     323                                        } else if (vCh2 == 'q' && fBuff.charAt(i + 2) == 'u' && i < vLen - 5 && fBuff.charAt(i + 3) == 'o' && fBuff.charAt(i + 4) == 't' && fBuff.charAt(i + 5) == ';') { 
     324                                                vBuf.append('\"'); 
     325                                                i = i + 5; 
     326                                                continue; 
     327                                        } 
     328                                } 
     329                                vBuf.append(vCh); 
     330                        } 
     331                        vInc = vBuf.toString(); 
     332                } else { 
     333                        vInc = fBuff.toString(); 
     334                } 
     335 
     336                try { 
     337                        if (vInc.equals("")) { 
     338                                fWriterDest.write(fTagOuv); 
     339                        } else if (vInc.equals("endif")) { 
     340                                fWriteDest = true; 
     341                                if (fStackCond != null && fStackCond.size() > 0) { 
     342                                        //On supprime le dernier if 
     343                                        fStackCond.remove(fStackCond.size() - 1); 
     344                                        //Si il existe encore un test faux, on bloque toujours l'écriture. 
     345                                        for (int i = 0; i < fStackCond.size(); i++) { 
     346                                                Boolean vResultIf = (Boolean) fStackCond.get(i); 
     347                                                if (vResultIf == Boolean.FALSE) { 
     348                                                        fWriteDest = false; 
     349                                                        break; 
     350                                                } 
     351                                        } 
     352                                } 
     353                        } else if (vInc.equals("else")) { 
     354                                fWriteDest = true; 
     355                                if (fStackCond != null && fStackCond.size() > 0) { 
     356                                        //On supprime le dernier if 
     357                                        int vPos = fStackCond.size() - 1; 
     358                                        Boolean vNewVal = ((Boolean) fStackCond.get(vPos)).booleanValue() ? Boolean.FALSE : Boolean.TRUE; 
     359                                        fStackCond.set(vPos, vNewVal); 
     360                                        fWriteDest = vNewVal.booleanValue(); 
     361                                        if (fWriteDest) { 
     362                                                //Si il existe encore un test faux, on bloque toujours l'écriture. 
     363                                                for (int i = 0; i < fStackCond.size(); i++) { 
     364                                                        Boolean vResultIf = (Boolean) fStackCond.get(i); 
     365                                                        if (vResultIf == Boolean.FALSE) { 
     366                                                                fWriteDest = false; 
     367                                                                break; 
     368                                                        } 
     369                                                } 
     370                                        } 
     371                                } 
     372                        } else if (fWriteDest) { 
     373 
     374                                IWAgent vAgent = null; 
     375                                IWService vService = null; 
     376                                IHDialog vDialog = fDialog; 
     377                                String vArgument = null; 
     378 
     379                                int vOffset = -1; 
     380                                int vEnd = 0; 
     381 
     382                                vOffset = vInc.indexOf(";arguments="); 
     383                                if (vOffset > 0) { 
     384                                        vArgument = vInc.substring(vOffset + 11); 
     385                                        vInc = vInc.substring(0, vOffset); 
     386                                } 
     387 
     388                                // 'argument=' = OBSOLET A VIRER ! 
     389                                vOffset = vInc.indexOf(";argument="); 
     390                                if (vOffset > 0) { 
     391                                        vArgument = vInc.substring(vOffset + 10); 
     392                                        vInc = vInc.substring(0, vOffset); 
     393                                        HLogMgr.hPublishTrace("La syntaxe 'argument=' dans une inclusion dynamique est obsolete et doit etre remplacée par 'arguments='."); 
     394                                } 
     395 
     396                                if (vInc.startsWith("agent=")) { 
     397                                        vOffset = 6; 
     398                                } else { 
     399                                        vOffset = vInc.indexOf(";agent="); 
     400                                        if (vOffset >= 0) { 
     401                                                vOffset += 7; 
     402                                        } 
     403                                } 
     404                                if (vOffset > 0) { 
     405                                        vEnd = Math.max(vInc.indexOf(';', vOffset), vInc.length()); 
     406                                        String vUrl = vInc.substring(vOffset, vEnd); 
     407                                        if (fOwner instanceof IWAgent) { 
     408                                                vAgent = ((IWAgent) fOwner).hGetAgentParRef(vUrl); 
     409                                        } else { 
     410                                                throw HLogMgr.hNewException("Impossible d'accéder à un agent dans le contexte de service."); 
     411                                        } 
     412                                        if (vAgent == null) { 
     413                                                //throw HLogMgr.hNewException("L'url '" + vUrl + "' ne pointe sur aucun agent."); 
     414                                                return; 
     415                                        } else if (!(vAgent instanceof IWAgentComputor)) { throw HLogMgr.hNewException("L'url '" + vUrl + "' pointe sur l'agent '" + vAgent + "' qui ne peut produire de résultat"); } 
     416                                } 
     417 
     418                                if (vInc.startsWith("service=")) { 
     419                                        vOffset = 8; 
     420                                } else { 
     421                                        vOffset = vInc.indexOf(";service="); 
     422                                        if (vOffset >= 0) { 
     423                                                vOffset += 9; 
     424                                        } 
     425                                } 
     426                                if (vOffset > 0) { 
     427                                        vEnd = Math.max(vInc.indexOf(';', vOffset), vInc.length()); 
     428                                        String vUrl = vInc.substring(vOffset, vEnd); 
     429                                        vService = ((IWSDialog) fDialog.hGoTo(vUrl)).hGetService(); 
     430                                        if (vService == null) { 
     431                                                //throw HLogMgr.hNewException("L'url '" + vUrl + "' ne pointe sur aucun service."); 
     432                                                return; 
     433                                        } else if (!(vService instanceof IWServiceAvecResultat)) { throw HLogMgr.hNewException("L'url '" + vUrl + "' pointe sur le service '" + vService + "' qui ne peut produire de résultat"); } 
     434                                } 
     435 
     436                                if (vInc.startsWith("dialog=")) { 
     437                                        vOffset = 7; 
     438                                } else { 
     439                                        vOffset = vInc.indexOf(";dialog="); 
     440                                        if (vOffset >= 0) { 
     441                                                vOffset += 8; 
     442                                        } 
     443                                } 
     444 
     445                                //'dialogue=' = OBSOLET A VIRER ! 
     446                                //              if (vInc.startsWith("dialogue=")) { 
     447                                //                      vOffset = 9; 
     448                                //                      HLogMgr.hPublishTrace("La syntaxe 'dialogue=' dans une inclusion dynamique est obsolete et doit etre remplacée par 'dialog='."); 
     449                                //              } else { 
     450                                //                      vOffset = vInc.indexOf(";dialogue="); 
     451                                //                      if (vOffset >= 0) { 
     452                                //                              vOffset += 10; 
     453                                //                              HLogMgr.hPublishTrace("La syntaxe 'dialogue=' dans une inclusion dynamique est obsolete et doit etre remplacée par 'dialog='."); 
     454                                //                      } 
     455                                //              } 
     456 
     457                                if (vOffset > 0) { 
     458                                        vEnd = Math.max(vInc.indexOf(';', vOffset), vInc.length()); 
     459                                        String vUrl = vInc.substring(vOffset, vEnd); 
     460                                        vDialog = fDialog.hGoTo(vUrl); 
     461                                        if (vDialog == null) { 
     462                                                //throw HLogMgr.hNewException("L'url '" + vUrl + "' ne pointe sur aucun dialogue."); 
     463                                                return; 
     464                                        } 
     465                                } 
     466 
     467                                if (vInc.startsWith("if;")) { 
     468                                        String vRes = ""; 
     469                                        if (vAgent != null) { 
     470                                                vRes = ((IWAgentComputor) vAgent).computeAsString(vDialog, vArgument); 
     471                                        } else if (vService != null) { 
     472                                                vRes = ((IWServiceAvecResultat) vService).hGetResultat(vDialog, vArgument).getString(); 
     473                                        } else if (vDialog instanceof IWADialog) { 
     474                                                if (!(((IWADialog) vDialog).hGetAgent() instanceof IWAgentComputor)) { throw HLogMgr.hNewException("Le dialogue d'agent '" + vDialog + "' ne peut pas produire de résultat"); } 
     475                                                vRes = ((IWAgentComputor) ((IWADialog) vDialog).hGetAgent()).computeAsString(vDialog, vArgument); 
     476                                        } else if (vDialog instanceof IWSDialog) { 
     477                                                if (!(((IWSDialog) vDialog).hGetService() instanceof IWServiceAvecResultat)) { throw HLogMgr.hNewException("Le dialogue de service '" + vDialog + "' ne peut pas produire de résultat"); } 
     478                                                vRes = ((IWServiceAvecResultat) ((IWSDialog) vDialog).hGetService()).hGetResultat(vDialog, vArgument).getString(); 
     479                                        } 
     480                                        if (fStackCond == null) fStackCond = new ArrayList(); 
     481                                        if (HDonneeUtils.hGetBooleanEvalTrue(vRes)) { 
     482                                                fStackCond.add(Boolean.TRUE); 
     483                                        } else { 
     484                                                fStackCond.add(Boolean.FALSE); 
     485                                                fWriteDest = false; 
     486                                        } 
     487                                } else { 
     488                                        Writer vWriter = fWriterDest; 
     489                                        if (vInc.startsWith("escapeXml;")) { 
     490                                                vWriter = new HWriterEscapeXml(vWriter, HWriterEscapeXml.ESCAPE_ATTR); 
     491                                        } 
     492                                        if (vAgent != null) { 
     493                                                ((IWAgentComputor) vAgent).computeAsData(vDialog, vArgument).writeValue(vWriter); 
     494                                        } else if (vService != null) { 
     495                                                ((IWServiceAvecResultat) vService).hGetResultat(vDialog, vArgument).writeValue(vWriter); 
     496                                        } else if (vDialog instanceof IWADialog) { 
     497                                                if (!(((IWADialog) vDialog).hGetAgent() instanceof IWAgentComputor)) { throw HLogMgr.hNewException("Le dialogue d'agent '" + vDialog + "' ne peut pas produire de résultat"); } 
     498                                                ((IWAgentComputor) ((IWADialog) vDialog).hGetAgent()).computeAsData(vDialog, vArgument).writeValue(vWriter); 
     499                                        } else if (vDialog instanceof IWSDialog) { 
     500                                                if (!(((IWSDialog) vDialog).hGetService() instanceof IWServiceAvecResultat)) { throw HLogMgr.hNewException("Le dialogue de service '" + vDialog + "' ne peut pas produire de résultat"); } 
     501                                                ((IWServiceAvecResultat) ((IWSDialog) vDialog).hGetService()).hGetResultat(vDialog, vArgument).writeValue(vWriter); 
     502                                        } 
     503                                } 
     504                        } 
     505 
     506                        //  
     507                        else { 
     508                                //Cas : fWriteDest == false 
     509                                if (vInc.startsWith("if;")) { 
     510                                        //Un père est déjà faux, on ajoute une condition à la stack, la valeur n'a aucune importance. 
     511                                        fStackCond.add(Boolean.TRUE); 
     512                                } 
     513                        } 
     514 
     515                } catch (IOException e) { 
     516                        throw (IOException) HLogMgr.hAddMessage(e, "Echec à l'insertion d'une inclusion : '" + vInc + "'."); 
     517                } catch (Exception e) { 
     518                        throw (IOException) HLogMgr.hAddMessage(new IOException("Echec à l'insertion d'une inclusion : '" + vInc + "'."), HLogMgr.hGetMessage(e)); 
     519                } finally { 
     520                        fBuff.setLength(0); 
     521                } 
     522 
     523        } 
    537524} 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dom/ZXPath.java

    r7458 r7466  
    4545import com.scenari.m.co.agent.IWADialog; 
    4646import com.scenari.m.co.agent.IWAgent; 
    47 import com.scenari.m.co.agent.IWAgentAvecLiens; 
     47import com.scenari.m.co.agent.IWAgentLinker; 
    4848import com.scenari.m.co.agent.IWAgentComputor; 
    4949import com.scenari.m.co.dialog.IHDialog; 
     
    244244         *  
    245245         */ 
    246         public IWAgentAvecLiens wGetRefAgentAvecLiens(XPathContext pCtx, XObject pXObj) throws Exception { 
     246        public IWAgentLinker wGetRefAgentAvecLiens(XPathContext pCtx, XObject pXObj) throws Exception { 
    247247                IWAgent vAgent = wGetRefAgent(pCtx, pXObj); 
    248                 while (vAgent != null && !(vAgent instanceof IWAgentAvecLiens)) { 
     248                while (vAgent != null && !(vAgent instanceof IWAgentLinker)) { 
    249249                        vAgent = vAgent.hGetAgentPere(); 
    250250                } 
    251                 return (IWAgentAvecLiens) vAgent; 
     251                return (IWAgentLinker) vAgent; 
    252252        } 
    253253 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dom/ZXPathAgentsLies.java

    r1710 r7466  
    4242 
    4343import com.scenari.m.co.agent.IWAgent; 
    44 import com.scenari.m.co.agent.IWAgentAvecLiens; 
     44import com.scenari.m.co.agent.IWAgentLinker; 
    4545import com.scenari.m.co.dialog.IHDialog; 
    4646import com.scenari.s.fw.log.HLogMgr; 
     
    114114        //On recherche l'AgentAvecLiens 
    115115        XObject vXObj = fArgAgentDial.execute(pCtx); 
    116         IWAgentAvecLiens vAgentPere = wGetRefAgentAvecLiens(pCtx, vXObj); 
     116        IWAgentLinker vAgentPere = wGetRefAgentAvecLiens(pCtx, vXObj); 
    117117 
    118118        if (vAgentPere != null) { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dom/ZXPathMax.java

    r7458 r7466  
    125125                                    vDialog = wGetDialogFromCtx(pCtx); 
    126126                                } 
    127                                 String vVal = ((IWAgentComputor) vNode).computeAsData(vDialog, null).getString(); 
     127                                String vVal = ((IWAgentComputor) vNode).computeAsString(vDialog, null); 
    128128                                vCurentDouble = XString.castToNum(vVal); 
    129129                            } else { 
     
    143143                                vDialog = wGetDialogFromCtx(pCtx); 
    144144                            } 
    145                             String vVal = ((IWAgentComputor) vObj).computeAsData(vDialog, null).getString(); 
     145                            String vVal = ((IWAgentComputor) vObj).computeAsString(vDialog, null); 
    146146                            vCurentDouble = XString.castToNum(vVal); 
    147147                        } else if (vObj instanceof IWServiceAvecResultat) { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dom/ZXPathMin.java

    r7458 r7466  
    126126                                    vDialog = wGetDialogFromCtx(pCtx); 
    127127                                } 
    128                                 String vVal = ((IWAgentComputor) vNode).computeAsData(vDialog, null).getString(); 
     128                                String vVal = ((IWAgentComputor) vNode).computeAsString(vDialog, null); 
    129129                                vCurentDouble = XString.castToNum(vVal); 
    130130                            } else { 
     
    144144                                vDialog = wGetDialogFromCtx(pCtx); 
    145145                            } 
    146                             String vVal = ((IWAgentComputor) vObj).computeAsData(vDialog, null).getString(); 
     146                            String vVal = ((IWAgentComputor) vObj).computeAsString(vDialog, null); 
    147147                            vCurentDouble = XString.castToNum(vVal); 
    148148                        } else if (vObj instanceof IWServiceAvecResultat) { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dom/ZXPathMoyenne.java

    r7458 r7466  
    129129                                    vDialog = wGetDialogFromCtx(pCtx); 
    130130                                } 
    131                                 String vVal = ((IWAgentComputor) vNode).computeAsData(vDialog, null).getString(); 
     131                                String vVal = ((IWAgentComputor) vNode).computeAsString(vDialog, null); 
    132132                                vSum += XString.castToNum(vVal); 
    133133                                vCount++; 
     
    147147                                vDialog = wGetDialogFromCtx(pCtx); 
    148148                            } 
    149                             String vVal = ((IWAgentComputor) vObj).computeAsData(vDialog, null).getString(); 
     149                            String vVal = ((IWAgentComputor) vObj).computeAsString(vDialog, null); 
    150150                            vSum += XString.castToNum(vVal); 
    151151                            vCount++; 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dom/ZXPathResultat.java

    r7458 r7466  
    130130                                                vParams = fArgArgument.execute(pCtx).object(); 
    131131                                        } 
    132                                         vResult = ((IWAgentComputor) vAgent).computeAsData(vDialog, vParams).getString(); 
     132                                        vResult = ((IWAgentComputor) vAgent).computeAsString(vDialog, vParams); 
    133133                                } 
    134134                        } else { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dom/ZXPathResultatAgent.java

    r7458 r7466  
    119119                                vParams = fArgArgument.execute(pCtx).object(); 
    120120                        } 
    121                         vResult = vAgent.computeAsData(vDialog, vParams).getString(); 
     121                        vResult = vAgent.computeAsString(vDialog, vParams); 
    122122                } 
    123123                if (vResult != null && vResult.length() > 0) { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dom/ZXPathResultatDialogue.java

    r7458 r7466  
    129129                                } 
    130130                                if (vAgent != null) { 
    131                                         vResult = ((IWAgentComputor) vAgent).computeAsData(vDialog, vParams).getString(); 
     131                                        vResult = ((IWAgentComputor) vAgent).computeAsString(vDialog, vParams); 
    132132                                } 
    133133                        } else if (vDialog instanceof IWSDialog) { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dom/ZXPathSomme.java

    r7458 r7466  
    129129                                    vDialog = wGetDialogFromCtx(pCtx); 
    130130                                } 
    131                                 String vVal = ((IWAgentComputor) vNode).computeAsData(vDialog, null).getString(); 
     131                                String vVal = ((IWAgentComputor) vNode).computeAsString(vDialog, null); 
    132132                                vSum += XString.castToNum(vVal); 
    133133                                vCount++; 
     
    147147                                vDialog = wGetDialogFromCtx(pCtx); 
    148148                            } 
    149                             String vVal = ((IWAgentComputor) vObj).computeAsData(vDialog, null).getString(); 
     149                            String vVal = ((IWAgentComputor) vObj).computeAsString(vDialog, null); 
    150150                            vSum += XString.castToNum(vVal); 
    151151                            vCount++; 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dtm/ZXPath.java

    r7458 r7466  
    5555import com.scenari.m.co.agent.IWADialog; 
    5656import com.scenari.m.co.agent.IWAgent; 
    57 import com.scenari.m.co.agent.IWAgentAvecLiens; 
     57import com.scenari.m.co.agent.IWAgentLinker; 
    5858import com.scenari.m.co.agent.IWAgentComputor; 
    5959import com.scenari.m.co.dialog.IHDialog; 
     
    254254         *  
    255255         */ 
    256         public IWAgentAvecLiens wGetRefAgentAvecLiens(XPathContext pCtx, XObject pXObj) throws Exception { 
     256        public IWAgentLinker wGetRefAgentAvecLiens(XPathContext pCtx, XObject pXObj) throws Exception { 
    257257                IWAgent vAgent = wGetRefAgent(pCtx, pXObj); 
    258                 while (vAgent != null && !(vAgent instanceof IWAgentAvecLiens)) { 
     258                while (vAgent != null && !(vAgent instanceof IWAgentLinker)) { 
    259259                        vAgent = vAgent.hGetAgentPere(); 
    260260                } 
    261                 return (IWAgentAvecLiens) vAgent; 
     261                return (IWAgentLinker) vAgent; 
    262262        } 
    263263 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dtm/ZXPathAgentsLies.java

    r1710 r7466  
    4848 
    4949import com.scenari.m.co.agent.IWAgent; 
    50 import com.scenari.m.co.agent.IWAgentAvecLiens; 
     50import com.scenari.m.co.agent.IWAgentLinker; 
    5151import com.scenari.m.co.dialog.IHDialog; 
    5252import com.scenari.s.fw.log.HLogMgr; 
     
    133133                //On recherche l'AgentAvecLiens 
    134134                XObject vXObj = fArgAgentDial.execute(pCtx); 
    135                 IWAgentAvecLiens vAgentPere = wGetRefAgentAvecLiens(pCtx, vXObj); 
     135                IWAgentLinker vAgentPere = wGetRefAgentAvecLiens(pCtx, vXObj); 
    136136 
    137137                if (vAgentPere != null) { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dtm/ZXPathMax.java

    r7458 r7466  
    146146                                                                vDialog = wGetDialogFromCtx(pCtx); 
    147147                                                        } 
    148                                                         String vVal = ((IWAgentComputor) vObj).computeAsData(vDialog, null).getString(); 
     148                                                        String vVal = ((IWAgentComputor) vObj).computeAsString(vDialog, null); 
    149149                                                        vCurentDouble = hGetStringToNumber(vVal); 
    150150                                                } else if (vObj instanceof IWServiceAvecResultat) { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dtm/ZXPathMin.java

    r7458 r7466  
    151151                                                                vDialog = wGetDialogFromCtx(pCtx); 
    152152                                                        } 
    153                                                         String vVal = ((IWAgentComputor) vObj).computeAsData(vDialog, null).getString(); 
     153                                                        String vVal = ((IWAgentComputor) vObj).computeAsString(vDialog, null); 
    154154                                                        vCurentDouble = hGetStringToNumber(vVal); 
    155155                                                } else if (vObj instanceof IWServiceAvecResultat) { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dtm/ZXPathMoyenne.java

    r7458 r7466  
    157157                                                                vDialog = wGetDialogFromCtx(pCtx); 
    158158                                                        } 
    159                                                         String vVal = ((IWAgentComputor) vObj).computeAsData(vDialog, null).getString(); 
     159                                                        String vVal = ((IWAgentComputor) vObj).computeAsString(vDialog, null); 
    160160                                                        vSum += hGetStringToNumber(vVal); 
    161161                                                        vCount++; 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dtm/ZXPathResultat.java

    r7458 r7466  
    147147                                                } 
    148148                                        } 
    149                                         vResult = ((IWAgentComputor) vAgent).computeAsData(vDialog, vParams).getString(); 
     149                                        vResult = ((IWAgentComputor) vAgent).computeAsString(vDialog, vParams); 
    150150                                } 
    151151                        } else { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dtm/ZXPathResultatAgent.java

    r7458 r7466  
    136136                                } 
    137137                        } 
    138                         vResult = vAgent.computeAsData(vDialog, vParams).getString(); 
     138                        vResult = vAgent.computeAsString(vDialog, vParams); 
    139139                } 
    140140                if (vResult != null && vResult.length() > 0) { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dtm/ZXPathResultatDialogue.java

    r7458 r7466  
    145145                                } 
    146146                                if (vAgent != null) { 
    147                                         vResult = ((IWAgentComputor) vAgent).computeAsData(vDialog, vParams).getString(); 
     147                                        vResult = ((IWAgentComputor) vAgent).computeAsString(vDialog, vParams); 
    148148                                } 
    149149                        } else if (vDialog instanceof IWSDialog) { 
  • trunk/Jav_CO/com/scenari/m/co/xpath/dtm/ZXPathSomme.java

    r7458 r7466  
    157157                                                                vDialog = wGetDialogFromCtx(pCtx); 
    158158                                                        } 
    159                                                         String vVal = ((IWAgentComputor) vObj).computeAsData(vDialog, null).getString(); 
     159                                                        String vVal = ((IWAgentComputor) vObj).computeAsString(vDialog, null); 
    160160                                                        vSum += hGetStringToNumber(vVal); 
    161161                                                        vCount++; 
Note: See TracChangeset for help on using the changeset viewer.