Package org.apache.cocoon

Examples of org.apache.cocoon.CascadingIOException


                }
                m_content.store(m_slideToken,m_uri,m_descriptor,content);
                try {
                    m_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
                    m_structure.create(m_slideToken,subject,m_uri);
                } catch (SlideException se) {
                    throw new CascadingIOException(se);
                }

                NodeRevisionDescriptor descriptor = new NodeRevisionDescriptor(bytes.length);
                descriptor.setResourceType("");
                descriptor.setSource("");
                descriptor.setContentLanguage("en");
                descriptor.setContentLength(bytes.length);
                String contentType = null;

                try {
                    contentType = ((org.apache.cocoon.environment.Context)
                        m_context.get(Constants.CONTEXT_ENVIRONMENT_CONTEXT)).getMimeType(m_path);
                } catch (ContextException ce) {
                    this.logger.warn("Could not get context to determine the mime type.");
                }
                if (contentType == null) {
                    contentType = "application/octet-stream";
                }
                descriptor.setContentType(contentType);
                descriptor.setLastModified(new Date());
                descriptor.setOwner(m_slideToken.getCredentialsToken().getPublicCredentials());
                NodeRevisionContent content = new NodeRevisionContent();
               
                content.setContent(bytes);
                try {
                    m_content.create(m_slideToken,m_uri,descriptor,content);
                    try {
                        m_nat.commit();
                    } catch (Exception cme) {
                        throw new CascadingIOException("Could not commit the transaction",cme);

                    }
                } catch (SlideException se) {
                    try {
                        m_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


            ByteArrayOutputStream os = new ByteArrayOutputStream();
            serializer.setOutputStream(os);
            this.toSAX(serializer);
            return new ByteArrayInputStream(os.toByteArray());
        } catch (SAXException se) {
            throw new CascadingIOException("Unable to stream content.", se);
        } catch (ComponentException ce) {
            throw new CascadingIOException("Unable to get components for serializing.", ce);
        } finally {
            if ( serializer != null ) {
                serializerSelector.release(serializer);
            }
            sitemapManager.release(serializerSelector);
View Full Code Here

        try {
            _sheet = new Sheet(getWorkbook());
        } catch (IOException e) {
            throw e;
        } catch (Exception e) {
            throw new CascadingIOException(e.getMessage(), e);
        }
    }
View Full Code Here

        protected InputStream openStreamInternal(String userAgent, Iterator mimeTypes,
                Iterator encodingTypes) throws IOException {
            try {
                return this.source.getInputStream();
            } catch (Exception e) {
                throw new CascadingIOException("Cannot open URL " + this.url, e);
            } finally {
                this.resolver.release(this.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

                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

                    cnx = null;
                    tmp.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);
                }
            }
        }
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

            this.toSAX(serializer);

            return new ByteArrayInputStream(os.toByteArray());
        } catch (ServiceException se) {
            throw new CascadingIOException("could not lookup pipeline components", se);
        } catch (ComponentException cme) {
            throw new CascadingIOException("could not lookup pipeline components", cme);
        } catch (Exception e) {
            throw new CascadingIOException("Exception during processing of " + this.getURI(), e);
        } finally {
            if (serializer != null) {
                serializerSelector.release(serializer);
            }
            if (serializerSelector != null) {
View Full Code Here

                    parser.parse(inputSource, serializer);
                }
               
                this.cachedResponse.setAlternativeResponse((byte[])serializer.getSAXFragment());
            } catch (ServiceException se) {
                throw new CascadingIOException("Unable to lookup xml serializer.", se);
            } finally {
                this.manager.release(parser);
                this.manager.release(serializer);
            }
            storeResponse = true;
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.