org.apache.cxf.service.model.ServiceInfo Java Examples

The following examples show how to use org.apache.cxf.service.model.ServiceInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JaxwsServiceBuilderTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testRpcLitNoSEI() throws Exception {
    builder.setServiceClass(org.apache.cxf.tools.fortest.withannotation.rpc.EchoImpl.class);
    ServiceInfo service = builder.createService();
    assertNotNull(service);

    assertEquals(new QName("http://cxf.apache.org/echotest", "EchoService"),
                 service.getName());
    assertEquals(new QName("http://cxf.apache.org/echotest", "Echo"),
                 service.getInterface().getName());

    generator.setServiceModel(service);

    File output = getOutputFile("rpclist_no_sei.wsdl");
    assertNotNull(output);
    generator.generate(output);
    assertTrue(output.exists());

    String s = new String(Files.readAllBytes(output.toPath()));
    assertTrue(s.indexOf("EchoPort") != -1);
    URI expectedFile = this.getClass()
        .getResource("expected/expected_rpclist_no_sei.wsdl").toURI();
    assertWsdlEquals(new File(expectedFile), output);
}
 
Example #2
Source File: UndertowHTTPDestinationTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testServerPolicyInServiceModel()
    throws Exception {
    policy = new HTTPServerPolicy();
    address = getEPR("bar/foo");
    bus = BusFactory.getDefaultBus(true);

    transportFactory = new HTTPTransportFactory();

    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setName(new QName("bla", "Service"));
    endpointInfo = new EndpointInfo(serviceInfo, "");
    endpointInfo.setName(new QName("bla", "Port"));
    endpointInfo.addExtensor(policy);

    engine = EasyMock.createMock(UndertowHTTPServerEngine.class);
    EasyMock.replay();
    endpointInfo.setAddress(NOWHERE + "bar/foo");

    UndertowHTTPDestination dest =
        new EasyMockUndertowHTTPDestination(
                bus, transportFactory.getRegistry(), endpointInfo, null, engine);
    assertEquals(policy, dest.getServer());
}
 
Example #3
Source File: FaultBeanGenerator.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Collection<JavaClass> generateBeanClasses(final ServiceInfo serviceInfo) {
    Set<Class<?>> exceptionClasses = new HashSet<>();
    String seiPackageName = null;
    for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
        Method method = (Method) op.getProperty("operation.method");
        exceptionClasses.addAll(getExceptionClasses(method));
        seiPackageName = getSEIPackage(method);
    }

    Collection<JavaClass> faultBeanClasses = new HashSet<>();
    String defaultPackage = seiPackageName + ".jaxws";
    FaultBean bean = new FaultBean();
    for (Class<?> clz : exceptionClasses) {
        if (!bean.faultBeanExists(clz)) {
            faultBeanClasses.add(bean.transform(clz, defaultPackage));
        }
    }

    return faultBeanClasses;
}
 
Example #4
Source File: StaxDataBinding.java    From cxf with Apache License 2.0 6 votes vote down vote up
public void initialize(Service service) {
    for (ServiceInfo serviceInfo : service.getServiceInfos()) {
        SchemaCollection schemaCollection = serviceInfo.getXmlSchemaCollection();
        if (schemaCollection.getXmlSchemas().length > 1) {
            // Schemas are already populated.
            continue;
        }
        new ServiceModelVisitor(serviceInfo) {
            public void begin(MessagePartInfo part) {
                if (part.getTypeQName() != null || part.getElementQName() != null) {
                    return;
                }
                part.setTypeQName(Constants.XSD_ANYTYPE);
            }
        } .walk();
    }
}
 
Example #5
Source File: CorbaHandlerUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static void initializeExceptionHandler(ORB orb,
                                              CorbaObjectHandler obj,
                                              CorbaTypeMap typeMap,
                                              ServiceInfo serviceInfo,
                                              Map<QName, CorbaObjectHandler> seenTypes) {
    Exception exceptType = (Exception)obj.getType();
    List<MemberType> exceptMembers = exceptType.getMember();
    QName typeName = exceptType.getType();
    for (int i = 0; i < exceptMembers.size(); ++i) {
        MemberType member = exceptMembers.get(i);
        QName memberName;
        if (member.isSetQualified() && member.isQualified() && (typeName != null)) {
            memberName = new QName(typeName.getNamespaceURI(), member.getName());
        } else {
            memberName = new QName("", member.getName());
        }
        QName memberType = member.getIdltype();
        CorbaObjectHandler memberObj = initializeObjectHandler(orb,
                                                               memberName,
                                                               memberType,
                                                               typeMap,
                                                               serviceInfo,
                                                               seenTypes);
        ((CorbaExceptionHandler)obj).addMember(memberObj);
    }
}
 
Example #6
Source File: CorbaUnionEventProducer.java    From cxf with Apache License 2.0 6 votes vote down vote up
public CorbaUnionEventProducer(CorbaObjectHandler h, ServiceInfo sInfo, ORB o) {
    CorbaUnionHandler handler = (CorbaUnionHandler) h;
    serviceInfo = sInfo;
    orb = o;
    name = handler.getName();
    isNil = checkIsNil(handler);
    if (!isNil) {
        CorbaObjectHandler contents = handler.getValue();
        if (contents != null) {
            Union unionType = (Union)handler.getType();
            if (unionType.isSetNillable() && unionType.isNillable()) {
                CorbaTypeEventProducer contentEventProducer =
                    CorbaHandlerUtils.getTypeEventProducer(contents, serviceInfo, orb);
                currentEventProducer = new SkipStartEndEventProducer(contentEventProducer, name);
            } else {
                List<CorbaObjectHandler> list = new ArrayList<>();
                list.add(contents);
                iterator = list.iterator();
            }
        } else if (handler.getSimpleName().equals(handler.getIdlType().getLocalPart() + "_f")) {
            state = states.length;
        }
    }
}
 
Example #7
Source File: CxfWSDLImporter.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
protected WSService importService(ServiceInfo service) {
  String name = service.getName().getLocalPart();
  String location = "";
  
  for (EndpointInfo endpoint : service.getEndpoints()) {
    location = endpoint.getAddress();
  }
  
  WSService wsService = new WSService(this.namespace + name, location, this.wsdlLocation);
  for (OperationInfo operation : service.getInterface().getOperations()) {
    WSOperation wsOperation = this.importOperation(operation, wsService);
    wsService.addOperation(wsOperation);

    this.wsOperations.put(this.namespace + operation.getName().getLocalPart(), wsOperation);
  }
  return wsService;
}
 
Example #8
Source File: WSDLServiceBuilder.java    From cxf with Apache License 2.0 6 votes vote down vote up
public ServiceInfo buildMockService(Definition def, PortType p) {
    DescriptionInfo description = new DescriptionInfo();
    if (recordOriginal) {
        description.setProperty(WSDL_DEFINITION, def);
    }
    description.setName(def.getQName());
    description.setBaseURI(def.getDocumentBaseURI());
    copyExtensors(description, def.getExtensibilityElements());
    copyExtensionAttributes(description, def);

    ServiceInfo service = new ServiceInfo();
    service.setDescription(description);
    if (recordOriginal) {
        service.setProperty(WSDL_DEFINITION, def);
    }
    getSchemas(def, service);

    service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);

    buildInterface(service, p);

    return service;
}
 
Example #9
Source File: JavaToWSDLProcessor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void customize(ServiceInfo service) {
    if (context.containsKey(ToolConstants.CFG_TNS)) {
        String ns = (String)context.get(ToolConstants.CFG_TNS);
        service.setTargetNamespace(ns);
    }

    if (context.containsKey(ToolConstants.CFG_PORT)) {
        String portName = (String)context.get(ToolConstants.CFG_PORT);
        EndpointInfo einfo = service.getEndpoints().iterator().next();
        QName qn = new QName(einfo.getName().getNamespaceURI(), portName);
        einfo.setName(qn);
    }

    if (context.containsKey(ToolConstants.CFG_SERVICENAME)) {
        String svName = getServiceName();
        service.setName(new QName(service.getName().getNamespaceURI(), svName));
    }
    EndpointInfo endpointInfo = service.getEndpoints().iterator().next();
    String address = ToolConstants.DEFAULT_ADDRESS + "/" + endpointInfo.getName().getLocalPart();
    if (context.get(ToolConstants.CFG_ADDRESS) != null) {
        address = (String)context.get(ToolConstants.CFG_ADDRESS);
    }
    endpointInfo.setAddress(address);
    context.put(ToolConstants.CFG_ADDRESS, address);

}
 
Example #10
Source File: EndpointPolicyImplTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testInitializePolicy() {
    EndpointInfo ei = control.createMock(EndpointInfo.class);
    PolicyEngineImpl engine = control.createMock(PolicyEngineImpl.class);
    ServiceInfo si = control.createMock(ServiceInfo.class);
    EasyMock.expect(ei.getService()).andReturn(si);
    Policy sp = control.createMock(Policy.class);
    EasyMock.expect(engine.getAggregatedServicePolicy(si, null)).andReturn(sp);
    Policy ep = control.createMock(Policy.class);
    EasyMock.expect(engine.getAggregatedEndpointPolicy(ei, null)).andReturn(ep);
    Policy merged = control.createMock(Policy.class);
    EasyMock.expect(sp.merge(ep)).andReturn(merged);
    EasyMock.expect(merged.normalize(null, true)).andReturn(merged);

    control.replay();
    EndpointPolicyImpl epi = new EndpointPolicyImpl(ei, engine, true, null);
    epi.initializePolicy(null);
    assertSame(merged, epi.getPolicy());
    control.verify();
}
 
Example #11
Source File: SoapBindingFactory.java    From cxf with Apache License 2.0 6 votes vote down vote up
public BindingInfo createBindingInfo(ServiceInfo service, javax.wsdl.Binding binding, String ns) {
    SoapBindingInfo bi = new SoapBindingInfo(service, ns);
    // Copy all the extensors
    initializeBindingInfo(service, binding, bi);

    SoapBinding wSoapBinding
        = SOAPBindingUtil.getSoapBinding(bi.getExtensors(ExtensibilityElement.class));


    bi.setTransportURI(wSoapBinding.getTransportURI());
    bi.setStyle(wSoapBinding.getStyle());

    for (BindingOperationInfo boi : bi.getOperations()) {
        initializeBindingOperation(bi, boi);
    }

    return bi;
}
 
Example #12
Source File: DispatchImpl.java    From cxf with Apache License 2.0 6 votes vote down vote up
private void addInvokeOperation(QName operationName, boolean oneWay) {
    ServiceInfo info = client.getEndpoint().getEndpointInfo().getService();

    OperationInfo invokeOpInfo = info.getInterface()
                   .getOperation(oneWay ? INVOKE_ONEWAY_QNAME : INVOKE_QNAME);

    OperationInfo opInfo = info.getInterface().addOperation(operationName);
    opInfo.setInput(invokeOpInfo.getInputName(), invokeOpInfo.getInput());

    if (!oneWay) {
        opInfo.setOutput(invokeOpInfo.getOutputName(), invokeOpInfo.getOutput());
    }

    for (BindingInfo bind : client.getEndpoint().getEndpointInfo().getService().getBindings()) {
        BindingOperationInfo bo = new BindingOperationInfo(bind, opInfo);
        bind.addOperation(bo);
    }
}
 
Example #13
Source File: CorbaConduitTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testBuildRequest() throws Exception {
    CorbaConduit conduit = setupCorbaConduit(false);
    CorbaMessage message = control.createMock(CorbaMessage.class);
    Exchange exchange = control.createMock(Exchange.class);
    EasyMock.expect(message.getExchange());
    EasyMock.expectLastCall().andReturn(exchange);
    ServiceInfo service = control.createMock(ServiceInfo.class);
    EasyMock.expect(exchange.get(ServiceInfo.class)).andReturn(service);
    List<CorbaTypeMap> list = control.createMock(List.class);
    CorbaTypeMap typeMap = control.createMock(CorbaTypeMap.class);
    EasyMock.expect(service.getExtensors(CorbaTypeMap.class)).andReturn(list);

    OperationType opType = control.createMock(OperationType.class);
    conduit.getArguments(message);
    EasyMock.expectLastCall().andReturn(null);
    conduit.getReturn(message);
    EasyMock.expectLastCall().andReturn(null);
    conduit.getExceptionList(conduit.getOperationExceptions(opType, typeMap),
                             message,
                             opType);
    EasyMock.expectLastCall().andReturn(null);

    conduit.getRequest(message, "Hello", null, null, null);
    EasyMock.expectLastCall();
}
 
Example #14
Source File: JaxwsServiceBuilderRPCTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGreeter() throws Exception {
    builder.setServiceClass(org.apache.cxf.tools.fortest.jaxws.rpc.Greeter.class);
    ServiceInfo service = builder.createService();
    generator.setServiceModel(service);
    File output = getOutputFile("rpc_greeter.wsdl");
    assertNotNull(output);
    generator.generate(output);
    assertTrue(output.exists());

    File expectedFile = new File(this.getClass()
        .getResource("expected/rpc_greeter.wsdl").toURI());

    //MOXy doesn't put a final attribute on the array types, we can ignore that
    //for the purpose of this test
    List<String> ignores = new ArrayList<>(DEFAULT_IGNORE_ATTR);
    ignores.add("final");
    assertWsdlEquals(expectedFile, output, ignores, DEFAULT_IGNORE_TAG);
}
 
Example #15
Source File: JaxWsServiceFactoryBeanTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testDocLiteralPartWithType() throws Exception {
    ReflectionServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean();
    serviceFactory.setBus(getBus());
    serviceFactory.setServiceClass(NoBodyPartsImpl.class);
    Service service = serviceFactory.create();
    ServiceInfo serviceInfo =
        service.getServiceInfos().get(0);
    QName qname = new QName("urn:org:apache:cxf:no_body_parts/wsdl",
                            "operation1");
    MessageInfo mi = serviceInfo.getMessage(qname);
    qname = new QName("urn:org:apache:cxf:no_body_parts/wsdl",
        "mimeAttachment");
    MessagePartInfo mpi = mi.getMessagePart(qname);
    QName elementQName = mpi.getElementQName();
    XmlSchemaElement element =
        serviceInfo.getXmlSchemaCollection().getElementByQName(elementQName);
    assertNotNull(element);
}
 
Example #16
Source File: JMSEndpointWSDLUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static <T> T getWSDLExtensor(EndpointInfo ei, Class<T> cls) {
    ServiceInfo si = ei.getService();
    BindingInfo bi = ei.getBinding();

    Object o = ei.getExtensor(cls);
    if (o == null && si != null) {
        o = si.getExtensor(cls);
    }
    if (o == null && bi != null) {
        o = bi.getExtensor(cls);
    }

    if (o == null) {
        return null;
    }
    if (cls.isInstance(o)) {
        return cls.cast(o);
    }
    return null;
}
 
Example #17
Source File: JaxWsServiceConfigurationTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetOutPartName() throws Exception {
    QName opName = new QName("http://cxf.com/", "sayHi");
    Method sayHiMethod = Hello.class.getMethod("sayHi", new Class[]{});
    ServiceInfo si = getMockedServiceModel("/wsdl/default_partname_test.wsdl");
    JaxWsServiceConfiguration jwsc = new JaxWsServiceConfiguration();
    JaxWsServiceFactoryBean bean = new JaxWsServiceFactoryBean();
    bean.setServiceClass(Hello.class);
    jwsc.setServiceFactory(bean);

    // clear the output
    OperationInfo op = si.getInterface().getOperation(opName);
    op.setOutput("output", new MessageInfo(op,
                                           MessageInfo.Type.OUTPUT,
                                           new QName("http://cxf.com/", "output")));

    QName partName = jwsc.getOutPartName(op, sayHiMethod, -1);
    assertEquals("get wrong return partName", new QName("http://cxf.com/", "return"), partName);
}
 
Example #18
Source File: NettyHttpDestinationTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetMultiple() throws Exception {
    transportFactory = new HTTPTransportFactory();
    bus = BusFactory.getDefaultBus();

    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setName(new QName("bla", "Service"));
    EndpointInfo ei = new EndpointInfo(serviceInfo, "");
    ei.setName(new QName("bla", "Port"));
    ei.setAddress("http://foo");
    Destination d1 = transportFactory.getDestination(ei, bus);

    Destination d2 = transportFactory.getDestination(ei, bus);

    // Second get should not generate a new destination. It should just retrieve the existing one
    assertEquals(d1, d2);

    d2.shutdown();

    Destination d3 = transportFactory.getDestination(ei, bus);
    // Now a new destination should have been created
    assertNotSame(d1, d3);
}
 
Example #19
Source File: SOAPLoggingTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testSoap() {
    DefaultLogEventMapper mapper = new DefaultLogEventMapper();
    Message message = new MessageImpl();
    ExchangeImpl exchange = new ExchangeImpl();
    ServiceInfo service = new ServiceInfo();
    BindingInfo info = new BindingInfo(service, "bindingId");
    SoapBinding value = new SoapBinding(info);
    exchange.put(Binding.class, value);
    OperationInfo opInfo = new OperationInfo();
    opInfo.setName(new QName("http://my", "Operation"));
    BindingOperationInfo boi = new BindingOperationInfo(info, opInfo);
    exchange.put(BindingOperationInfo.class, boi);
    message.setExchange(exchange);
    LogEvent event = mapper.map(message);
    Assert.assertEquals("{http://my}Operation", event.getOperationName());
}
 
Example #20
Source File: SoapBindingConfiguration.java    From cxf with Apache License 2.0 5 votes vote down vote up
public QName getBindingName(ServiceInfo si) {
    if (bindingName == null) {
        return new QName(si.getName().getNamespaceURI(),
                         si.getName().getLocalPart() + bindingNamePostfix);
    }
    return bindingName;
}
 
Example #21
Source File: JAXBContextInitializer.java    From cxf with Apache License 2.0 5 votes vote down vote up
JAXBContextInitializer(ServiceInfo serviceInfo,
                              Set<Class<?>> classes,
                              Collection<Object> typeReferences,
                              Map<String, Object> unmarshallerProperties) {
    super(serviceInfo);
    this.classes = classes;
    this.typeReferences = typeReferences;
    this.unmarshallerProperties = unmarshallerProperties;
}
 
Example #22
Source File: ReflectionServiceFactoryTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testWrappedBuild() throws Exception {
    Service service = createService(true);

    ServiceInfo si = service.getServiceInfos().get(0);
    InterfaceInfo intf = si.getInterface();

    assertEquals(4, intf.getOperations().size());

    String ns = si.getName().getNamespaceURI();
    OperationInfo sayHelloOp = intf.getOperation(new QName(ns, "sayHello"));
    assertNotNull(sayHelloOp);

    assertEquals("sayHello", sayHelloOp.getInput().getName().getLocalPart());

    List<MessagePartInfo> messageParts = sayHelloOp.getInput().getMessageParts();
    assertEquals(1, messageParts.size());
    assertNotNull(messageParts.get(0).getXmlSchema());

    // test unwrapping
    assertTrue(sayHelloOp.isUnwrappedCapable());

    OperationInfo unwrappedOp = sayHelloOp.getUnwrappedOperation();
    assertEquals("sayHello", unwrappedOp.getInput().getName().getLocalPart());

    messageParts = unwrappedOp.getInput().getMessageParts();
    assertEquals(0, messageParts.size());

    // test output
    messageParts = sayHelloOp.getOutput().getMessageParts();
    assertEquals(1, messageParts.size());
    assertEquals("sayHelloResponse", sayHelloOp.getOutput().getName().getLocalPart());

    messageParts = unwrappedOp.getOutput().getMessageParts();
    assertEquals("sayHelloResponse", unwrappedOp.getOutput().getName().getLocalPart());
    assertEquals(1, messageParts.size());
    MessagePartInfo mpi = messageParts.get(0);
    assertEquals("return", mpi.getName().getLocalPart());
    assertEquals(String.class, mpi.getTypeClass());
}
 
Example #23
Source File: CorbaAnonStructEventProducer.java    From cxf with Apache License 2.0 5 votes vote down vote up
public CorbaAnonStructEventProducer(CorbaObjectHandler h,
                                    ServiceInfo service,
                                    ORB orbRef) {
    CorbaStructHandler handler = (CorbaStructHandler)h;
    iterator = handler.members.iterator();
    orb = orbRef;
    serviceInfo = service;
}
 
Example #24
Source File: PolicyEngineImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
Policy getAggregatedServicePolicy(ServiceInfo si, Message m) {
    if (si == null) {
        return new Policy();
    }
    Policy aggregated = busPolicy;
    for (PolicyProvider pp : getPolicyProviders()) {
        Policy p = pp.getEffectivePolicy(si, m);
        if (null == aggregated) {
            aggregated = p;
        } else if (p != null) {
            aggregated = aggregated.merge(p);
        }
    }
    return aggregated == null ? new Policy() : aggregated;
}
 
Example #25
Source File: JAXBDataBinding.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addSchemasForServiceInfos(OASISCatalogManager catalog,
                                       List<ServiceInfo> serviceList,
                                      Options opts,
                                      SchemaCompiler schemaCompiler,
                                      SchemaCollection schemaCollection) {
    Set<String> ids = new HashSet<>();
    for (ServiceInfo si : serviceList) {
        for (SchemaInfo sci : si.getSchemas()) {
            String key = sci.getSystemId();
            if (ids.contains(key)) {
                continue;
            }
            ids.add(key);
            Element ele = sci.getElement();
            if (context.fullValidateWSDL()) {
                validateSchema(ele, sci.getSystemId(), catalog, schemaCollection);
            }
            ele = removeImportElement(ele, key, catalog);
            InputSource is = new InputSource((InputStream)null);
            //key = key.replaceFirst("#types[0-9]+$", "");
            is.setSystemId(key);
            is.setPublicId(key);
            opts.addGrammar(is);
            try {
                XMLStreamReader reader = createNoCDATAReader(StaxUtils.createXMLStreamReader(ele, key));
                schemaCompiler.parseSchema(key, reader);
            } catch (XMLStreamException e) {
                throw new RuntimeException(e);
            }
        }
    }

}
 
Example #26
Source File: ApplicationContextTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
private EndpointInfo getEndpointInfo(String serviceNS,
                                     String endpointLocal,
                                     String address) {
    ServiceInfo serviceInfo2 = new ServiceInfo();
    serviceInfo2.setName(new QName(serviceNS, "Service"));
    EndpointInfo info2 = new EndpointInfo(serviceInfo2, "");
    info2.setName(new QName("urn:test:ns", endpointLocal));
    info2.setAddress(address);
    return info2;
}
 
Example #27
Source File: ProcessorUtil.java    From cxf with Apache License 2.0 5 votes vote down vote up
public static boolean isSchemaFormQualified(ToolContext context, QName partElement) {
    ServiceInfo serviceInfo = context.get(ServiceInfo.class);
    SchemaCollection schemaCol = serviceInfo.getXmlSchemaCollection();
    XmlSchema schema = schemaCol.getSchemaForElement(partElement);
    if (schema != null) {
        return schema.getElementFormDefault() == XmlSchemaForm.QUALIFIED;
    }
    return false;

}
 
Example #28
Source File: WoodstoxValidationImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void setupValidation(XMLStreamReader reader,
                            Endpoint endpoint,
                            ServiceInfo serviceInfo) throws XMLStreamException {
    if (utils != null && reader != null && !utils.setupValidation(reader, endpoint, serviceInfo)) {
        utils = null;
    }
}
 
Example #29
Source File: ServiceJavascriptBuilder.java    From cxf with Apache License 2.0 5 votes vote down vote up
/**
 * Construct builder object.
 * @param serviceInfo CXF service model description of the service.
 * @param endpointAddress http:// URL for the service, or null if not known.
 * @param prefixAccumulator object that keeps track of prefixes through an entire WSDL.
 * @param nameManager object that generates names for JavaScript objects.
 */
public ServiceJavascriptBuilder(ServiceInfo serviceInfo,
                                String endpointAddress,
                                NamespacePrefixAccumulator prefixAccumulator,
                                NameManager nameManager) {
    super(serviceInfo);
    this.endpointAddress = endpointAddress;
    code = new StringBuilder();
    utils = new JavascriptUtils(code);
    this.nameManager = nameManager;
    xmlSchemaCollection = serviceInfo.getXmlSchemaCollection();
    this.prefixAccumulator = prefixAccumulator;
}
 
Example #30
Source File: WSDLToJavaProcessor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private JavaModel wsdlDefinitionToJavaModel(ServiceInfo serviceInfo) throws ToolException {
    JavaModel javaModel = null;
    Map<QName, JavaModel> map = CastUtils.cast((Map<?, ?>)context.get(MODEL_MAP));
    if (map == null) {
        map = new LinkedHashMap<>();
        context.put(MODEL_MAP, map);
    }
    if (map.containsKey(serviceInfo.getName())) {
        javaModel = map.get(serviceInfo.getName());
    } else {
        javaModel = new JavaModel();
        map.put(serviceInfo.getName(), javaModel);
    }
    context.put(JavaModel.class, javaModel);

    List<JavaInterface> interfaces = new ArrayList<>();
    interfaces.addAll(javaModel.getInterfaces().values());

    PortTypeProcessor portTypeProcessor = new PortTypeProcessor(context);
    portTypeProcessor.process(serviceInfo);

    ServiceProcessor serviceProcessor = new ServiceProcessor(context);
    serviceProcessor.process(serviceInfo);

    for (JavaInterface intf : javaModel.getInterfaces().values()) {
        if (!interfaces.contains(intf)) {
            intf.annotate(new WebServiceAnnotator());
            intf.annotate(new XmlSeeAlsoAnnotator(context.get(ClassCollector.class)));
            intf.annotate(new BindingAnnotator());
        }
    }
    return javaModel;
}