}
public AWTemplate loadTemplate ()
{
AWTemplate template = null;
AWResource resource = templateResource();
if (resource != null) {
template = (AWTemplate)resource.object();
if ((template == null) ||
(AWConcreteApplication.IsRapidTurnaroundEnabled
&& requestContext().currentPhase() == AWRequestContext.Phase_Render
&& resource.hasChanged())) {
// reset needs to be called before template parser since the template parser
// can append validation errors
componentDefinition().resetValidationData();
template = parseTemplate();
if (template != null) {
AWApi componentApi = ((AWConcreteTemplate)template).removeApiTag();
if (AWConcreteApplication.IsDebuggingEnabled) {
componentDefinition().setComponentApi(componentApi);
// validate the componentAPI. Needed since componentAPI
// validation initializes supported binding information.
if (componentApi != null && requestContext() != null) {
// if there is a component api, then validate it (metadata validation)
componentApi.validate(requestContext().validationContext(), this);
}
}
resource.setObject(template);
}
}
}
return template;
}