use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType in project midpoint by Evolveum.
the class RConnectorHost method toJAXB.
@Override
public ConnectorHostType toJAXB(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) throws DtoTranslationException {
ConnectorHostType object = new ConnectorHostType();
RUtil.revive(object, prismContext);
RConnectorHost.copyToJAXB(this, object, prismContext, options);
return object;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType in project midpoint by Evolveum.
the class ConnectorFactoryConnIdImpl method getConnectorInfo.
/**
* Get contect informations
*
* @param connectorType
* @return
* @throws ObjectNotFoundException
*/
private ConnectorInfo getConnectorInfo(ConnectorType connectorType) throws ObjectNotFoundException {
if (!SchemaConstants.ICF_FRAMEWORK_URI.equals(connectorType.getFramework())) {
throw new ObjectNotFoundException("Requested connector for framework " + connectorType.getFramework() + " cannot be found in framework " + SchemaConstants.ICF_FRAMEWORK_URI);
}
ConnectorKey key = getConnectorKey(connectorType);
if (connectorType.getConnectorHost() == null && connectorType.getConnectorHostRef() == null) {
// Local connector
return getLocalConnectorInfoManager().findConnectorInfo(key);
}
ConnectorHostType host = connectorType.getConnectorHost();
if (host == null) {
throw new ObjectNotFoundException("Attempt to use remote connector without ConnectorHostType resolved (there is only ConnectorHostRef");
}
return getRemoteConnectorInfoManager(host).findConnectorInfo(key);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType in project midpoint by Evolveum.
the class ConnectorFactoryConnIdImpl method convertToConnectorType.
/**
* Converts ICF ConnectorInfo into a midPoint XML connector representation.
* <p>
* TODO: schema transformation
*
* @param hostType host that this connector runs on or null for local connectors
*/
private ConnectorType convertToConnectorType(ConnectorInfo cinfo, ConnectorHostType hostType) throws SchemaException {
ConnectorType connectorType = new ConnectorType();
ConnectorKey key = cinfo.getConnectorKey();
UcfUtil.addConnectorNames(connectorType, "ConnId", key.getBundleName(), key.getConnectorName(), key.getBundleVersion(), hostType);
String stringID = keyToNamespaceSuffix(key);
connectorType.setFramework(SchemaConstants.ICF_FRAMEWORK_URI);
connectorType.setConnectorType(key.getConnectorName());
connectorType.setNamespace(ICF_CONFIGURATION_NAMESPACE_PREFIX + stringID);
connectorType.setConnectorVersion(key.getBundleVersion());
connectorType.setConnectorBundle(key.getBundleName());
if (hostType != null) {
// bind using connectorHostRef and OID
ObjectReferenceType ref = new ObjectReferenceType();
ref.setOid(hostType.getOid());
ref.setType(ObjectTypes.CONNECTOR_HOST.getTypeQName());
ref.asReferenceValue().setObject(hostType.asPrismObject());
connectorType.setConnectorHostRef(ref);
}
PrismSchema connectorSchema = generateConnectorConfigurationSchema(cinfo, connectorType);
LOGGER.trace("Generated connector schema for {}: {} definitions", connectorType, connectorSchema.getDefinitions().size());
UcfUtil.setConnectorSchema(connectorType, connectorSchema);
return connectorType;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType in project midpoint by Evolveum.
the class ConnectorFactoryConnIdImpl method listConnectors.
/**
* Returns a list XML representation of the ICF connectors.
*/
@Override
public Set<ConnectorType> listConnectors(ConnectorHostType host, OperationResult parentResult) throws CommunicationException {
OperationResult result = parentResult.createSubresult(ConnectorFactory.OPERATION_LIST_CONNECTORS);
result.addContext(OperationResult.CONTEXT_IMPLEMENTATION_CLASS, ConnectorFactoryConnIdImpl.class);
result.addParam("host", host);
try {
if (host == null) {
Set<ConnectorType> connectors = listLocalConnectors();
result.recordSuccess();
return connectors;
} else {
// This is necessary as list of the remote connectors is cached locally.
// So if any remote connector is added then it will not be discovered unless we
// clear the cache. This may look like inefficiency but in fact the listConnectors() method is
// used only when discovering new connectors. Normal connector operation is using connector objects
// stored in repository.
connectorInfoManagerFactory.clearRemoteCache();
Set<ConnectorType> connectors = listRemoteConnectors(host);
result.recordSuccess();
return connectors;
}
} catch (Throwable icfException) {
Throwable ex = processConnIdException(icfException, "list connectors", result);
result.recordFatalError(ex.getMessage(), ex);
if (ex instanceof CommunicationException) {
throw (CommunicationException) ex;
} else if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
} else if (ex instanceof Error) {
throw (Error) ex;
} else {
throw new SystemException("Unexpected ICF exception: " + ex.getMessage(), ex);
}
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType in project midpoint by Evolveum.
the class NameStep method discoverConnectorsPerformed.
@SuppressWarnings("unchecked")
private void discoverConnectorsPerformed(AjaxRequestTarget target) {
DropDownChoice<PrismObject<ConnectorHostType>> connectorHostChoice = ((DropDownFormGroup<PrismObject<ConnectorHostType>>) get(ID_CONNECTOR_HOST)).getInput();
PrismObject<ConnectorHostType> connectorHostObject = connectorHostChoice.getModelObject();
ConnectorHostType host = connectorHostObject != null ? connectorHostObject.asObjectable() : null;
if (host != null) {
discoverConnectors(host);
allConnectorsModel.reset();
}
relevantConnectorsModel.reset();
DropDownFormGroup<PrismObject<ConnectorType>> connectorDropDown = getConnectorDropDown();
PrismObject<ConnectorType> selectedConnector = connectorDropDown.getInput().getModelObject();
if (selectedConnector != null) {
if (!isConnectorOnHost(selectedConnector, connectorHostObject)) {
PrismObject<ConnectorType> compatibleConnector = null;
for (PrismObject<ConnectorType> relevantConnector : relevantConnectorsModel.getObject()) {
if (isConfigurationSchemaCompatible(relevantConnector)) {
compatibleConnector = relevantConnector;
break;
}
}
selectedConnectorModel.setObject(compatibleConnector);
}
}
target.add(connectorDropDown.getInput(), connectorDropDown.getAdditionalInfoComponent(), ((PageBase) getPage()).getFeedbackPanel());
}
Aggregations