Package org.apache.avalon.framework.component

Examples of org.apache.avalon.framework.component.ComponentManager


                                                    Object value)
        throws Exception
    {
        // since no new components can be declared on sitemap we could
        // very well use the 'other' one here. Anyway, since it's there...
        ComponentManager sitemapManager = CocoonComponentManager.getSitemapComponentManager();
        ComponentSelector outputSelector = (ComponentSelector)sitemapManager
            .lookup(OutputModule.ROLE + "Selector");
        OutputModule output = (OutputModule) outputSelector.select(type);
        try {
            output.setAttribute(null, this.environment.getObjectModel(), attribute,
                                jsobjectToObject(value));
View Full Code Here


    public void jsFunction_outputModuleCommit(String type)
        throws Exception
    {
        // since no new components can be declared on sitemap we could
        // very well use the 'other' one here. Anyway, since it's there...
        ComponentManager sitemapManager = CocoonComponentManager.getSitemapComponentManager();
        ComponentSelector outputSelector = (ComponentSelector)sitemapManager
            .lookup(OutputModule.ROLE + "Selector");
        OutputModule output = (OutputModule) outputSelector.select(type);
        try {
            output.commit(null, this.environment.getObjectModel());
        } finally {
View Full Code Here

    public void jsFunction_outputModuleRollback(String type)
        throws Exception
    {
        // since no new components can be declared on sitemap we could
        // very well use the 'other' one here. Anyway, since it's there...
        ComponentManager sitemapManager = CocoonComponentManager.getSitemapComponentManager();
        ComponentSelector outputSelector = (ComponentSelector)sitemapManager
            .lookup(OutputModule.ROLE + "Selector");
        OutputModule output = (OutputModule) outputSelector.select(type);
        try {
            output.rollback(null, this.environment.getObjectModel(), null);
        } finally {
View Full Code Here

                ModifiableSource ws = (ModifiableSource) source;

                frag.normalize();

                if ( null != serializerName) {
          ComponentManager manager = CocoonComponentManager.getSitemapComponentManager();

                  ComponentSelector selector = null;
                  Serializer serializer = null;
                  OutputStream oStream = null;
                  try {
                       selector = (ComponentSelector)manager.lookup(Serializer.ROLE + "Selector");
                       serializer = (Serializer)selector.select(serializerName);
                       oStream = ws.getOutputStream();
                       serializer.setOutputStream(oStream);
                         serializer.startDocument();
                       DOMStreamer streamer = new DOMStreamer(serializer);
                       streamer.stream(frag);
                         serializer.endDocument();
                  } catch (ComponentException e) {
                    throw new ProcessingException("Unable to lookup serializer.", e);
          } finally {
                      if (oStream != null) {
                          oStream.flush();
                          try {
                              oStream.close();
                          } catch (Exception ignore) {
                            }
                        }
            if ( selector != null ) {
              selector.release( serializer );
              manager.release( selector );
            }
                  }
                } else {
                  final String content = XMLUtils.serializeNode(frag,
                                             XMLUtils.defaultSerializeToXMLFormat(false));
                  OutputStream oStream = ws.getOutputStream();
 
                  oStream.write(content.getBytes());
                  oStream.flush();
                  oStream.close();
                }
            } else {
              String content;
        if ( null != serializerName) {
          ComponentManager  manager = CocoonComponentManager.getSitemapComponentManager();
                   
                    ComponentSelector selector = null;
                    Serializer serializer = null;
                    ByteArrayOutputStream oStream = new ByteArrayOutputStream();
                    try {
                        selector = (ComponentSelector)manager.lookup(Serializer.ROLE + "Selector");
                        serializer = (Serializer)selector.select(serializerName);
                        serializer.setOutputStream(oStream);
                        serializer.startDocument();
                        DOMStreamer streamer = new DOMStreamer(serializer);
                        streamer.stream(frag);
                        serializer.endDocument();
          } catch (ComponentException e) {
            throw new ProcessingException("Unable to lookup serializer.", e);
                    } finally {
                        if (oStream != null) {
                            oStream.flush();
                            try {
                                oStream.close();
                            } catch (Exception ignore) {
                            }
                        }
            if ( selector != null ) {
              selector.release( serializer );
              manager.release( selector );
            }
                    }
          content = oStream.toString();
        } else {
                    content = XMLUtils.serializeNode(frag,
View Full Code Here

                ModifiableSource ws = (ModifiableSource) source;

                frag.normalize();

                if ( null != serializerName) {
          ComponentManager manager = CocoonComponentManager.getSitemapComponentManager();

                  ComponentSelector selector = null;
                  Serializer serializer = null;
                  OutputStream oStream = null;
                  try {
                       selector = (ComponentSelector)manager.lookup(Serializer.ROLE + "Selector");
                       serializer = (Serializer)selector.select(serializerName);
                       oStream = ws.getOutputStream();
                       serializer.setOutputStream(oStream);
                         serializer.startDocument();
                       DOMStreamer streamer = new DOMStreamer(serializer);
                       streamer.stream(frag);
                         serializer.endDocument();
                  } catch (ComponentException e) {
                    throw new ProcessingException("Unable to lookup serializer.", e);
          } finally {
                      if (oStream != null) {
                          oStream.flush();
                          try {
                              oStream.close();
                          } catch (Exception ignore) {
                            }
                        }
            if ( selector != null ) {
              selector.release( serializer );
              manager.release( selector );
            }
                  }
                } else {
                  final String content = XMLUtils.serializeNode(frag,
                                             XMLUtils.defaultSerializeToXMLFormat(false));
                  OutputStream oStream = ws.getOutputStream();
 
                  oStream.write(content.getBytes());
                  oStream.flush();
                  oStream.close();
                }
            } else {
              String content;
        if ( null != serializerName) {
          ComponentManager  manager = CocoonComponentManager.getSitemapComponentManager();
                   
                    ComponentSelector selector = null;
                    Serializer serializer = null;
                    ByteArrayOutputStream oStream = new ByteArrayOutputStream();
                    try {
                        selector = (ComponentSelector)manager.lookup(Serializer.ROLE + "Selector");
                        serializer = (Serializer)selector.select(serializerName);
                        serializer.setOutputStream(oStream);
                        serializer.startDocument();
                        DOMStreamer streamer = new DOMStreamer(serializer);
                        streamer.stream(frag);
                        serializer.endDocument();
          } catch (ComponentException e) {
            throw new ProcessingException("Unable to lookup serializer.", e);
                    } finally {
                        if (oStream != null) {
                            oStream.flush();
                            try {
                                oStream.close();
                            } catch (Exception ignore) {
                            }
                        }
            if ( selector != null ) {
              selector.release( serializer );
              manager.release( selector );
            }
                    }
          content = oStream.toString();
        } else {
                    content = XMLUtils.serializeNode(frag,
View Full Code Here

                if (isDebug) log("Adding SMTP gateway: " + server) ;
                gatewayServer.add(server);
            }
        }

        ComponentManager compMgr = (ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
        String outgoingPath = getInitParameter("outgoing");
        if (outgoingPath == null) {
            outgoingPath = "file:///../var/mail/outgoing";
        }

        try {
            // Instantiate the a MailRepository for outgoing mails
            MailStore mailstore = (MailStore) compMgr.lookup("org.apache.james.services.MailStore");

            DefaultConfiguration spoolConf
                = new DefaultConfiguration("repository", "generated:RemoteDelivery.java");
            spoolConf.setAttribute("destinationURL", outgoingPath);
            spoolConf.setAttribute("type", "SPOOL");
View Full Code Here

    /**
     * Fetch the repository of users
     */
    protected void initUsersRepository() throws Exception {
        ComponentManager compMgr = (ComponentManager) getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
        UsersStore usersStore = (UsersStore) compMgr.lookup("org.apache.james.services.UsersStore");
        String repName = getInitParameter("repositoryName");

        usersRepository = usersStore.getRepository(repName);
        if (usersRepository == null) throw new Exception("Invalid user repository: " + repName);
    }
View Full Code Here

        }
        if (getInitParameter("target_column") == null) {
            throw new MailetException("target_column not specified for JDBCAlias");
        }
        try {
            ComponentManager componentManager = (ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
            // Get the DataSourceSelector service
            DataSourceSelector datasources = (DataSourceSelector)componentManager.lookup(DataSourceSelector.ROLE);
            // Get the data-source required.
            datasource = (DataSourceComponent)datasources.select(datasourceName);

            conn = datasource.getConnection();
View Full Code Here

            delete = (getInitParameter("delete") == null) ? false : new Boolean(getInitParameter("delete")).booleanValue();
        } catch (Exception e) {
            // Ignore exception, default to false
        }

        ComponentManager compMgr = (ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
        try {
            MailStore mailstore = (MailStore) compMgr.lookup("org.apache.james.services.MailStore");
            DefaultConfiguration mailConf
                = new DefaultConfiguration("repository", "generated:ToRepository");
            mailConf.setAttribute("destinationURL", repositoryPath);
            mailConf.setAttribute("type", "MAIL");
            repository = (MailRepository) mailstore.select(mailConf);
View Full Code Here

        }

        Connection conn = null;

        try {
            ComponentManager componentManager = (ComponentManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
            // Get the DataSourceSelector service
            DataSourceSelector datasources = (DataSourceSelector)componentManager.lookup(DataSourceSelector.ROLE);
            // Get the data-source required.
            datasource = (DataSourceComponent)datasources.select(datasourceName);

            conn = datasource.getConnection();
View Full Code Here

TOP

Related Classes of org.apache.avalon.framework.component.ComponentManager

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.