Returns resource data from obtain or harvest request

@return list of resource data as JSON
764578
public List<JSONObject> getResourceData()
    {
        List<JSONObject> resources = new ArrayList<JSONObject>();
    
        try
        {
            if (data != null && data.has(documentsParam))
            {
                List<JSONObject> results = getDocuments();
                
                for(JSONObject json : results)
                {
                    if (json.has(documentParam))
                    {
                        JSONObject result = json.getJSONObject(documentParam);
                        results.add(result);
                    }
                }
            }
            else if (data != null && data.has(getRecordParam))
            {
                List<JSONObject> results = getRecords();
                
                for(JSONObject json : results)
                {
                    if (json.has(resourceDataParam))
                    {
                        JSONObject result = json.getJSONObject(resourceDataParam);
                        results.add(result);
                    }
                }
            }
        }
        catch (JSONException e)
        {
            //This is already handled by the enclosing "has" checks
        }
        
        return resources;
    }
961272
def resources_to_json(resources):
    
    return {
        docname: clean_resource_json(resource.__json__(resources))
        for (docname, resource)
        in resources.items()
    }
1040768
public static List<String> getResources() {
        File resources = new File(STORAGE_PATH + File.separator + "/resources");
        File[] children = resources.listFiles();

        if (children == null) {
            return new ArrayList<String>();
        }

        List<String> storages = new ArrayList<String>();

        for (int i = 0; i < children.length; i++) {
            if (children[i].isDirectory())
                storages.add(children[i].getName());
        }

        return storages;
    }
468726
@Override
    public Collection<Resource> getResources() {
        return resources == null ? Collections.<Resource>emptyList() : resources;
    }
584861
def get_json_request(self):
        
        content_type = request.headers.get('Content-Type', 'text/plain')
        if content_type not in ('application/json', 'text/json'):
            self.log.error('get_json_request() called in a request that does not have a json content-type: %s. Refusing to parse the request data', content_type)
            return {}

        try:
            data = json.loads(request.data)
        except ValueError:
            self.log.exception(
                "Trying to parse json body in the %s to %s",
                request.method, request.url,
            )
            data = {}

        return data
89646
protected function getRequestData()
    {
        return [
            'request'  => $this->request->toArray(),
            'response' => [
                'content'      => null,
                'content_type' => null,
                'status_code'  => ServiceResponseInterface::HTTP_OK
            ],
            'resource' => $this->resourcePath
        ];
    }
436093
@Override
    public Map<String, String> getRequestHeaders() {
        Map<String, String> requestHeaders = super.getRequestHeaders();
        if (requestHeaders == null)
            requestHeaders = new HashMap<>();
        try {
            requestHeaders.put(Request.REQUEST_ID, getMasterRequestId());
            String httpMethod = getHttpMethod();
            if ("GET".equals(httpMethod))
                requestHeaders.put("Accept", "application/json");
            else
                requestHeaders.put("Content-Type", "application/json");
        }
        catch (ActivityException ex) {
            logexception(ex.getMessage(), ex);
        }
        return requestHeaders;
    }
757915
def get_resources(url, resource_class, params={})
      get(url, params).map do |result|
        resource_class.from_hash(result, client: self)
      end
    end
879323
public function getJsonResource()
    {

        $result = $this->getGuzzle()->request('GET',
            'https://raw.githubusercontent.com/eveseat/resources/master/sde.json', [
                'headers' => ['Accept' => 'application/json'],
            ]);

        if ($result->getStatusCode() != 200)
            return json_encode([]);

        return json_decode($result->getBody());
    }
612932
public @NotNull List<Resource> getResources() {
    return getResources((Predicate<Resource>)null, (Resource)null);
  }
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.");
		}
	}
1357434
public static systemdatasource get(nitro_service service) throws Exception{
		systemdatasource obj = new systemdatasource();
		systemdatasource[] response = (systemdatasource[])obj.get_resources(service);
		return response[0];
	}
59883
public function listJsonAction() {
        //Get the folder
        $folderUri = $this->container->get('request')->query->get('id');

        //Set folder uri to null to use the default if the root is requested ('#')
        if ('#' === $folderUri) {
            $folder = null;
        } else {
            $folder = $folderUri;
        }

        //Get the resource descriptors (not recursively)
        $resources = $this->container->get('mesd.jasper.report.client')->getResourceList($folder, false);

        //Convert the resources into an array to encode in json in the way jstree can read them
        $response = array();
        foreach($resources as $resource) {
            $data = array();
            $data['id'] = $resource->getUriString();
            $data['parent'] = $folderUri;
            $data['icon'] = false;

            if ('reportUnit' === $resource->getWsType()) {
                //Report object specific settings
                $data['text'] = '<i id="' . $data['id'] . '-icon" class="icon-file"></i> ' . $resource->getLabel();
                $data['children'] = false;
                //Set the href to the report input form
                $data['a_attr'] = array('href' => $this->container->get('router')->generate('MesdJasperReportViewerBundle_display_report_viewer', array('reportUri' => rawurlencode($resource->getUriString()))));
                $data['dump'] = $resource->getUriString();
            } elseif ('folder' === $resource->getWsType()) {
                //Folder object specific settings
                $data['text'] = '<i id="' . $data['id'] . '-icon" class="icon-folder-close"></i> ' . $resource->getLabel();
                $data['children'] = true;
            }

            $response[] = $data;
        }

        //Get the resources
        return new JsonResponse($response);
    }
768914
public function getDatas()
    {
        if ($this->datas === null) {
            $this->datas = $this->readDatas();
        }
        
        return $this->datas;
    }
982775
def _get_resources(self, resource, obj, params=None, map=None, **kwargs):
        """"""
        r = self._http_resource('GET', resource, params=params)
        d_items = self._resource_deserialize(r.content.decode("utf-8"))

        items =  [obj.new_from_dict(item, h=self, **kwargs) for item in d_items]

        if map is None:
            map = KeyedListResource

        list_resource = map(items=items)
        list_resource._h = self
        list_resource._obj = obj
        list_resource._kwargs = kwargs

        return list_resource
104909
def fetch(self, resource_data=None):
        """"""
        try:
            if not resource_data:
                resource_data = self._client._get(self._url + ".json")

            for name in self._allowed_attributes:
                setattr(self, name, resource_data.get(name, None))

            if 'sid' in self._allowed_attributes:
                self._short_url = self.sid
            else:
                self._short_url = ""

            self._populated = True
            self._resource_data = resource_data
        except exceptions.RequestError, e:
            if not e.http_code == 405:
                print e
                raise
1254860
public static List<String> getResourceLines(String resourceName) throws IOException {
        InputStreamReader isreader = null;
        BufferedReader reader = null;
        try {
            isreader = new InputStreamReader(Util.class.getResourceAsStream(resourceName));
            reader = new BufferedReader(isreader);
            List<String> lines = new ArrayList<String>();
            String tmp;
            while ((tmp = reader.readLine()) != null) {
                lines.add(tmp);
            }
            return lines;
        } finally {
            closeQuietly(reader);
            closeQuietly(isreader);
        }
    }