@Override public VDBMetaData getVdb() { if (this.vdbState.dqpWorkContext == null) { return null; } return this.vdbState.dqpWorkContext.getVDB(); }
@Override public VDBMetaData getVdb() { if (this.vdbState.dqpWorkContext == null) { return null; } return this.vdbState.dqpWorkContext.getVDB(); }
@Override public VDBMetaData getVdb() { if (this.vdbState.dqpWorkContext == null) { return null; } return this.vdbState.dqpWorkContext.getVDB(); }
private void checkActive(DQPWorkContext workContext) throws TeiidProcessingException { if (workContext.getVDB().getStatus() != Status.ACTIVE) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID31099, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31099, workContext.getVDB(), workContext.getVDB().getStatus())); } }
private void checkActive(DQPWorkContext workContext) throws TeiidProcessingException { if (workContext.getVDB().getStatus() != Status.ACTIVE) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID31099, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31099, workContext.getVDB(), workContext.getVDB().getStatus())); } }
private void checkActive(DQPWorkContext workContext) throws TeiidProcessingException { if (workContext.getVDB().getStatus() != Status.ACTIVE) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID31099, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31099, workContext.getVDB(), workContext.getVDB().getStatus())); } }
public HashMap<String, DataPolicy> getAllowedDataPolicies() { if (this.policies == null) { this.policies = new HashMap<String, DataPolicy>(); Set<String> userRoles = getUserRoles(); // get data roles from the VDB VDBMetaData vdb = getVDB(); TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); Collection<? extends DataPolicy> allPolicies = null; if (metadata == null) { allPolicies = vdb.getDataPolicies(); } else { allPolicies = metadata.getPolicies().values(); } for (DataPolicy policy : allPolicies) { if (matchesPrincipal(userRoles, policy)) { this.policies.put(policy.getName(), policy); } } } return this.policies; }
public HashMap<String, DataPolicy> getAllowedDataPolicies() { if (this.policies == null) { this.policies = new HashMap<String, DataPolicy>(); Set<String> userRoles = getUserRoles(); // get data roles from the VDB VDBMetaData vdb = getVDB(); TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); Collection<? extends DataPolicy> allPolicies = null; if (metadata == null) { allPolicies = vdb.getDataPolicies(); } else { allPolicies = metadata.getPolicies().values(); } for (DataPolicy policy : allPolicies) { if (matchesPrincipal(userRoles, policy)) { this.policies.put(policy.getName(), policy); } } } return this.policies; }
public HashMap<String, DataPolicy> getAllowedDataPolicies() { if (this.policies == null) { this.policies = new HashMap<String, DataPolicy>(); Set<String> userRoles = getUserRoles(); // get data roles from the VDB VDBMetaData vdb = getVDB(); TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); Collection<? extends DataPolicy> allPolicies = null; if (metadata == null) { allPolicies = vdb.getDataPolicies(); } else { allPolicies = metadata.getPolicies().values(); } for (DataPolicy policy : allPolicies) { if (matchesPrincipal(userRoles, policy)) { this.policies.put(policy.getName(), policy); } } } return this.policies; }
void initialize(RequestMessage requestMsg, BufferManager bufferManager, ProcessorDataManager processorDataManager, TransactionService transactionService, TempTableStore tempTableStore, DQPWorkContext workContext, SessionAwareCache<PreparedPlan> planCache) { this.requestMsg = requestMsg; this.vdbName = workContext.getVdbName(); this.vdbVersion = workContext.getVdbVersion(); this.bufferManager = bufferManager; this.processorDataManager = processorDataManager; this.transactionService = transactionService; this.tempTableStore = tempTableStore; this.workContext = workContext; this.requestId = workContext.getRequestID(this.requestMsg.getExecutionId()); this.connectorManagerRepo = workContext.getVDB().getAttachment(ConnectorManagerRepository.class); this.planCache = planCache; }
void initialize(RequestMessage requestMsg, BufferManager bufferManager, ProcessorDataManager processorDataManager, TransactionService transactionService, TempTableStore tempTableStore, DQPWorkContext workContext, SessionAwareCache<PreparedPlan> planCache) { this.requestMsg = requestMsg; this.vdbName = workContext.getVdbName(); this.vdbVersion = workContext.getVdbVersion(); this.bufferManager = bufferManager; this.processorDataManager = processorDataManager; this.transactionService = transactionService; this.tempTableStore = tempTableStore; this.workContext = workContext; this.requestId = workContext.getRequestID(this.requestMsg.getExecutionId()); this.connectorManagerRepo = workContext.getVDB().getAttachment(ConnectorManagerRepository.class); this.planCache = planCache; }
void initialize(RequestMessage requestMsg, BufferManager bufferManager, ProcessorDataManager processorDataManager, TransactionService transactionService, TempTableStore tempTableStore, DQPWorkContext workContext, SessionAwareCache<PreparedPlan> planCache) { this.requestMsg = requestMsg; this.vdbName = workContext.getVdbName(); this.vdbVersion = workContext.getVdbVersion(); this.bufferManager = bufferManager; this.processorDataManager = processorDataManager; this.transactionService = transactionService; this.tempTableStore = tempTableStore; this.workContext = workContext; this.requestId = workContext.getRequestID(this.requestMsg.getExecutionId()); this.connectorManagerRepo = workContext.getVDB().getAttachment(ConnectorManagerRepository.class); this.planCache = planCache; }
/** * if the metadata has not been supplied via setMetadata, this method will create the appropriate state * * @throws TeiidComponentException */ protected void initMetadata() throws TeiidComponentException { if (this.metadata != null) { return; } // Prepare dependencies for running the optimizer this.capabilitiesFinder = new CachedFinder(this.connectorManagerRepo, workContext.getVDB()); if (this.bufferManager.getOptions() != null) { this.capabilitiesFinder = new TempCapabilitiesFinder(this.capabilitiesFinder, this.bufferManager.getOptions().getDefaultNullOrder()); } else { this.capabilitiesFinder = new TempCapabilitiesFinder(this.capabilitiesFinder); } VDBMetaData vdbMetadata = workContext.getVDB(); metadata = vdbMetadata.getAttachment(QueryMetadataInterface.class); globalTables = vdbMetadata.getAttachment(GlobalTableStore.class); if (metadata == null) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30489, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30489, this.vdbName, this.vdbVersion)); } TempMetadataAdapter tma = new TempMetadataAdapter(metadata, this.tempTableStore.getMetadataStore()); tma.setSession(true); this.metadata = tma; }
/** * if the metadata has not been supplied via setMetadata, this method will create the appropriate state * * @throws TeiidComponentException */ protected void initMetadata() throws TeiidComponentException { if (this.metadata != null) { return; } // Prepare dependencies for running the optimizer this.capabilitiesFinder = new CachedFinder(this.connectorManagerRepo, workContext.getVDB()); if (this.bufferManager.getOptions() != null) { this.capabilitiesFinder = new TempCapabilitiesFinder(this.capabilitiesFinder, this.bufferManager.getOptions().getDefaultNullOrder()); } else { this.capabilitiesFinder = new TempCapabilitiesFinder(this.capabilitiesFinder); } VDBMetaData vdbMetadata = workContext.getVDB(); metadata = vdbMetadata.getAttachment(QueryMetadataInterface.class); globalTables = vdbMetadata.getAttachment(GlobalTableStore.class); if (metadata == null) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30489, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30489, this.vdbName, this.vdbVersion)); } TempMetadataAdapter tma = new TempMetadataAdapter(metadata, this.tempTableStore.getMetadataStore()); tma.setSession(true); this.metadata = tma; }
private VDBMetaData getVDBInternal() throws SQLException, TeiidProcessingException { if (this.vdb == null) { LocalServerConnection lsc = (LocalServerConnection) getConnection().getServerConnection(); vdb = lsc.getWorkContext().getVDB(); if (vdb == null) { throw new TeiidRuntimeException(ODataPlugin.Util.gs( ODataPlugin.Event.TEIID16001, this.vdbName, this.vdbVersion)); } this.vdb = vdb; } if (vdb.getStatus() != Status.ACTIVE) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID31099, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31099, vdb, vdb.getStatus())); } return this.vdb; }
public void setNewVDBState(DQPWorkContext newWorkContext) { this.vdbState = new VDBState(); VDBMetaData vdb = newWorkContext.getVDB(); GlobalTableStore actualGlobalStore = vdb.getAttachment(GlobalTableStore.class); this.vdbState.globalTables = actualGlobalStore; this.vdbState.session = newWorkContext.getSession(); this.vdbState.classLoader = vdb.getAttachment(ClassLoader.class); this.vdbState.vdbName = vdb.getName(); this.vdbState.vdbVersion = vdb.getVersion(); this.vdbState.dqpWorkContext = newWorkContext; TempMetadataAdapter metadata = new TempMetadataAdapter(vdb.getAttachment(QueryMetadataInterface.class), globalState.sessionTempTableStore.getMetadataStore()); metadata.setSession(true); this.vdbState.metadata = metadata; }
public void setNewVDBState(DQPWorkContext newWorkContext) { this.vdbState = new VDBState(); VDBMetaData vdb = newWorkContext.getVDB(); GlobalTableStore actualGlobalStore = vdb.getAttachment(GlobalTableStore.class); this.vdbState.globalTables = actualGlobalStore; this.vdbState.session = newWorkContext.getSession(); this.vdbState.classLoader = vdb.getAttachment(ClassLoader.class); this.vdbState.vdbName = vdb.getName(); this.vdbState.vdbVersion = vdb.getVersion(); this.vdbState.dqpWorkContext = newWorkContext; TempMetadataAdapter metadata = new TempMetadataAdapter(vdb.getAttachment(QueryMetadataInterface.class), globalState.sessionTempTableStore.getMetadataStore()); metadata.setSession(true); this.vdbState.metadata = metadata; }
public void setNewVDBState(DQPWorkContext newWorkContext) { this.vdbState = new VDBState(); VDBMetaData vdb = newWorkContext.getVDB(); GlobalTableStore actualGlobalStore = vdb.getAttachment(GlobalTableStore.class); this.vdbState.globalTables = actualGlobalStore; this.vdbState.session = newWorkContext.getSession(); this.vdbState.classLoader = vdb.getAttachment(ClassLoader.class); this.vdbState.vdbName = vdb.getName(); this.vdbState.vdbVersion = vdb.getVersion(); this.vdbState.dqpWorkContext = newWorkContext; TempMetadataAdapter metadata = new TempMetadataAdapter(vdb.getAttachment(QueryMetadataInterface.class), globalState.sessionTempTableStore.getMetadataStore()); metadata.setSession(true); this.vdbState.metadata = metadata; }
public static DQPWorkContext buildWorkContext(QueryMetadataInterface metadata, VDBMetaData vdb) { DQPWorkContext workContext = new DQPWorkContext(); SessionMetadata session = new SessionMetadata(); workContext.setSession(session); session.setVDBName(vdb.getName()); session.setVDBVersion(vdb.getVersion()); session.setSessionId(String.valueOf(1)); session.setUserName("foo"); //$NON-NLS-1$ session.setVdb(vdb); workContext.getVDB().addAttchment(QueryMetadataInterface.class, metadata); if (metadata instanceof TransformationMetadata) { workContext.getVDB().addAttchment(TransformationMetadata.class, (TransformationMetadata)metadata); } DQPWorkContext.setWorkContext(workContext); return workContext; }
private Request helpProcessMessage(RequestMessage message, SessionAwareCache<PreparedPlan> cache, DQPWorkContext workContext) throws TeiidComponentException, TeiidProcessingException { Request request = null; if (cache != null) { request = new PreparedStatementRequest(cache); } else { request = new Request(); } ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class); workContext.getVDB().addAttchment(ConnectorManagerRepository.class, repo); Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(new AutoGenDataService()); request.initialize(message, Mockito.mock(BufferManager.class), new FakeDataManager(), new FakeTransactionService(), TEMP_TABLE_STORE, workContext, null); DefaultAuthorizationValidator drav = new DefaultAuthorizationValidator(); request.setAuthorizationValidator(drav); request.processRequest(); return request; }