Search in sources :

Example 16 with EntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType in project airavata by apache.

the class StorageCreator method findServerName.

protected String findServerName(String besUrl, EndpointReferenceType smsEpr) throws Exception {
    int besIndex = besUrl.indexOf("StorageFactory?res");
    String ss = besUrl.substring(0, besIndex);
    ss = ss + "Registry";
    EndpointReferenceType eprt = WSUtilities.makeServiceEPR(ss, "default_registry", Registry.REGISTRY_PORT);
    RegistryClient registry = new RegistryClient(eprt, secProps);
    // first, check if server name is already in the EPR...
    String dn = WSUtilities.extractServerIDFromEPR(smsEpr);
    if (dn != null) {
        return dn;
    }
    // otherwise find a matching service in the registry
    String url = smsEpr.getAddress().getStringValue();
    if (url.contains("/services/"))
        url = url.substring(0, url.indexOf("/services"));
    if (log.isDebugEnabled())
        log.debug("Checking for services at " + url);
    for (EntryType entry : registry.listEntries()) {
        if (entry.getMemberServiceEPR().getAddress().getStringValue().startsWith(url)) {
            dn = WSUtilities.extractServerIDFromEPR(entry.getMemberServiceEPR());
            if (dn != null) {
                return dn;
            }
        }
    }
    return null;
}
Also used : EndpointReferenceType(org.w3.x2005.x08.addressing.EndpointReferenceType) EntryType(org.oasisOpen.docs.wsrf.sg2.EntryType) RegistryClient(de.fzj.unicore.wsrflite.xmlbeans.client.RegistryClient)

Example 17 with EntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType in project midpoint by Evolveum.

the class ParamsTypeUtil method fromParamsType.

public static Map<String, Serializable> fromParamsType(ParamsType paramsType, PrismContext prismContext) throws SchemaException {
    if (paramsType != null) {
        Map<String, Serializable> params = new HashMap<>();
        for (EntryType entry : paramsType.getEntry()) {
            Serializable realValue;
            if (entry.getEntryValue() != null) {
                Serializable value = (Serializable) entry.getEntryValue().getValue();
                if (value instanceof RawType) {
                    RawType raw = (RawType) value;
                    if (raw.isParsed()) {
                        realValue = raw.getAlreadyParsedValue().getRealValue();
                    } else {
                        realValue = raw.guessFormattedValue();
                    }
                } else {
                    realValue = value;
                }
            } else {
                realValue = null;
            }
            params.put(entry.getKey(), realValue);
        }
        return params;
    }
    return null;
}
Also used : Serializable(java.io.Serializable) EntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType) HashMap(java.util.HashMap) RawType(com.evolveum.prism.xml.ns._public.types_3.RawType)

Example 18 with EntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType in project midpoint by Evolveum.

the class ParamsTypeUtil method fromParamsType.

public static Map<String, Collection<String>> fromParamsType(ParamsType paramsType) {
    if (paramsType != null) {
        Map<String, Collection<String>> params = new HashMap<>();
        for (EntryType entry : paramsType.getEntry()) {
            if (entry.getEntryValue() != null) {
                String newValue = extractString(entry.getEntryValue());
                Collection<String> values = params.computeIfAbsent(entry.getKey(), k -> new ArrayList<>());
                values.add(newValue);
            }
        }
        return params;
    }
    return null;
}
Also used : EntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType) HashMap(java.util.HashMap) Collection(java.util.Collection)

Example 19 with EntryType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType in project midpoint by Evolveum.

the class ParamsTypeUtil method createEntryElement.

private static EntryType createEntryElement(String key, String value) {
    EntryType entryType = new EntryType();
    entryType.setKey(key);
    if (value != null) {
        entryType.setEntryValue(new JAXBElement<>(SchemaConstants.C_PARAM_VALUE, Serializable.class, value));
    }
    return entryType;
}
Also used : Serializable(java.io.Serializable) EntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType)

Aggregations

EntryType (com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType)5 HashMap (java.util.HashMap)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 Map (java.util.Map)3 ServiceLocatorException (org.talend.esb.servicelocator.client.ServiceLocatorException)3 UnknownJavaObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.UnknownJavaObjectType)2 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 WebApplicationException (javax.ws.rs.WebApplicationException)2 JAXBElement (javax.xml.bind.JAXBElement)2 QName (javax.xml.namespace.QName)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