/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.tuscany.sca.implementation.spring.introspect; import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllInterfaces; import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllPublicAndProtectedFields; import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllUniquePublicProtectedMethods; import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getPrivateFields; import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.toPropertyName; import java.lang.annotation.Annotation; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Type; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import javax.jws.WebService; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Contract; import org.apache.tuscany.sca.assembly.Multiplicity; import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor; import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper; import org.apache.tuscany.sca.implementation.java.introspect.impl.AmbiguousConstructorException; import org.apache.tuscany.sca.implementation.java.introspect.impl.InvalidServiceType; import org.apache.tuscany.sca.implementation.java.introspect.impl.NoConstructorException; import org.apache.tuscany.sca.implementation.java.introspect.impl.Resource; import org.apache.tuscany.sca.implementation.spring.SpringConstructorArgElement; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper; import org.osoa.sca.annotations.Callback; import org.osoa.sca.annotations.Context; import org.osoa.sca.annotations.Property; import org.osoa.sca.annotations.Reference; import org.osoa.sca.annotations.Remotable; /** * Heuristically evaluates an un-annotated Java implementation type to determine * services, references, and properties according to the algorithm described in * the SCA Java Client and Implementation Model Specification
TODO * Implement: When no service interface is annotated, need to calculate a * single service comprising all public methods that are not reference or * property injection sites. If that service can be exactly mapped to an * interface implemented by the class then the service interface will be defined * in terms of that interface. * * @version $Rev: 689426 $ $Date: 2008-08-27 14:56:06 +0530 (Wed, 27 Aug 2008) $ */ public class SpringBeanPojoProcessor extends BaseJavaClassVisitor { private JavaInterfaceFactory javaFactory; private List
* The name of the reference or of the property is derived from the
* name found on the setter method or on the field.
*/
private boolean isReferenceType(Class> cls, Type genericType) {
Class> baseType = JavaIntrospectionHelper.getBaseType(cls, genericType);
return baseType.isInterface() && baseType.isAnnotationPresent(Remotable.class);
}
/**
* Returns true if the given operation is defined in the collection of
* service interfaces
*/
private boolean isInServiceInterface(Method operation, List