Search in sources :

Example 1 with ConnectorHostType

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;
}
Also used : ConnectorHostType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType)

Example 2 with ConnectorHostType

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);
}
Also used : ConnectorHostType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType) ConnectorKey(org.identityconnectors.framework.api.ConnectorKey) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException)

Example 3 with ConnectorHostType

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;
}
Also used : MutablePrismSchema(com.evolveum.midpoint.prism.schema.MutablePrismSchema) PrismSchema(com.evolveum.midpoint.prism.schema.PrismSchema) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) ConnectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType) GuardedString(org.identityconnectors.common.security.GuardedString)

Example 4 with ConnectorHostType

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);
        }
    }
}
Also used : ConnectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) SystemException(com.evolveum.midpoint.util.exception.SystemException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 5 with ConnectorHostType

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());
}
Also used : ConnectorHostType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType) PrismObject(com.evolveum.midpoint.prism.PrismObject) ConnectorType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType) DropDownFormGroup(com.evolveum.midpoint.web.component.form.DropDownFormGroup)

Aggregations

ConnectorHostType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorHostType)13 ConnectorType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType)7 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)5 PrismObject (com.evolveum.midpoint.prism.PrismObject)4 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)4 Task (com.evolveum.midpoint.task.api.Task)3 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)3 IModel (org.apache.wicket.model.IModel)3 PageBase (com.evolveum.midpoint.gui.api.page.PageBase)2 PrismSchema (com.evolveum.midpoint.prism.schema.PrismSchema)2 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)2 CheckBoxColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxColumn)2 DropDownFormGroup (com.evolveum.midpoint.web.component.form.DropDownFormGroup)2 ArrayList (java.util.ArrayList)2 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)2 MainObjectListPanel (com.evolveum.midpoint.gui.api.component.MainObjectListPanel)1 PipelineItem (com.evolveum.midpoint.model.api.PipelineItem)1 PipelineData (com.evolveum.midpoint.model.impl.scripting.PipelineData)1