Main Page   Packages   Class Hierarchy   Compound List   File List   Compound Members  

AliasCompiler.java

Go to the documentation of this file.
00001 /***
00002  * Jonathan: an Open Distributed Processing Environment 
00003  * Copyright (C) 2001 Kelua SA
00004  * 
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  * 
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  * 
00019  * Contact: jonathan@objectweb.org
00020  *
00021  * Author: Bruno Dumant
00022  * 
00023  */
00024 
00025 package org.objectweb.jonathan.tools.compilers;
00026 
00027 import org.objectweb.jonathan.tools.XML2Kernel;
00028 import org.objectweb.jonathan.tools.nanoxml.XMLElement;
00029 import org.objectweb.jonathan.tools.nanoxml.XMLParseException;
00030 
00031 
00032 import java.io.IOException;
00033 import java.io.Writer;
00034 
00040 public class AliasCompiler implements TagCompiler {
00041    
00042    static int nb = 0;
00043 
00055    public String writeComponent(XMLElement _current_component,
00056                                 String _element_name,
00057                                 String _configuration_var_name,
00058                                 Writer _writer,
00059                                 String _configuration_name)
00060       throws IOException {
00061       
00062       String $current_tag = _current_component.getTagName();
00063       
00064       if ($current_tag.equals("ALIAS")){
00065          String $alias = _current_component.getProperty("NAME");
00066          String $var_name = "ALIAS" + (nb++); 
00067          _writer.write("         Component " + $var_name + 
00068                        " = new org.objectweb.jonathan.libs.kernel.decoders.JAlias(\"" + 
00069                        XML2Kernel.normalize($alias)+ "\",'/');\n");
00070          return $var_name;
00071       } else {
00072          throw new IOException("TAG error at line " + _current_component.getLineNr() + ":\n" +
00073                                "ALIAS excepted instead of " + $current_tag);
00074       }      
00075    }
00076 }

Generated at Fri May 31 19:23:31 2002 for Jonathan by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001