00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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 }