Search in sources :

Example 11 with AdminProcessingException

use of org.teiid.adminapi.AdminProcessingException in project teiid by teiid.

the class VDBStatusChecker method updateSource.

/**
 * @return true if the datasource is new to the vdb
 * @throws AdminProcessingException
 */
public boolean updateSource(String vdbName, String vdbVersion, SourceMappingMetadata mapping, boolean replace) throws AdminProcessingException {
    String dsName = stripContext(mapping.getConnectionJndiName());
    VDBMetaData vdb = getVDBRepository().getLiveVDB(vdbName, vdbVersion);
    if (vdb == null || vdb.getStatus() == Status.FAILED) {
        return false;
    }
    synchronized (vdb) {
        ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
        ConnectorManager existing = cmr.getConnectorManager(mapping.getName());
        try {
            cmr.createConnectorManager(vdb, cmr.getProvider(), mapping, replace);
        } catch (TeiidException e) {
            throw new AdminProcessingException(RuntimePlugin.Event.TEIID40033, e);
        }
        if (mapping.getConnectionJndiName() != null && (existing == null || !dsName.equals(existing.getConnectionName()))) {
            List<Runnable> runnables = new ArrayList<Runnable>();
            resourceAdded(dsName, runnables, vdb);
            return true;
        }
        return false;
    }
}
Also used : ConnectorManagerRepository(org.teiid.dqp.internal.datamgr.ConnectorManagerRepository) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) ArrayList(java.util.ArrayList) ConnectorManager(org.teiid.dqp.internal.datamgr.ConnectorManager) AdminProcessingException(org.teiid.adminapi.AdminProcessingException) TeiidException(org.teiid.core.TeiidException)

Aggregations

AdminProcessingException (org.teiid.adminapi.AdminProcessingException)11 DataPolicyMetadata (org.teiid.adminapi.impl.DataPolicyMetadata)4 ConnectorManagerRepository (org.teiid.dqp.internal.datamgr.ConnectorManagerRepository)4 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)3 SourceMappingMetadata (org.teiid.adminapi.impl.SourceMappingMetadata)3 ConnectorManager (org.teiid.dqp.internal.datamgr.ConnectorManager)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 OperationFailedException (org.jboss.as.controller.OperationFailedException)1 ConnectionType (org.teiid.adminapi.VDB.ConnectionType)1 VDBMetaData (org.teiid.adminapi.impl.VDBMetaData)1 TeiidException (org.teiid.core.TeiidException)1