public Resource create( final ResourceManager caller, final ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { if ( parent == null ) { throw new ResourceCreationException( "Cannot create resource: Batik libraries are not available." ); } return parent.create( caller, data, context ); } }
public Resource create( final ResourceManager caller, final ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { if ( parent == null ) { throw new ResourceCreationException( "Cannot create resource: Batik libraries are not available." ); } return parent.create( caller, data, context ); } }
public Resource create( final ResourceManager caller, final ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { if ( parent == null ) { throw new ResourceCreationException( "Cannot create resource: Pixie library is not available." ); } return parent.create( caller, data, context ); } }
public Resource create( final ResourceManager caller, final ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { if ( parent == null ) { throw new ResourceCreationException( "Cannot create resource: Pixie library is not available." ); } return parent.create( caller, data, context ); } }
private Resource autoCreateResource( final ResourceManager frontEnd, final ResourceData data, final ResourceKey context ) throws ResourceLoadingException, ResourceCreationException { final Iterator it = resourceFactories.iterator(); while ( it.hasNext() ) { final ResourceFactory fact = (ResourceFactory) it.next(); try { final Resource res = fact.create( frontEnd, data, context ); if ( res != null ) { return res; } } catch ( ResourceCreationException rex ) { // ignore it, try the next factory ... } } throw new ResourceCreationException( "No known factory was able to handle the given data." ); }
protected Object finishResult( final Object res, final ResourceManager manager, final ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { final CrosstabElement report = (CrosstabElement) res; if ( report == null ) { throw new ResourceCreationException( "Report has not been parsed." ); } // subreports use the content-base of their master-report for now. This is safe for the old platform reports // and for bundle-reports. report.setDefinitionSource( data.getKey() ); return report; }
protected Object finishResult( final Object res, final ResourceManager manager, final ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { final SubReport report = (SubReport) res; if ( report == null ) { throw new ResourceCreationException( "Report has not been parsed." ); } // subreports use the content-base of their master-report for now. This is safe for the old platform reports // and for bundle-reports. report.setDefinitionSource( data.getKey() ); return report; }
public Resource create( final ResourceManager caller, final ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { final long version = data.getVersion( caller ); final byte[] resource = data.getResource( caller ); final Image image; try { image = createImage( resource ); } catch ( IOException e ) { throw new ResourceCreationException( "Failed to load the image.", e ); } if ( image == null ) { throw new ResourceCreationException( "Failed to load the image. ImageIO#read returned null" ); } return new SimpleResource( data.getKey(), image, Image.class, version ); }
public Resource create( final ResourceManager manager, final ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { try { final InputStream in = data.getResourceAsStream( manager ); final ObjectInputStream oin = new ObjectInputStream( in ); try { final Object ob = oin.readObject(); // yes, that will be more generic in the future ... if ( ob instanceof External8BitEncodingData == false ) { throw new ResourceCreationException( "This is no 8Bit Encoding data" ); } final External8BitEncodingData encData = (External8BitEncodingData) ob; final External8BitEncodingCore encCore = new External8BitEncodingCore( encData ); return new SimpleResource( data.getKey(), encCore, getFactoryType(), data.getVersion( manager ) ); } finally { oin.close(); } } catch ( IOException e ) { throw new ResourceLoadingException( "Failed to load resource", e ); } catch ( ClassNotFoundException e ) { throw new ResourceCreationException ( "Missing class definition: Failed to create encoding." ); } }
return new DomResource( data.getKey(), db.parse( input ), data.getVersion( manager ) ); } catch ( ParserConfigurationException e ) { throw new ResourceCreationException( "Unable to initialize the XML-Parser", e ); } catch ( SAXException e ) { throw new ResourceCreationException( "Unable to parse the document: " + data.getKey(), e ); } catch ( IOException e ) { throw new ResourceLoadingException( "Unable to read the stream from document: " + data.getKey(), e );
public Resource create( final ResourceManager manager, final ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { final ResourceKey key = data.getKey(); final Map factoryParameters = key.getFactoryParameters(); final boolean embedded = Boolean.TRUE.equals( factoryParameters.get( BaseFontResourceFactory.EMBEDDED ) ); final String encoding = String.valueOf( factoryParameters.get( BaseFontResourceFactory.ENCODING ) ); final String fontType = String.valueOf( factoryParameters.get( BaseFontResourceFactory.FONTNAME ) ); final DependencyCollector dc = new DependencyCollector( key, data.getVersion( manager ) ); final byte[] ttfAfm = data.getResource( manager ); byte[] pfb = null; if ( embedded && ( fontType.endsWith( ".afm" ) || fontType.endsWith( ".pfm" ) ) ) { final String pfbFileName = fontType.substring( 0, fontType.length() - 4 ) + ".pfb"; try { final ResourceKey pfbKey = manager.deriveKey( key, pfbFileName ); final ResourceData res = manager.load( pfbKey ); pfb = res.getResource( manager ); dc.add( pfbKey, res.getVersion( manager ) ); } catch ( ResourceException e ) { // ignore .. } } try { final BaseFont baseFont = BaseFont.createFont( fontType, encoding, embedded, false, ttfAfm, pfb ); return new CompoundResource( key, dc, baseFont, getFactoryType() ); } catch ( Exception e ) { throw new ResourceCreationException( "Failed to create the font " + fontType, e ); } }
throw new ResourceCreationException ( "Unable to initialize the XML-Parser", e ); } catch ( SAXException e ) { throw new ResourceCreationException( "Unable to parse the document", e ); } catch ( IOException e ) { throw new ResourceLoadingException( "Unable to read the stream", e );
final XmlFactoryModule[] rootHandlers = getModules(); if ( rootHandlers.length == 0 ) { throw new ResourceCreationException( "There are no root-handlers registered for the factory for type " + getFactoryType() ); return createResource( targetKey, handler, createdProduct, getFactoryType() ); } catch ( ParserConfigurationException e ) { throw new ResourceCreationException( "Unable to initialize the XML-Parser", e ); } catch ( SAXException e ) { throw new ResourceCreationException( "Unable to parse the document: " + data.getKey(), e ); } catch ( IOException e ) { throw new ResourceLoadingException( "Unable to read the stream from document: " + data.getKey(), e );
protected Object finishResult( final Object res, final ResourceManager manager, final ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { final MasterReport report = (MasterReport) res; if ( report == null ) { throw new ResourceCreationException( "Report has not been parsed." ); } if ( context != null ) { report.setContentBase( context ); } else { report.setContentBase( data.getKey() ); } report.setDefinitionSource( data.getKey() ); report.setResourceManager( manager ); report.updateLegacyConfiguration(); return report; }
throw e; } catch ( Exception e ) { throw new ResourceCreationException( "Failed to load or check content", e );
public Resource create( final ResourceManager manager, ResourceData data, final ResourceKey context ) throws ResourceCreationException, ResourceLoadingException { if ( data instanceof CachingResourceBundleData ) { // todo: Friggin' cheap hack final CachingResourceBundleData cachingResourceBundleData = (CachingResourceBundleData) data; data = cachingResourceBundleData.getBackend(); } if ( data instanceof RepositoryResourceBundleData == false ) { data = manager.loadResourceBundle( data.getKey() ); if ( data instanceof CachingResourceBundleData ) { // todo: Friggin' cheap hack 2 final CachingResourceBundleData cachingResourceBundleData = (CachingResourceBundleData) data; data = cachingResourceBundleData.getBackend(); } } if ( data instanceof RepositoryResourceBundleData == false ) { throw new ContentNotRecognizedException( "No valid handler for the given content." ); } final RepositoryResourceBundleData bdata = (RepositoryResourceBundleData) data; final Repository repository = bdata.getRepository(); try { final StaticDocumentBundle bundle = new StaticDocumentBundle( repository, manager, bdata.getBundleKey() ); return new SimpleResource( data.getKey(), bundle, getFactoryType(), data.getVersion( manager ) ); } catch ( ResourceException e ) { throw new ResourceCreationException( "Unable to interpret document-bundle", e ); } }
throw new ResourceCreationException( "Damn, the style rule is null" ); throw new ResourceCreationException( "Failed to parse the stylesheet." ); } catch ( IOException e ) { throw new ResourceLoadingException( "Failed to load the stylesheet." );
( data.getKey(), dependencies, handler.getStyleSheet(), getFactoryType() ); } catch ( CSSParserInstantiationException e ) { throw new ResourceCreationException( "Failed to parse the stylesheet.", e ); } catch ( IOException e ) { throw new ResourceLoadingException( "Failed to load the stylesheet.", e );