Package org.apache.cocoon.mail.datasource

Examples of org.apache.cocoon.mail.datasource.AbstractDataSource


            return (String) this.obj;
        }

        public DataSource getDataSource(SourceResolver resolver, List sources)
        throws IOException, MessagingException {
            AbstractDataSource ds = null;

            if (isURL) {
                String url = (String) getObject();
                Source src = resolver.resolveURI(url);
                sources.add(src);
View Full Code Here


        }

        // Override to set name to null: body can not have name.
        public DataSource getDataSource(SourceResolver resolver, List sources)
        throws IOException, MessagingException {
            AbstractDataSource ds = (AbstractDataSource) super.getDataSource(resolver, sources);
            ds.setName(null);
            return ds;
        }
View Full Code Here

            return (String) this.obj;
        }

        public DataSource getDataSource(SourceResolver resolver, List sources)
        throws IOException, MessagingException {
            AbstractDataSource ds = null;

            if (isURL) {
                String url = (String) getObject();
                Source src = resolver.resolveURI(url);
                sources.add(src);
                if (src.exists()) {
                    ds = new SourceDataSource(src, getType(), getName());
                }
            } else if (getObject() instanceof Part) {
                Part part = (Part) getObject();
                ds = new FilePartDataSource(part, getType(), getName());
            } else if (getObject() instanceof InputStream) {
                InputStream in = (InputStream) getObject();
                ds = new InputStreamDataSource(in, getType(), getName());
            } else if (getObject() instanceof byte[]) {
                byte[] data = (byte[]) getObject();
                ds = new InputStreamDataSource(data, getType(), getName());
            } else {
                // TODO: other classes?
                throw new MessagingException("Not yet supported: " + getObject());
            }

            if (ds != null) {
                ds.enableLogging(getMyLogger());
            }
            return ds;
        }
View Full Code Here

        }

        // Override to set name to null: body can not have name.
        public DataSource getDataSource(SourceResolver resolver, List sources)
        throws IOException, MessagingException {
            AbstractDataSource ds = (AbstractDataSource) super.getDataSource(resolver, sources);
            ds.setName(null);
            return ds;
        }
View Full Code Here

            return (String) this.obj;
        }

        public DataSource getDataSource(SourceResolver resolver, List sources)
        throws IOException, MessagingException {
            AbstractDataSource ds = null;

            if (isURL) {
                String url = (String) getObject();
                Source src = resolver.resolveURI(url);
                sources.add(src);
                if (src.exists()) {
                    ds = new SourceDataSource(src, getType(), getName());
                }
            } else if (getObject() instanceof Part) {
                Part part = (Part) getObject();
                ds = new FilePartDataSource(part, getType(), getName());
            } else if (getObject() instanceof InputStream) {
                InputStream in = (InputStream) getObject();
                ds = new InputStreamDataSource(in, getType(), getName());
            } else if (getObject() instanceof byte[]) {
                byte[] data = (byte[]) getObject();
                ds = new InputStreamDataSource(data, getType(), getName());
            } else {
                // TODO: other classes?
                throw new MessagingException("Not yet supported: " + getObject());
            }

            if (ds != null) {
                ds.enableLogging(getMyLogger());
            }
            return ds;
        }
View Full Code Here

        }

        // Override to set name to null: body can not have name.
        public DataSource getDataSource(SourceResolver resolver, List sources)
        throws IOException, MessagingException {
            AbstractDataSource ds = (AbstractDataSource) super.getDataSource(resolver, sources);
            ds.setName(null);
            return ds;
        }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.mail.datasource.AbstractDataSource

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.