How to use the pygw.config.config.GATEWAY.new_array function in pygw

To help you get started, we’ve selected a few pygw examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github locationtech / geowave / python / src / main / python / pygw / base_models.py View on Github external
def add_index(self, type_name, *indices):
        """
        Add new indices for a given data type. 

        Args:
            type_name (str) : name of data type to register indices to
            *indices (pygw.base_models.Index) : Index to add
        """
        assert isinstance(type_name,str)

        n = len(indices)
        j_index_class = config.MODULE__core_store.Index
        j_index_arr = config.GATEWAY.new_array(j_index_class,n)
        for idx, py_obj in enumerate(indices):
                j_index_arr[idx] = py_obj._java_ref
    
        self._java_ref.addType(type_name,j_index_arr)
github locationtech / geowave / python / src / main / python / pygw / query.py View on Github external
def set_type_names(self, type_names=None):
        if type_names:
            assert isinstance(type_names, list)
            for t in type_names: assert isinstance(t, str)
            n = len(type_names)
            j_string_cls = config.GATEWAY.jvm.java.lang.String
            j_string_arr = config.GATEWAY.new_array(j_string_cls, n)
            for idx, name in enumerate(type_names):
                j_string_arr[idx] = name
            self.type_names = type_names
            self._java_ref.setTypeNames(j_string_arr)
github locationtech / geowave / python / src / main / python / pygw / base_models.py View on Github external
Args:
            url (str) : The URL for data to read and ingest into this data store
            *indices (pygw.base_models.Index) : Index to ingest into
            ingest_options : Options for ingest
        """ 
        # TODO: Ingest Options
        if ingest_options: raise NotImplementedError()

        # TODO: Not Fully implemented!

        assert isinstance(url,str)

        n = len(indices)
        j_index_class = config.MODULE__core_store.Index
        j_index_arr = config.GATEWAY.new_array(j_index_class,n)
        for idx, name in enumerate(indices):
                j_index_arr[idx] = name._java_ref
        java_url = config.GATEWAY.jvm.java.net.URL(url)
        self._java_ref.ingest(java_url,ingest_options,j_index_arr)
github locationtech / geowave / python / src / main / python / pygw / query.py View on Github external
def set_fields(self, fields=None):
        if not hasattr(self, 'type_names'):
            raise QueryBuilder.IncompatibleOptions(\
                 "Subset fields can only be applied when exactly ONE type name is set: You have 0 set.")
        if len(self.type_names) != 1:
            raise QueryBuilder.IncompatibleOptions(\
                "Subset fields can only be applied when exactly ONE type name is set: You have {} set.".format(len(self.type_names)))
        if fields:
            assert isinstance(fields, list)
            for f in fields: assert isinstance(f, str)
            n = len(fields)
            j_string_cls = config.GATEWAY.jvm.java.lang.String
            j_string_arr = config.GATEWAY.new_array(j_string_cls, n)
            for idx, field in enumerate(fields):
                j_string_arr[idx] = field
            self._java_ref.subsetFields(self.type_names[0], j_string_arr)
github locationtech / geowave / python / src / main / python / pygw / query.py View on Github external
def set_auth(self, auths=None):
        if auths:
            assert isinstance(auths, list)
            for a in auths: assert isinstance(a, str)
            n = len(auths)
            j_string_cls = config.GATEWAY.jvm.java.lang.String
            j_string_arr = config.GATEWAY.new_array(j_string_cls, n)
            for idx, auth in enumerate(auths):
                j_string_arr[idx] = auth
            self._java_ref.setAuthorizations(j_string_arr)
github locationtech / geowave / python / src / main / python / pygw / base_models.py View on Github external
def add_type(self, type_adapter, *initial_indices):
        """
        Add this type to the data store. This only needs to be called one time per type.

        Args:
            type_adapter (pygw.base_models.DataTypeAdapter): the data type adapter for this type that is used to read and write GeoWave entries
            initial_indices (pygw.base_models.Index): the initial indexing for this type, additional indices can be added in the future
        """
        assert isinstance(type_adapter,DataTypeAdapter)

        n = len(initial_indices)
        j_index_class = config.MODULE__core_store.Index
        j_index_arr = config.GATEWAY.new_array(j_index_class,n)
        for idx, py_obj in enumerate(initial_indices):
                j_index_arr[idx] = py_obj._java_ref
    
        self._java_ref.addType(type_adapter._java_ref,j_index_arr)