/** * Starts parsing. * * @param atts * the attributes. * @throws org.xml.sax.SAXException * if there is a parsing error. */ protected void startParsing( final PropertyAttributes atts ) throws SAXException { super.startParsing( atts ); final String content = atts.getValue( getUri(), "src" ); if ( content == null ) { throw new SAXException( "Required attribute 'src' is missing." ); } elementFactory.setContent( content ); final ResourceManager resourceManager = getRootHandler().getResourceManager(); elementFactory.setBaseURL( resourceManager.toURL( getRootHandler().getContext() ) ); }
/** * Starts parsing. * * @param atts * the attributes. * @throws org.xml.sax.SAXException * if there is a parsing error. */ protected void startParsing( final PropertyAttributes atts ) throws SAXException { super.startParsing( atts ); final String fieldName = atts.getValue( getUri(), "fieldname" ); if ( fieldName == null ) { throw new SAXException( "Required attribute 'fieldname' is missing." ); } elementFactory.setFieldname( fieldName ); final ResourceManager resourceManager = getRootHandler().getResourceManager(); elementFactory.setBaseURL( resourceManager.toURL( getRootHandler().getContext() ) ); }
private void handleSource( final PropertyAttributes atts ) { final ResourceManager resourceManager = getRootHandler().getResourceManager(); elementFactory.setBaseURL( resourceManager.toURL( getRootHandler().getContext() ) ); elementFactory.setContent( atts.getValue( getUri(), ImageRefReadHandler.SRC_ATT ) ); }
/** * Starts parsing. * * @param attrs * the attributes. * @throws SAXException * if there is a parsing error. */ protected void startParsing( final Attributes attrs ) throws SAXException { super.startParsing( attrs ); final ResourceManager resourceManager = getRootHandler().getResourceManager(); final ResourceKey context = getRootHandler().getContext(); final Configuration configuration = ClassicEngineBoot.getInstance().getGlobalConfig(); final Iterator keys = configuration.findPropertyKeys( ElementMetaDataParser.GLOBAL_INCLUDES_PREFIX ); while ( keys.hasNext() ) { final String key = (String) keys.next(); final String href = configuration.getConfigProperty( key ); if ( StringUtils.isEmpty( href, true ) ) { continue; } try { final ResourceKey resourceKey = resourceManager.deriveKey( context, href ); final Resource resource = resourceManager.create( resourceKey, null, GlobalMetaDefinition.class ); globalMetaDefinition.merge( (GlobalMetaDefinition) resource.getResource() ); } catch ( ResourceException e ) { logger.warn( "Failed to parse included global definitions: " + getLocator(), e ); } } }
final ResourceManager resourceManager = getRootHandler().getResourceManager(); final ResourceKey key = getRootHandler().getContext(); final ResourceKey parent = key.getParent();
/** * Starts parsing. * * @param attrs * the attributes. * @throws SAXException * if there is a parsing error. */ protected void startParsing( final Attributes attrs ) throws SAXException { final String href = attrs.getValue( getUri(), "src" ); if ( href == null ) { throw new ParseException( "Required attribute 'src' is missing", getLocator() ); } final ResourceManager resourceManager = getRootHandler().getResourceManager(); final ResourceKey context = getRootHandler().getContext(); try { final ResourceKey resourceKey = resourceManager.deriveKey( context, href ); final Resource resource = resourceManager.create( resourceKey, null, GlobalMetaDefinition.class ); result = (GlobalMetaDefinition) resource.getResource(); } catch ( ResourceException e ) { throw new ParseException( "Failed to parse included global definitions", e, getLocator() ); } if ( globalMetaDefinition != null ) { globalMetaDefinition.merge( result ); } }
/** * Parses an external file using LibLoader and returns the parsed result as an object of type * <code>targetClass</code>. The file is given as relative pathname (relative to the current source file). The current * helper-methods are used as parse-parameters for the external parsing. * * @param file the file to be parsed. * @param targetClass the target type of the parse operation. * @param map the map of parse parameters. * @return the result, never null. * @throws ParseException if parsing the result failed for some reason. * @throws ResourceLoadingException if there was an IO error loading the resource. * @see #deriveParseParameters() */ protected Object performExternalParsing( final String file, final Class targetClass, final Map map ) throws ParseException, ResourceLoadingException { try { final ResourceManager resourceManager = rootHandler.getResourceManager(); final ResourceKey source = rootHandler.getSource(); final ResourceKey target = resourceManager.deriveKey( source, file, map ); final DependencyCollector dc = rootHandler.getDependencyCollector(); final Resource resource = resourceManager.create( target, rootHandler.getContext(), targetClass ); dc.add( resource ); return resource.getResource(); } catch ( ResourceLoadingException rle ) { throw rle; } catch ( ResourceException e ) { throw new ParseException( "Failure while loading data: " + file, e, getLocator() ); } }
final ResourceManager resourceManager = rootHandler.getResourceManager(); final ResourceKey source = rootHandler.getSource();
final ResourceManager manager = getRootHandler().getResourceManager(); try { final ResourceKey derivedKey = manager.deriveKey( key, href );
final ResourceManager resourceManager = getRootHandler().getResourceManager(); try { final Resource bundleData = resourceManager.create( key.getParent(), null, DocumentBundle.class );