compiler.startDocument();
XMLConsumer nextConsumer = compiler;
NodeList transformations = XMLUtil.selectNodeList(sunletConf,
"transformation/stylesheet");
Transformer xslT = null;
ArrayList transformers = new ArrayList();
ComponentSelector selector = null;
Request request = ObjectModelHelper.getRequest(this.objectModel);
try {
if (transformations != null && transformations.getLength() > 0) {
selector = (ComponentSelector) this.manager.lookup(Transformer.ROLE + "Selector");
nextConsumer = new IncludeXMLConsumer(nextConsumer);
for(int k = transformations.getLength()-1; k >=0; k--) {
xslT = (Transformer)selector.select("xslt");
transformers.add(xslT);
xslT.setup(resolver,
objectModel,
XMLUtil.getValueOfNode(transformations.item(k)),
new Parameters());
xslT.setConsumer(nextConsumer);
nextConsumer = xslT;
}
nextConsumer.startDocument();
}
switch (resource.getResourceType()) {
case ResourceConnector.RESOURCE_TYPE_CLASS: {
Sunlet theSunlet;
try {
Class loaderClass = Class.forName(resource.getResourceIdentifier());
theSunlet = (Sunlet)loaderClass.newInstance();
} catch (ClassNotFoundException cnfException) {
throw new ProcessingException("getSunlet: Class not found: " + resource.getResourceIdentifier(), cnfException);
} catch (IllegalAccessException iaException) {
throw new ProcessingException("getSunlet: Illegal Access: " + resource.getResourceIdentifier(), iaException);
} catch (InstantiationException iException) {
throw new ProcessingException("getSunlet: Instantion exception: " + resource.getResourceIdentifier(), iException);
}
theSunlet.init(objectModel, p);
theSunlet.execute(nextConsumer, nextConsumer, objectModel, p);
break;
}
default: {
boolean includeFragment = true;
boolean handlesParameters = XMLUtil.getValueAsBooleanOf(sunletConf, "configuration/handlesParameters", true);
String size = p.getParameter("size", "max");
if (resource.getResourceType() == ResourceConnector.RESOURCE_TYPE_FILE) {
// files have no possibility to evaluate minimized, so if they are not maximized
// they will be neglected
includeFragment = size.equals("max");
} else {
includeFragment = size.equals("max");
if (includeFragment == false) {
if (this.logger.isWarnEnabled() == true) {
this.logger.warn("Minimized sunlet '"+sunletID+"' not handled correctly.");
}
}
}
if ( includeFragment == true) {
String res;
if (resource.getResourceType() == ResourceConnector.RESOURCE_TYPE_URI) {
if (this.response != null) {
res = this.response.encodeURL(resource.getResourceIdentifier());
} else {
res = resource.getResourceIdentifier();
}
} else {
res = resource.getResourceIdentifier();
}
if (this.logger.isDebugEnabled() == true) {
this.logger.debug("sunSpot Loading sunlet " + sunletID);
}
// add the parameters to the request attributes
Map info = new HashMap(3);
SessionContextImpl.sunLetInfo.set(info);
info.put(Constants.SUNLETINFO_PARAMETERS, p);
info.put(Constants.SUNLETINFO_PORTALURI, request.getRequestURI());
info.put(Constants.SUNLETINFO_STATUSPROFILE, loadedSunlet[7]);
this.resourceConnector.streamXML(resource.getResourceType(), null,
res, (handlesParameters == true ? p : null),
new IncludeXMLConsumer(nextConsumer), null);
if (this.logger.isDebugEnabled() == true) {
this.logger.debug("sunSpot: Loaded sunlet " + sunletID);
}
}
}
}
if (xslT != null) {
xslT.endDocument();
xslT = null;
}
} finally {
SessionContextImpl.sunLetInfo.set(null);
if (selector != null) {