Package org.apache.excalibur.source

Examples of org.apache.excalibur.source.Source


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


        // decide, if to take content from source or plain text
        // from variable to build mailbody
        String messageString;
        if (this.bodyURI != null) {
            Source      inSrc   = resolver.resolveURI(this.bodyURI);
            this.usedSources.add(inSrc);
            InputStream inStr   = inSrc.getInputStream();
            byte[]      byteArr = new byte[inStr.available()];
            inStr.read(byteArr);
           
            messageString = new String(byteArr);
           
            // String mailBody = new String(byteArr);
            // this.setMessageBody(messageBodyPart, mailBody, this.bodyMimeType);
        } else {
            messageString = this.body;
            // this.setMessageBody(messageBodyPart, this.body, this.bodyMimeType);           
        }

        // make it a simple plain text message in the case of a set plain/text
        // mime-type and any attachements
        if("text/plain".equals(this.bodyMimeType) && this.attachments.size() == 0) {    
            sm.setText(messageString);
        }
        // add message as message body part
        else {
            messageBodyPart.setContent(messageString, this.bodyMimeType);
            Multipart multipart = new MimeMultipart();
            multipart.addBodyPart(messageBodyPart);

            // process attachments
            Iterator i = this.attachments.iterator();
            while (i.hasNext()) {
                AttachmentDescriptor aD = (AttachmentDescriptor) i.next();
                messageBodyPart = new MimeBodyPart();
   
                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));
View Full Code Here

      this.contextPath = null;
      this.sendPartial = true;
      this.smtpMessage = null;
        final Iterator i = this.usedSources.iterator();
        while ( i.hasNext() ) {
            final Source source = (Source)i.next();
            this.resolver.release(source);
        }
        this.usedSources.clear();
       super.recycle();
  }
View Full Code Here

        User user = null;
        Document doc = null;

        // invoke the source
        Source source = null;
        try {
            source = SourceUtil.getSource(authenticationResourceName, null,
                                          null, this.resolver);
            doc = org.apache.cocoon.components.source.SourceUtil.toDOM(source);
        } catch (IOException e) {
View Full Code Here

     */
    public void logout(final Map logoutContext, final User user) {
        final String logoutResourceName = this.logoutResource;
        if (logoutResourceName != null) {
            // invoke the source
            Source source = null;
            try {
                // This allows arbitrary business logic to be called. Whatever is returned
                // is ignored.
                source = SourceUtil.getSource(logoutResourceName, null, null, this.resolver);
                org.apache.cocoon.components.source.SourceUtil.toDOM(source);
View Full Code Here

        String configUrl = config.getChild("jtidy-config").getValue(null);

        if(configUrl != null) {
            org.apache.excalibur.source.SourceResolver resolver = null;
            Source configSource = null;
            try {
                resolver = (org.apache.excalibur.source.SourceResolver)this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE);
                configSource = resolver.resolveURI(configUrl);
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Loading configuration from " + configSource.getURI());
                }

                this.properties = new Properties();
                this.properties.load(configSource.getInputStream());

            } catch (Exception e) {
                getLogger().warn("Cannot load configuration from " + configUrl);
                throw new ConfigurationException("Cannot load configuration from " + configUrl, e);
            } finally {
View Full Code Here

 
 
    public Map act( Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters param )
  throws Exception {
    String command = param.getParameter(PARAM_COMMAND);
    Source src = null;
   
    if ((param != null) && (command != null)) {
      try {
        src = resolver.resolveURI(command);
                File file = SourceUtil.getFile(src);
View Full Code Here

                    if (resolver == null) {
                        // we have no resolver : definitely don't know (need to have one)
                        return 0;
                    }
                    try {
                        Source newSrc = resolver.resolveURI((String)data.get(i+1));
                        int value = validity.isValid(newSrc.getValidity());
                        resolver.release(newSrc);
                        if (value != 1) {
                            return -1;
                        }
                    } catch(IOException ioe) {
View Full Code Here

        Document doc = null;
        String exceptionMsg = null;
       
        // invoke the source
        try {
            Source source = null;
            try {
                source = org.apache.cocoon.components.source.SourceUtil.getSource(authenticationResourceName,
                                                                                  null,
                                                                                  parameters,
                                                                                  this.resolver);
View Full Code Here

                        BundleFactory.ConfigurationKeys.ROOT_DIRECTORY,
                        "location"
                );

        debug("catalog location:" + location);
        Source source = null;
        try {
            source = sourceResolver.resolveURI(location);
            String systemId = source.getURI();
            debug("catalog directory:" + systemId);
            dirConf.setValue(systemId);
            configuration.addChild(dirConf);
        } finally {
            if (source != null)
View Full Code Here

TOP

Related Classes of org.apache.excalibur.source.Source

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.