use of com.evolveum.midpoint.xml.ns._public.common.common_3.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());
}
}
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;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType in project midpoint by Evolveum.
the class ParamsTypeUtil method setObjectReferenceEntry.
private static void setObjectReferenceEntry(EntryType entryType, ObjectType objectType) {
ObjectReferenceType objRefType = new ObjectReferenceType();
objRefType.setOid(objectType.getOid());
ObjectTypes type = ObjectTypes.getObjectType(objectType.getClass());
if (type != null) {
objRefType.setType(type.getTypeQName());
}
JAXBElement<ObjectReferenceType> element = new JAXBElement<ObjectReferenceType>(SchemaConstants.C_OBJECT_REF, ObjectReferenceType.class, objRefType);
// entryType.setAny(element);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType in project midpoint by Evolveum.
the class ParamsTypeUtil method createEntryElement.
/**
* Temporary workaround, brutally hacked -- so that the conversion
* of OperationResult into OperationResultType 'somehow' works, at least to the point
* where when we:
* - have OR1
* - serialize it into ORT1
* - then deserialize into OR2
* - serialize again into ORT2
* so we get ORT1.equals(ORT2) - at least in our simple test case :)
*
* FIXME: this should be definitely reworked
*
* @param entry
* @return
*/
private static EntryType createEntryElement(String key, Serializable value) {
EntryType entryType = new EntryType();
entryType.setKey(key);
if (value != null) {
Document doc = DOMUtil.getDocument();
if (value instanceof ObjectType && ((ObjectType) value).getOid() != null) {
// Store only reference on the OID. This is faster and getObject can be used to retrieve
// the object if needed. Although is does not provide 100% accuracy, it is a good tradeoff.
setObjectReferenceEntry(entryType, ((ObjectType) value));
// these values should be put 'as they are', in order to be deserialized into themselves
} else if (value instanceof String || value instanceof Integer || value instanceof Long) {
entryType.setEntryValue(new JAXBElement<Serializable>(SchemaConstants.C_PARAM_VALUE, Serializable.class, value));
} else if (XmlTypeConverter.canConvert(value.getClass())) {
// try {
// entryType.setEntryValue(new JXmlTypeConverter.toXsdElement(value, SchemaConstants.C_PARAM_VALUE, doc, true));
// } catch (SchemaException e) {
// LOGGER.error("Cannot convert value {} to XML: {}",value,e.getMessage());
// setUnknownJavaObjectEntry(entryType, value);
// }
} else if (value instanceof Element || value instanceof JAXBElement<?>) {
entryType.setEntryValue((JAXBElement<?>) value);
// FIXME: this is really bad code ... it means that 'our' JAXB object should be put as is
} else if ("com.evolveum.midpoint.xml.ns._public.common.common_3".equals(value.getClass().getPackage().getName())) {
JAXBElement<Object> o = new JAXBElement<Object>(SchemaConstants.C_PARAM_VALUE, Object.class, value);
entryType.setEntryValue(o);
} else {
setUnknownJavaObjectEntry(entryType, value);
}
}
return entryType;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.EntryType in project midpoint by Evolveum.
the class ParamsTypeUtil method setUnknownJavaObjectEntry.
private static void setUnknownJavaObjectEntry(EntryType entryType, Serializable value) {
UnknownJavaObjectType ujo = new UnknownJavaObjectType();
ujo.setClazz(value.getClass().getName());
ujo.setToString(value.toString());
entryType.setEntryValue(new ObjectFactory().createUnknownJavaObject(ujo));
}
Aggregations