Package org.apache.avalon.framework.service

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


    {
        final String key = Role4.ROLE;
        final String type = "Factory";

        final ServiceManager serviceManager = getServiceManager();
        final BaseRole object1 = (BaseRole) serviceManager.lookup( key );
        final BaseRole object2 = (BaseRole) serviceManager.lookup( key );

        assertTrue( type + " object IDs (1 vs 2)", object1.getID() != object2.getID() );

        final Thread thread = new Thread()
View Full Code Here


        final String key = Role4.ROLE;
        final String type = "Factory";

        final ServiceManager serviceManager = getServiceManager();
        final BaseRole object1 = (BaseRole) serviceManager.lookup( key );
        final BaseRole object2 = (BaseRole) serviceManager.lookup( key );

        assertTrue( type + " object IDs (1 vs 2)", object1.getID() != object2.getID() );

        final Thread thread = new Thread()
        {
View Full Code Here

        {
            public void run()
            {
                try
                {
                    final BaseRole object3 = (BaseRole) serviceManager.lookup( key );
                    final BaseRole object4 = (BaseRole) serviceManager.lookup( key );

                    assertTrue( type + " object IDs (1 vs 3)", object1.getID() != object3.getID() );
                    assertTrue( type + " object IDs (2 vs 4)", object2.getID() != object4.getID() );
                    assertTrue( type + " object IDs (3 vs 4)", object3.getID() != object4.getID() );
View Full Code Here

            public void run()
            {
                try
                {
                    final BaseRole object3 = (BaseRole) serviceManager.lookup( key );
                    final BaseRole object4 = (BaseRole) serviceManager.lookup( key );

                    assertTrue( type + " object IDs (1 vs 3)", object1.getID() != object3.getID() );
                    assertTrue( type + " object IDs (2 vs 4)", object2.getID() != object4.getID() );
                    assertTrue( type + " object IDs (3 vs 4)", object3.getID() != object4.getID() );
                }
View Full Code Here

    public void testPoolable()
        throws Exception
    {
        final ServiceManager serviceManager = getServiceManager();
        final String key = Role2.ROLE;
        final BaseRole object1 = (BaseRole) serviceManager.lookup( key );
        final BaseRole object2 = (BaseRole) serviceManager.lookup( key );
        final BaseRole object3 = (BaseRole) serviceManager.lookup( key );

        serviceManager.release( object1 );
        serviceManager.release( object2 );
View Full Code Here

        throws Exception
    {
        final ServiceManager serviceManager = getServiceManager();
        final String key = Role2.ROLE;
        final BaseRole object1 = (BaseRole) serviceManager.lookup( key );
        final BaseRole object2 = (BaseRole) serviceManager.lookup( key );
        final BaseRole object3 = (BaseRole) serviceManager.lookup( key );

        serviceManager.release( object1 );
        serviceManager.release( object2 );
        serviceManager.release( object3 );
View Full Code Here

    {
        final ServiceManager serviceManager = getServiceManager();
        final String key = Role2.ROLE;
        final BaseRole object1 = (BaseRole) serviceManager.lookup( key );
        final BaseRole object2 = (BaseRole) serviceManager.lookup( key );
        final BaseRole object3 = (BaseRole) serviceManager.lookup( key );

        serviceManager.release( object1 );
        serviceManager.release( object2 );
        serviceManager.release( object3 );
    }
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.");
                            if (!(node instanceof Element))
View Full Code Here

        try {
            ServiceManager sitemapManager = (ServiceManager) this.context.get(ContextHelper.CONTEXT_SITEMAP_SERVICE_MANAGER);
            ServiceSelector serializerSelector = null;
            Serializer serializer = null;
            try {
                serializerSelector = (ServiceSelector) sitemapManager.lookup(Serializer.ROLE+"Selector");
                serializer = (Serializer) serializerSelector.select("xml");
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                serializer.setOutputStream(os);
                this.toSAX(serializer);
                return new ByteArrayInputStream(os.toByteArray());
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.