Package org.apache.hivemind.service

Examples of org.apache.hivemind.service.MethodIterator


    protected Set getInterceptedMethods(InterceptorStack stack, List parameters)
    {
        Set methods = new HashSet();
        MethodMatcher matcher = buildMethodMatcher(parameters);

        MethodIterator mi = new MethodIterator(stack.getServiceInterface());

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            if (includeMethod(matcher, sig))
                methods.add(sig);
        }
        return methods;
View Full Code Here


    protected void addServiceMethods(InterceptorStack stack, ClassFab fab, List parameters)
    {
        MethodMatcher matcher = buildMethodMatcher(parameters);

        MethodIterator mi = new MethodIterator(stack.getServiceInterface());

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            if (includeMethod(matcher, sig))
                addServiceMethodImplementation(fab, sig);
            else
                addPassThruMethodImplementation(fab, sig);
        }

        if (!mi.getToString())
            addToStringMethod(stack, fab);
    }
View Full Code Here

        List serviceMethods = new ArrayList();
        List filterMethods = new ArrayList();

        createInfrastructure();

        MethodIterator mi = new MethodIterator(_serviceInterface);

        while (mi.hasNext())
        {
            serviceMethods.add(mi.next());
        }

        boolean toStringMethodExists = mi.getToString();

        mi = new MethodIterator(_filterInterface);

        while (mi.hasNext())
        {
            filterMethods.add(mi.next());
        }

        while (!serviceMethods.isEmpty())
        {
            MethodSignature ms = (MethodSignature) serviceMethods.remove(0);
View Full Code Here

        ClassFab cf = _classFactory.newClass(name, Object.class);

        cf.addInterface(interfaceType);

        MethodIterator mi = new MethodIterator(interfaceType);

        while (mi.hasNext())
        {
            ClassFabUtils.addNoOpMethod(cf, mi.next());
        }

        if (!mi.getToString())
            ClassFabUtils.addToStringMethod(cf, ImplMessages
                    .defaultImplementationDescription(interfaceType));

        return cf.createClass();
    }
View Full Code Here

    }

    private void addMethods(ClassFab cf, String serviceId, Class serviceInterface,
            String propertyName, Object targetService)
    {
        MethodIterator mi = new MethodIterator(serviceInterface);

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            String body = "return ($r) _targetServiceProperty()." + sig.getName() + "($$);";

            cf.addMethod(Modifier.PUBLIC, sig, body);
        }

        if (!mi.getToString())
            ClassFabUtils.addToStringMethod(cf, ImplMessages.servicePropertyToString(
                    serviceId,
                    serviceInterface,
                    propertyName,
                    targetService));
View Full Code Here

        { commands, toString });
    }

    void addMethods(ClassFab cf, Class commandInterface)
    {
        MethodIterator mi = new MethodIterator(commandInterface);

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            addMethod(cf, commandInterface, sig);
        }

        if (!mi.getToString())
            addToString(cf);
    }
View Full Code Here

        cf.addMethod(Modifier.PRIVATE, new MethodSignature(serviceInterface, "_getStrategy",
                new Class[]
                { Object.class }, null), "return (" + serviceInterface.getName()
                + ") _registry.getStrategy($1.getClass());");

        MethodIterator i = new MethodIterator(serviceInterface);

        while (i.hasNext())
        {
            MethodSignature sig = i.next();

            if (proper(sig))
            {
                addAdaptedMethod(cf, sig);
            }
            else
            {
                ClassFabUtils.addNoOpMethod(cf, sig);

                factoryParameters.getErrorLog().error(
                        StrategyMessages.improperServiceMethod(sig),
                        HiveMind.getLocation(factoryParameters.getFirstParameter()),
                        null);
            }

        }

        if (!i.getToString())
            ClassFabUtils.addToStringMethod(cf, StrategyMessages.toString(factoryParameters
                    .getServiceId(), serviceInterface));

        return cf.createClass();
    }
View Full Code Here

        ClassFab classFab,
        Class serviceInterface,
        String serviceId,
        String jndiName)
    {
        MethodIterator mi = new MethodIterator(serviceInterface);

        while (mi.hasNext())
        {
            addServiceMethod(classFab, mi.next());
        }

        if (!mi.getToString())
            addToStringMethod(classFab, serviceInterface, serviceId, jndiName);
    }
View Full Code Here

    protected Set getInterceptedMethods(InterceptorStack stack, List parameters)
    {
        Set methods = new HashSet();
        MethodMatcher matcher = buildMethodMatcher(parameters);

        MethodIterator mi = new MethodIterator(stack.getServiceInterface());

        while (mi.hasNext())
        {
            MethodSignature sig = mi.next();

            if (includeMethod(matcher, sig))
                methods.add(sig);
        }
        return methods;
View Full Code Here

     */
    public void addServiceMethods(String indirection, boolean addToString)
    {
        BodyBuilder builder = new BodyBuilder();

        MethodIterator mi = new MethodIterator(_serviceInterface);
        while (mi.hasNext())
        {
            MethodSignature m = mi.next();
            if( !_classFab.containsMethod( m ) )
            {
                builder.clear();
                builder.begin();
                builder.add("return ($r) ");
                builder.add(indirection);
                builder.add(".");
                builder.add(m.getName());
                builder.addln("($$);");
                builder.end();
                _classFab.addMethod(Modifier.PUBLIC, m, builder.toString());
            }
        }

        if (!mi.getToString() && addToString)
            ClassFabUtils.addToStringMethod(_classFab, "<" + _type + " for \" + _extensionPointId + \""
                    + "(" + _serviceInterface.getName() + ")>");
    }
View Full Code Here

TOP

Related Classes of org.apache.hivemind.service.MethodIterator

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.