Package org.apache.avalon.framework.service

Examples of org.apache.avalon.framework.service.ServiceManager.lookup()


     */
    protected Application getApplication(final String appName)
    throws Exception {
        final ServiceManager current = (ServiceManager)
                   this.context.get(ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER);
        Object o = current.lookup(Application.class.getName() + '/' + appName);
        if ( o == null ) {
            throw new ConfigurationException(
                           "Application '" + appName + "' not found."
                       );
        }
View Full Code Here


            DocumentFragment domTemplate = null;

            String src = DomHelper.getAttribute(bindingElm, "src", null);
            if (src != null) {
                ServiceManager manager = assistant.getServiceManager();
                SourceResolver sourceResolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
                Source source = null;
                try {
                    source = sourceResolver.resolveURI(src);
                    Document document = SourceUtil.toDOM(source);
                    Element element = document.getDocumentElement();
View Full Code Here

                    Document document = SourceUtil.toDOM(source);
                    Element element = document.getDocumentElement();

                    String xpath = DomHelper.getAttribute(bindingElm, "xpath", null);
                    if (xpath != null) {
                        XPathProcessor xpathProcessor = (XPathProcessor) manager.lookup(XPathProcessor.ROLE);
                        try {
                            Node node = xpathProcessor.selectSingleNode(document, xpath);
                            if (node == null) {
                                throw new BindingException("XPath expression '" + xpath + "' didn't return a result.",
                                                           DomHelper.getLocationObject(bindingElm));
View Full Code Here

                    Invoker.executeNode(consumer, val, stripRoot);
                else {
                    ServiceManager serviceManager = executionContext.getServiceManager();
                    SAXParser parser = null;
                    try {
                        parser = (SAXParser) serviceManager.lookup(SAXParser.ROLE);
                        InputSource source = new InputSource(new ByteArrayInputStream(val.toString().getBytes()));
                        IncludeXMLConsumer includeConsumer = new IncludeXMLConsumer(consumer);
                        includeConsumer.setIgnoreRootElement(stripRoot);
                        parser.parse(source, includeConsumer);
                    } finally {
View Full Code Here

     */
    public void init() throws MessagingException {
        super.init();
        ServiceManager compMgr = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
        try {
            mailServer = (MailServer) compMgr.lookup(MailServer.ROLE);
        } catch (ServiceException e) {
            log("Exception in getting the MailServer: " + e.getMessage() + e.getKey());
        }
        try {
            localusers = (UsersRepository) compMgr.lookup(UsersRepository.ROLE);
View Full Code Here

            mailServer = (MailServer) compMgr.lookup(MailServer.ROLE);
        } catch (ServiceException e) {
            log("Exception in getting the MailServer: " + e.getMessage() + e.getKey());
        }
        try {
            localusers = (UsersRepository) compMgr.lookup(UsersRepository.ROLE);
        } catch (ServiceException e) {
            log("Exception in getting the UsersStore: " + e.getMessage() + e.getKey());
        }
    }
View Full Code Here

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

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

            outgoingPath = "file:///../var/mail/outgoing";
        }

        try {
            // Instantiate the a MailRepository for outgoing mails
            Store mailstore = (Store) compMgr.lookup(Store.ROLE);

            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() {
        ServiceManager compMgr = (ServiceManager) getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
        try {
            UsersStore usersStore = (UsersStore) compMgr.lookup(UsersStore.ROLE);
            String repName = getInitParameter("repositoryName");

            usersRepository = usersStore.getRepository(repName);
        } catch (Exception e) {
            log("Failed to retrieve Store component:" + e.getMessage());
View Full Code Here

        ServiceManager manager = ctx.getServiceManager();

        XPathProcessor xpathProcessor = null;
        try {
            try {
                xpathProcessor = (XPathProcessor)manager.lookup(XPathProcessor.ROLE);
            } catch (Exception e) {
                throw new SAXException("XPointerPart: error looking up XPathProcessor.", e);
            }
            NodeList nodeList = xpathProcessor.selectNodeList(document, expression, ctx);
            if (nodeList.getLength() > 0) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.