Get the db envelope.

@return the Envelope of the dataset.
@throws Exception
557830
public Envelope getBounds() throws Exception {
        checkMetadata();
        String boundsWSEN = metadataMap.get("bounds");
        String[] split = boundsWSEN.split(",");
        double w = Double.parseDouble(split[0]);
        double s = Double.parseDouble(split[1]);
        double e = Double.parseDouble(split[2]);
        double n = Double.parseDouble(split[3]);
        return new Envelope(w, e, s, n);
    }
1027195
public int dataToFields(Rec record) throws DBException
    {
        m_iColumn = 1;
        int iErrorCode = super.dataToFields(record);

        KeyArea keyArea = this.getRecord().getKeyArea(0); // Primary index
        keyArea.setupKeyBuffer(null, DBConstants.TEMP_KEY_AREA);        // Save keys for possible update/delete
        if (this.getResultSetType() != DBConstants.SQL_SELECT_TYPE)
            if (CLEANUP_STATEMENTS)
                this.setResultSet(null, this.getResultSetType());  // Close this statement

        return iErrorCode;
    }
1235894
public RemoteDatabase getRemoteDatabase()
        throws RemoteException
    {
        if (m_remoteDatabase != null)
            return m_remoteDatabase;
        try {
            if (this.getTableCount() == 0)
                return null;    // Never
            ClientTable table = (ClientTable)m_vTableList.get(0);
            RemoteTable tableRemote = table.getRemoteTable();
            if (tableRemote != null)
            {
                synchronized (this.getSyncObject(tableRemote))
                {   // In case this is called from another task
                    // Move these properties up in case they are in the environment properties.
                    Map<String,Object> propDatabase = BaseDatabase.addDBProperties(this.getProperties(), this, null);
                    BaseDatabase.addDBProperty(propDatabase, this, null, this.getDatabaseName(false) + BaseDatabase.DBSHARED_PARAM_SUFFIX);
                    BaseDatabase.addDBProperty(propDatabase, this, null, this.getDatabaseName(false) + BaseDatabase.DBUSER_PARAM_SUFFIX);
                    m_remoteDatabase = tableRemote.getRemoteDatabase(propDatabase);
                }
            }
            if (m_remoteDatabase != null)
            {
                synchronized (this.getSyncObject(m_remoteDatabase))
                {   // In case this is called from another task
                    m_remoteProperties = m_remoteDatabase.getDBProperties();
                }
            }
        } catch (RemoteException ex)    {
            Utility.getLogger().warning("dbServer exception: " + ex.getMessage());
            throw ex;
        } catch (Exception ex)  {
            ex.printStackTrace();
        }
        return m_remoteDatabase;
    }
927097
public int dataToFields(Rec record) throws DBException
    {
        try   {
            return ((BaseBuffer)m_dataSource).bufferToFields((FieldList)record, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE);
        } catch (Exception ex) {
            throw DatabaseException.toDatabaseException(ex);
        }
    }
343732
public function createReference()
    {
        $documentId = $this->getId();
        if (null === $documentId) {
            throw new Exception('Document must be stored to get DBRef');
        }

        return $this
            ->getCollection()
            ->getMongoCollection()
            ->createDBRef($documentId);
    }
365195
private String getDatabaseProductName(WSDataSource dataSource) throws Exception {
        String dbProductName = dataSource.getDatabaseProductName();
        if (dbProductName == null) {
            // Query the metadata under a new transaction and commit right away
            LocalTransactionCurrent localTranCurrent = this.localTranCurrent;
            LocalTransactionCoordinator suspendedLTC = localTranCurrent.suspend();
            EmbeddableWebSphereTransactionManager tranMgr = this.tranMgr;
            Transaction suspendedTran = suspendedLTC == null ? tranMgr.suspend() : null;
            boolean tranStarted = false;
            try {
                tranMgr.begin();
                tranStarted = true;
                Connection con = dataSource.getConnection();
                try {
                    dbProductName = con.getMetaData().getDatabaseProductName();
                } finally {
                    con.close();
                }
            } finally {
                try {
                    if (tranStarted)
                        tranMgr.commit();
                } finally {
                    // resume
                    if (suspendedTran != null)
                        tranMgr.resume(suspendedTran);
                    else if (suspendedLTC != null)
                        localTranCurrent.resume(suspendedLTC);
                }
            }
        }
        return dbProductName;
    }
392494
public static SQLService getInstance() throws Exception {
        if (_instance == null) {
            _instance = new SQLService();
            _instance.startServer();

            // default pool size is 20
            // can be overriden by env variable
            int dbPool = 20;
            if (Utils.getEnvironmentOptionValue(Constants.SYS_DATABASE_POOL_SIZE) != null) {
                dbPool = Integer.valueOf(Utils.getEnvironmentOptionValue(Constants.SYS_DATABASE_POOL_SIZE));
            }

            // initialize connection pool
            PoolProperties p = new PoolProperties();
            String connectString = "jdbc:h2:tcp://" + _instance.databaseHost + ":" + String.valueOf(_instance.port) + "/" +
                _instance.databaseName + "/proxydb;MULTI_THREADED=true;AUTO_RECONNECT=TRUE;AUTOCOMMIT=ON";
            p.setUrl(connectString);
            p.setDriverClassName("org.h2.Driver");
            p.setUsername("sa");
            p.setJmxEnabled(true);
            p.setTestWhileIdle(false);
            p.setTestOnBorrow(true);
            p.setValidationQuery("SELECT 1");
            p.setTestOnReturn(false);
            p.setValidationInterval(5000);
            p.setTimeBetweenEvictionRunsMillis(30000);
            p.setMaxActive(dbPool);
            p.setInitialSize(5);
            p.setMaxWait(30000);
            p.setRemoveAbandonedTimeout(60);
            p.setMinEvictableIdleTimeMillis(30000);
            p.setMinIdle(10);
            p.setLogAbandoned(true);
            p.setRemoveAbandoned(true);
            _instance.datasource = new DataSource();
            _instance.datasource.setPoolProperties(p);
        }
        return _instance;
    }
239343
@Override
  public final synchronized SrvDatabase lazyGetSrvDatabase() throws Exception {
    String beanName = getSrvDatabaseName();
    SrvDatabase srvDatabase =
      (SrvDatabase) getBeansMap().get(beanName);
    if (srvDatabase == null) {
      srvDatabase = new SrvDatabase();
      srvDatabase.setLogger(lazyGetLogger());
      srvDatabase.setHlpInsertUpdate(lazyGetHlpInsertUpdate());
      srvDatabase.setDataSource(lazyGetDataSource());
      getBeansMap().put(beanName, srvDatabase);
      lazyGetLogger().info(null, AFactoryAppBeansJdbc.class, beanName
        + " has been created.");
    }
    return srvDatabase;
  }
1362971
public Object getWrapper() throws Exception
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
        {
            Tr.entry(tc, "getWrapper");
        }

        EJSContainer container = EJSContainer.getDefaultContainer();
        Object retObj = null;
        WrapperManager wm = container.getWrapperManager();

        // The first bytes of serialized data is a header and
        // the first byte of header identifies it as either a
        // BeanId or a WrapperId. So examine first byte to
        // determine whether it is a BeanId or a WrapperId.
        if (ivIdBytes[0] == (byte) 0xAC)
        {
            // First byte indicates it is a BeanId. Use the
            // WrapperManager to find the wrapper in wrapper cache.
            ByteArray byteArray = new ByteArray(ivIdBytes);

            if (DEBUG_ON) // d458325
            {
                if (isTraceOn && tc.isDebugEnabled())
                {
                    Tr.debug(tc, "serialized BeanId bytes = " + byteArray.toString());
                }
            }

            BeanId beanId = BeanId.getBeanId(byteArray, container);

            if (isTraceOn && tc.isDebugEnabled())
            {
                Tr.debug(tc, "deserialized a BeanId = " + beanId
                             + ", primary key = " + beanId.getPrimaryKey());
            }

            retObj = wm.getWrapper(beanId).getLocalObject();
        }
        else if (ivIdBytes[0] == (byte) 0xAD) // d458325
        {
            // First byte indicates it is a WrapperId that was serialized.
            // Recreate the WrapperId and use it to get BeanId, local business
            // interface name, and local business interface index.
            WrapperId wrapperId = new WrapperId(ivIdBytes);
            int index = wrapperId.ivInterfaceIndex;
            String interfaceName = wrapperId.ivInterfaceClassName;

            if (DEBUG_ON) // d458325
            {
                if (isTraceOn && tc.isDebugEnabled())
                {
                    Tr.debug(tc, "serialized WrapperId bytes[" + ivIdBytes.length + "] = "
                                 + wrapperId.toString());
                    Tr.debug(tc, "WrapperId.ivInterfaceIndex = " + index
                                 + ", WrapperId.ivInterfaceClassName = " + interfaceName
                                 + ", WrapperId.ivBeanIdIndex = " + wrapperId.ivBeanIdIndex);
                }
            }

            ByteArray byteArray = wrapperId.getBeanIdArray();
            BeanId beanId = BeanId.getBeanId(byteArray, container);
            BeanMetaData bmd = beanId.getBeanMetaData();

            Tr.debug(tc, "deserialized a WrapperId for BeanId = " + beanId
                         + ", primary key = " + beanId.getPrimaryKey());

            // Obtain the home and create the 'set' of wrappers for the
            // deserialized BeanId.
            EJSHome home = bmd.getHome();
            EJSWrapperCommon wc = home.internalCreateWrapper(beanId);

            // Finally, decide which proxy is needed from the set. This may
            // be for an aggregate local wrapper (all business local interfaces)
            // or it may be for a specific interface, in which case the index
            // must be verified                                          F743-34304
            if (index == EJSWrapperBase.AGGREGATE_LOCAL_INDEX)
            {
                retObj = wc.getAggregateLocalWrapper();
            }
            else
            {
                // Now verify index is still valid. If we fail over to a new server,
                // the index for the interface may be different than original server.
                // In that case, we need to determine the new index.
                Class<?>[] bInterfaces = bmd.ivBusinessLocalInterfaceClasses;
                int numberOfLocalInterfaces = bInterfaces.length;
                String wrapperInterfaceName = null;
                if (index < numberOfLocalInterfaces)
                {
                    wrapperInterfaceName = bInterfaces[index].getName();
                }

                // Is the BusinessLocalWrapper for the correct interface name?
                if ((wrapperInterfaceName == null) || (!wrapperInterfaceName.equals(interfaceName)))
                {
                    // Nope, index must be invalid, so we need to get an updated index
                    // that matches the desired interface name.
                    // Fix up the WrapperId with index that matches this server.
                    index = bmd.getRequiredLocalBusinessInterfaceIndex(interfaceName);
                }

                // Now that we have correct index, obtain the corresponding
                // proxy object.
                retObj = wc.getLocalBusinessObject(index);
            }
        }

        // Return the wrapper
        if (isTraceOn && tc.isEntryEnabled())
        {
            Tr.exit(tc, "getWrapper returning: " +
                        (retObj == null ? retObj
                                        : (retObj.getClass().getName() +
                                        '@' + Integer.toHexString(retObj.hashCode()))));
        }
        return retObj;
    }
772729
public List<T> collect() throws Exception {
		final String id = new AbstractID().toString();
		final TypeSerializer<T> serializer = getType().createSerializer(getExecutionEnvironment().getConfig());

		this.output(new Utils.CollectHelper<>(id, serializer)).name("collect()");
		JobExecutionResult res = getExecutionEnvironment().execute();

		ArrayList<byte[]> accResult = res.getAccumulatorResult(id);
		if (accResult != null) {
			try {
				return SerializedListAccumulator.deserializeList(accResult, serializer);
			} catch (ClassNotFoundException e) {
				throw new RuntimeException("Cannot find type class of collected data type.", e);
			} catch (IOException e) {
				throw new RuntimeException("Serialization error while deserializing collected data", e);
			}
		} else {
			throw new RuntimeException("The call to collect() could not retrieve the DataSet.");
		}
	}
546722
@Override
    public void open() throws Exception {
        EDb edb = EDb.fromFileDesktop(databaseFile);
        spatialDb = edb.getSpatialDb();
        spatialDb.open(databaseFile.getAbsolutePath());
        GeometryColumn geometryColumnsForTable = spatialDb.getGeometryColumnsForTable(LasCellsTable.TABLENAME);
        crs = CrsUtilities.getCrsFromSrid(geometryColumnsForTable.srid);
        isOpen = true;
    }
195566
protected function getFields()
    {
        if (is_null($this->fields)) {
            $columns = $this->getColumns();

            if (empty($columns)) {
                throw new Exception('The table ' . $this->tableName . ' was not found in the ' . $this->databaseName . ' database.');
            }

            $this->fields = $this->transfer($columns);
        }

        return $this->fields;
    }
723348
public DataSet[] getDataSetsPerClass() throws Exception {
    	DataSet[] dataSetsPerClass = new DataSet[this.getNrOfClasses()];
    	// create a new data set for each class
    	for (int i = 0; i < dataSetsPerClass.length; i++) {
			dataSetsPerClass[i] = new DataSet(this.nrOfDimensions);
		}
    	
    	// fill the data sets
    	for(DataObject currentObject : dataList) {
    		dataSetsPerClass[currentObject.getClassLabel()].addObject(currentObject);
    	}
    	
    	return dataSetsPerClass;
    }
1030901
public Connection getConnection() throws SQLException {
    try {
      if (urlParser == null) {
        initialize();
      }

      return MariaDbConnection.newConnection(urlParser, null);
    } catch (SQLException e) {
      throw ExceptionMapper.getException(e, null, null, false);
    }
  }
436855
@Override
  public final synchronized int getIdDatabase() {
    if (this.idDatabase == 0) {
      try {
        String query = "select count(*) as TOTALROWS from " + DatabaseInfo.class
          .getSimpleName().toUpperCase() + ";";
        Integer rowCount = evalIntegerResult(query, "TOTALROWS");
        if (rowCount != 1) {
          throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
            "database_info_config_error");
        }
        query = "select DATABASEID from " + DatabaseInfo.class
          .getSimpleName().toUpperCase() + ";";
        Integer databaseId = evalIntegerResult(query, "DATABASEID");
        if (databaseId == null) {
          throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
            "database_info_config_error");
        }
        this.idDatabase = databaseId;
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return this.idDatabase;
  }
56297
public function getSessionBag()
    {
        if (null === $this->sessionBag) {
            if (!$this->container) {
                throw new Exception('A container object is required to access the \'session_bag\' service.');
            }

            $this->sessionBag = $this->container->get('session_bag', [$this->bagName]);
        }

        return $this->sessionBag;
    }
336536
public function init()
    {
        $json = [];
        foreach ($this->dataset as $file) {
            if (!(is_file($file) && is_readable($file))) {
                throw new Exception("File '$file' for dataset not readable.");
            }
            $content = file_get_contents($file);
            $key = pathinfo($file, PATHINFO_FILENAME);
            $json[$key] = json_decode($content, true);
        }

        $this->session->set(self::KEY, $json);
        return $this;
    }