def _execute_xml_reference(self): """Return Reference node """ doc = WPS.Reference() storage_option = config.get_config_value('remote-storage', 'storage_option') if storage_option == 'ftp': self.storage = FTPStorage() elif storage_option == 'dropbox': self.storage = DropboxStorage() elif storage_option == 'googledrive': self.storage = GoogleDriveStorage() else: self.storage = FileStorage() # get_url will create the file and return the url for it doc.attrib['{http://www.w3.org/1999/xlink}href'] = self.get_url() if self.data_format: if self.data_format.mime_type: doc.attrib['mimeType'] = self.data_format.mime_type if self.data_format.encoding: doc.attrib['encoding'] = self.data_format.encoding if self.data_format.schema: doc.attrib['schema'] = self.data_format.schema return doc
def _execute_xml_reference(self): """Return Reference node """ doc = WPS.Reference() store_type = config.get_config_value('server', 'store_type') self.storage = None if store_type == 'db': db_storage_instance = DbStorage() self.storage = db_storage_instance.get_db_type() else: self.storage = FileStorage() """ to be implemented: elif store_type == 's3' and \ config.get_config_value('s3', 'bucket_name'): self.storage = S3Storage() """ doc.attrib['{http://www.w3.org/1999/xlink}href'] = self.get_url() if self.data_format: if self.data_format.mime_type: doc.attrib['mimeType'] = self.data_format.mime_type if self.data_format.encoding: doc.attrib['encoding'] = self.data_format.encoding if self.data_format.schema: doc.attrib['schema'] = self.data_format.schema return doc
def _execute_xml_reference(self): """ Decide what storage model to use and return Reference node """ doc = WPS.Reference() # get_url will create the file and return the url for it store_type = config.get_config_value('server', 'store_type') self.storage = None # chooses FileStorage, S3Storage or PgStorage based on a store_type value in cfg file if store_type == 'db' and \ config.get_config_value('db', 'dbname'): # TODO: more databases in config file self.storage = PgStorage() elif store_type == 's3' and \ config.get_config_value('s3', 'bucket_name'): self.storage = S3Storage() else: self.storage = FileStorage() doc.attrib['{http://www.w3.org/1999/xlink}href'] = self.get_url() if self.data_format: if self.data_format.mime_type: doc.attrib['mimeType'] = self.data_format.mime_type if self.data_format.encoding: doc.attrib['encoding'] = self.data_format.encoding if self.data_format.schema: doc.attrib['schema'] = self.data_format.schema return doc
def _execute_xml_reference(self): """Return Reference node """ doc = WPS.Reference() doc.attrib['{http://www.w3.org/1999/xlink}href'] = self.stream if self.method.upper() == 'POST' or self.method.upper() == 'GET': doc.attrib['method'] = self.method.upper() return doc
def test_reference_post_input(self): request_doc = WPS.Execute( OWS.Identifier('foo'), WPS.DataInputs( WPS.Input( OWS.Identifier('name'), WPS.Reference(WPS.Body('request body'), { '{http://www.w3.org/1999/xlink}href': 'http://foo/bar/service' }, method='POST')))) rv = get_inputs_from_xml(request_doc) self.assertEqual(rv['name'][0]['href'], 'http://foo/bar/service') self.assertEqual(rv['name'][0]['method'], 'POST') self.assertEqual(rv['name'][0]['body'], 'request body')
def _execute_xml_reference(self): """Return Reference node """ doc = WPS.Reference() doc.attrib['{http://www.w3.org/1999/xlink}href'] = self.url if self.data_format: if self.data_format.mime_type: doc.attrib['mimeType'] = self.data_format.mime_type if self.data_format.encoding: doc.attrib['encoding'] = self.data_format.encoding if self.data_format.schema: doc.attrib['schema'] = self.data_format.schema if self.method.upper() == 'POST' or self.method.upper() == 'GET': doc.attrib['method'] = self.method.upper() return doc
def test_wcs(self): try: sys.path.append("/usr/lib/grass64/etc/python/") import grass.script as grass except: self.skipTest('GRASS lib not found') client = client_for(Service(processes=[create_sum_one()])) request_doc = WPS.Execute( OWS.Identifier('sum_one'), WPS.DataInputs( WPS.Input( OWS.Identifier('input'), WPS.Reference(href=wcsResource, mimeType='image/tiff'))), WPS.ProcessOutputs(WPS.Output(OWS.Identifier('output'))), version='1.0.0') resp = client.post_xml(doc=request_doc) assert_response_success(resp)
def test_wfs(self): client = client_for(Service(processes=[create_feature()])) request_doc = WPS.Execute( OWS.Identifier('feature'), WPS.DataInputs( WPS.Input( OWS.Identifier('input'), WPS.Reference( {'{http://www.w3.org/1999/xlink}href': wfsResource}, mimeType=FORMATS.GML.mime_type, encoding='', schema=''))), WPS.ProcessOutputs(WPS.Output(OWS.Identifier('output'))), version='1.0.0') resp = client.post_xml(doc=request_doc) assert_response_success(resp)
def _execute_xml_reference(self): """Return Reference node """ doc = WPS.Reference() # get_url will create the file and return the url for it self.storage = FileStorage() doc.attrib['{http://www.w3.org/1999/xlink}href'] = self.get_url() if self.data_format: if self.data_format.mime_type: doc.attrib['mimeType'] = self.data_format.mime_type if self.data_format.encoding: doc.attrib['encoding'] = self.data_format.encoding if self.data_format.schema: doc.attrib['schema'] = self.data_format.schema return doc