Examples of ContextDescriptor


Examples of com.tacitknowledge.flip.context.ContextDescriptor

    }
   
    @Test
    public void testAnonymousAnnotatedMethodShouldBeMap() throws Exception {
        TestContextProvider contextProvider = new TestContextProvider();
        ContextDescriptor contextDescriptor = contextDescriptorFactory.createContextDescriptor(contextProvider);
       
        Method method = contextProvider.getClass().getMethod("getAnonMethod");
        assertThat(contextDescriptor.getAnonymousProperties(), Matchers.not(Matchers.hasItem(method)));
        assertThat(contextDescriptor.getProperties().values(), Matchers.not(Matchers.hasItem(method)));
    }
View Full Code Here

Examples of org.apache.avalon.meta.info.ContextDescriptor

        super( name );
    }

    protected Descriptor getDescriptor()
    {
        return new ContextDescriptor( m_classname, m_entries, getProperties() );
    }
View Full Code Here

Examples of org.apache.avalon.meta.info.ContextDescriptor

    }

    protected void checkDescriptor( Descriptor desc )
    {
        super.checkDescriptor( desc );
        ContextDescriptor ctxd = (ContextDescriptor) desc;

        assertEquals( m_classname, ctxd.getContextInterfaceClassname() );
        assertEquals( m_entries.length, ctxd.getEntries().length );

        EntryDescriptor[] entries = ctxd.getEntries();

        for ( int i = 0; i < m_entries.length; i++ )
        {
            assertEquals( m_entries[i], entries[i] );
            assertEquals( m_entries[i], ctxd.getEntry( m_entries[i].getKey() ) );
        }
    }
View Full Code Here

Examples of org.apache.avalon.meta.info.ContextDescriptor

        }
    }

    public void testJoin()
    {
        ContextDescriptor desc = (ContextDescriptor) getDescriptor();
        EntryDescriptor[] good = new EntryDescriptor[]{
            new EntryDescriptor( "key", String.class.getName() ),
            new EntryDescriptor( "no conflict", String.class.getName() )
        };
        EntryDescriptor[] bad = new EntryDescriptor[]{
            new EntryDescriptor( "key", Integer.class.getName() )
        };

        checkDescriptor( desc );
        EntryDescriptor[] merged = desc.merge( good );
        checkDescriptor( desc );

        // The items to merge in are first.  Shouldn't this be a set?
        assertEquals( good[0], merged[0] );
        assertEquals( good[1], merged[1] );
        assertEquals( m_entries[0], merged[2] );

        try
        {
            desc.merge( bad );
            fail( "Did not throw expected IllegalArgumentException" );
        }
        catch ( IllegalArgumentException iae )
        {
            // Success!!
View Full Code Here

Examples of org.apache.avalon.meta.info.ContextDescriptor

        final CategoryDescriptor[] loggers = new LoggerTag( getJavaClass() ).getCategories();
        final DependencyDescriptor[] dependencies =
          new DependencyTag( getJavaClass() ).getDependencies();
        final StageDescriptor[] stages = new StageTag( getJavaClass() ).getStages();
        final ExtensionDescriptor[] extensions = new ExtensionTag( getJavaClass() ).getExtensions();
        final ContextDescriptor context = new ContextTag( getJavaClass() ).getContext();

        return new Type( info, loggers, context, services, dependencies, stages, extensions, null );
    }
View Full Code Here

Examples of org.apache.avalon.meta.info.ContextDescriptor

    {
        JavaMethod[] methods = findTaggedMethods(
          getJavaClass(), getNS() + Tags.DELIMITER + ENTRY );
        if( methods.length == 0 )
        {
            return new ContextDescriptor( new EntryDescriptor[0] );
        }
        else
        {
           
            //
            // collect the @avalon.entry tags from this class and
            // all supertypes methods marked with @avalon.entry
            //

            final ArrayList list = new ArrayList();
            final Set marked = new HashSet( 10 );
            for( int j = 0; j < methods.length; j++ )
            {
                final DocletTag[] tags =
                  methods[j].getTagsByName( getNS() + Tags.DELIMITER + ENTRY );
                for( int i = 0; i < tags.length; i++ )
                {
                    final String key = getNamedParameter( tags[i], KEY_PARAM );
                    if( !marked.contains( key ) )
                    {
                        list.add( getEntry( tags[i] ) );
                        marked.add( key );
                    }
                }
            }

            final EntryDescriptor[] entries =
              (EntryDescriptor[])list.toArray( new EntryDescriptor[ list.size() ] );

            String type = null;
            String strategy = null;
            for( int j = 0; j < methods.length; j++ )
            {
                JavaMethod method = methods[j];
                final DocletTag tag = method.getTagByName( getNS() + Tags.DELIMITER + KEY );
                if( tag != null )
                {
                    type =
                      resolveType( getNamedParameter( tag, TYPE_PARAM, CONTEXT_CLASS ) );
                    strategy = getNamedParameter( tag, STRATEGY_PARAM, null );
                    break;
                }
            }

            Properties properties = null;
            if( strategy != null )
            {
                properties = new Properties();
                properties.setProperty(
                   ContextDescriptor.STRATEGY_KEY, strategy );
            }

            return new ContextDescriptor( type, entries, properties );
        }
    }
View Full Code Here

Examples of org.apache.avalon.meta.info.ContextDescriptor

        configuration = info.getChild( "loggers" );
        final CategoryDescriptor[] loggers = buildLoggers( configuration );

        configuration = info.getChild( "context" );
        final ContextDescriptor context = buildContext( configuration );

        configuration = info.getChild( "services" );
        final ServiceDescriptor[] services = buildServices( configuration );

        configuration = info.getChild( "dependencies" );
View Full Code Here

Examples of org.apache.avalon.meta.info.ContextDescriptor

        final Properties attributes =
          buildAttributes( context.getChild( "attributes" ) );

        String classname = context.getAttribute( "type", null );

        return new ContextDescriptor( classname, entrys, attributes );
    }
View Full Code Here

Examples of org.apache.avalon.meta.info.ContextDescriptor

        final InfoDescriptor descriptor =
          buildInfoDescriptor( classname, configuration );

        configuration = info.getChild( "loggers" );
        final CategoryDescriptor[] loggers = new CategoryDescriptor[0];
        final ContextDescriptor context =
          buildPhoenixContext();

        configuration = info.getChild( "services" );
        final ServiceDescriptor[] services =
          buildBlockServices( configuration );
View Full Code Here

Examples of org.apache.avalon.meta.info.ContextDescriptor

        EntryDescriptor home =
          new EntryDescriptor(
            ContextDescriptor.HOME_KEY,
            "java.io.File", false, false, "app.home" );

        return new ContextDescriptor( new EntryDescriptor[]{ name, partition, home } );
    }
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.