Search in sources :

Example 1 with EntryType

use of org.oasisOpen.docs.wsrf.sg2.EntryType in project midpoint by Evolveum.

the class ParamsTypeUtil method createEntryElement.

private static EntryType createEntryElement(Entry<String, Serializable> entry, PrismContext prismContext) throws SchemaException {
    EntryType result = new EntryType();
    result.setKey(entry.getKey());
    if (XmlTypeConverter.canConvert(entry.getValue().getClass())) {
        return createEntryElement(entry.getKey(), entry.getValue());
    } else {
        RootXNode xnode = prismContext.xnodeSerializer().options(SerializationOptions.createSerializeReferenceNames()).serializeAnyData(entry.getValue(), SchemaConstants.C_PARAM_VALUE);
        return createEntryElement(entry.getKey(), new RawType(xnode, prismContext));
    }
}
Also used : EntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType) RootXNode(com.evolveum.midpoint.prism.xnode.RootXNode) RawType(com.evolveum.prism.xml.ns._public.types_3.RawType)

Example 2 with EntryType

use of org.oasisOpen.docs.wsrf.sg2.EntryType in project tesb-rt-se by Talend.

the class LocatorRestServiceImpl method registerEndpoint.

/**
 * Register the endpoint for given service.
 *
 * @param input
 *            RegisterEndpointRequestType encapsulate name of service and
 *            endpointURL. Must not be <code>null</code>
 */
public void registerEndpoint(RegisterEndpointRequest arg0) {
    String endpointURL = arg0.getEndpointURL();
    QName serviceName = QName.valueOf(arg0.getServiceName());
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("Registering endpoint " + endpointURL + " for service " + serviceName + "...");
    }
    try {
        initLocator();
        BindingType bindingType = arg0.getBinding() == null ? BindingType.OTHER : BindingType.valueOf(arg0.getBinding().value());
        TransportType transportType = arg0.getTransport() == null ? TransportType.OTHER : TransportType.valueOf(arg0.getTransport().value());
        SLPropertiesImpl slProps = null;
        if (!arg0.getEntryType().isEmpty()) {
            slProps = new SLPropertiesImpl();
            List<EntryType> entries = arg0.getEntryType();
            for (EntryType entry : entries) {
                slProps.addProperty(entry.getKey(), entry.getValue());
            }
        }
        Endpoint simpleEndpoint = new SimpleEndpoint(serviceName, endpointURL, bindingType, transportType, slProps);
        locatorClient.register(simpleEndpoint, true);
    } catch (ServiceLocatorException e) {
        // throw new ServiceLocatorFault(e.getMessage(), e);
        throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build());
    } catch (InterruptedException e) {
        // throw new InterruptedExceptionFault(e.getMessage(), e);
        throw new WebApplicationException(Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build());
    }
}
Also used : EntryType(org.talend.schemas.esb.locator.rest._2011._11.EntryType) SimpleEndpoint(org.talend.esb.servicelocator.client.SimpleEndpoint) Endpoint(org.talend.esb.servicelocator.client.Endpoint) SimpleEndpoint(org.talend.esb.servicelocator.client.SimpleEndpoint) SLEndpoint(org.talend.esb.servicelocator.client.SLEndpoint) WebApplicationException(javax.ws.rs.WebApplicationException) QName(javax.xml.namespace.QName) BindingType(org.talend.esb.servicelocator.client.BindingType) ServiceLocatorException(org.talend.esb.servicelocator.client.ServiceLocatorException) SLPropertiesImpl(org.talend.esb.servicelocator.client.SLPropertiesImpl) TransportType(org.talend.esb.servicelocator.client.TransportType)

Example 3 with EntryType

use of org.oasisOpen.docs.wsrf.sg2.EntryType in project tesb-rt-se by Talend.

the class LocatorRestServiceTest method registerEndpointWithProps.

@Test
public void registerEndpointWithProps() throws ServiceLocatorException, InterruptedException {
    sl.register(endpoint(), EasyMock.eq(true));
    EasyMock.expectLastCall();
    replayAll();
    RegisterEndpointRequest req = new RegisterEndpointRequest();
    EntryType entryType = new EntryType();
    entryType.setKey("test");
    entryType.getValue().add("test");
    req.getEntryType().add(entryType);
    req.setEndpointURL(ENDPOINTURL);
    req.setServiceName(SERVICE_NAME.toString());
    lps.registerEndpoint(req);
}
Also used : RegisterEndpointRequest(org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest) EntryType(org.talend.schemas.esb.locator.rest._2011._11.EntryType) Test(org.junit.Test)

Example 4 with EntryType

use of org.oasisOpen.docs.wsrf.sg2.EntryType in project tesb-rt-se by Talend.

the class LocatorRestServiceTest method registerEndpointExpectedInterruptedException.

@Test(expected = WebApplicationException.class)
public void registerEndpointExpectedInterruptedException() throws ServiceLocatorException, InterruptedException {
    sl.register(endpoint(), EasyMock.eq(true));
    EasyMock.expectLastCall().andStubThrow(new InterruptedException("test"));
    replayAll();
    RegisterEndpointRequest req = new RegisterEndpointRequest();
    EntryType entryType = new EntryType();
    entryType.setKey("test");
    entryType.getValue().add("test");
    req.getEntryType().add(entryType);
    req.setEndpointURL(ENDPOINTURL);
    req.setServiceName(SERVICE_NAME.toString());
    lps.registerEndpoint(req);
}
Also used : RegisterEndpointRequest(org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest) EntryType(org.talend.schemas.esb.locator.rest._2011._11.EntryType) Test(org.junit.Test)

Example 5 with EntryType

use of org.oasisOpen.docs.wsrf.sg2.EntryType in project tesb-rt-se by Talend.

the class RESTClient method registerEndpointExample.

private void registerEndpointExample(String service, String endpoint, String key, String value) {
    System.out.println("------------------------------");
    System.out.println("Register service endpoint");
    System.out.println("ServiceName: ".concat(service));
    System.out.println("EndpointURL: ".concat(endpoint));
    System.out.println("Property: " + key + "=" + value);
    WebClient wc = WebClient.create(BASE_ADDRESS);
    EntryType et = new EntryType();
    et.setKey(key);
    et.getValue().add(value);
    RegisterEndpointRequest registerEndpointRequest = new RegisterEndpointRequest();
    registerEndpointRequest.setEndpointURL(endpoint);
    registerEndpointRequest.setBinding(BindingType.JAXRS);
    registerEndpointRequest.setTransport(TransportType.HTTPS);
    registerEndpointRequest.setServiceName(service);
    registerEndpointRequest.getEntryType().add(et);
    try {
        wc.post(registerEndpointRequest);
        System.out.println("Endpoint registered successfully");
    } catch (WebApplicationException ex) {
        System.err.println(ex.getMessage());
    }
}
Also used : RegisterEndpointRequest(org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest) EntryType(org.talend.schemas.esb.locator.rest._2011._11.EntryType) WebApplicationException(javax.ws.rs.WebApplicationException) WebClient(org.apache.cxf.jaxrs.client.WebClient)

Aggregations

EntryType (com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType)5 EntryType (org.talend.schemas.esb.locator.rest._2011._11.EntryType)5 Test (org.junit.Test)4 RegisterEndpointRequest (org.talend.schemas.esb.locator.rest._2011._11.RegisterEndpointRequest)4 ServiceLocatorException (org.talend.esb.servicelocator.client.ServiceLocatorException)3 RawType (com.evolveum.prism.xml.ns._public.types_3.RawType)2 RegistryClient (de.fzj.unicore.wsrflite.xmlbeans.client.RegistryClient)2 Serializable (java.io.Serializable)2 HashMap (java.util.HashMap)2 WebApplicationException (javax.ws.rs.WebApplicationException)2 EntryType (org.oasisOpen.docs.wsrf.sg2.EntryType)2 BindingType (org.talend.esb.servicelocator.client.BindingType)2 SLPropertiesImpl (org.talend.esb.servicelocator.client.SLPropertiesImpl)2 SimpleEndpoint (org.talend.esb.servicelocator.client.SimpleEndpoint)2 TransportType (org.talend.esb.servicelocator.client.TransportType)2 EntryType (org.talend.schemas.esb.locator._2011._11.EntryType)2 EndpointReferenceType (org.w3.x2005.x08.addressing.EndpointReferenceType)2 RootXNode (com.evolveum.midpoint.prism.xnode.RootXNode)1 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)1 UnknownJavaObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.UnknownJavaObjectType)1