/** * Construct from a file. * * @param file * the file */ public InMemoryResource(String content) { super(""); try { this.array = content.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new PaxmlParseException(e.getMessage()); } }
/** * Construct from a file. * * @param file * the file */ public InMemoryResource(String content) { super(""); try { this.array = content.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new PaxmlParseException(e.getMessage()); } }
private ITagFactory doCreateTagFactory(Class<?> clazz) { Tag a = ReflectUtils.getAnnotation(clazz, Tag.class); if (a == null) { throw new PaxmlParseException("Tag class '" + clazz.getName() + "' has no @" + Tag.class.getSimpleName() + " annotation on itself nor its super classes"); } Class<? extends ITagFactory> factoryClass = a.factory(); if (ReflectUtils.isAbstract(factoryClass)) { return null; } ITagFactory factory = cachedTagFactories.get(factoryClass); if (factory == null) { try { factory = factoryClass.newInstance(); } catch (Exception e) { throw new PaxmlRuntimeException("Cannot create tag factory from class: " + factoryClass.getName(), e); } cachedTagFactories.put(factoryClass, factory); } factory.setEntityFactory(this); return factory; }
private ITagFactory doCreateTagFactory(Class<?> clazz) { Tag a = ReflectUtils.getAnnotation(clazz, Tag.class); if (a == null) { throw new PaxmlParseException("Tag class '" + clazz.getName() + "' has no @" + Tag.class.getSimpleName() + " annotation on itself nor its super classes"); } Class<? extends ITagFactory> factoryClass = a.factory(); if (ReflectUtils.isAbstract(factoryClass)) { return null; } ITagFactory factory = cachedTagFactories.get(factoryClass); if (factory == null) { try { factory = factoryClass.newInstance(); } catch (Exception e) { throw new PaxmlRuntimeException("Cannot create tag factory from class: " + factoryClass.getName(), e); } cachedTagFactories.put(factoryClass, factory); } factory.setEntityFactory(this); return factory; }
path = base.createRelative(path).getURI().toString(); } catch (IOException e) { throw new PaxmlParseException("Cannot create relative path '" + path + "' from base resource: " + base + ", because: " + e.getMessage());
path = base.createRelative(path).getURI().toString(); } catch (IOException e) { throw new PaxmlParseException("Cannot create relative path '" + path + "' from base resource: " + base + ", because: " + e.getMessage());
final String subExp = exp.substring(startPos + 2, endPos); if (StringUtils.isBlank(subExp)) { throw new PaxmlParseException("Empty evaluation given at position " + startPos + " in expression: " + exp); lastStart = searchStart; } else { throw new PaxmlParseException("No closing sign } found after opening sign ${ at position " + startPos + " in expression string: " + exp);
final String subExp = exp.substring(startPos + 2, endPos); if (StringUtils.isBlank(subExp)) { throw new PaxmlParseException("Empty evaluation given at position " + startPos + " in expression: " + exp); lastStart = searchStart; } else { throw new PaxmlParseException("No closing sign } found after opening sign ${ at position " + startPos + " in expression string: " + exp);
private void buildListeners(OMElement ele, boolean detach) { for (OMElement child : AxiomUtils.getElements(ele, "listener")) { String className = child.getText().trim(); if (StringUtils.isNotBlank(className)) { Class<?> clazz = ReflectUtils.loadClassStrict(className, null); if (ReflectUtils.isImplementingClass(clazz, IExecutionListener.class, true)) { model.getConfig().getExecutionListeners().add((Class<? extends IExecutionListener>) clazz); } else if (ReflectUtils.isImplementingClass(clazz, IEntityExecutionListener.class, true)) { model.getConfig().getEntityListeners().add((Class<? extends IEntityExecutionListener>) clazz); } else if (ReflectUtils.isImplementingClass(clazz, ITagExecutionListener.class, true)) { model.getConfig().getTagListeners().add((Class<? extends ITagExecutionListener>) clazz); } else { throw new PaxmlParseException("Unknown listener type: " + clazz.getName()); } } if (detach) { child.detach(); } } }
private void buildListeners(OMElement ele, boolean detach) { for (OMElement child : AxiomUtils.getElements(ele, "listener")) { String className = child.getText().trim(); if (StringUtils.isNotBlank(className)) { Class<?> clazz = ReflectUtils.loadClassStrict(className, null); if (ReflectUtils.isImplementingClass(clazz, IExecutionListener.class, true)) { model.getConfig().getExecutionListeners().add((Class<? extends IExecutionListener>) clazz); } else if (ReflectUtils.isImplementingClass(clazz, IEntityExecutionListener.class, true)) { model.getConfig().getEntityListeners().add((Class<? extends IEntityExecutionListener>) clazz); } else if (ReflectUtils.isImplementingClass(clazz, ITagExecutionListener.class, true)) { model.getConfig().getTagListeners().add((Class<? extends ITagExecutionListener>) clazz); } else { throw new PaxmlParseException("Unknown listener type: " + clazz.getName()); } } if (detach) { child.detach(); } } }
IParserContext deepest = contextImpl.getParserStack().getFirst(); OMElement ele = deepest.getElement(); throw new PaxmlParseException("Cannot parse tag <" + ele.getLocalName() + "> at line: " + ele.getLineNumber() + ", resource: " + deepest.getResource() + "\r\nBecause: " + Paxml.getCause(e), e);
IParserContext deepest = contextImpl.getParserStack().getFirst(); OMElement ele = deepest.getElement(); throw new PaxmlParseException( "Cannot parse tag <" + ele.getLocalName() + "> at line: " + ele.getLineNumber() + ", resource: " + deepest.getResource() + "\r\nBecause: " + Paxml.getCause(e), e);