public SmooksResourceConfiguration getResourceByName(String name) { for(int i = resourceStack.size() - 1; i >= 0; i--) { SmooksResourceConfiguration config = resourceStack.get(i); String resourceName = config.getResource(); if(name.equals(resourceName)) { return config; } } return null; }
public SmooksResourceConfiguration getResourceByName(String name) { for(int i = resourceStack.size() - 1; i >= 0; i--) { SmooksResourceConfiguration config = resourceStack.get(i); String resourceName = config.getResource(); if(name.equals(resourceName)) { return config; } } return null; }
public SmooksResourceConfiguration getResourceByName(String name) { for(int i = resourceStack.size() - 1; i >= 0; i--) { SmooksResourceConfiguration config = resourceStack.get(i); String resourceName = config.getResource(); if(name.equals(resourceName)) { return config; } } return null; }
public SmooksResourceConfiguration getResourceByName(String name) { for(int i = resourceStack.size() - 1; i >= 0; i--) { SmooksResourceConfiguration config = resourceStack.get(i); String resourceName = config.getResource(); if(name.equals(resourceName)) { return config; } } return null; }
@Override protected void loadTemplate(SmooksResourceConfiguration config) throws IOException { String path = config.getResource(); if(path.charAt(0) == '/') { path = path.substring(1); } String dir = path.substring(0, path.lastIndexOf('/')); templateName = path.substring(path.lastIndexOf('/'), path.indexOf(".st")); templateGroupDir = new STRawGroupDir(dir, getEncoding().displayName(),'$','$'); template = templateGroupDir.getInstanceOf(templateName); }
@Override protected void loadTemplate(SmooksResourceConfiguration config) throws IOException { String path = config.getResource(); if(path.charAt(0) == '/') { path = path.substring(1); } String dir = path.substring(0, path.lastIndexOf('/')); templateName = path.substring(path.lastIndexOf('/'), path.indexOf(".st")); templateGroupDir = new STRawGroupDir(dir, getEncoding().displayName(),'$','$'); template = templateGroupDir.getInstanceOf(templateName); }
@Override protected void loadTemplate(SmooksResourceConfiguration config) { String path = config.getResource(); if(path.charAt(0) == '/') { path = path.substring(1); } if(path.endsWith(".st")) { path = path.substring(0, path.length() - 3); } StringTemplateGroup templateGroup = new StringTemplateGroup(path); templateGroup.setFileCharEncoding(getEncoding().displayName()); template = templateGroup.getInstanceOf(path); }
@Override protected void loadTemplate(SmooksResourceConfiguration config) { String path = config.getResource(); if(path.charAt(0) == '/') { path = path.substring(1); } if(path.endsWith(".st")) { path = path.substring(0, path.length() - 3); } StringTemplateGroup templateGroup = new StringTemplateGroup(path); templateGroup.setFileCharEncoding(getEncoding().displayName()); template = templateGroup.getInstanceOf(path); }
private boolean isXMLTargetedConfiguration(ExecutionContext executionContext) { if(isXMLTargetedConfiguration == null) { synchronized (this) { if(isXMLTargetedConfiguration == null) { SmooksResourceConfiguration readerConfiguration = AbstractParser.getSAXParserConfiguration(executionContext.getDeliveryConfig()); if(readerConfiguration != null) { // We have an reader config, if the class is not configured, we assume // the expected Source to be XML... isXMLTargetedConfiguration = (readerConfiguration.getResource() == null); } else { // If no reader config is present at all, we assume the expected Source is XML... isXMLTargetedConfiguration = true; } } } } return isXMLTargetedConfiguration; }
public String getResourceType() { String restype; if (isJavaResource()) { return "class"; } restype = getStringParameter(PARAM_RESTYPE); if (restype != null && !restype.trim().equals("")) { // Ala DTD v1.0, where we weren't able to specify the type in any other way. if (getParameter(PARAM_RESDATA) == null) { logger.debug("Resource configuration defined with '" + PARAM_RESTYPE + "' parameter but no '" + PARAM_RESDATA + "' parameter."); } } else if (resourceType != null) { // Ala DTD v2.0, where the type is set through the "type" attribute on the <resource> element. restype = resourceType; } else { restype = getExtension(getResource()); } return restype; }
/** * Create a FreeMarker based ContentHandler. * @param resourceConfig The SmooksResourceConfiguration for the FreeMarker. * @return The FreeMarker {@link org.milyn.delivery.ContentHandler} instance. */ public synchronized ContentHandler create(SmooksResourceConfiguration resourceConfig) throws SmooksConfigurationException, InstantiationException { try { return Configurator.configure(new FreeMarkerTemplateProcessor(), resourceConfig, applicationContext); } catch (SmooksConfigurationException e) { throw e; } catch (Exception e) { InstantiationException instanceException = new InstantiationException("FreeMarker resource [" + resourceConfig.getResource() + "] not loadable. FreeMarker resource invalid."); instanceException.initCause(e); throw instanceException; } }
/** * Create a StringTemplate based ContentHandler. * @param resourceConfig The SmooksResourceConfiguration for the StringTemplate. * @return The StringTemplate {@link org.milyn.delivery.ContentHandler} instance. */ public synchronized ContentHandler create(SmooksResourceConfiguration resourceConfig) throws SmooksConfigurationException, InstantiationException { try { return Configurator.configure(new StringTemplateTemplateProcessor(), resourceConfig, applicationContext); } catch (SmooksConfigurationException e) { throw e; } catch (Exception e) { InstantiationException instanceException = new InstantiationException("StringTemplate ProcessingUnit resource [" + resourceConfig.getResource() + "] not loadable. StringTemplate resource invalid."); instanceException.initCause(e); throw instanceException; } }
/** * Create a StringTemplate based ContentHandler. * @param resourceConfig The SmooksResourceConfiguration for the StringTemplate. * @return The StringTemplate {@link org.milyn.delivery.ContentHandler} instance. */ public synchronized ContentHandler create(SmooksResourceConfiguration resourceConfig) throws SmooksConfigurationException, InstantiationException { try { return Configurator.configure(new StringTemplateTemplateProcessor(), resourceConfig, applicationContext); } catch (SmooksConfigurationException e) { throw e; } catch (Exception e) { InstantiationException instanceException = new InstantiationException("StringTemplate ProcessingUnit resource [" + resourceConfig.getResource() + "] not loadable. StringTemplate resource invalid."); instanceException.initCause(e); throw instanceException; } }
/** * Create a StringTemplate based ContentHandler. * @param resourceConfig The SmooksResourceConfiguration for the StringTemplate. * @return The StringTemplate {@link org.milyn.delivery.ContentHandler} instance. */ public synchronized ContentHandler create(SmooksResourceConfiguration resourceConfig) throws SmooksConfigurationException, InstantiationException { try { return Configurator.configure(new StringTemplateTemplateProcessor(), resourceConfig, applicationContext); } catch (SmooksConfigurationException e) { throw e; } catch (Exception e) { InstantiationException instanceException = new InstantiationException("StringTemplate ProcessingUnit resource [" + resourceConfig.getResource() + "] not loadable. StringTemplate resource invalid."); instanceException.initCause(e); throw instanceException; } }
/** * Create a StringTemplate based ContentHandler. * @param resourceConfig The SmooksResourceConfiguration for the StringTemplate. * @return The StringTemplate {@link org.milyn.delivery.ContentHandler} instance. */ public synchronized ContentHandler create(SmooksResourceConfiguration resourceConfig) throws SmooksConfigurationException, InstantiationException { try { return Configurator.configure(new StringTemplateTemplateProcessor(), resourceConfig, applicationContext); } catch (SmooksConfigurationException e) { throw e; } catch (Exception e) { InstantiationException instanceException = new InstantiationException("StringTemplate ProcessingUnit resource [" + resourceConfig.getResource() + "] not loadable. StringTemplate resource invalid."); instanceException.initCause(e); throw instanceException; } }
/** * Create a FreeMarker based ContentHandler. * @param resourceConfig The SmooksResourceConfiguration for the FreeMarker. * @return The FreeMarker {@link org.milyn.delivery.ContentHandler} instance. */ public synchronized ContentHandler create(SmooksResourceConfiguration resourceConfig) throws SmooksConfigurationException, InstantiationException { try { return Configurator.configure(new FreeMarkerTemplateProcessor(), resourceConfig, applicationContext); } catch (SmooksConfigurationException e) { throw e; } catch (Exception e) { InstantiationException instanceException = new InstantiationException("FreeMarker resource [" + resourceConfig.getResource() + "] not loadable. FreeMarker resource invalid."); instanceException.initCause(e); throw instanceException; } }
private void assertSelectorsNotAccessingText(ContentHandlerConfigMapTable saxVisitorMap) { Map<String, List<ContentHandlerConfigMap<? extends SAXVisitor>>> table = saxVisitorMap.getTable(); Collection<List<ContentHandlerConfigMap<? extends SAXVisitor>>> contentHandlerMaps = table.values(); for(List<ContentHandlerConfigMap<? extends SAXVisitor>> contentHandlerMapList : contentHandlerMaps) { for(ContentHandlerConfigMap<? extends SAXVisitor> contentHandlerMap : contentHandlerMapList) { SmooksResourceConfiguration resourceConfig = contentHandlerMap.getResourceConfig(); SelectorStep selectorStep = resourceConfig.getSelectorStep(); if(selectorStep.accessesText()) { throw new SmooksConfigurationException("Unsupported selector '" + selectorStep.getXPathExpression() + "' on resource '" + resourceConfig + "'. The 'text()' XPath token is only supported on SAX Visitor implementations that implement the " + SAXVisitAfter.class.getName() + " interface only. Class '" + resourceConfig.getResource() + "' implements other SAX Visitor interfaces."); } } } }
private void assertSelectorsNotAccessingText(ContentHandlerConfigMapTable saxVisitorMap) { Map<String, List<ContentHandlerConfigMap<? extends SAXVisitor>>> table = saxVisitorMap.getTable(); Collection<List<ContentHandlerConfigMap<? extends SAXVisitor>>> contentHandlerMaps = table.values(); for(List<ContentHandlerConfigMap<? extends SAXVisitor>> contentHandlerMapList : contentHandlerMaps) { for(ContentHandlerConfigMap<? extends SAXVisitor> contentHandlerMap : contentHandlerMapList) { SmooksResourceConfiguration resourceConfig = contentHandlerMap.getResourceConfig(); SelectorStep selectorStep = resourceConfig.getSelectorStep(); if(selectorStep.accessesText()) { throw new SmooksConfigurationException("Unsupported selector '" + selectorStep.getXPathExpression() + "' on resource '" + resourceConfig + "'. The 'text()' XPath token is only supported on SAX Visitor implementations that implement the " + SAXVisitAfter.class.getName() + " interface only. Class '" + resourceConfig.getResource() + "' implements other SAX Visitor interfaces."); } } } }
private void assertSelectorsNotAccessingText(ContentHandlerConfigMapTable saxVisitorMap) { Map<String, List<ContentHandlerConfigMap<? extends SAXVisitor>>> table = saxVisitorMap.getTable(); Collection<List<ContentHandlerConfigMap<? extends SAXVisitor>>> contentHandlerMaps = table.values(); for(List<ContentHandlerConfigMap<? extends SAXVisitor>> contentHandlerMapList : contentHandlerMaps) { for(ContentHandlerConfigMap<? extends SAXVisitor> contentHandlerMap : contentHandlerMapList) { SmooksResourceConfiguration resourceConfig = contentHandlerMap.getResourceConfig(); SelectorStep selectorStep = resourceConfig.getSelectorStep(); if(selectorStep.accessesText()) { throw new SmooksConfigurationException("Unsupported selector '" + selectorStep.getXPathExpression() + "' on resource '" + resourceConfig + "'. The 'text()' XPath token is only supported on SAX Visitor implementations that implement the " + SAXVisitAfter.class.getName() + " interface only. Class '" + resourceConfig.getResource() + "' implements other SAX Visitor interfaces."); } } } }
private void assertSelectorsNotAccessingText(ContentHandlerConfigMapTable saxVisitorMap) { Map<String, List<ContentHandlerConfigMap<? extends SAXVisitor>>> table = saxVisitorMap.getTable(); Collection<List<ContentHandlerConfigMap<? extends SAXVisitor>>> contentHandlerMaps = table.values(); for(List<ContentHandlerConfigMap<? extends SAXVisitor>> contentHandlerMapList : contentHandlerMaps) { for(ContentHandlerConfigMap<? extends SAXVisitor> contentHandlerMap : contentHandlerMapList) { SmooksResourceConfiguration resourceConfig = contentHandlerMap.getResourceConfig(); SelectorStep selectorStep = resourceConfig.getSelectorStep(); if(selectorStep.accessesText()) { throw new SmooksConfigurationException("Unsupported selector '" + selectorStep.getXPathExpression() + "' on resource '" + resourceConfig + "'. The 'text()' XPath token is only supported on SAX Visitor implementations that implement the " + SAXVisitAfter.class.getName() + " interface only. Class '" + resourceConfig.getResource() + "' implements other SAX Visitor interfaces."); } } } }