Package org.apache.geronimo.xml.ns.naming_1

Examples of org.apache.geronimo.xml.ns.naming_1.ServiceRefType


            if (mergeItem != null) {
                if (mergeItem.isFromWebFragment()) {
                    throw new DeploymentException(WebDeploymentMessageUtils.createDuplicateJNDIRefMessage("service-ref", serviceRefName, mergeItem.getBelongedURL(), mergeContext.getCurrentJarUrl()));
                } else if (mergeItem.isFromWebXml() && !isServiceRefInjectTargetsConfiguredInInitialWebXML(serviceRefName, mergeContext)) {
                    //Merge InjectTarget
                    ServiceRefType serviceRef = (ServiceRefType) mergeItem.getValue();
                    for (InjectionTargetType injectTarget : srcServiceRef.getInjectionTargetArray()) {
                        String serviceRefInjectTargetKey = createServiceRefInjectTargetKey(serviceRefName, injectTarget.getInjectionTargetClass().getStringValue(), injectTarget
                                .getInjectionTargetName().getStringValue());
                        if (!mergeContext.containsAttribute(serviceRefInjectTargetKey)) {
                            serviceRef.addNewInjectionTarget().set(injectTarget);
                            mergeContext.setAttribute(serviceRefInjectTargetKey, Boolean.TRUE);
                        }
                    }
                }
            } else {
                ServiceRefType targetServiceRef = (ServiceRefType) webApp.addNewServiceRef().set(srcServiceRef);
                mergeContext.setAttribute(serviceRefKey, new MergeItem(targetServiceRef, mergeContext.getCurrentJarUrl(), ElementSource.WEB_FRAGMENT));
                for (InjectionTargetType injectionTarget : targetServiceRef.getInjectionTargetArray()) {
                    mergeContext.setAttribute(createServiceRefInjectTargetKey(serviceRefName, injectionTarget.getInjectionTargetClass().getStringValue(), injectionTarget.getInjectionTargetName()
                            .getStringValue()), Boolean.TRUE);
                }
            }
        }
View Full Code Here


            throw new DeploymentException("Could not load " + classDescription + " class " + className, e);
        }
    }

    public void buildNaming(XmlObject serviceRef, GerServiceRefType gerServiceRefType, Module module, Map componentContext) throws DeploymentException {
        ServiceRefType serviceRefType =
            (ServiceRefType)convert(serviceRef, JEE_CONVERTER, ServiceRefType.type);
        buildNaming(serviceRefType, gerServiceRefType, module, componentContext);
    }
View Full Code Here

                jaxrpcClass = loadClass("javax.xml.rpc.Service", bundle);
            }
            if (jaxwsClass == null) {
                jaxwsClass = loadClass("javax.xml.ws.Service", bundle);
            }
            ServiceRefType serviceRefType = (ServiceRefType) convert(
                    serviceRef, JEE_CONVERTER, ServiceRefType.type);

            String name = getStringValue(serviceRefType.getServiceRefName());
            GerServiceRefType gerServiceRefType = (GerServiceRefType) serviceRefMap.get(name);
            serviceRefMap.remove(name);

            String serviceInterfaceName = getStringValue(serviceRefType
                    .getServiceInterface());
            Class serviceInterfaceClass = loadClass(serviceInterfaceName, bundle);

            InjectionTargetType[] injections = serviceRefType.getInjectionTargetArray();
            addInjections(name, injections, sharedContext);

            if (jaxrpcClass.isAssignableFrom(serviceInterfaceClass)) {
                // class jaxrpc handler
                ServiceRefBuilder jaxrpcBuilder = getJAXRCPBuilder();
View Full Code Here

                    try {

                        log.debug("processResource(): Does not exist in DD: " + resourceName);

                        // Doesn't exist in deployment descriptor -- add new
                        ServiceRefType serviceRef = annotatedApp.addNewServiceRef();

                        //------------------------------------------------------------------------------
                        // <service-ref> required elements:
                        //------------------------------------------------------------------------------

                        // service-ref-name
                        JndiNameType serviceRefName = serviceRef.addNewServiceRefName();
                        serviceRefName.setStringValue(resourceName);
                        serviceRef.setServiceRefName(serviceRefName);

                        // service-ref-interface
                        FullyQualifiedClassType serviceRefInterfaceClass = serviceRef.addNewServiceInterface();
                        serviceRefInterfaceClass.setStringValue(resourceType);
                        serviceRef.setServiceInterface(serviceRefInterfaceClass);

                        //------------------------------------------------------------------------------
                        // <service-ref> optional elements:
                        //------------------------------------------------------------------------------

                        // description
                        String descriptionAnnotation = annotation.description();
                        if (!descriptionAnnotation.equals("")) {
                            DescriptionType description = serviceRef.addNewDescription();
                            description.setStringValue(descriptionAnnotation);
                        }

                        // service-ref-type
                        if (!serviceRef.isSetServiceRefType()) {
                            FullyQualifiedClassType serviceRefTypeClass = serviceRef.addNewServiceRefType();
                            serviceRefTypeClass.setStringValue(resourceType);
                            serviceRef.setServiceRefType(serviceRefTypeClass);
                        }

                        // injectionTarget
                        if (method != null || field != null) {
                            InjectionTargetType injectionTarget = serviceRef.addNewInjectionTarget();
                            configureInjectionTarget(injectionTarget, method, field);
                        }
                       
                        // mappedName
                        if (!serviceRef.isSetMappedName() && annotation.mappedName().trim().length() > 0) {
                            XsdStringType mappedName = serviceRef.addNewMappedName();
                            mappedName.setStringValue(annotation.mappedName().trim());
                            serviceRef.setMappedName(mappedName);
                        }
                    }
                    catch (Exception anyException) {
                        log.debug("SwitchServiceRefBuilder: Exception caught while processing <service-ref>");
                    }
View Full Code Here

        //------------------------------------------------------------------------------------------
        // 1. <service-ref>
        //------------------------------------------------------------------------------------------

        ServiceRefType serviceRef = null;

        ServiceRefType[] serviceRefs = annotatedApp.getServiceRefArray();
        for (ServiceRefType currServiceRef : serviceRefs) {
            if (currServiceRef.getServiceRefName().getStringValue().trim().equals(webServiceRefName)) {
                serviceRef = currServiceRef;
                break;
            }
        }

        if (serviceRef == null) {
            // Doesn't exist in deployment descriptor -- add new
            serviceRef = annotatedApp.addNewServiceRef();

            // ------------------------------------------------------------------------------
            // <service-ref> required elements:
            // ------------------------------------------------------------------------------

            // service-ref-name
            JndiNameType serviceRefName = serviceRef.addNewServiceRefName();
            serviceRefName.setStringValue(webServiceRefName);
            serviceRef.setServiceRefName(serviceRefName);

            // service-ref-interface
            if (!webServiceRefValue.equals(Object.class)) {
                FullyQualifiedClassType qualifiedClass = serviceRef.addNewServiceInterface();
                qualifiedClass.setStringValue(webServiceRefValue.getName());
                serviceRef.setServiceInterface(qualifiedClass);
            } else {
                FullyQualifiedClassType qualifiedClass = serviceRef.addNewServiceInterface();
                qualifiedClass.setStringValue(webServiceRefType.getName());
                serviceRef.setServiceInterface(qualifiedClass);
            }
        }

        //------------------------------------------------------------------------------
        // <service-ref> optional elements:
        //------------------------------------------------------------------------------

        // service-ref-type
        if (!serviceRef.isSetServiceRefType() && !webServiceRefType.equals(Object.class)) {
            FullyQualifiedClassType qualifiedClass = serviceRef.addNewServiceRefType();
            qualifiedClass.setStringValue(webServiceRefType.getName());
            serviceRef.setServiceRefType(qualifiedClass);
        }

        // mapped-name
        if (!serviceRef.isSetMappedName() && annotation.mappedName().trim().length() > 0) {
            XsdStringType mappedName = serviceRef.addNewMappedName();
            mappedName.setStringValue(annotation.mappedName().trim());
            serviceRef.setMappedName(mappedName);
        }

        // WSDL document location
        if (!serviceRef.isSetWsdlFile()) {
            String wsdlLocation = annotation.wsdlLocation();

            if (wsdlLocation == null || wsdlLocation.trim().length() == 0) {
                WebServiceClient wsClient = null;
                if (Object.class.equals(webServiceRefValue)) {
                    wsClient = (WebServiceClient) webServiceRefType.getAnnotation(WebServiceClient.class);
                } else {
                    wsClient = (WebServiceClient) webServiceRefValue.getAnnotation(WebServiceClient.class);
                }
                if (wsClient == null) {
                    wsdlLocation = null;
                } else {
                    wsdlLocation = wsClient.wsdlLocation();
                }
            }

            if (wsdlLocation != null && wsdlLocation.trim().length() > 0) {
                XsdAnyURIType wsdlFile = serviceRef.addNewWsdlFile();
                wsdlFile.setStringValue(wsdlLocation);
                serviceRef.setWsdlFile(wsdlFile);
            }
        }

        // handler-chains
        if (!serviceRef.isSetHandlerChains()) {
            HandlerChain handlerChain = null;
            Class annotatedClass = null;
            if (method != null) {
                handlerChain = method.getAnnotation(HandlerChain.class);
                annotatedClass = method.getDeclaringClass();
            } else if (field != null) {
                handlerChain = field.getAnnotation(HandlerChain.class);
                annotatedClass = field.getDeclaringClass();
            }
           
            // if not specified on method or field, try to get it from Service class
            if (handlerChain == null) {
                if (Object.class.equals(webServiceRefValue)) {
                    handlerChain = (HandlerChain) webServiceRefType.getAnnotation(HandlerChain.class);
                    annotatedClass = webServiceRefType;
                } else {
                    handlerChain = (HandlerChain) webServiceRefValue.getAnnotation(HandlerChain.class);
                    annotatedClass = webServiceRefValue;
                }
            }
           
            if (handlerChain != null) {
                HandlerChainAnnotationHelper.insertHandlers(serviceRef, handlerChain, annotatedClass);
            }
        }
       
        if (method != null || field != null) {
            configureInjectionTarget(serviceRef.addNewInjectionTarget(), method, field);
        }

    }
View Full Code Here

    public ITableLabelProvider getLabelProvider() {
        return new LabelProvider() {
            @Override
            public String getColumnText(Object element, int columnIndex) {
                if (EjbLocalRefType.class.isInstance(element)) {
                  EjbLocalRefType ejbLocalRef = (EjbLocalRefType) element;
                    switch (columnIndex) {
                    case 0:
                        return ejbLocalRef.getRefName();
                    case 1:
                        return ejbLocalRef.getEjbLink();
                    }
                }
                return null;
            }
        };
View Full Code Here

    public ITableLabelProvider getLabelProvider() {
        return new LabelProvider() {
            @Override
            public String getColumnText(Object element, int columnIndex) {
                if (EjbRefType.class.isInstance(element)) {
                  EjbRefType ejbRef = (EjbRefType) element;
                    switch (columnIndex) {
                    case 0:
                        return ejbRef.getRefName();
                    case 1:
                        return ejbRef.getEjbLink();
                    }
                }
                return null;
            }
        };
View Full Code Here

            if (security.getRoleMappings() != null && security.getRoleMappings().getRole().size() == 0) {
                security.setRoleMappings(null);
            }
        } else if (source instanceof WebAppType) {
            WebAppType webapp = (WebAppType)source;
            GbeanLocatorType gbeanlocator = webapp.getWebContainer();
            if (gbeanlocator != null && isEmpty(gbeanlocator.getGbeanLink()) && isEmpty(gbeanlocator.getPattern())) {
                webapp.setWebContainer(null);
            }
        } else if (source instanceof OpenejbJarType) {
          OpenejbJarType openejb = (OpenejbJarType)source;
            ResourceLocatorType locator = openejb.getCmpConnectionFactory();
View Full Code Here

        specifyAsLink = toolkit.createButton(composite, CommonMessages.useGBeanLink, SWT.RADIO);
        GridData data = new GridData();
        data.horizontalSpan = 2;
        specifyAsLink.setLayoutData(data);

        GbeanLocatorType wc = plan.getWebContainer();

        toolkit.createLabel(composite, CommonMessages.gBeanLink);
        String value = wc != null ? wc.getGbeanLink() : null;
        gBeanLink = toolkit.createText(composite, value, SWT.BORDER);
        gBeanLink.setLayoutData(createTextFieldGridData());
        gBeanLink.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                getGBeanLocator().setGbeanLink(gBeanLink.getText());
                markDirty();
            }
        });

        specifyAsPattern = toolkit.createButton(composite, CommonMessages.useGBeanPattern, SWT.RADIO);
        specifyAsPattern.setLayoutData(data);

        toolkit.createLabel(composite, CommonMessages.groupId);
        value = wc != null && wc.getPattern() != null ? wc.getPattern().getGroupId()
                : null;
        group = toolkit.createText(composite, value, SWT.BORDER);
        group.setLayoutData(createTextFieldGridData());
        group.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                getPattern().setGroupId(group.getText());
                markDirty();
            }
        });

        toolkit.createLabel(composite, CommonMessages.artifactId);
        value = wc != null && wc.getPattern() != null ? wc.getPattern().getArtifactId()
                : null;
        artifact = toolkit.createText(composite, value, SWT.BORDER);
        artifact.setLayoutData(createTextFieldGridData());
        artifact.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                getPattern().setArtifactId(artifact.getText());
                markDirty();
            }
        });

        toolkit.createLabel(composite, CommonMessages.moduleId);
        value = wc != null && wc.getPattern() != null ? wc.getPattern().getModule()
                : null;
        module = toolkit.createText(composite, value, SWT.BORDER);
        module.setLayoutData(createTextFieldGridData());
        module.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                getPattern().setModule(module.getText());
                markDirty();
            }
        });

        toolkit.createLabel(composite, CommonMessages.name);
        value = wc != null && wc.getPattern() != null ? wc.getPattern().getName()
                : null;
        name = toolkit.createText(composite, value, SWT.BORDER);
        name.setLayoutData(createTextFieldGridData());
        name.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                getPattern().setName(name.getText());
                markDirty();
            }
        });

        toolkit.createLabel(composite, CommonMessages.version);
        value = wc != null && wc.getPattern() != null ? wc.getPattern().getVersion()
                : null;
        version = toolkit.createText(composite, value, SWT.BORDER);
        version.setLayoutData(createTextFieldGridData());
        version.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                getPattern().setVersion(version.getText());
                markDirty();
            }
        });

        specifyAsLink.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                if (specifyAsLink.getSelection()) {
                    getGBeanLocator().setPattern(null);
                    if (gBeanLink.getText().length() > 0) {
                        plan.getWebContainer().setGbeanLink(gBeanLink.getText());
                    }
                    markDirty();
                    toggle();
                }
            }
        });
        specifyAsPattern.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                if (specifyAsPattern.getSelection()) {
                  if (plan.getWebContainer() != null) {
                      plan.getWebContainer().setGbeanLink (null);
                  }
                    if (group.getText().length() > 0) {
                        getPattern().setGroupId(group.getText());
                    }
                    if (artifact.getText().length() > 0) {
                        getPattern().setArtifactId(artifact.getText());
                    }
                    if (module.getText().length() > 0) {
                        getPattern().setModule(module.getText());
                    }
                    if (name.getText().length() > 0) {
                        getPattern().setName(name.getText());
                    }
                    if (version.getText().length() > 0) {
                        getPattern().setVersion(version.getText());
                    }
                    markDirty();
                    toggle();
                }
            }
        });

        if (wc != null) {
            if (wc.getGbeanLink() != null) {
                specifyAsLink.setSelection(true);
            } else if (wc.getPattern() != null) {
                specifyAsPattern.setSelection(true);
            }
        }

        toggle();
View Full Code Here

    /**
     * @return
     */
    private GbeanLocatorType getGBeanLocator() {
      GbeanLocatorType wc = plan.getWebContainer();
        if (wc == null) {
            wc = namingFactory.createGbeanLocatorType();
            plan.setWebContainer(wc);
        }
        return wc;
View Full Code Here

TOP

Related Classes of org.apache.geronimo.xml.ns.naming_1.ServiceRefType

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.