Package org.apache.cocoon

Examples of org.apache.cocoon.CascadingIOException


                return new ByteArrayInputStream(bOut.toByteArray());
            }
        } catch (IOException ioe) {
            throw ioe;
        } catch (Exception e) {
            throw new CascadingIOException("Exception during processing of " + getURI(), e);
        } finally {
            cleanup();
        }
    }
View Full Code Here


        final Environment currentEnv = CocoonComponentManager.getCurrentEnvironment();
        org.apache.cocoon.environment.Source source;
        try {
            source = this.sourceFactory.getSource(currentEnv, location);
        } catch (ProcessingException pe) {
            throw new CascadingIOException("ProcessingException: " + pe.getMessage(), pe);
        }
        return new CocoonToAvalonSource( location, source );
    }
View Full Code Here

            handler.setResult(new StreamResult(this.output));
            this.setContentHandler(handler);
            this.setLexicalHandler(handler);
        } catch (Exception e) {
            final String message = "Cannot set XMLSerializer outputstream";
            throw new CascadingIOException(message, e);
        }
    }
View Full Code Here

            handler.getTransformer().setOutputProperties(this.format);
            handler.setResult(new StreamResult(this.output));
            this.setContentHandler(handler);
            this.setLexicalHandler(handler);
        } catch (Exception e) {
            throw new CascadingIOException(e.toString(), e);
        }
    }
View Full Code Here

                content.store(slideToken, config.getFilesPath()+path,
                              revisionDescriptor, revisionContent);
                try {
                    nat.commit();
                } catch (Exception cme) {
                    throw new CascadingIOException("Could not commit the transaction",
                                                   cme);
                }

            } catch (ObjectNotFoundException e) {

                // Todo : Check to see if parent exists
                SubjectNode subject = new SubjectNode();

                try {
                    // Creating an object
                    structure.create(slideToken, subject,
                                     config.getFilesPath()+path);
                } catch (SlideException se) {
                    throw new CascadingIOException(se);
                }

                NodeRevisionDescriptor revisionDescriptor = new NodeRevisionDescriptor(bytes.length);

                // Resource type
                revisionDescriptor.setResourceType("");

                // Source
                revisionDescriptor.setSource("");

                // Get content language
                revisionDescriptor.setContentLanguage("en");

                // Get content length
                revisionDescriptor.setContentLength(bytes.length);

                // Get content type
                String contentType = null;

                try {
                    contentType = ((org.apache.cocoon.environment.Context) context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT)).getMimeType(path);
                } catch (ContextException ce) {
                    this.logger.warn("Could not get context to determine the mime type.");
                }
                if (contentType==null) {
                    contentType = "application/octet-stream";
                }
                revisionDescriptor.setContentType(contentType);

                // Last modification date
                revisionDescriptor.setLastModified(new Date());

                // Owner
                revisionDescriptor.setOwner(slideToken.getCredentialsToken().getPublicCredentials());

                // Creating revisionDescriptor associated with the object
                NodeRevisionContent revisionContent = new NodeRevisionContent();

                revisionContent.setContent(bytes);

                try {
                    content.create(slideToken, config.getFilesPath()+path,
                                   revisionDescriptor, revisionContent);

                    try {
                        nat.commit();
                    } catch (Exception cme) {
                        throw new CascadingIOException("Could not commit the transaction",
                                                       cme);

                    }
                } catch (SlideException se) {

                    try {
                        nat.rollback();
                    } catch (Exception rbe) {
                        this.logger.warn("Could not rollback the transaction.",
                                         rbe);
                    }

                    throw new CascadingIOException("Could not create source",
                                                   se);
                }

            } catch (Exception e) {
                if (e instanceof IOException) {
                    throw (IOException) e;
                }
                throw new CascadingIOException("Could not create source", e);
            } finally {

                this.isClosed = true;
            }
        }
View Full Code Here

            oos.flush();
            oos.close();
        } catch (IOException io) {
            throw io;
        } catch (Exception ignore) {
            throw new CascadingIOException("Exception.", ignore);
        } finally {
            this.resolver.release( child );
        }
    }
View Full Code Here

        final Environment currentEnv = CocoonComponentManager.getCurrentEnvironment();
        org.apache.cocoon.environment.Source source;
        try {
            source = this.sourceFactory.getSource(currentEnv, location);
        } catch (ProcessingException pe) {
            throw new CascadingIOException("ProcessingException: " + pe.getMessage(), pe);
        }
        return new CocoonToAvalonSource( location, source );
    }
View Full Code Here

            Source redirectSource = null;
            try {
                redirectSource = this.resolveURI(newURL);
                SourceUtil.parse( this.manager, redirectSource, ls);
            } catch (SourceException se) {
                throw new CascadingIOException("SourceException: " + se, se);
            } catch (SAXException se) {
                throw new CascadingIOException("SAXException: " + se, se);
            } catch (ProcessingException pe) {
                throw new CascadingIOException("ProcessingException: " + pe, pe);
            } finally {
                this.release( redirectSource );
            }
        } else {
            Source redirectSource = null;
            try {
                redirectSource = this.resolveURI(newURL);
                InputStream is = redirectSource.getInputStream();
                byte[] buffer = new byte[8192];
                int length = -1;

                while ((length = is.read(buffer)) > -1) {
                    this.outputStream.write(buffer, 0, length);
                }
            } catch (SourceException se) {
                throw new CascadingIOException("SourceException: " + se, se);
            } finally {
                this.release( redirectSource);
            }
        }
    }
View Full Code Here

            oos.flush();
            oos.close();
        } catch (IOException io) {
            throw io;
        } catch (Exception ignore) {
            throw new CascadingIOException("Exception.", ignore);
        } finally {
            this.resolver.release( child );
        }
    }
View Full Code Here

                try {
                    cnx.close();
                } catch (Exception e) {
                    String msg = "Error closing the connection for " + BlobSource.this.getURI();
                    BlobSource.this.getLogger().warn(msg, e);
                    throw new CascadingIOException(msg + " : " + e.getMessage(), e);
                } finally {
                    cnx = null;
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.CascadingIOException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.