Package org.apache.axis.utils.cache

Examples of org.apache.axis.utils.cache.JavaClass


    }

    public void testNoSuchMethod()
    {
        Class v = new java.util.Vector().getClass();
        JavaClass jcVec = new JavaClass(v);

        Method add7 = jcVec.getMethod("add", 7);
        assertNull("add7 was not null", add7);
    }
View Full Code Here


    }

    public void testUnknownNumberOfArgs()
    {
        Class v = new java.util.Vector().getClass();
        JavaClass jcVec = new JavaClass(v);

        Method add7 = jcVec.getMethod("add", -1);
        assertNull("add7 was not null", add7);

        Method insertElementAt = jcVec.getMethod("insertElementAt", -1);
        assertEquals("Length was not 2, it was: " + insertElementAt.getParameterTypes().length,
                     2, insertElementAt.getParameterTypes().length);
        assertEquals("Return type was not 'void', it was: " + insertElementAt.getReturnType().getName(),
                     "void", insertElementAt.getReturnType().getName());
    }
View Full Code Here

            int             i ;

            Object obj        = getServiceObject(msgContext,
                                                 service,
                                                 clsName);
            JavaClass jc    = JavaClass.find(obj.getClass());

            Message        reqMsg  = msgContext.getRequestMessage();
            SOAPEnvelope   reqEnv  = (SOAPEnvelope)reqMsg.getSOAPPart().getAsSOAPEnvelope();
            Message        resMsg  = msgContext.getResponseMessage();
            SOAPEnvelope   resEnv  = (resMsg == null) ?
View Full Code Here

        } catch( Exception exp ) {
            category.error( exp );
            throw AxisFault.makeFault(exp);
        }

        JavaClass jc    = JavaClass.find(obj.getClass());
        String  allowedMethods = getServiceAllowedMethods(service);

        /** ??? Should we enforce setting methodName?  As it was,
         * if it's null, we allowed any method.  This seems like it might
         * be considered somewhat insecure (it's an easy mistake to
         * make).  Tossing an Exception if it's not set, and using "*"
         * to explicitly indicate "any method" is probably better.
         */
        if ((allowedMethods == null) || allowedMethods.equals(""))
          throw new AxisFault("Server.NoMethodConfig",
            JavaUtils.getMessage("noOption00", getServiceClassNameOptionName(), serviceName),
            null, null);

        if (allowedMethods.equals("*"))
          allowedMethods = null;

        /** If the class knows what it should be exporting,
        * respect its wishes.
        */
        if (obj instanceof AxisServiceConfig) {
            allowedMethods = ((AxisServiceConfig)obj).getMethods();
        }

        try {
            AxisClassLoader cl     = msgContext.getClassLoader();
            Class           cls    = jc.getJavaClass();
            String url = msgContext.getStrProp(MessageContext.TRANS_URL);
            String urn = (String)msgContext.getTargetService();
            String description = "Service";
            Document doc = WSDLUtils.writeWSDLDoc(cls, allowedMethods,
                    url, urn, description, msgContext);
View Full Code Here

    protected Object getNewServiceObject(MessageContext msgContext,
                                             String clsName)
        throws Exception
    {
        AxisClassLoader cl     = msgContext.getClassLoader();
        JavaClass       jc     = cl.lookup(clsName);

        return jc.getJavaClass().newInstance();
    }
View Full Code Here

        String  clsName    = (String) service.getOption( "className" );

        try {
            AxisClassLoader cl     = msgContext.getClassLoader();
            JavaClass       jc     = cl.lookup(clsName);
            Class           cls    = jc.getJavaClass();
           
            if (category.isDebugEnabled()) {
                category.debug(JavaUtils.getMessage(
                        "lookup00", methodName, clsName));
            }

            // try to find the method without knowing the number of
            // parameters.  If we are successful, we can make better
            // decisions about what deserializers to use for parameters
            Method method = jc.getMethod(methodName, -1);
            if (method != null) defaultParamTypes = method.getParameterTypes();
           
            // !!! This should be smart enough to deal with overloaded
            // methods - we should really be keeping a list of all of
            // the possibilities, then moving down the list to keep
View Full Code Here

        }

        if (clsName != null) {
            ClassLoader cl       = msgContext.getClassLoader();
            ClassCache cache     = msgContext.getAxisEngine().getClassCache();
            JavaClass       jc   = null;
            try {
                jc = cache.lookup(clsName, cl);
            } catch (ClassNotFoundException e) {
                throw new SAXException(e);
            }
           
            if (log.isDebugEnabled()) {
                log.debug(JavaUtils.getMessage(
                        "lookup00", name, clsName));
            }
           
            Method[] method = jc.getMethod(name);
            int numChildren = (getChildren() == null) ? 0 : getChildren().size();
            if (method != null) {
                for (int i = 0; i < method.length; i++) {
                    defaultParamTypes = method[i].getParameterTypes();
                    if (defaultParamTypes.length >= numChildren) {
View Full Code Here

    }

    public synchronized void registerClass( String name, Class cls ) {
        /* And finally register it */
        /***************************/
        JavaClass oldClass = (JavaClass)classCache.get(name);
        if (oldClass!=null && oldClass.getJavaClass()==cls) return;
        classCache.put( name, new JavaClass(cls) );
    }
View Full Code Here

     * if necessary.
     * @param className name of the class desired
     * @return JavaClass entry
     */
    public JavaClass lookup(String className) throws ClassNotFoundException {
        JavaClass jc = (JavaClass) classCache.get( className );
        if ( jc == null ) {
            loadClass( className );
            jc = (JavaClass) classCache.get( className );
        }

View Full Code Here

            int             i ;

            Object obj        = getServiceObject(msgContext,
                                                 service,
                                                 clsName);
            JavaClass jc    = JavaClass.find(obj.getClass());

            Message        reqMsg  = msgContext.getRequestMessage();
            SOAPEnvelope   reqEnv  = (SOAPEnvelope)reqMsg.getSOAPEnvelope();
            Message        resMsg  = msgContext.getResponseMessage();
            SOAPEnvelope   resEnv  = (resMsg == null) ?
View Full Code Here

TOP

Related Classes of org.apache.axis.utils.cache.JavaClass

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.