40 import com.sun.org.apache.xalan.internal.xsltc.DOM; |
40 import com.sun.org.apache.xalan.internal.xsltc.DOM; |
41 import com.sun.org.apache.xalan.internal.xsltc.Translet; |
41 import com.sun.org.apache.xalan.internal.xsltc.Translet; |
42 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; |
42 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; |
43 import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet; |
43 import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet; |
44 import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable; |
44 import com.sun.org.apache.xalan.internal.xsltc.runtime.Hashtable; |
|
45 import com.sun.org.apache.xalan.internal.utils.ObjectFactory; |
45 |
46 |
46 /** |
47 /** |
47 * @author Morten Jorgensen |
48 * @author Morten Jorgensen |
48 * @author G. Todd Millerj |
49 * @author G. Todd Millerj |
49 * @author Jochen Cordes <Jochen.Cordes@t-online.de> |
50 * @author Jochen Cordes <Jochen.Cordes@t-online.de> |
140 protected TemplatesImpl(byte[][] bytecodes, String transletName, |
143 protected TemplatesImpl(byte[][] bytecodes, String transletName, |
141 Properties outputProperties, int indentNumber, |
144 Properties outputProperties, int indentNumber, |
142 TransformerFactoryImpl tfactory) |
145 TransformerFactoryImpl tfactory) |
143 { |
146 { |
144 _bytecodes = bytecodes; |
147 _bytecodes = bytecodes; |
145 _name = transletName; |
148 init(transletName, outputProperties, indentNumber, tfactory); |
146 _outputProperties = outputProperties; |
|
147 _indentNumber = indentNumber; |
|
148 _tfactory = tfactory; |
|
149 } |
149 } |
150 |
150 |
151 /** |
151 /** |
152 * Create an XSLTC template object from the translet class definition(s). |
152 * Create an XSLTC template object from the translet class definition(s). |
153 */ |
153 */ |
154 protected TemplatesImpl(Class[] transletClasses, String transletName, |
154 protected TemplatesImpl(Class[] transletClasses, String transletName, |
155 Properties outputProperties, int indentNumber, |
155 Properties outputProperties, int indentNumber, |
156 TransformerFactoryImpl tfactory) |
156 TransformerFactoryImpl tfactory) |
157 { |
157 { |
158 _class = transletClasses; |
158 _class = transletClasses; |
|
159 _transletIndex = 0; |
|
160 init(transletName, outputProperties, indentNumber, tfactory); |
|
161 } |
|
162 |
|
163 private void init(String transletName, |
|
164 Properties outputProperties, int indentNumber, |
|
165 TransformerFactoryImpl tfactory) { |
159 _name = transletName; |
166 _name = transletName; |
160 _transletIndex = 0; |
|
161 _outputProperties = outputProperties; |
167 _outputProperties = outputProperties; |
162 _indentNumber = indentNumber; |
168 _indentNumber = indentNumber; |
163 _tfactory = tfactory; |
169 _tfactory = tfactory; |
164 } |
170 _useServicesMechanism = tfactory.useServicesMechnism(); |
165 |
171 } |
166 |
|
167 /** |
172 /** |
168 * Need for de-serialization, see readObject(). |
173 * Need for de-serialization, see readObject(). |
169 */ |
174 */ |
170 public TemplatesImpl() { } |
175 public TemplatesImpl() { } |
171 |
176 |
355 // The translet needs to keep a reference to all its auxiliary |
366 // The translet needs to keep a reference to all its auxiliary |
356 // class to prevent the GC from collecting them |
367 // class to prevent the GC from collecting them |
357 AbstractTranslet translet = (AbstractTranslet) _class[_transletIndex].newInstance(); |
368 AbstractTranslet translet = (AbstractTranslet) _class[_transletIndex].newInstance(); |
358 translet.postInitialization(); |
369 translet.postInitialization(); |
359 translet.setTemplates(this); |
370 translet.setTemplates(this); |
|
371 translet.setServicesMechnism(_useServicesMechanism); |
360 if (_auxClasses != null) { |
372 if (_auxClasses != null) { |
361 translet.setAuxiliaryClasses(_auxClasses); |
373 translet.setAuxiliaryClasses(_auxClasses); |
362 } |
374 } |
363 |
375 |
364 return translet; |
376 return translet; |