Package org.apache.cocoon.mail.datasource

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


                    if (a.isURL) {
                        String name = (String) a.getObject();
                        Source src = resolver.resolveURI(name);
                        sourcesList.add(src);
                        if (src.exists()) {
                            ds = new SourceDataSource(
                                    src,
                                    a.getType(src.getMimeType()),
                                    a.getName(name.substring(name.lastIndexOf('/') + 1)));
                        }
                    } else {
View Full Code Here


            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) {
View Full Code Here

   
                if (!aD.isTextContent()) {
                    Source inputSource = resolver.resolveURI(aD.isURLSource() ? aD.strAttrSrc : aD.strAttrFile);
                    this.usedSources.add(inputSource);
   
                    DataSource dataSource = new SourceDataSource(inputSource, aD.strAttrMimeType, aD.strAttrName);

                    messageBodyPart.setDataHandler(new DataHandler(dataSource));
                } else {
                    messageBodyPart.setContent(aD.strContent, aD.strAttrMimeType);
                }
View Full Code Here

                if (!aD.isTextContent()) {
                    Source inputSource = resolver.resolveURI(aD.isURLSource() ? aD.strAttrSrc : aD.strAttrFile);
                    this.usedSources.add(inputSource);

                    DataSource dataSource = new SourceDataSource(inputSource, aD.strAttrMimeType, aD.strAttrName);
                    ((SourceDataSource) dataSource).enableLogging(getLogger());

                    messageBodyPart.setDataHandler(new DataHandler(dataSource));
                } else {
                    messageBodyPart.setContent(aD.strContent, aD.strAttrMimeType);
View Full Code Here

                    Source source = resolver.resolveURI(this.src);
                    sourcesList.add(source);
                    if (source.exists()) {
                        ds =
                            new SourceDataSource(
                                source,
                                (this.srcMimeType == null
                                    ? source.getMimeType()
                                    : this.srcMimeType),
                                this.src.substring(this.src.lastIndexOf('/') + 1));
                    }

                    this.message.setDataHandler(new DataHandler(ds));

                } else if (this.body != null) {
                    if (this.charset != null) {
                        this.message.setText(this.body, this.charset);
                    } else {
                        this.message.setText(this.body);
                    }
                }
            } else {
                Multipart multipart = new MimeMultipart();
                BodyPart bodypart = new MimeBodyPart();
                multipart.addBodyPart(bodypart);
                this.message.setContent(multipart);

                if (this.src != null) {
                    DataSource ds = null;

                    Source source = resolver.resolveURI(this.src);
                    sourcesList.add(source);
                    if (source.exists()) {
                        ds =
                            new SourceDataSource(
                                source,
                                (this.srcMimeType == null
                                    ? source.getMimeType()
                                    : this.srcMimeType),
                                this.src.substring(this.src.lastIndexOf('/') + 1));
                    }

                    bodypart.setDataHandler(new DataHandler(ds));
                    bodypart.setFileName(ds.getName());

                } else if (this.body != null) {
                    bodypart.setText(this.body);
                }

                for (Iterator i = this.attachmentList.iterator(); i.hasNext();) {
                    a = (Attachment) i.next();
                    DataSource ds = null;
                    if (a.isURL) {
                        String name = (String) a.getObject();
                        Source src = resolver.resolveURI(name);
                        sourcesList.add(src);
                        if (src.exists()) {
                            ds =
                                new SourceDataSource(
                                    src,
                                    a.getType(src.getMimeType()),
                                    a.getName(name.substring(name.lastIndexOf('/') + 1)));
                        }
                    } else {
View Full Code Here

                    Source source = resolver.resolveURI(this.src);
                    sourcesList.add(source);
                    if (source.exists()) {
                        ds =
                            new SourceDataSource(
                                source,
                                (this.srcMimeType == null
                                    ? source.getMimeType()
                                    : this.srcMimeType),
                                this.src.substring(this.src.lastIndexOf('/') + 1));
                    }

                    this.message.setDataHandler(new DataHandler(ds));

                } else if (this.body != null) {
                    if (this.charset != null) {
                        this.message.setText(this.body, this.charset);
                    } else {
                        this.message.setText(this.body);
                    }
                }
            } else {
                Multipart multipart = new MimeMultipart();
                BodyPart bodypart = null;

                if (this.src != null) {
                    DataSource ds = null;

                    Source source = resolver.resolveURI(this.src);
                    sourcesList.add(source);
                    if (source.exists()) {
                        ds =
                            new SourceDataSource(
                                source,
                                (this.srcMimeType == null
                                    ? source.getMimeType()
                                    : this.srcMimeType),
                                this.src.substring(this.src.lastIndexOf('/') + 1));
                    }

                    bodypart.setDataHandler(new DataHandler(ds));
                    bodypart.setFileName(ds.getName());

                    multipart.addBodyPart(bodypart);

                } else if (this.body != null) {
                    bodypart = new MimeBodyPart();
                    bodypart.setText(this.body);
                    multipart.addBodyPart(bodypart);
                }
                this.message.setContent(multipart);

                for (Iterator i = this.attachmentList.iterator(); i.hasNext();) {
                    a = (Attachment) i.next();
                    DataSource ds = null;
                    if (a.isURL) {
                        String name = (String) a.getObject();
                        Source src = resolver.resolveURI(name);
                        sourcesList.add(src);
                        if (src.exists()) {
                            ds =
                                new SourceDataSource(
                                    src,
                                    a.getType(src.getMimeType()),
                                    a.getName(name.substring(name.lastIndexOf('/') + 1)));
                        }
                    } else {
View Full Code Here

                if (!aD.isTextContent()) {
                    Source inputSource = resolver.resolveURI(aD.isURLSource() ? aD.strAttrSrc : aD.strAttrFile);
                    this.usedSources.add(inputSource);

                    DataSource dataSource = new SourceDataSource(inputSource, aD.strAttrMimeType, aD.strAttrName);
                    ((SourceDataSource) dataSource).enableLogging(getLogger());

                    messageBodyPart.setDataHandler(new DataHandler(dataSource));
                } else {
                    messageBodyPart.setContent(aD.strContent, aD.strAttrMimeType);
View Full Code Here

            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) {
View Full Code Here

            if (!aD.isTextContent()) {
                Source inputSource = resolver.resolveURI(aD.isURLSource() ? aD.strAttrSrc : aD.strAttrFile);
                this.usedSources.add(inputSource);

                DataSource dataSource = new SourceDataSource(inputSource, aD.strAttrMimeType, aD.strAttrName);
                ((SourceDataSource) dataSource).enableLogging(getLogger());

                messageBodyPart.setDataHandler(new DataHandler(dataSource));
            } else {
                messageBodyPart.setContent(aD.strContent, aD.strAttrMimeType);
View Full Code Here

                    Source source = resolver.resolveURI(this.src);
                    sourcesList.add(source);
                    if (source.exists()) {
                        ds =
                            new SourceDataSource(
                                source,
                                (this.srcMimeType == null
                                    ? source.getMimeType()
                                    : this.srcMimeType),
                                this.src.substring(this.src.lastIndexOf('/') + 1));
                    }

                    this.message.setDataHandler(new DataHandler(ds));

                } else if (this.body != null) {
                    if (this.charset != null) {
                        this.message.setText(this.body, this.charset);
                    } else {
                        this.message.setText(this.body);
                    }
                }
            } else {
                Multipart multipart = new MimeMultipart();
                BodyPart bodypart = null;

                if (this.src != null) {
                    DataSource ds = null;

                    Source source = resolver.resolveURI(this.src);
                    sourcesList.add(source);
                    if (source.exists()) {
                        ds =
                            new SourceDataSource(
                                source,
                                (this.srcMimeType == null
                                    ? source.getMimeType()
                                    : this.srcMimeType),
                                this.src.substring(this.src.lastIndexOf('/') + 1));
                    }

                    bodypart.setDataHandler(new DataHandler(ds));
                    bodypart.setFileName(ds.getName());

                    multipart.addBodyPart(bodypart);

                } else if (this.body != null) {
                    bodypart = new MimeBodyPart();
                    bodypart.setText(this.body);
                    multipart.addBodyPart(bodypart);
                }
                this.message.setContent(multipart);

                for (Iterator i = this.attachmentList.iterator(); i.hasNext();) {
                    a = (Attachment) i.next();
                    DataSource ds = null;
                    if (a.isURL) {
                        String name = (String) a.getObject();
                        Source src = resolver.resolveURI(name);
                        sourcesList.add(src);
                        if (src.exists()) {
                            ds =
                                new SourceDataSource(
                                    src,
                                    a.getType(src.getMimeType()),
                                    a.getName(name.substring(name.lastIndexOf('/') + 1)));
                        }
                    } else {
View Full Code Here

TOP

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

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.