Examples of ServiceContract


Examples of com.bj58.spat.gaea.server.contract.annotation.ServiceContract

        }
       
        for (Class<?> cls : clsSet) {
            try {
              ServiceBehavior behavior = cls.getAnnotation(ServiceBehavior.class);
              ServiceContract contract = cls.getAnnotation(ServiceContract.class);
              if(behavior == null && contract == null) {
                continue;
              }
             
              if(contract != null) {
View Full Code Here

Examples of com.bj58.spat.gaea.server.contract.annotation.ServiceContract

   *
   * @param cls
   * @return
   */
  protected static ClassInfo contract(Class<?> cls) {
    ServiceContract contractAnn = cls.getAnnotation(ServiceContract.class);
   
    ClassInfo ci = new ClassInfo();
    ci.setCls(cls);
    ci.setClassType(ClassInfo.ClassType.INTERFACE);

    List<Class<?>> interfaceList = getInterfaces(cls);
    List<ClassInfo.MethodInfo> methodInfos = new ArrayList<ClassInfo.MethodInfo>();

    for(Class<?> interfaceCls : interfaceList) {
      Method[] methods = interfaceCls.getDeclaredMethods();
      if(contractAnn != null && contractAnn.defaultAll()) {
         for(Method m : methods) {
           if(Modifier.isPublic(m.getModifiers()) || Modifier.isProtected(m.getModifiers())) {
             ClassInfo.MethodInfo mi = new ClassInfo.MethodInfo();
             mi.setMethod(m);
             methodInfos.add(mi);
View Full Code Here

Examples of org.apache.tuscany.model.assembly.ServiceContract

            AssemblyFactory factory = modelContext.getAssemblyFactory();
            componentType = factory.createComponentType();
            for (EntryPoint entryPoint : getEntryPoints()) {
                Service service = factory.createService();
                service.setName(entryPoint.getName());
                ServiceContract serviceContract = entryPoint.getConfiguredService().getPort().getServiceContract();
                if (serviceContract != null)
                    service.setServiceContract(serviceContract);
                componentType.getServices().add(service);

                ConfiguredReference configuredReference = entryPoint.getConfiguredReference();
                ServiceURI sourceURI = factory.createServiceURI(null, entryPoint, configuredReference);
                for (String target : configuredReference.getTargets()) {
                    ServiceURI targetURI = factory.createServiceURI(null, target);
                    Wire wire = factory.createWire();
                    wire.setSource(sourceURI);
                    wire.setTarget(targetURI);
                    getWires().add(wire);
                }
            }
            for (ExternalService externalService : getExternalServices()) {
                if (externalService.getOverrideOption() == null || externalService.getOverrideOption() == OverrideOption.NO)
                    continue;
                Reference reference = factory.createReference();
                reference.setName(externalService.getName());
                ServiceContract serviceContract = externalService.getConfiguredService().getPort().getServiceContract();
                if (serviceContract != null)
                    reference.setServiceContract(serviceContract);
                componentType.getReferences().add(reference);
            }
            for (Component<Implementation> component : getComponents()) {
View Full Code Here

Examples of org.apache.tuscany.model.assembly.ServiceContract

    public void testServiceBasicProcessing() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(TestComponentImpl.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(TestComponent.class, contract.getInterface());
        assertEquals(Scope.MODULE, contract.getScope());
    }
View Full Code Here

Examples of org.apache.tuscany.model.assembly.ServiceContract

     */
    public void testSingleServiceProcessing() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(TestLocalComponentImpl.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(TestLocalComponent.class, contract.getInterface());
        assertEquals(Scope.MODULE, contract.getScope());
    }
View Full Code Here

Examples of org.apache.tuscany.model.assembly.ServiceContract

     */
    public void testInteraceHierarchyServiceProcessing() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(SuperFooImpl.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(SuperSuperFoo.class, contract.getInterface());
    }
View Full Code Here

Examples of org.apache.tuscany.model.assembly.ServiceContract

     */
    public void testNonServiceProcessing() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(TestNonServiceInterfacesImpl.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(TestNonServiceInterfacesImpl.class, contract.getInterface());
        assertEquals(Scope.MODULE, contract.getScope());
    }
View Full Code Here

Examples of org.apache.tuscany.model.assembly.ServiceContract

     */
    public void testNonServiceSpecifiedProcessing() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(TestNonServiceSpecifiedImpl.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(TestNonServiceInterface.class, contract.getInterface());
        assertEquals(Scope.MODULE, contract.getScope());
    }
View Full Code Here

Examples of org.apache.tuscany.model.assembly.ServiceContract

     */
    public void testParentScopeEvaluation() throws Exception {
        ComponentType type = factory.createComponentType();
        introspector.introspect(ScopeTestComponent.class, type);
        assertEquals(1, type.getServices().size());
        ServiceContract contract = type.getServices().get(0).getServiceContract();
        assertEquals(Scope.MODULE, contract.getScope());
    }
View Full Code Here

Examples of org.apache.tuscany.model.assembly.ServiceContract

                    public Service getPort() {
                        return new Service() {

                            public ServiceContract getServiceContract() {
                                return new ServiceContract() {

                                    public Class getInterface() {
                                        return Foo.class;
                                    }
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.