Package org.jboss.wsf.spi.metadata.j2ee.serviceref

Examples of org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData


*/
public class WebServiceReferences {


    public static ManagedReferenceFactory createWebServiceFactory(final DeploymentUnit deploymentUnit, final String targetType, final WSRefAnnotationWrapper wsRefDescription, final AnnotatedElement target, String bindingName) throws DeploymentUnitProcessingException {
        final UnifiedServiceRefMetaData serviceRefUMDM = createServiceRef(deploymentUnit, targetType, wsRefDescription, target, bindingName, bindingName);
        final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
        return new WebServiceManagedReferenceFactory(serviceRefUMDM, module.getClassLoader());
    }
View Full Code Here


        final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
        return new WebServiceManagedReferenceFactory(serviceRefUMDM, module.getClassLoader());
    }

    public static ManagedReferenceFactory createWebServiceFactory(final DeploymentUnit deploymentUnit, final String targetType, final WSRefAnnotationWrapper wsRefDescription, final AnnotatedElement target, String bindingName, final String refKey) throws DeploymentUnitProcessingException {
        final UnifiedServiceRefMetaData serviceRefUMDM = createServiceRef(deploymentUnit, targetType, wsRefDescription, target, bindingName, refKey);
        final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
        return new WebServiceManagedReferenceFactory(serviceRefUMDM, module.getClassLoader());
    }
View Full Code Here

        return new WebServiceManagedReferenceFactory(serviceRefUMDM, module.getClassLoader());
    }

    private static UnifiedServiceRefMetaData createServiceRef(final DeploymentUnit unit, final String type, final WSRefAnnotationWrapper annotation, final AnnotatedElement annotatedElement, final String bindingName, final String refKey) throws DeploymentUnitProcessingException {
        final WSRefRegistry wsRefRegistry = ASHelper.getWSRefRegistry(unit);
        UnifiedServiceRefMetaData serviceRefUMDM = wsRefRegistry.get(refKey);
        if (serviceRefUMDM == null) {
            serviceRefUMDM = new UnifiedServiceRefMetaData(getUnifiedVirtualFile(unit), bindingName);
            wsRefRegistry.add(refKey, serviceRefUMDM);
        }
        initServiceRef(unit, serviceRefUMDM, type, annotation);
        processWSFeatures(serviceRefUMDM, annotatedElement);
        return serviceRefUMDM;
View Full Code Here

            return Collections.<BindingConfiguration> emptyList();
        }

        final List<BindingConfiguration> bindingDescriptions = new LinkedList<BindingConfiguration>();
        for (final ServiceReferenceMetaData serviceRefMD : serviceRefsMD) {
            final UnifiedServiceRefMetaData serviceRefUMDM = getServiceRef(unit, componentDescription, serviceRefMD);
            final Module module = unit.getAttachment(Attachments.MODULE);
            WebServiceManagedReferenceFactory factory = new WebServiceManagedReferenceFactory(serviceRefUMDM, module.getClassLoader());
            final FixedInjectionSource valueSource = new FixedInjectionSource(factory, factory);
            final BindingConfiguration bindingConfiguration = new BindingConfiguration(serviceRefUMDM.getServiceRefName(), valueSource);
            bindingDescriptions.add(bindingConfiguration);
            final String serviceRefTypeName = serviceRefUMDM.getServiceRefType();
            final Class<?> serviceRefType = getClass(classLoader, serviceRefTypeName);
            processInjectionTargets(resourceInjectionTarget, valueSource, classLoader, deploymentReflectionIndex, serviceRefMD, serviceRefType);
        }
        return bindingDescriptions;
    }
View Full Code Here

        //check jaxrpc service refs
        if (serviceRefMD.getJaxrpcMappingFile() != null || "javax.xml.rpc.Service".equals(serviceRefMD.getServiceInterface())) {
            throw WSLogger.ROOT_LOGGER.jaxRpcNotSupported();
        }
        // construct service ref
        final UnifiedServiceRefMetaData serviceRefUMDM = translate(serviceRefMD);
        serviceRefUMDM.setVfsRoot(getUnifiedVirtualFile(unit));
        processWSFeatures(unit, serviceRefMD.getInjectionTargets(), serviceRefUMDM);
        final WSRefRegistry wsRefRegistry = ASHelper.getWSRefRegistry(unit);
        wsRefRegistry.add(getCacheKey(componentDescription, serviceRefUMDM), serviceRefUMDM);
        return serviceRefUMDM;
    }
View Full Code Here

            return null;
        return createServiceRef(annotationInstance, annotationTarget, vfs);
    }

    protected UnifiedServiceRefMetaData createServiceRef(AnnotationInstance annotationInstance, E annotationTarget, UnifiedVirtualFile vfs) {
        final UnifiedServiceRefMetaData ref = new UnifiedServiceRefMetaData(vfs);
        final AnnotationValue declaredNameValue = annotationInstance.value("name");
        String nameValue = declaredNameValue == null ? "" : declaredNameValue.asString();
        if (nameValue.length() == 0)
            nameValue = getName(annotationTarget);
        ref.setServiceRefName(nameValue);
        // TODO handle mappedName
        // final AnnotationValue declaredMappedNameValue = annotationInstance.value("mappedName");
        //String mappedNameValue = declaredMappedNameValue == null ? "" : declaredMappedNameValue.asString();
        final AnnotationValue declaredWsdlLocation = annotationInstance.value("wsdlLocation");
        String wsdlLocationValue = declaredWsdlLocation == null ? "" : declaredWsdlLocation.asString();
        if (wsdlLocationValue.length() > 0)
            ref.setWsdlFile(wsdlLocationValue);
        final AnnotationValue declaredTypeValue = annotationInstance.value("type");
        DotName declaredType = declaredTypeValue != null ? declaredTypeValue.asClass().name() : null;
        if (declaredType != null && declaredType.toString() != Object.class.getName()) {
            ref.setServiceRefType(declaredType.toString());
        } else
            ref.setServiceRefType(getType(annotationTarget));

        final AnnotationValue declaredValue = annotationInstance.value("value");
        DotName value = declaredValue != null ? declaredValue.asClass().name() : null;
        if (declaredValue != null && !declaredValue.toString().equals(Service.class.getName())) {
            ref.setServiceInterface(value.toString());
        }
        else {
            ClassInfo targetClass = getTypeInfo(annotationTarget);
            // FIXME
            if (targetClass != null/* && isAssignableFrom(targetClass, DotName.createSimple(Service.class.getName()))*/) {
                ref.setServiceInterface(getTypeInfo(annotationTarget).name().toString());
            }
        }

        final boolean isJAXRPC = ref.getMappingFile() != null // TODO: is mappingFile check required?
        || "javax.xml.rpc.Service".equals(ref.getServiceInterface());
        ref.setType(isJAXRPC ? Type.JAXRPC : Type.JAXWS);
        return ref;
    }
View Full Code Here

      return spiProvider.getSPI(ServiceRefBinderFactory.class).newServiceRefBinder(Type.JAXWS);
   }

   public ServiceRefMetaData newServiceRefMetaData()
   {
      return new UnifiedServiceRefMetaData();
   }
View Full Code Here

            }

         }
      }

      UnifiedServiceRefMetaData serviceRef = (UnifiedServiceRefMetaData)sref;
      serviceRef.setVfsRoot(vfsRoot);
      try
      {
         if (getServiceRefType(serviceRef, loader) == Type.JAXRPC)
         {
            getJaxrpcBinder().setupServiceRef(encCtx, encName, null, serviceRef, loader);
View Full Code Here

         // Get the target class name
         String targetClassName = (String)ref.get(ServiceReferenceable.TARGET_CLASS_NAME).getContent();

         // Unmarshall the UnifiedServiceRef
         UnifiedServiceRefMetaData serviceRef = unmarshallServiceRef(ref);
         String serviceRefName = serviceRef.getServiceRefName();
         QName serviceQName = serviceRef.getServiceQName();

         String serviceImplClass = serviceRef.getServiceImplClass();
         if (serviceImplClass == null)
            serviceImplClass = (String)ref.get(ServiceReferenceable.SERVICE_IMPL_CLASS).getContent();

         // If the target defaults to javax.xml.ws.Service, use the service as the target
         if (Service.class.getName().equals(targetClassName))
            targetClassName = serviceImplClass;
        
         log.debug("[name=" + serviceRefName + ",service=" + serviceImplClass + ",target=" + targetClassName + "]");

         // Load the service class
         ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
         Class serviceClass = ctxLoader.loadClass(serviceImplClass);
         Class targetClass = (targetClassName != null ? ctxLoader.loadClass(targetClassName) : null);

         if (Service.class.isAssignableFrom(serviceClass) == false)
            throw new IllegalArgumentException("WebServiceRef type '" + serviceClass + "' is not assignable to javax.xml.ws.Service");
        
         log.debug("Loaded Service '" + serviceClass.getName() + "' from: " + serviceClass.getProtectionDomain().getCodeSource());

         // Receives either a javax.xml.ws.Service or a dynamic proxy
         Object target;

         // Get the URL to the wsdl
         URL wsdlURL = serviceRef.getWsdlLocation();
         try
         {
            // Associate the ServiceRefMetaData with this thread
            serviceRefAssociation.set(serviceRef);
View Full Code Here

      }
   }

   private UnifiedServiceRefMetaData unmarshallServiceRef(Reference ref) throws ClassNotFoundException, NamingException
   {
      UnifiedServiceRefMetaData sref;
      RefAddr refAddr = ref.get(ServiceReferenceable.SERVICE_REF_META_DATA);
      ByteArrayInputStream bais = new ByteArrayInputStream((byte[])refAddr.getContent());
      try
      {
         ObjectInputStream ois = new ObjectInputStream(bais);
View Full Code Here

TOP

Related Classes of org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData

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.