public LocalServerConnection(Properties connectionProperties, boolean useCallingThread) throws CommunicationException, ConnectionException { this.connectionProperties = connectionProperties; this.csr = getClientServiceRegistry(); String vdbVersion = connectionProperties.getProperty(TeiidURL.JDBC.VDB_VERSION); String vdbName = connectionProperties.getProperty(TeiidURL.JDBC.VDB_NAME); int firstIndex = vdbName.indexOf('.'); int lastIndex = vdbName.lastIndexOf('.'); if (firstIndex != -1 && firstIndex == lastIndex) { vdbVersion = vdbName.substring(firstIndex + 1); vdbName = vdbName.substring(0, firstIndex); } if (vdbVersion != null) { int waitForLoad = PropertiesUtils.getIntProperty(connectionProperties, EmbeddedProfile.WAIT_FOR_LOAD, -1); if (waitForLoad != 0) { this.csr.waitForFinished(vdbName, Integer.valueOf(vdbVersion), waitForLoad); } } workContext.setSecurityHelper(csr.getSecurityHelper()); workContext.setUseCallingThread(useCallingThread); workContext.setSecurityContext(csr.getSecurityHelper().getSecurityContext()); authenticate(); passthrough = Boolean.valueOf( connectionProperties.getProperty( TeiidURL.CONNECTION.PASSTHROUGH_AUTHENTICATION, "false")); // $NON-NLS-1$ }
private DQPWorkContext createWorkContext(final CommandContext context, VDBMetaData vdb) { SessionMetadata session = createTemporarySession(context.getUserName(), "asynch-mat-view-load", vdb); // $NON-NLS-1$ session.setSubject(context.getSubject()); session.setSecurityDomain(context.getSession().getSecurityDomain()); session.setSecurityContext(context.getSession().getSecurityContext()); DQPWorkContext workContext = new DQPWorkContext(); workContext.setAdmin(true); DQPWorkContext current = context.getDQPWorkContext(); workContext.setSession(session); workContext.setPolicies(current.getAllowedDataPolicies()); workContext.setSecurityHelper(current.getSecurityHelper()); return workContext; }